1. A method comprising: generating, with a digital system, a gain map based on a wide dynamic range (WDR) Bayer image; generating, with the digital system, a hierarchical representation of the gain map to give a plurality of coefficient arrays in each of a plurality of levels; modifying, with the digital system, coefficients of each of the coefficient arrays to give modified coefficient arrays, wherein modifying the coefficients includes mapping the coefficients with a piecewise linear function; and inverse filtering, with the digital system, each of the modified coefficient arrays to generate a hierarchical noise-filtered gain map.