Enhancing Contrast of Compressed Images: Reducing Block Artifacts Adaptively