Nonlinear mapping for dynamic range compression in digital images