ios - GPUImage is slow the first blurs -


i'm using excellent gpuimage blur views (https://github.com/bradlarson/gpuimage)

however, seems first couple of times blur views, it's slow. after few blurs, it's faster.

why that, , there way preload gpuimage framework fast time?

thanks

    gpuimageiosblurfilter *blurfilter = [gpuimageiosblurfilter new];     blurfilter.blurradiusinpixels = 1;     blurfilter.saturation = 1.2;     blurfilter.downsampling = 4.0f;     blurredimage = [blurfilter imagebyfilteringimage:blurredimage]; 

there slight lag on first usage of given filter, because framework has compile shaders used filter. these shaders cached later reuse. blurs in particular exhibit this, since shaders generated each blur radius use (for performance reasons when reused in video, etc.).

that said, make sure absolutely need work uiimages in above code. -imagebyfilteringimage: isn't fastest approach, since has take in uiimage, generate gpuimagepicture behind scenes, upload image texture, process image, grab bytes , recreate uiimage that.

if want display more realtime feed of adjusting image , displaying preview screen, you'd better off manually creating gpuimagepicture , sending output gpuimageview, updates every time change filter values.

also, don't performance tests in simulator. exhibits weird behavior due software emulation of parts of gpu, , i've seen strange initial lags when processing things there. isn't present in native mac version of framework, it's simulator oddity.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -