Data Compression

Doing More With Less

Nathan Tenney

WSU Tri-Cities

Data Representation

Compression Basics

Compression Basics

Compression Basics

Compression Basics

*Symbol* *Code 1* *Code 2* *Code 3*
A 1 1 11
B 2 22 12
C 12 12 21

Compression Basics

Compression Basics

Compression Basics

Compression Basics

Run Length Encoding

Run Length Encoding

Run Length Encoding

Run Length Encoding

Basic Huffman

Huffman Example 1

Huffman Example

Huffman Example 2

Huffman Example

Huffman Example 3

Huffman Example

Huffman Efficiency

Huffman Efficiency

Huffman Efficiency

Huffman Pairs

Huffman Pairs

Huffman Issues

Lisp Example

(defun queue-length (queue) “Returns as two values the number of elements in the queue and the maximum number of elements the queue can hold.” (check-type queue queue) (let ((length (length (queue-elements queue))) (delta (the fixnum (- (queue-put-ptr queue) (queue-get-ptr queue))))) (declare (fixnum length delta)) ;; The maximum number of elements the queue can hold is ;; (1- LENGTH) because a queue is empty when put-ptr = ;; get-ptr. (values (mod delta length) (the fixnum (1- length)))))

Sibling Property

If each node has a sibling (except the root), and the breadth first right to left traversal generates a list of nodes with non-increasing frequency, it can be proven that a tree adhering to the sibling property is a Huffman tree.

Sibling Property

Sibling Property

Adaptive Huffman

Adaptive Huffman

Adaptive Huffman

Adaptive Huffman

Adaptive Huffman

Adaptive Huffman Example