1. A method for processing an image data, the method comprising: receiving a plurality of gray data including gray levels; removing dependencies between consecutive gray levels in a direction of the plurality of gray data sequence being received to generate different gray levels at time (N), (N−1), and (N−2), where N is an integer number of clock cycles, wherein said removing dependencies further comprises calculating a number of occurrences of each gray level as the gray data sequence being received, and outputting the total number of occurrences of each gray level with said each gray level; pipelining memory read, addition, and memory write operations to be performed in a same clock cycle, after removing the dependencies between consecutive gray levels; and outputting a histogram of the image data.