Optimizing The High Dynamic Range Imaging Pipeline