- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello!
I would like to use the Intel IPP within my Visual Basic 2005 projects.
I am not able to call any function as I do not know how to generate the IntPtr to my floating point arrays.
If anybody could e.g. show me how to use the ippsAdd_64ffunction to add2 10-element vectors, I would be very glad ...
Best regards,
Martin.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Martin,
You can take a look on IPP VB sample, available on IPP Samples pagelook at Development Environment section.
Regards,
Vladimir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello, Vladimir,
thanks for your fast reply. The problem is that all examples are based on the ippi function where the pointer IntPtr to the data can be obtained by the special function Scan0.
Within e.g. a floating point vector, I don't know how to get the pointer to that floating point vector.
If you could just add the correct line in the following code, I would be very happy:
Dim
X() As Single = {1, 2, 3, -4, -5}Dim I_Ptr As IntPtr = ?????
ipp.sp.ippsAbs_32f_I(I_Ptr, 5)
Best regards,
Martin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Martin,
our expert suggest you to use the following piece of code:
Dim X() As Single = {1, 2, 3, -4, -5}
Dim I_Ptr As IntPtr = Marshal.UnsafeAddrOfPinnedArrayElement(X, 0)
ipp.sp.ippsAbs_32f_I(I_Ptr, 5)
Regards,
Vladimir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi!
Thanks for the help, this did solve some problem.
Could you please tell me how I get the IntPtr to one single value, e.g. to use the ippsMax function? At the moment, I do it the way you can see below which is not very elegant. (I write a wrapper around the IPP function to give a more conveniant access to them).
By the way, is there any plan by Intel to provide such a wrapper which uses e.g. function overloading, ... to provide such an easy access?
Best regards,
Martin.
Public Function ippsMax(ByRef Array() As Single, ByRef Max As Single) As ipp.IppStatusDim RetVal As ipp.IppStatus : Dim TempVal(0 To 0) As SingleRetVal = ipp.sp.ippsMax_16s(GetPtr(Array), Array.Length, GetPtr(TempVal))
Max = TempVal(0) :
Return RetValEnd Function
Public
Function GetPtr(ByRef Array() As Single) As IntPtrReturn System.Runtime.InteropServices.Marshal.UnsafeAddrOfPinnedArrayElement(Array, 0)End Function
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
there is answer from our expert:
you need to useShortfor 16-bit data notSingle. the one of the reason why we deliver VB wrapper sample as a sample, not a complete solution is that you can implement it in different ways. You can change in sample sources for functions like ippsMax the following:
Declare
Function _ippsMax_16s
Lib "ipps-5.2.dll" _(
ByVal pSrc As IntPtr, ByVal len As Integer, ByRef pMax As Short) As IppStatus
and then in your example
Public
Function ippsMax(ByRef Array() As Short, ByRef Max As Short) As ipp.IppStatusDim RetVal As ipp.IppStatusRetVal = ippsMax_16s(GetPtr(Array), Array.Length, Max)
Return RetValEnd
FunctionPublic Function GetPtr(ByRef Array() As Short) As IntPtrReturn System.Runtime.InteropServices.Marshal.UnsafeAddrOfPinnedArrayElement(Array, 0)End Function
Regards,
Vladimir
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page