Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

ippiMalloc problem

trlinux
Beginner
585 Views
Hi there, i'm trouble with ippiMalloc_32f_C1 i'm allocating memory like that ;

int r_step;
Ipp32f *imgResult = ippiMalloc_32f_C1(621, 471, &r_step);
//rstep is2496
and then i'm setting all values to 100 with ippiSet;
IppiSize ttsize = {621,471};
ippiSet_32f_C1R(100,imgResult,r_step,ttsize);
and then trying to reach some memory location like that;
float trouble= *(imgResult+(620+r_step*470)); //last pixel on the image ... if r_step is bigger than 118 going to exception ..
is there any problem with my way to reach memory location ?
I tested something with 4x4 array and working well with step is equal to 32 ;
int an;
IppiSize tsize = {4,4};
Ipp8u * test = ippiMalloc_8u_C1(tsize.width,tsize.height,&an); //an equal to 32
ippiSet_8u_C1R(0,test,an,tsize);
unsigned char fine = *(test+(3+an*3)); // last value on the array is equal to 0 working fine ...
0 Kudos
1 Solution
Albert_Stepanov
New Contributor I
585 Views
Hi,
the ippiMalloc* functions return parameter 'step' in bytes. So right code to reach the last pixel is:
float trouble= *(imgResult+(620+r_step/sizeof(float)*470));
// not forget to free memory

ippiFree(imgResult);

Regards,
Albert

View solution in original post

0 Kudos
2 Replies
Albert_Stepanov
New Contributor I
586 Views
Hi,
the ippiMalloc* functions return parameter 'step' in bytes. So right code to reach the last pixel is:
float trouble= *(imgResult+(620+r_step/sizeof(float)*470));
// not forget to free memory

ippiFree(imgResult);

Regards,
Albert

0 Kudos
trlinux
Beginner
585 Views
Thanks Albert ...
0 Kudos
Reply