Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

String split question

2dipikke
Beginner
666 Views
Hi, I'm trying to use the functions ippsSplitC_8u_D2L or ippsSplitC_16u_D2L either with managed C++ or C#, but I'm not able to made them work, I've got problems with parameters.
Does anybody have an example of how they work?
Thank you very much in advance
Marco
0 Kudos
4 Replies
Vladimir_Dudnik
Employee
666 Views

Hi

did you took a look on IPP C# sample, which demonstartes how to implement C# interface to IPP functions? It also contains interfaces to ippCH functions (string and text processing which you use)

Regards,
Vladimir

0 Kudos
2dipikke
Beginner
666 Views
Yes, I did,but I've found just the DllImport declaration of the functions that use unsafe C# code with difficult to manage byte**.
Is there any sample code that show the right way to use them?
Could you post some?
Thank you
0 Kudos
Vladimir_Dudnik
Employee
666 Views

Hi,

yes, our expert prepared such a simple sample specially for you:)

#include
#include
#include

int main() {
const Ipp8u States[] = "Alabama Alaska Arizona Arkansas California Colorado Connecticut";
Ipp8u buff[40];
Ipp8u* nameState[4] = { buff, buff + 10, buff + 20, buff + 30 };
int lenNameState[4]= { 10, 10, 10, 10 };
int i, numState = 4;
IppStatus status;

status = ippsSplitC_8u_D2L( (Ipp8u*)States, sizeof(States) - 1, ' ', nameState, lenNameState, &numState );
if( status < ippStsNoErr ) {
printf( "Error "%s" appear in ippsSplitC_8u_D2L function. ", ippGetStatusString( status ) );
return 1;
} /* if */
for( i = 0; i < numState; i++ ) {
*(nameState + lenNameState) = '�';
printf( "State %d: %s; ", i, (char*)(nameState) );
} /* for */
return 0;
} /* main */



This example should ouput on the screen:

State 0: Alabama;
State 1: Alaska;
State 2: Arizona;
State 3: Arkansas;

Regards,
Vladimir

0 Kudos
rmauldin
Beginner
666 Views

Im sorry, I could have sworn he was looking for managed code without pointers. I don't see any managed code here. No namespace, and managed C# has no use for headers. Great program, but maybe not quite what he was hoping for...

Thanks,
Ryan

0 Kudos
Reply