Delta encoding stores data as the difference between successive samples rather than storing the samples directly. It works best for smooth data where adjacent values are typically close. The first value is stored normally, and subsequent values are the difference from the previous value. This shifts the data toward zero, enabling further compression with techniques like Huffman encoding that work best on data probabilities centered around zero. Linear predictive coding expands on this idea to better predict each value based on multiple previous samples.
Download as PPTX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
69 views
Lecture 13 - Delta Coding
Delta encoding stores data as the difference between successive samples rather than storing the samples directly. It works best for smooth data where adjacent values are typically close. The first value is stored normally, and subsequent values are the difference from the previous value. This shifts the data toward zero, enabling further compression with techniques like Huffman encoding that work best on data probabilities centered around zero. Linear predictive coding expands on this idea to better predict each value based on multiple previous samples.
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 41
Delta Encoding
By Fareed Ahmed Jokhio
Delta Encoding • In science, engineering, and mathematics, the Greek letter delta (Δ) is used to denote the change in a variable. • The term delta encoding, refers to several techniques that store data as the difference between successive samples (or characters), rather than directly storing the samples themselves. • Figure on next slide shows an example of how this is done. Delta Encoding
• The first value in the delta encoded file is the
same as the first value in the original data. • All the following values in the encoded file are equal to the difference (delta) between the corresponding value in the input file, and the previous value in the input file. Delta Encoding • Delta encoding can be used for data compression when the values in the original data are smooth, that is, there is typically only a small change between adjacent values. • This is not the case for ASCII text and executable code; however, it is very common when the file represents a signal. Delta Encoding • For instance, Fig. shows a segment of an audio signal, digitized to 8 bits, with each sample between -127 and 127. Delta Encoding • Figure on this slide shows the delta encoded version of this signal. Delta Encoding • The key feature is that the delta encoded signal has a lower amplitude than the original signal. • In other words, delta encoding has increased the probability that each sample's value will be near zero, and decreased the probability that it will be far from zero. • This uneven probability is just the thing that Huffman encoding needs to operate. Delta Encoding • If the original signal is not changing, or is changing in a straight line, delta encoding will result in runs of samples having the same value. • This is what run-length encoding requires. • Correspondingly, delta encoding followed by Huffman and/or run-length encoding is a common strategy for compressing signals. Delta Encoding • The idea used in delta encoding can be expanded into a more complicated technique called Linear Predictive Coding, or LPC. • To understand LPC, imagine that the first 99 samples from the input signal have been encoded, and we are about to work on sample number 100. Delta Encoding • We then ask ourselves: based on the first 99 samples, what is the most likely value for sample 100? • In delta encoding, the answer is that the most likely value for sample 100 is the same as the previous value, sample 99. • This expected value is used as a reference to encode sample 100. Delta Encoding • That is, the difference between the sample and the expectation is placed in the encoded file. • LPC expands on this by making a better guess at what the most probable value is. • This is done by looking at the last several samples, rather than just the last sample. • The algorithms used by LPC are similar to recursive filters, making use of the z-transform and other intensively mathematical techniques. Lempel–Ziv–Welch (LZW) Algorithm
• Left to right: Abraham Lempel, Jacob Ziv &
Terry Welch Lempel–Ziv–Welch (LZW) Algorithm
• The LZW algorithm is a very common
compression technique. • This algorithm is typically used in GIF and optionally in PDF and TIFF. • Unix’s ‘compress’ command, among other uses. • It is lossless, meaning no data is lost when compressing. Lempel–Ziv–Welch (LZW) Algorithm
• The algorithm is simple to implement and has
the potential for very high throughput in hardware implementations. • It is the algorithm of the widely used Unix file compression utility compress, and is used in the GIF image format. Lempel–Ziv–Welch (LZW) Algorithm
• The Idea relies on reoccurring patterns to save
data space. • LZW is the foremost technique for general purpose data compression due to its simplicity and versatility. • It is the basis of many PC utilities that claim to “double the capacity of your hard drive”. Lempel–Ziv–Welch (LZW) Algorithm
• LZW compression works by reading a
sequence of symbols, grouping the symbols into strings, and converting the strings into codes. • Because the codes take up less space than the strings they replace, we get compression. • Characteristic features of LZW includes: Lempel–Ziv–Welch (LZW) Algorithm
• LZW compression uses a code table, with 4096
as a common choice for the number of table entries. • Codes 0-255 in the code table are always assigned to represent single bytes from the input file. Lempel–Ziv–Welch (LZW) Algorithm
• When encoding begins the code table contains
only the first 256 entries, with the remainder of the table being blanks. • Compression is achieved by using codes 256 through 4095 to represent sequences of bytes. Lempel–Ziv–Welch (LZW) Algorithm
• As the encoding continues, LZW identifies
repeated sequences in the data, and adds them to the code table. • Decoding is achieved by taking each code from the compressed file and translating it through the code table to find what character or characters it represents. Lempel–Ziv–Welch (LZW) Algorithm • Example: ASCII code. • Typically, every character is stored with 8 binary bits, allowing up to 256 unique symbols for the data. • This algorithm tries to extend the library to 9 to 12 bits per character. • The new unique symbols are made up of combinations of symbols that occurred previously in the string. Lempel–Ziv–Welch (LZW) Algorithm
• It does not always compress well, especially
with short, diverse strings. • But is good for compressing redundant data, and does not have to save the new dictionary with the data: this method can both compress and uncompress data. Lempel–Ziv–Welch (LZW) Algorithm • The idea of the compression algorithm is the following: as the input data is being processed, a dictionary keeps a correspondence between the longest encountered words and a list of code values. • The words are replaced by their corresponding codes and so the input file is compressed. • Therefore, the efficiency of the algorithm increases as the number of long, repetitive words in the input data increases. LZW ENCODING Compression using LZW • Example 1: Use the LZW algorithm to compress the string: BABAABAAA • The steps involved are systematically shown in the diagram below. Compression using LZW Compression using LZW Compression using LZW Compression using LZW Compression using LZW Compression using LZW LZW Decompression • The LZW decompressor creates the same string table during decompression. • It starts with the first 256 table entries initialized to single characters. • The string table is updated for each character in the input stream, except the first one. • Decoding achieved by reading codes and translating them through the code table being built. LZW Decompression Algorithm LZW Decompression • Example 2: LZW Decompression: Use LZW to decompress the output sequence of : <66><65><256><257><65><260>
• The steps involved are systematically shown in
the diagram below. LZW Decompression • In this example, 72 bits are represented with 72 bits of data. • After a reasonable string table is built, compression improves dramatically. LZW Summary: • This algorithm compresses repetitive sequences of data very well. • Since the codewords are 12 bits, any single encoded character will expand the data size rather than reduce it. Advantages of LZW over Huffman: • LZW requires no prior information about the input data stream. • LZW can compress the input stream in one single pass. • Another advantage of LZW its simplicity, allowing fast execution.