1. A method of processing a quantized input image, comprising: employing a processor: detecting if a selected pixel in the quantized input image belongs to a ramp area in a selected direction; dynamically selecting a quantization level based on the detection results; and refining the pixel based on the selected quantization level.