1. A system in an electronic device for compressing image data, the system comprising: a pattern module configured to: receive a pixel block comprising a plurality of pixels, dynamically generate a pattern database comprising a plurality of entries, wherein each entry includes a pattern value associated with an index code, perform a pattern search by comparing a pixel pattern value generated from a color value of each of the plurality of pixels to the plurality of entries in the pattern database, and update the pattern database with new pattern entries based on the color values of the plurality of pixels, the pattern module being further configured to terminate the pattern search if greater than a threshold number of the plurality of pixels are determined to correspond to new pattern entries; and a pattern mode coding module configured to generate a compressed pixel block using pattern encoding based at least partly on results of the pattern search.