15.04.2018 Views

programming-for-dummies

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

442<br />

Lossy Data Compression<br />

IAMSAMSAMIAM#<br />

Scans “I” and stores it in the dictionary<br />

IAMSAMSAMIAM#<br />

Scans “A” and stores it in the dictionary<br />

IAMSAMSAMIAM#<br />

1 A<br />

9 I<br />

13 M<br />

19 S<br />

27 AM<br />

28 SA<br />

29 MI<br />

30 AM#<br />

Scans “M” and stores it in the dictionary<br />

IAMSAMSAMIAM#<br />

Scans “S” and stores it in the dictionary<br />

IAMSAMSAMIAM#<br />

Scans “A”, which is already in the dictionary,<br />

so it scans the next two characters “AM”<br />

IAMSAMSAMIAM#<br />

Figure 4-4:<br />

The LZW<br />

algorithm<br />

stores<br />

increasing<br />

larger<br />

strings as<br />

numbers.<br />

Scans “S”, which is already in the dictionary,<br />

so it scans the next two characters “SA”<br />

IAMSAMSAMIAM#<br />

Scans “M”, which is already in the dictionary,<br />

so it scans the next two characters “MI”<br />

IAMSAMSAMIAM#<br />

Scans “A”and “AM”, which is already in the dictionary,<br />

so it scans the next three characters “AM#”<br />

Lossy Data Compression<br />

Lossy data compression shrinks data through a combination of packing data<br />

more efficiently (like lossless compression) and by throwing out chunks of<br />

data that aren’t considered crucial. As a result, lossy compression is used<br />

less often <strong>for</strong> text (where losing data is unacceptable because a single missing<br />

word or number can alter the entire meaning of the text) and more often<br />

<strong>for</strong> audio, graphics, and video.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!