Efficient and adaptable high dynamic range compression