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

Crashing with ippiFilterWiener_8u_C1R

dzar1
Beginner
312 Views
I'm a new user to thr IPP and am having a problem with a Wiener filter. I've, essentially, copied the example in the manual to get started and it works in some cases, but crashes in others. Here is what I'm doing:

myFilter(BYTE *src, BYTE *dst)
{
IppiSize dstRoiSize = {800,512};
IppiSize maskSize = {5,5};
IppiPoint anchor = {1,1};
Ipp32f noise[1] = {0.5};
int size = 800;
int BufferSize;

ippiFilterWienerGetBufferSize(dstRoiSize, maskSize, 1, &BufferSize);
Ipp8u* pBuffer = ippsMalloc_8u(BufferSize);
ippiFilterWiener_8u_C1R(src, size, dst, size, dstRoiSize, maskSize, anchor, noise, pBuffer);
ippsFree(pBuffer);
}

My program crashes executing the ippiFilterWiener_8u_C1R call. My pointers to src/dst are valid (the src is an image bitnmap that I can display, already, and dst was created and memory allocated to it). When I do a similar function call with different src/dst/dstRoiSize in another place in my program, it all works, fine.

What's even stranger is that the error is a memory access violation to a location that's well before the src pointer. No matter what source address I use, this is true. It's very far away from both the dst and pBuffer addresses so I don't think it's overflow from them. In the case that works, dstRoiSize is {2048, 512}. I've tried various masks and sizes withthe same src/dst with no luck. I did find it will not crash if I change the anchor to {5,5}but then the image is just uniform gray no matter what the source image looks like.

Any thoughts or new things to look at?


0 Kudos
2 Replies
dzar1
Beginner
312 Views
Update...

Turns out, I do not have this problem if I'm not running the debugger. (I was running it to see the data and verify it was set up properly.) Same code, recompiled with my release libraries, optimizations, etc. and all works, fine. Any idea why this would fail when debugging?
0 Kudos
Vladimir_Dudnik
Employee
312 Views

Hello,

So, unmodified sample from IPP documentation work successully for you?

Please make sure you apply correct parameters to the function. Note, in IPP an image is defined with three parameters - pointer to the beginning of pixels array, byte step (distance in bytes between two adjacent image rows) and ROI, rectangle of interest (rectangular area starting from the pixel refererred by pointer with size in pixels width and height, defined in IppiSize).

Also note that size of work buffer is depend on ROI and mask size and number of channels, so you need to re-calculate it if you change these parameters dynamically.

Regards,
Vladimir

0 Kudos
Reply