vb6内嵌汇编实现图像快速对比

vb6内嵌汇编实现图像快速对比,1024x768的两个图像对比最快仅用时4ms (XP/2.4G/512M)。

(声明:魏滔序原创,转贴请注明出处。)

';:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ' vb6内嵌汇编实现图像快速对比 ' Programmed by 魏滔序 ' WebSite: http://www.chenoe.com ' Blog: http://blog.csdn.net/Modest ';:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

Option Explicit Private Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (lpPrevWndFunc As Any, ByVal hWnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long Private AsmCode(46) As Byte Private Sub InitAsmCode() If AsmCode(0) <> &H55 Then AsmCode(0) = &H55 AsmCode(1) = &H8B AsmCode(2) = &HEC AsmCode(3) = &H8B AsmCode(4) = &H55 AsmCode(5) = &H10 AsmCode(6) = &H85 AsmCode(7) = &HD2 AsmCode(8) = &H76 AsmCode(9) = &H21 AsmCode(10) = &H8B AsmCode(11) = &H45 AsmCode(12) = &HC AsmCode(13) = &H8B AsmCode(14) = &H4D AsmCode(15) = &H8 AsmCode(16) = &H56 AsmCode(17) = &H57 AsmCode(18) = &H8B AsmCode(19) = &H31 AsmCode(20) = &H8B AsmCode(21) = &H38 AsmCode(22) = &H3B AsmCode(23) = &HF7 AsmCode(24) = &H75 AsmCode(25) = &H6 AsmCode(26) = &HC7 AsmCode(27) = &H0 AsmCode(28) = &H0 AsmCode(29) = &H0 AsmCode(30) = &H0 AsmCode(31) = &H0 AsmCode(32) = &H83 AsmCode(33) = &HC1 AsmCode(34) = &H4 AsmCode(35) = &H83 AsmCode(36) = &HC0 AsmCode(37) = &H4 AsmCode(38) = &H4A AsmCode(39) = &H75 AsmCode(40) = &HE9 AsmCode(41) = &H5F AsmCode(42) = &H5E AsmCode(43) = &H5D AsmCode(44) = &HC2 AsmCode(45) = &H10 AsmCode(46) = &H0 End If End Sub Public Function ImgCompare(SrcData As cDIB, DestData As cDIB) As Boolean Call InitAsmCode CallWindowProc AsmCode(0), SrcData.ImagePtr, DestData.ImagePtr, SrcData.mWidth * SrcData.mHeight, 0 ImgCompare = True End Function

评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值