Implement adaptive contrast with histograms and entropy