# Faster Blur? || Glassmorphism UI

**URL:** <https://forum.juce.com/t/faster-blur-glassmorphism-ui/43086>\
**Category:** General JUCE discussion\
**Created:** [December 5, 2020, 8:17pm UTC](https://forum.juce.com/t/faster-blur-glassmorphism-ui/43086 "2020-12-05T20:17:40Z")\
**Posts on this page:** 1\
**Showing post:** 75

<div class="post-metadata">

**Author:** ![sudara](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/sudara/32/8071_2.png) [@sudara](https://forum.juce.com/u/sudara)\
**Post date:** [February 1, 2023, 1:05pm UTC](https://forum.juce.com/t/faster-blur-glassmorphism-ui/43086/75 "2023-02-01T13:05:41Z")

</div>

Ok, I tried out Intel’s [FilterGaussianBorder](https://www.intel.com/content/www/us/en/develop/documentation/ipp-dev-reference/top/volume-2-image-processing/filtering-functions-2/filters-with-borders/filtergaussianborder.html) on 500x500px - they don’t seem to have a more efficient blur option and I was too lazy to write a custom kernel for tent convolution.

Overall, it’s slightly slower than Stack on my current machine (AMD Ryzen 9 5900HX), which is maybe to be expected since Guassian does a lot of work…

 ![image](https://us1.discourse-cdn.com/flex026/uploads/juce/original/2X/b/b2c6d07e47648efdcfcfc65c713ddc9876cf4fba.png)

One note: `drawImageAt` seemed strangely expensive on Windows (I showed a milder version here), regularly taking up to 5-10ms to draw the 500x500px image, which seemed a bit suspicious? I saw this on the mac machines too, but it seemed to only do that on first paint or two, so I assumed some allocation or memory cache effect was happening. Notable, because in those cases the drawing of the image is 5-10x more expensive than the creation of it, taking the whole operation it out of the “safely animatable” range of timings (I consider this to be \<5-10ms on nicer machines).

 ![image](https://us1.discourse-cdn.com/flex026/uploads/juce/original/2X/e/e139939dcc56604ffead30e3a9425b1b963adab0.png)

* * *

The ippi API is pretty gross, requiring in/out vars, many calls to prep things, manual custom allocation/freeing. Had no idea what to choose for the Gaussian sigma (or what’s normal), so I tuned it by eye:

```cpp
// intel calls the area being operated on roi (region of interest)
IppiSize roiSize = {(int) width, (int) height};
int specSize = 0;
int tempBufferSize = 0;
Ipp8u borderValue = 0;
ippiFilterGaussianGetBufferSize(roiSize, radius * 2 + 1, ipp8u, 1, &specSize, &tempBufferSize);
auto pSpec = (IppFilterGaussianSpec *) ippsMalloc_8u(specSize);
auto pBuffer = ippsMalloc_8u(tempBufferSize);
ippiFilterGaussianInit(roiSize, (radius * 2 + 1), 10, ippBorderRepl, ipp8u, 1, pSpec, pBuffer);
auto status = ippGetStatusString(ippiFilterGaussianBorder_8u_C1R(
        (Ipp8u *) data.getLinePointer(0), data.lineStride,
        (Ipp8u *) blurData.getLinePointer(0), blurData.lineStride,
         roiSize, borderValue, pSpec, pBuffer));
ippsFree(pSpec);
ippsFree(pBuffer);

```

* * *

Anyway, I went down this path originally because I thought it would be interesting to try a IPP/vdsp optimized version of stack blur, but got distracted by these built in functions. Pretty neat those are included. I might eventually try writing a stack blur algo, but it’s back to work for now!

---

_[View the full topic](https://forum.juce.com/t/faster-blur-glassmorphism-ui/43086)._
