0

Currently we are using IPP 5.2 in our application, I try to replace it with IPP 2019 with Nuget package. I don't understand the performance comparison of resize with CUBIC between IPP 5.2 and IPP 2019.

My CPU is Intel Core i7-8700k. In my project. For IPP 5.2 the version information is 0x3BBBF280 "6.0 Update 2 build 167.41", name is 0x3BBBF2A8 "ippip8-6.0.dll+".

For IPP 2019, the version is x3b834230 "2019.0.4 (r62443)" and the name is 0x3b834220 "ippIP AVX2 (h9)". The cubic parameter B is set to 0.15 and C is set to 0.5.

The comparison test for resizing with cubic, the size of source images are kept as the same and the resize factor is varied. The cubic method ippiResizeCubic_16u_C1R is used. The repetition is set to 1000.

When the size of source image is (30, 27) , small image, the performance of IPP 5 is better than IPP 2019. Comparison Test result with size (30,27)

When the size of source image is (150, 136), the performance of IPP 5 is almost the same as IPP 2019. Comparison Test result with size (150,136)

When the size of source image is larger then (150, 136), like the third image with size (480, 517), the speed of IPP 2019 is faster than IPP 5. Comparison Test result with size (480,517)

old IPP resize function in IPL project

ippiResize_16u_C1R((Ipp16u*)pSrc, srcSize, src->widthStep, srcRoi,
     (Ipp16u*)pDst, dst->widthStep, dstRoiSize, xFactor, yFactor, interpolation);

new implementation with Cubic interpolation type

ippiResizeGetSize_16u(srcSize, dstRoiSize, ippCubic, 0, &specSize,   &initSize);
pInitBuf = ippsMalloc_8u(initSize);
pSpec = (IppiResizeSpec_32f*)ippsMalloc_8u(specSize);
ippiResizeCubicInit_16u(srcSize, dstRoiSize, CubicParameterB, CubicParameterC, pSpec, pInitBuf);
ippiResizeGetBufferSize_8u(pSpec, dstRoiSize,1, &bufSize);
pBuffer = ippsMalloc_8u(bufSize);
ippiResizeCubic_16u_C1R((Ipp16u*)pSrc, src->widthStep, (Ipp16u*)pDst, dst->widthStep, dstOffset, dstRoiSize, ippBorderRepl, borderValue, pSpec, pBuffer);
iplFree(pInitBuf);
iplFree(pSpec);
iplFree(pBuffer);

From the test result I got, the IPP 2019 is faster when dealing with larger image, but slower when resizing smaller image. Is this because different cubic algorithm is used in the IPP 2019.

For resizing the smaller image (30,27), is the quality of resized image with IPP 2019 better than resized with IPP 5?

Thank you for your help, any suggestions are appreciated!

Kind regards,

Ning

Ning Liu
  • 19
  • 4
  • You must exclude the memory allocation (and free) from the measurements. – Rotem Sep 07 '19 at 07:57
  • Hi Rotem, thank you for your advice. memory allocation and free are part of the resize function, I think the old ippiResize_16u_C1R also contains such part. – Ning Liu Sep 10 '19 at 08:36
  • I don't think the old version uses dynamic memory allocation and free, it's not difficult to implement resize without using "sketch buffer" (can't know for sure)... The common usage is allocating memory once in initialization, execute resize multiple times, and free when at the end. Besides that, 30x27 is too small for efficient AVX2 optimization. – Rotem Sep 10 '19 at 18:15
  • Hi @Rotem, you are right, the buffer size calculation is new added. I've tested it without memory allocation and free. But the result is similar as before, Furthermore, I've also test the IPP 2019 p8 library which is the same type as in IPP 6. The result also similar – Ning Liu Sep 11 '19 at 11:49

1 Answers1

2

actually the issue has been confirmed with the latest IPP 2019 u5 and escalated against the IPP team. The performance regression happens with so-called small image sizes ( < 120 ) due to redesigned IPP resizing functions. With the larger input image sizes, the latest version of IPP outperforms significantly the IPP 5.2 and 6.0. This topic has been discussed here.

ZachB
  • 13,051
  • 4
  • 61
  • 89
Gennady.F
  • 571
  • 2
  • 7