Changing GPUImageFilter forceProcessingAtSize does not work as expected (example app included to demonstrate the bug)
Before adding a GPUImageFilter to a GPUImageView, you can change the processing size to any size to save resources if you don't need to render the full-sized image. However, once you forceProcessingAtSize, you cannot do it again with the desired results.
For instance, if you have a 320x480 GPUImageView, you can force the rendering to 320x480. However, if the GPUImageView is resized to say 160x240 and you force the rendering to 160x240, the actual camera frames will be resized to 80x120, and the remainder of the 160x240 frame buffer is filled with black. The GPUImageView fillMode doesn't help, as technically the frame it is receiving from GPUImage is the correct size, just with most of it filled with black.
Since it is hard to explain, I've uploaded a sample project to Github demonstrating this glitch: https://github.com/iSkythe/GPUImageGlitchSampleApp.
Essentially it seems that after the GPUImageView is added as a target of the GPUImageFilter, the GPUImageFilter bases all future forceProcessingAtSize off of that. I've tried going through the code, but I just can't seem to figure out exactly where this bug is happening.
That's interesting. I was just chasing down something like this. I'll see if your test project can help me find where this is coming from.
+1
I have been seeing these issues as well.
It looks like the Frame Buffer maintains the size of the previous forceProcessing call. So if you original have 1000x1000 forceProcessing call, then forceProcessing at 500x500, the image will be rendered in 1/4 of the frame buffer.
To the bottom of both forceProcessing methods I added:
[self destroyFilterFBO];
for (id<GPUImageInput> currentTarget in targets)
{
if ([currentTarget respondsToSelector:@selector(destroyFilterFBO)]) {
[currentTarget performSelector:@selector(destroyFilterFBO)];
}
}
NOTE: I had to make GPUImageInput protocol extend from NSObject to get the respondsToSelector/performSelector methods.
and that seems to have fixed the issue. I don't know the library well enough to know if there are any other side effects though.