a language for image processing and computational photography
Halide is a new programming language designed to make it easier to write high-performance image processing code on modern machines. Its current front end is an embedding in C++. Hardware targets include x86-64/SSE, ARM v7/NEON, and CUDA.
The following function defines and sets the schedule for a 3x3 box filter defined as a series of two 3x1 passes:
Func blur_3x3(Func input) {
Func tmp, blurred;
Var x, y, xi, yi;
// The algorithm - no storage or order
tmp(x, y) = (input(x-1, y) + input(x, y) + input(x+1, y))/3;
blurred(x, y) = (tmp(x, y-1) + tmp(x, y) + tmp(x, y+1))/3;
// The schedule - defines order, locality; implies storage
blurred.tile(x, y, xi, yi, 256, 32)
.vectorize(xi, 8).parallel(y);
tmp.chunk(x).vectorize(x, 8);
return blurred;
}
Check out the Getting Started tutorial in our README, to see how to use Halide in your own programs.
As a user of Halide, the easiest way to get started is with one of our binary distributions. The compiler is currently supported on recent releases of Mac OS X (we use 10.6 through 10.8) and mainstream Linux distributions (we use Ubuntu 12.04). (Windows support is technically feasible, but we have not yet built or tested on Windows.)
Halide: A Language and Compiler for Optimizing Parallelism, Locality, and Recomputation in Image Processing Pipelines
Jonathan Ragan-Kelley,
Connelly Barnes,
Andrew Adams,
Sylvain Paris,
Frédo Durand,
Saman Amarasinghe.
PLDI 2013
Decoupling Algorithms from Schedules for Easy Optimization of Image Processing Pipelines
Jonathan Ragan-Kelley,
Andrew Adams,
Sylvain Paris,
Marc Levoy,
Saman Amarasinghe,
Frédo Durand.
SIGGRAPH 2012