Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
7 Views

what is ARR_HDR_SIZE in IPP samples

Hello All,

I am implementing the JPEG encoding and everything looks fine. But, I want to know the ARR_HDR_SIZE  in uic samples 

 

#include <stdlib.h>
#include <etxt.h>
#include "uic_new.h"

using namespace UIC;

static const unsigned int ARR_HDR_SIZE = 32;

void* UIC::ArrAlloc   (Ipp32u itemSize, Ipp32u nOfItems)
{
    void *buff = malloc(itemSize * nOfItems + ARR_HDR_SIZE);
    unsigned int *countOf = (unsigned int*)buff;

    *countOf = nOfItems;

    return ((Etxt_DText)buff) + ARR_HDR_SIZE;
}

void  UIC::ArrFree    (const void* arr)
{
    Etxt_DText tmp = (Etxt_DText) arr;
    tmp -= ARR_HDR_SIZE;
    free(tmp);
}

Ipp32u UIC::ArrCountOf(const void* arr)
{
    Etxt_DText tmp = (Etxt_DText) arr;
    tmp -= ARR_HDR_SIZE;
    return *((unsigned int *)tmp );
}

in the above code what is the ARR_HDR_SIZE   and what it represents?.

could you anyone help me.

Regards,

sathish

0 Kudos
1 Reply
Highlighted
Employee
7 Views

Hi Sathish S.

It seems a IPP issue and here is IPP forum : https://software.intel.com/en-us/forums/intel-integrated-performance-primitives, you may submit the issue there in the future. 

The ARR_HDR_SIZE = 32  is  for 32-byte alignment.   almost same as the function ippiMalloc

The function ippiMalloc is declared in the ippi.h file. This function allocates a memory block aligned to a
32-byte boundary for elements of different data types. Every line of the image is aligned in accordance with the
pStepBytes parameter, which is calculated by the ippiMalloc function and returned for further use.

And  It is  for better performance, for example,  https://software.intel.com/en-us/node/503946. ;

Best Regards,

Ying

0 Kudos