Trade Resources Industry Views A Way to Help Developers More Easily Rearrange Their Image Processing Code

A Way to Help Developers More Easily Rearrange Their Image Processing Code

MIT researchers have figured out a way to help developers more easily rearrange their image processing code so that it can execute faster and use fewer computational resources.

Such a technique could prove especially beneficial for mobile phones and other portable devices where battery power is at a premium. Users are growing more accustomed to running advanced photo manipulation apps like Instagram on their phones, so developers of these apps are struggling to make their creations as speedy as possible.

"I was looking for some easier way to write high performance code for mobile devices, but it turned out to be great for desktops as well," said Andrew Adams, a postdoctoral student at the MIT Computer Science and Artificial Intelligence Laboratory (CSAIL).

Adams, along with other researchers from MIT, Stanford University and Adobe, have developed a DSL (Domain Specific Language), and associated compiler, that creates a layer of abstraction that allows developers to easily move around chunks of code in order to find the most computationally efficient method of processing images.

The researchers have used the DSL, called Halide, to rewrite several common image-processing functions. In many cases they were able to demonstrate two-, three-, or even six-fold increases in speed.

Typically, image processing involves multiple steps, some of which can be executed in a parallel in multicore processors. For developers, however, moving code around to find the optimal order of execution can be a complicated and error-prone process, given that with the imperative languages used today for image processing -- such as C++ -- the order in which a program executes tends to be "baked into the code," Adams said.

"Getting performance improvements on mobile platforms can be quite painful. If you've already optimized your code a certain way, If you want to try optimizing a different way you have to rearrange all your code, and you'll probably just increased the number bugs. It's just a painful experience," Adams said.

Borrowing ideas from functional programming, Halide provides developers with the ability to easily schedule when and where each routine should execute. The programmer can experiment with the order in which the program executes, without worrying about introducing bugs or breakages.

Halide can also save time in porting programs to different hardware as well. The programmer needs only to reorder the execution of code that is optimal for the new platform.

The DSL is an extension of C++, and compilers are available for both x86 and ARM mobile processors, as well as for Nvidia Cuda GPUs. The researchers may also create a version tailored for the OpenGL library. Ultimately, though, they hope that the ideas behind Halide -- rather than the DSL itself -- are embedded in commercial development tools and languages.

The researchers plan to discuss Halide at the Association for Computing Machinery's Special Interest Group on Computer Graphics and Interactive Techniques (Siggraph) conference next week in Los Angeles.

Source: http://www.computerworld.com/s/article/9229924/MIT_researchers_streamline_coding_for_image_processing
Contribute Copyright Policy
MIT Researchers Streamline Coding for Image Processing