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

Interpolation problem with ippiResizeSqrPixel, using IPPI_INTER_CUBIC

carlo_sandriqrverona
1,360 Views
Hello,

I am experiencing a problem with the ippiResizeSqrPixel_8u_C1R function when using IPPI_INTER_CUBIC interpolation (I tried also IPPI_INTER_LANCZOS and it seems to be the same, while IPPI_INTER_NN and IPPI_INTER_LINEAR work fine).

Basically, I have a 100x100 image (1 byte = 1 pixel) with all pixels set to 0, except for the top-left quarter of this image, which I set to another value (128). By resizing this image, for instance to a size of 84x86, I obtain a strange pattern, with some row and column portions showing a value of 127. I am attaching here the source and destination image (.bmp), and also a .jpg image with a different palette, to highlight the artifact's shape.

This seems to be some kind of rounding problem with floating point computation, but I was wondering if this is expected. I also noticed that an analogous call to the old (deprecated) ippiResize_8u_C1R, again with IPPI_INTER_CUBIC interpolation, did not cause the same problem.

I am using Intel IPP 6.1 (in case there are many subversions, mine is the one distributed with Intel Compiler 11.1.046), statically linked with dispatching (I tried both the threaded and not threaded version).
I am running my program on an Intel Xeon CPU (2 quad core processors). A call to ippGetCpuType() on my workstation returns ippCpuPenryn.

I am providing here the code I used, so that you can check if I misunderstood something about these functions.


{
int iSizeX_Src = 100;
int iSizeY_Src = 100;

double xFactor = 0.84;
double yFactor = 0.86;

int iSizeX_Dst = (int) (0.5 + (xFactor * (double)iSizeX_Src));
int iSizeY_Dst = (int) (0.5 + (yFactor * (double)iSizeY_Src));

int iSrcStepBytes;
int iDstStepBytes;

Ipp8u* pSrc = ippiMalloc_8u_C1(iSizeX_Src, iSizeY_Src, &iSrcStepBytes);
Ipp8u* pDst = ippiMalloc_8u_C1(iSizeX_Dst, iSizeY_Dst, &iDstStepBytes);

IppiSize srcSize; srcSize.width = iSizeX_Src; srcSize.height = iSizeY_Src;
IppiSize dstSize; dstSize.width = iSizeX_Dst; dstSize.height = iSizeY_Dst;

ippiSet_8u_C1R(0, pSrc, iSrcStepBytes, srcSize);
ippiSet_8u_C1R(0, pDst, iDstStepBytes, dstSize);

// Set the value 128 to the top left-quarter of the source image
IppiSize srcRoiSize_1; srcRoiSize_1.width = 50; srcRoiSize_1.height = 50;
ippiSet_8u_C1R(128, pSrc, iSrcStepBytes, srcRoiSize_1);

IppiRect srcRoi;
srcRoi.x = 0; srcRoi.y = 0;
srcRoi.width = srcSize.width;
srcRoi.height = srcSize.height;

IppiRect dstRoi;
dstRoi.x = 0; dstRoi.y = 0;
dstRoi.width = dstSize.width;
dstRoi.height = dstSize.height;

int interpolation = IPPI_INTER_CUBIC;

int iBufferSize;
ippiResizeGetBufSize (srcRoi, dstRoi, 1, interpolation, &iBufferSize);

Ipp8u* pBuffer = ippsMalloc_8u(iBufferSize);

ippiResizeSqrPixel_8u_C1R ( pSrc, srcSize, iSrcStepBytes, srcRoi, pDst, iDstStepBytes, dstRoi, xFactor, yFactor, 0, 0, interpolation, pBuffer );

ippsFree(pBuffer);
ippiFree(pSrc);
ippiFree(pDst);
}

ImgSrc.bmp ----> resize ----> ImgDst.bmp ----> zoom + change palette ----> ImgPattern.jpg



Thanks in advance, regards.

Carlo
0 Kudos
1 Solution
Ying_H_Intel
Employee
1,360 Views
I have just tried IPP 6.1 Update 2, but nothing changed for ippCpuPenryn.

Regards,
Carlo


Carlo,

Thank you a lot for the test. Looks it is really abug with penryn cpu optimization.We will fix it in next release. For now, you may work around the issue by setting
if ippCpuPenryn==ippGetCpuType()
{ippStaticInitCpu(ippCpuC2D)
} or other methed.

Thanks
Ying

View solution in original post

0 Kudos
6 Replies
Ying_H_Intel
Employee
1,360 Views


Hi Carlo,

I recalled, thereis aippiResizeSqrtPixelissue fixed in latest IPP 6.1.2 version.

See http://software.intel.com/en-us/articles/intel-ipp-library-61-fixes-list/
and note 2: in http://software.intel.com/en-us/forums/showthread.php?t=69755

Would you like to try the IPP 6.1.2 version and see if the problem is gone?
You can get the install package from Intel registraction center and if compiler pro version, it is 11.1.051
Which version of Intel IPP, Intel MKL and Intel TBB is installed by the Intel Compiler Professional Edition?

Regards,
Ying

0 Kudos
Ying_H_Intel
Employee
1,360 Views
Hi Carlo,

I did quick test on my laptop, IBM T61 with IPP 6.1 udpate 1
ippCpuC2D = 0x21, /* Intel Core 2 Duo processor
The function works no problem, no 127 in the resized image.

Looks the cpu type is key of the problem.

Do you have other machines, for example (ippCpuC2D or ippCpuC2Q) to test if it has different behavious?

Regards,
Ying


0 Kudos
carlo_sandriqrverona
1,360 Views
Quoting - Ying H (Intel)
Hi Carlo,

I did quick test on my laptop, IBM T61 with IPP 6.1 udpate 1
ippCpuC2D = 0x21, /* Intel Core 2 Duo processor
The function works no problem, no 127 in the resized image.

Looks the cpu type is key of the problem.

Do you have other machines, for example (ippCpuC2D or ippCpuC2Q) to test if it has different behavious?

Regards,
Ying




Hi Ying,

I tested the same code on two different CPU types (one ippCpuEM64T and one ippCpuC2D, as yours) and, indeed, I did not have the same problem.

I am also going to try IPP 6.1 update 2 soon, as you suggested, to see if something has changed for the ippCpuPenryn type, too.

Thanks for your support, regards

Carlo

0 Kudos
carlo_sandriqrverona
1,360 Views
I have just tried IPP 6.1 Update 2, but nothing changed for ippCpuPenryn.

Regards,
Carlo

0 Kudos
Ying_H_Intel
Employee
1,361 Views
I have just tried IPP 6.1 Update 2, but nothing changed for ippCpuPenryn.

Regards,
Carlo


Carlo,

Thank you a lot for the test. Looks it is really abug with penryn cpu optimization.We will fix it in next release. For now, you may work around the issue by setting
if ippCpuPenryn==ippGetCpuType()
{ippStaticInitCpu(ippCpuC2D)
} or other methed.

Thanks
Ying

0 Kudos
carlo_sandriqrverona
1,360 Views
Quoting - Ying H (Intel)


Carlo,

Thank you a lot for the test. Looks it is really abug with penryn cpu optimization.We will fix it in next release. For now, you may work around the issue by setting
if ippCpuPenryn==ippGetCpuType()
{ippStaticInitCpu(ippCpuC2D)
} or other methed.

Thanks
Ying



Ok, thanks to you.

Regards,
Carlo
0 Kudos
Reply