BradLarson / GPUImage

An open source iOS framework for GPU-based image and video processing
http://www.sunsetlakesoftware.com/2012/02/12/introducing-gpuimage-framework
BSD 3-Clause "New" or "Revised" License
20.25k stars 4.61k forks source link

GPUImageLowPassFilter makes crash. #793

Open donobono opened 11 years ago

donobono commented 11 years ago

Today, I downloaded all your source and I added GPUImageLowPassFilter in SimplePhotoSimplePhotoFilter sample like below.

viewDidLoad method GPUImageLowPassFilter *filterLowPass = [[GPUImageLowPassFilter alloc] init]; [filterLowPass setFilterStrength:0.8]; filter = filterLowPass;

then I took a picture, but it crashed.

I debugged and I found the point app is crashed, it is conserveMemoryForNextFrame method of GPUImageFilter.m.

Could you please fix this problem, I love low pass filter and I should use it. :-)

Thank you for your great source!!

PS : I tested with iPhone iOS 6.1

BradLarson commented 11 years ago

I'll look at this, but I'll warn you that the low pass filter may not work properly with still photos. It requires the results of multiple previous images, and the preview images will be of a different resolution than your final photo. This may not work, or it may produce unpredictable artifacts.

donobono commented 11 years ago

I used low pass filter very well with old source(maybe 2~3 month before), but recent version has this problem. I tried to debug with my app source(not sample source), conserveMemoryForNextFrame method of GPUImageFilter makes endless loop.

tonyzonghui commented 11 years ago

Hi BradLarson, I think it might be the problem with the os version comparison. I saw it uses defined(__IPHONE_6_0) to check for arc compatibility, but for ios6.1 this might not work.

girishvr commented 11 years ago

Hi, I am using GPUImageLowPassFilter on a video but it ends in an Infinite loop which is caused on endProcessing. Any idea what needs to be done.

Thanks.

gessl commented 11 years ago

I have crash problems with both GPUImageLowPassFilter, GPUImageHighPass, and GPUImageMotionDetector filters. I use swappable filters for a live video feed. All other filters swap just fine, which leeds me to believe that my overall handling is as intended. In particular the code crashes when I try to remove any of these three filters from the live camera feed:

    [videoCamera removeTarget:inputFilter]; // <- Crashes when inputFilter is GPUImageLowPassFilter
    [inputFilter removeTarget:textureOutput];

The filtershowcase example does not seem to suffer from this problem as the videocamera source is reallocated every time a new filter becomes active, so filters are never removed as targets from the videocamera feed.

scttnlsn commented 11 years ago

I have things setup very similarly to @gessl and experience the same problem when removing the GPUImageLowPassFilter- an infinite loop on endProcessing.

girishvr commented 11 years ago

Actually, the GPUImageLowPassFilter has got two filters added as a target to each other.

[bufferFilter addTarget:dissolveBlendFilter atTextureLocation:1];
[dissolveBlendFilter addTarget:bufferFilter];

So, when removeTarget is called, it results into an infinite loop. We could find a hack for this solution. Let me update it and send a pull request.

jbartot commented 11 years ago

Hi, I just stumbled upon this issue as well. It only triggered when I am processing a movie file. Anyway, the fix does seem to be commenting out or removing:

[dissolveBlendFilter addTarget:bufferFilter];

Does someone want to commit that change?