The technology takes an HDR image as an input and performs a two-scale decomposition of the image into a base layer, which encodes large scale features, and a detail layer. Only the base layer has its contrast reduced, thereby preserving detail. The base layer is achieved by using a fast and robust edge-preserving filter called the bilateral filter. This non-linear filter is derived from a Gaussian blur filter, in which the weight of each pixel is computed in a manner that decreases the weight of pixels with large intensity difference. As a result, the filter blurs the small variations of a signal (e.g., noise or texture detail) but prevents blurring across edges. The Inventors improve upon existing bilateral filtering techniques by using a piecewise-linear approximation to linearize the filtering process and accelerate it by two orders of magnitude.