I have a Vectorization optimization problem.
I have a struct pDst which have 3 fields named: 'red', 'green' and 'blue'.
The type might be 'Char', 'Short' or 'Float'.This is given and can not be altered.
We have another array pSrc which represents an image [RGB] - Namely an array of 3 pointers which every one of them point to a layer of an image.Each layer is built using IPP plane oriented image (Namely, Each plane is formed independently - 'ippiMalloc_32f_C1'):http://software.intel.com/sites/products/documentation/hpc/ipp/ippi/ippi_ch3/functn_Malloc.html
We would like to copy it as described in the following code:
for(int y = 0; y < imageHeight; ++y)
for(int x = 0; x < imageWidth; ++x)
pDst[x + y * pDstRowStep].red = pSrc[x + y * pSrcRowStep];
pDst[x + y * pDstRowStep].green = pSrc[x + y * pSrcRowStep];
pDst[x + y * pDstRowStep].blue = pSrc[x + y * pSrcRowStep];
Yet, in this form the compiler can't vectorize the code.
At first it says: "loop was not vectorized: existence of vector dependence.".
When I use the #pragma ivdep to help the compiler (Since there's no dependence) I get the following error:"loop was not vectorized: dereference too complex.".
Anyone has an idea how to allow vectorization?
I have Intel Compiler 13.0.