GPUImage 2
github.com
github.com
Takes a bit of learning but it's really fast. The tutorial series is good http://halide-lang.org/tutorials/tutorial_introduction.html
It'd be interesting to see a comparison between the two for something non-trivial, both in terms of code complexity and performance. My guess is that Halide takes a lot more code but ends up being 2-3x faster due to the ease of low level optimization.
But given a known format I'm pretty sure you can convert any RAW image format into something Halide understands without loss (at the moment most RAW image data uses at most 14 bits IIRC, so a 16 bit RGB array should be enough), after which you can implement, say, debayering algorithms yourself.
In fact, that's the first example you see in the first publication (see top left) about Halide:
But yes, you can use Halide for handling RAW image data. I actually used it for exactly that a couple of months ago, when I implemented a demosaic algorithm. It's damn fast too.
The new API is way more concise and super clear. Particularly love the use of blocks for configuration groups, as it makes preset behaviour more portable and easily defined (say, for a Instagram-style app).
Great work Brad, this is a much-loved framework and it's great to see the changes in v2.
Edit: Forget my Instagram comparison, Brad gives much better examples in the blog post announcing 2.0: http://www.sunsetlakesoftware.com/2016/04/16/introducing-gpu...
"The objective of the framework is to make it as easy as possible to set up and perform realtime video processing or machine vision against image or video sources. By relying on the GPU to run these operations, performance improvements of 100X or more over CPU-bound code can be realized. This is particularly noticeable in mobile or embedded devices. On an iPhone 4S, this framework can easily process 1080p video at over 60 FPS. On a Raspberry Pi 3, it can perform Sobel edge detection on live 720p video at over 20 FPS."
http://www.sunsetlakesoftware.com/2016/04/16/introducing-gpu...
The size difference between the Objective C and new Swift version is significant:
GPUImage Version |Files |Lines of Code
Objective-C (without shaders)| 359 |20107
Swift (without shaders) |157 |4549
Swift code is clearly more concise than Objective-C, as everyone who's worked with both knows, but this statement shouldn't be taken as a point for Objective-C vs Swift on its own.
Can anyone shed some light on this matter? Has anything changed in the last years? Are bus transfers still a concern? If yes, how does GPUImage handle them?
In addition (iirc) CPU-GPU busses have got quite a bit faster in the last 5 years. They're still a large bottleneck, yes, but for expensive, highly parallel computations on small pieces of data they don't completely dominate the computation cost.
EDIT:
I've also noticed that this framework uses OpenGL(ES) for its offloading. Given that, the computation could easily be offloaded to an embedded (i.e. non-discrete) GPU, eliminating the data movement cost.
The big problem with iOS image handling has always been the pitiful amount of RAM on the devices. It wasn't until relatively recently (iPad 4) that the iPads even had enough to reliably handle images in the 10-15 megapixel range without being killed by the memory watchdog.