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

Zoom / Filter question

umundry
Beginner
1,696 Views

Hello,

I need to filter, zoom and pan an image. My implementation first filters the source image (smoothing or sharpening), then using Lanczos resizing, zooms and pans it into an output image. After spending a lot of time to get this working I sadly realize that these 2 steps (one is filtering and one is Lanczos resizing) end up being too slow for real-time interaction.

With that my question is, is there a resize function which allows one to set a convolution filter?

Thank you!

0 Kudos
1 Solution
Valentin_K_Intel
Employee
1,684 Views

Hi umundry,

Intel(R) IPP library does not contain resize functions, which can set a convolutional filter for smoothing. 

Could you please specify hardware parameters, library versions and all parameters for the resize functions for the case when ippiResizeLanczos has worse performance that ippiResizeSqrPixel?

The function ippiResizeSqrPixel is deprecated, however you can use it with Intel(R) IPP legacy libraries: https://software.intel.com/en-us/articles/intel-ipp-legacy-libraries

Thanks,
Valentin

View solution in original post

0 Kudos
20 Replies
Alice_H_Intel
Employee
1,671 Views

Hello,

I'll investigate this and get back to you soon.

Thanks,

Alice

0 Kudos
umundry
Beginner
1,671 Views

Thank you Alice!

0 Kudos
Chao_Y_Intel
Moderator
1,671 Views

HI umundry,

Did you threaded your code get the performance improvement?

Thanks,
Chao

 

0 Kudos
Adriaan_van_Os
New Contributor I
1,671 Views

Tiling would help too, I guess. That is, do the consecutive operations on one image tile (and then do those operations on the next tile, etc.) That prevents costly cache misses.

Or using a small preview image to get the real-time interaction user prefs.

Regards,

Adriaan van Os

 

0 Kudos
umundry
Beginner
1,671 Views

To answer Adrian's question, the app does not allow for a "small preview image".

For Chao: The entire app is highly optimized and uses every core/thread available. I had to start tinkering with this when the function ippiFilterSharpen_8u_C1R() was deprecated and removed and I had to start fishing for an alternative. Resizing using Lanczos was the visually equivalent, but it is way slower hence the reason for this post.

So the question remains and I hope that Alice (or Chao?) will come up with THE answer.

Thanks!

0 Kudos
umundry
Beginner
1,671 Views

I am sorry, correction, the deprecation of the ippiResizeSqrPixel_() function caused the issue.

0 Kudos
Adriaan_van_Os
New Contributor I
1,671 Views

To answer Adrian's question, the app does not allow for a "small preview image".

I didn't ask a question, just gave two suggestions on how to solve your posted problem. I sincerely apologize for doing that,

A. van Os

 

0 Kudos
BMart1
New Contributor II
1,671 Views

If you don't mind a hack, you can rewrite ippiResizeLanczosInit to create a IppiResizeSpec_32f​ with your own convolution filter. It's sort of documented at https://software.intel.com/en-us/articles/the-intel-avx-realization-of-lanczos-interpolation-in-intel-ipp-2d-resize-transform

Alternatively, you can switch to https://github.com/uploadcare/pillow-simd which has full source code.

Bruno

0 Kudos
Chao_Y_Intel
Moderator
1,671 Views
thanks, umundry for some detail. i will invite export on this function to provide some further suggestion. Regards, Chao
0 Kudos
Thomas_Jensen1
Beginner
1,671 Views

Bruno, your referred article has several missing image links!

Otherwise, its is a very informative text.

Thomas

 

0 Kudos
umundry
Beginner
1,671 Views

To Adrian: Sorry if I offended you, not my intent.

To Bruno: That "hack" seems to be a PhD thesis :-) Sadly I won't have the time to dive deeply into that but as Thomas said, still very informative.

Chao/Alice, I am hoping that you'll come up with something that I can use. It seems like performance went backwards with the deprecation of ippiResizeSqrPixel() and forcing a more fancy but slower alternative. I am not certain what exactly the cause of the slowdown is, it seems that the numerous memory allocations and de-allocations might play a role. In the application, this code is called 4 times -each on a separate thread-, and all of that approx. 20 ... 30 times per second when interacting. If I only filter, but not pan/zoom, then all works like butter, very smooth, no hick-ups whatsoever (ippiResizeSqrPixel() kept up and was smooth as well). So the culprit definitely is the Lanczos resizing.

Thank you everyone!

0 Kudos
BMart1
New Contributor II
1,671 Views

@Thomas Maybe the PDF has the images.

@umundry I found ResizeSqrPixel​ to be slower than ResizeAntialiasing. What exact functions are you using? Are you sure you are comparing apples to apples? Is Antialiasing the same? I think the sweet spot is linear (not lanczos) interpolation with antialiasing.

0 Kudos
umundry
Beginner
1,671 Views

I am comparing ippiResizeSqrPixel() to ippiResizeLanczos(). No antialiasing handling involved. Regarding interpolation type, we have performed extensive testing on image quality and determined that Lanczos reproduces what we need best.

Thanks!

0 Kudos
BMart1
New Contributor II
1,671 Views

You can use VTune to profile each function and compare the kernels. Another advantage of ippiResizeSqrPixel is that the pan can be subpixel accurate.  I don't know if you are using that.

0 Kudos
umundry
Beginner
1,671 Views

ippiResizeSqrPixel() is deprecated...

0 Kudos
Valentin_K_Intel
Employee
1,685 Views

Hi umundry,

Intel(R) IPP library does not contain resize functions, which can set a convolutional filter for smoothing. 

Could you please specify hardware parameters, library versions and all parameters for the resize functions for the case when ippiResizeLanczos has worse performance that ippiResizeSqrPixel?

The function ippiResizeSqrPixel is deprecated, however you can use it with Intel(R) IPP legacy libraries: https://software.intel.com/en-us/articles/intel-ipp-legacy-libraries

Thanks,
Valentin

0 Kudos
umundry
Beginner
1,671 Views

Hi Valentin,

that Is a clear albeit disappointing answer, thank you!

I have looked at that legacy link which apparently lists the deprecated functions and ippiResizeSqrPixel is not one of them. But I'll check. If it is, then my problem is solved that way.

Thank you!

0 Kudos
umundry
Beginner
1,671 Views

I have downloaded the legacy zip file but need a password to use its content. Where do I obtain that password?

Thanks!

0 Kudos
Chao_Y_Intel
Moderator
1,671 Views

HI Umundry, 

can you check the "readme.txt" file at the package, and it includes the password for unzipping? 

Thanks,
Chao

0 Kudos
umundry
Beginner
1,474 Views

Thank you Chao, yes I found it, and using the legacy lib support, everything is back to working at lightning speed again! So, Valentin gave the decisive hint.

Thank you everyone!!!

0 Kudos
Reply