- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I was happy to realize that the recent releases introduced some basic filtering of 3D volumes, but unfortunately I'm trying to use ipprFilter to do a simple filtering with a summation kernel on a neighborhood of 3x3x3 and I get an access violation.
What I basically did was to allocate a large 'volume' (with ippsMalloc_16s) that includes suitable margins in all dimensions:
16 voxels on each end of each row (for the original 512x512xN data to remain aligned to 32 bytes)
1 extra row on each end of each plane
1 extra plane on each end of the entire volume
The entire 'volume' was reset with ippsZero and the original data was copied row by row with extra care for the margins.
I then defined Ipp16s **pSrc = new Ipp16s*, an array of N pointers to Ipp16s, as required by ipprFilter, and initialized each element to point to the correct offset within each plane of the volume (for all but the first and last planes that serve as margins).
Did the same for pDst.
Finally, I calculated the size of the buffer required for ipprFilter, using ipprFilterGetBufSize and allocated filtAuxBuf, an Ipp8u array of that size.
The call to ipprFilter was as follows:
IppStatus sts =
ipprFilter_16s_C1PV(pSrc, nVoxelsPerRowWithMargins*sizeof(short),
(const Ipp16s**)pDst, nVoxelsPerRowWithMargins*sizeof(short),
dstVolume, pKernel, kernelVolume, anchor, 1, filtAuxBuf);
where:
dstVolume = {512, 512, N}
pKernel = {1, 1, 1, 1, 1, 1, 1, 1, 1}
kernelVolume {3, 3, 3}
anchor = {1, 1, 1}
Note that I had to perform a c-style cast of pDst to (const Ipp16s**) or else the compilation fails ("Conversion loses qualifiers"). That for itself is a bit troubling.
Does anybody have an experience with ipprFilter?
Does anybody have a code snippet that shows correct usage?
Please advise.
What I basically did was to allocate a large 'volume' (with ippsMalloc_16s) that includes suitable margins in all dimensions:
16 voxels on each end of each row (for the original 512x512xN data to remain aligned to 32 bytes)
1 extra row on each end of each plane
1 extra plane on each end of the entire volume
The entire 'volume' was reset with ippsZero and the original data was copied row by row with extra care for the margins.
I then defined Ipp16s **pSrc = new Ipp16s*
Did the same for pDst.
Finally, I calculated the size of the buffer required for ipprFilter, using ipprFilterGetBufSize and allocated filtAuxBuf, an Ipp8u array of that size.
The call to ipprFilter was as follows:
IppStatus sts =
ipprFilter_16s_C1PV(pSrc, nVoxelsPerRowWithMargins*sizeof(short),
(const Ipp16s**)pDst, nVoxelsPerRowWithMargins*sizeof(short),
dstVolume, pKernel, kernelVolume, anchor, 1, filtAuxBuf);
where:
dstVolume = {512, 512, N}
pKernel = {1, 1, 1, 1, 1, 1, 1, 1, 1}
kernelVolume {3, 3, 3}
anchor = {1, 1, 1}
Note that I had to perform a c-style cast of pDst to (const Ipp16s**) or else the compilation fails ("Conversion loses qualifiers"). That for itself is a bit troubling.
Does anybody have an experience with ipprFilter?
Does anybody have a code snippet that shows correct usage?
Please advise.
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Sid,
You will find a working exampleof function usage in the attached file test_3df.cpp.
You need to initialize all kernel values (3*3*3 in your case) and correctly to allocate memory for volumes(not on a stack).
Thanks,
Beg
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - sid1
dstVolume = {512, 512, N}
>>> pKernel = {1, 1, 1, 1, 1, 1, 1, 1, 1}
kernelVolume {3, 3, 3}
anchor = {1, 1, 1}
>>> pKernel = {1, 1, 1, 1, 1, 1, 1, 1, 1}
kernelVolume {3, 3, 3}
anchor = {1, 1, 1}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Yuri Tikhomirov (Intel)
Hi Sid,
You will find a working exampleof function usage in the attached file test_3df.cpp.
You need to initialize all kernel values (3*3*3 in your case) and correctly to allocate memory for volumes(not on a stack).
Thanks,
Beg
Thanks for the example! Regretfully, I already converted my code to use successive IPPI calls, but I will save your code for rainy days.
The main difference is that you allocated plane by plane where I allocated the entire volume at once and initialized pointers to each plane.
In my next attempt I would most certainly follow your guidlines.
Thanks,
Sid
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Yuri,
Have you tried your code for different filter kernel sizes? If, for example, I set:
#define kwid 9
I get an error in the filter output and also a run-time error when deallocating the memory.
Do you know if this is a bug in your implementation of in the filter routine, ipprFilter_16s_C1PV, itself?
Thanks,
Jonathan.
Have you tried your code for different filter kernel sizes? If, for example, I set:
#define kwid 9
I get an error in the filter output and also a run-time error when deallocating the memory.
Do you know if this is a bug in your implementation of in the filter routine, ipprFilter_16s_C1PV, itself?
Thanks,
Jonathan.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page