#include "stdafx.h" #include "BlobStorage.h" #include "ASGInspection.h" #include "StopWatch3.h" #include "Pad.h" #include #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<= 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; }