Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Erik
Beginner
59 Views

Convert non-ipp array to ipp array

What is the best way to take an array of struct{ int r : 16; int i : 16; } and convert to an array of Ipp32f and then on to an array of Ipp32fc.

Note: My access to the array of structs will be through a pointer, ie. I will not have access to the creation/allocation of the memory.

Can I do the following?

//Define in some header file
typedef struct {
int r : 16;
int i : 16;
}ri;

//Defined in the c file with "void function(ri *src, len)"
Ipp32fc dest[32];

void function(ri * src, len)
{

ippsConvert_16s32f((Ipp16s*)ri, (Ipp32f*)dest, len);
//.....
}


Side question: Does declaring an array such as dest above guarantee that it is 32 byte aligned as it would be if allocated with the ippsMalloc functions?
0 Kudos
1 Reply
Vladimir_Dudnik
Employee
59 Views

Hello,

yes, using ippsConvert_16s32f function should be appropriate for this purpose. To align array allocated on the stack you may do something like this:

Ipp8u buf[len * sizeof(Ipp32fc) + 31];
Ipp32f* dest = &buf[0] & (-32);

Regards,
Vladimir

Reply