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

ippStsSizeErr returned from ippiCopyReplicateBorder_8u_C1R

JD
Beginner
891 Views
Hi,
I get the sizing error returned fromippiCopyReplicateBorder_8u_C1R() and I'm at a loss as to why. From the manual, the error arises when:
"Indicates an error condition if srcRoiSize or dstRoiSize has a fieldwith a zero or negative value, or topBorderHeight orleftBorderWidth is less than zero, or dstRoiSize.width Indicates an error condition if srcRoiSize or dstRoiSize has a fieldwith a zero or negative value, or topBorderHeight orleftBorderWidth is less than zero, or dstRoiSize.width
Here is a code snippet where I've put numeric values in for easier reading. I do not see where I am violating the above rules and causing the ippStsSizeErr error. (imData is my pointer to the source data - a pre-allocated image volume). I am trying to copy one padded slice
[cpp]roiSize.width = 200;
roiSize.height = 1024;
padSize.width = 208;
padSize.height = 1044;
const unsigned int uNumPadPixels = (padSize.width) * (padSize.height);

// IPP allocation requires padding the image:
Ipp8u *ippPad = (Ipp8u *) ippsMalloc_8u( uNumPadPixels );
if ( !ippPad )
  return EXIT_FAILURE;

ippError = ippiCopyReplicateBorder_8u_C1R( imData, 200, roiSize, ippPad, 208, padSize, 4, 10 );
// Returns ippStsSizeErr[/cpp]
If anyone can spot my error, I'd appreciate it! Many thanks!
0 Kudos
3 Replies
JD
Beginner
891 Views
BTW, it works with the following settings (which is why I'm so lost!):
[cpp]const unsigned int uIppPadY = _anchy;
IppiSize roiSize = { 200, 1024 };
IppiSize padSize = { 204, 1032 };
const unsigned int uNumPadPixels = (padSize.width) * (padSize.height);

// IPP allocation requires padding the image:
Ipp8u *ippPad = (Ipp8u *) ippsMalloc_8u( uNumPadPixels );
if ( !ippPad ) return EXIT_FAILURE;

ippError = ippiCopyReplicateBorder_8u_C1R( imData, 200, roiSize, ippPad, padSize.width, padSize, 2, 4);[/cpp]
0 Kudos
Ying_H_Intel
Employee
891 Views
Hi JD,

The problemmay bethe padSize={208,1044}
padSize.width = 208;
padSize.height = 1044;

It is notwanted size if
topBorderHeight=4;
leftBorderWidth =10;

According to the function parameter definition:
IppStatus ippiCopyReplicateBorder_(const Ipp* pSrc, int
srcStep, IppiSize srcRoiSize, Ipp* pDst, int dstStep, IppiSize
dstRoiSize, int topBorderHeight, int leftBorderWidth);

The topBorderHeight will increase the Height
and The leftBorderWidth will increase the Width.

The right size should be
PAD.width > roiSize.width +leftBorderWidth = 210;
PAD.height > roiSize.height+ topBorderHeigh = 1036;

or change the call
IppStatus ippError = ippiCopyReplicateBorder_8u_C1R( imData, 200, roiSize, ippPad, padSize.width, padSize, 10, 4);


The second canwork becuase of
padSize.width=204>200+4
padSize.height=1032>1024+2


Hope it helps,
Ying
Samiliarfunction sample codein KB article

http://software.intel.com/en-us/articles/intel-integrated-performance-primitives-intel-ipp-processing-an-image-from-edge-to-edge/
0 Kudos
JD
Beginner
891 Views
Hi Ying,
Many thanks for the prompt response. You are correct, and I am very grateful to you for finding my error. Basically, I had the pad width and height around the wrong way. The correct order is:
IppStatus ippiCopyReplicateBorder_( .....int topBorderHeight, int leftBorderWidth);
Again, thanks. I guess I was staring at the same thing for too long!
JD.
0 Kudos
Reply