ADAPTIVE RUN-LENGTH ENCODING

Publisher Summary This chapter elaborates an adaptive run-length encoding method. Some compression techniques work in two dimensions, storing regions of the picture in a data structure such as a quadtree. High compression can be achieved this way for some images, but finding the best decomposition of the image can be difficult, and fast decompression of selected regions also can be hard. A less sophisticated but simpler image storage technique is known as run-length encoding. However, this scheme is not efficient for images where the colors change quickly. If each pixel in a scanline is different than the preceding pixel, then run-length encoding actually will double the size of the file relative to a straightforward dump, because each pixel will be preceded by a count byte with value 0. To handle this situation, the count byte is redefined as a signed 8-bit integer. If the value is zero or positive, it indicates a run of length one more than its value; but if the count is negative, it means that what follows is a dump. This is called adaptive run-length encoding. A straightforward application of this technique usually produces a smaller file than a raw dump, but not always.