Text this: Reducing the dynamic range of infrared images based on block-priority equalization and compression of histograms