IPP 2D convolution work properly on demo data only

IPP 2D convolution work properly on demo data only

Hello,

I have a question.

There are two functions of 2D convolution in attached cpp-file.

The first one is a standard convolution on floating-point data.

The second is a function, that use ippiConvValid_32f_C1R() for convolution.

When I use data of this example (https://software.intel.com/sites/products/documentation/doclib/ipp_sa/80...) with integer numbers for source matrix and kernel, everything is ok, results of two functions are equal, but when i use generator of random integer or floating-point numbers, ippiConvValid_32f_C1R() returns wrong result.

What's the problem?

AttachmentSize
Downloadtext/x-c++src convolution_0.cpp4.02 KB
8 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hello,

Which version of Intel IPP are you using now?

ippiConvValid_ functions is deprecated, could you use the ippiConv_xxx as the replacement?

Thanks,
Chao

I have downloaded last demo version IPP two weeks ago. 
I would like to buy the license if it will work properly.
Now, I have tried to use the function ippiConv_32f_C1R(...) instead ippiConvValid_32f_C1R(...), but i get the same result.
I noticed, when i am using the kernel and src1 from example(https://software.intel.com/sites/products/documentation/doclib/ipp_sa/80...), both functions are working properly, but if I try to change at least one number in the kernel, thus disrupting its "symmetry", I get absolutely wrong result. What else can i do?

Hi Alexander,

I guess you've implemented correlation instead of convolution - Ii think that if you perform a mirroring of your generated kernel (so that right bottom pixel becomes the left top) for your function (or for IPP) - you'll get the expected and comparable result.

regards, Igor

I don't quite understand, what you mean?

In the documentation for the function I see the formula

I need the exactly this formula for convolution, not for correlation. In documentation I don't see any limitation that kernel should be mirrored (symmetric).

 

Hi Alexander,

I've said nothing about symmetry. It's seen from the formula that kernel (g in the formula) is applied from the top index to bottom. So for your implementation of convolution (I guess) you should perform kernel transposition in the next manner:

from:

k00,k01,k02

k10,k11,k12

k20,k21,k22

to:

k22,k21,k20

k12,k11,k10

k02,k01,k00

regards, Igor

Hi, Igor,

After transposition of the kernel, you recommended, it works!

Thank you so much!

Leave a Comment

Please sign in to add a comment. Not a member? Join today