In this paper, an efficient least mean square (LMS) optimization algorithm based on the ordering of pixels is proposed for simultaneous sharpness enhancement and coding artifact reduction. The pixels in a filter aperture are ordered according to their spatial distances and intensity deviations to the central pixel. The optimized filter coefficients for the ordered pixels are obtained by training on a dataset that is composed of the original images and the compressed blurred versions of the original images. The pixel ordering procedure makes the algorithm more efficient for training and much cheaper in terms of classification than other LMS techniques. Experimental results show the superior performance of the proposed algorithm to the state-of-the-art classification-based techniques.