Patent ID: 7925086

Claim:
A method of processing a quantized input image, comprising: detecting if a selected pixel in the quantized image belongs to a ramp area in each of multiple pre-defined directions by comparing luminance of pixels in the pre-defined directions to a threshold, wherein the threshold is determined based on luminance values of pixels in the pre-defined directions; dynamically selecting a quantization level for each of the pre-defined directions based on the corresponding detection results; refining the pixel based on the selected quantization levels including: applying a segmentation process along the ramp direction to obtain a smoothly changing area including the selected pixel; and refining the smoothly changing area based on the quantization levels to obtain a refined segment area; performing a low-pass filtering operation on the refined segment area to obtain a filtered area with higher precision pixel values; performing luminance value measurements in the refined segment area; and determining a gain value from the measured luminance values including determining a sub-gain g 3 based on the neighboring pixel differences along the selected direction within the refined segment and determining the sub-gain value g 3 further based on a ratio of: (a) the total sign changes of the neighboring differences along the pre-defined directions within the refined segment, and (b) the total number of the pixels within the refined segment.