Community
cancel
Showing results for 
Search instead for 
Did you mean: 
jinming_g_
Beginner
137 Views

ippsMalloc_...(int len)

what is the parameter 'len' referring to in ippsMalloc_XYZ(int len) function?

does it refer to "number of bytes", or "number" of elements"?

using examples on the reference:  https://software.intel.com/en-us/ipp-9.0-ipps-manual-pdf

page 35:

     Ipp8u* pBuf = ippsMalloc_8u(8*sizeof(Ipp8u));

seems referring to "number of bytes"

but the example on page 168:  

     Ipp32f *x = ippsMalloc_32f(1000), mean;
      int i;
      for(i = 0; i<1000; ++i) x = (float)rand() / RAND_MAX;

seemly referring to  "number of elements": here 'array' x has 1000 'elements', and will take 1000*sizeof(Ipp32f), or 4000 bytes!

0 Kudos
1 Reply
Sergey_K_Intel
Employee
137 Views

Hi!

Agree. The example on pg. 35 is not clear. The "sizeof" there is very confusing. The "ippsMalloc_*" functions as a parameter take the number of elements. This is why ippsMalloc function has clones with data type suffixes - 8u, 16s, etc.

You may treat, for example, ippsMalloc_32f(n) as ippsMalloc_8u(n * sizeof(Ipp32f)). It's the same.

Reply