16,553
社区成员
发帖
与我相关
我的任务
分享
unsafe int ISampleGrabberCB.BufferCB(double SampleTime, IntPtr pBuffer, int BufferLen)
{
int x;
int y;
byte* b = (byte*) pBuffer;
for (x = 1; x <= this.videoHeight; x++)
{
y = 0;
while (y < this.videoStride)
{
b[0] = (byte) (b[0] ^ 0xff);
b++;
y++;
}
b = (byte*) pBuffer;
b += x * this.videoStride;
}
return 0;
}
Private Function DirectShowLib.ISampleGrabberCB.BufferCB(ByVal SampleTime As Double, ByVal pBuffer As IntPtr, ByVal BufferLen As Integer) As Integer Implements ISampleGrabberCB.BufferCB
Dim x As Integer
Dim y As Integer
Dim b As Byte* = DirectCast(pBuffer, Byte*)
x = 1
Do While (x <= Me.videoHeight)
y = 0
Do While (y < Me.videoStride)
b(0) = CByte((b(0) Xor &HFF))
b += 1
y += 1
Loop
b = DirectCast(pBuffer, Byte*)
b = (b + (x * Me.videoStride))
x += 1
Loop
Return 0
End Function
Private Function DirectShowLib.ISampleGrabberCB.BufferCB(ByVal SampleTime As Double, ByVal pBuffer As IntPtr, ByVal BufferLen As Integer) As Integer Implements ISampleGrabberCB.BufferCB
Dim x As Integer
Dim y As Integer
'Dim b As Byte* = DirectCast(pBuffer, Byte*)
dim offset as integer=0 '偏移量初始为0
x = 1
Do While (x <= Me.videoHeight)
y = 0
Do While (y < Me.videoStride)
'b(0) = CByte((b(0) Xor &HFF))
Marshal.WriteByte(pBuffer ,offset,Marshal.ReadByte(pBuffer ,offset) xor &HFF)
'b += 1
offset+=1
y += 1
Loop
'b = DirectCast(pBuffer, Byte*)
offset=0 '字节数组偏移量重初始化为0
'b = (b + (x * Me.videoStride))
offset=x*me.videoStride '偏移量移动到下一处理位置
x += 1
Loop
Return 0
End Function
Private Function BufferCB(SampleTime As Double, pBuffer As IntPtr, BufferLen As Integer) As Integer Implements ISampleGrabberCB.BufferCB
Dim x As Integer
Dim y As Integer
Dim b As Byte* = CByte(pBuffer)
For x = 1 To Me.videoHeight
y = 0
While y < Me.videoStride
b(0) = CByte((b(0) Xor &Hff))
b += 1
y += 1
End While
b = CByte(pBuffer)
b += x * Me.videoStride
Next
Return 0
End Function