Zoom / Filter question

Zoom / Filter question


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!

21 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.


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



Thank you Alice!

HI umundry,

Did you threaded your code get the performance improvement?



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.


Adriaan van Os


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.


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

> 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


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-l...

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


thanks, umundry for some detail. i will invite export on this function to provide some further suggestion.


Bruno, your referred article has several missing image links!

Otherwise, its is a very informative text.



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!

@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.

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.


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.

ippiResizeSqrPixel() is deprecated...

Best Reply

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


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!

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


HI Umundry, 

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


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!!!

Leave a Comment

Please sign in to add a comment. Not a member? Join today