Data Compression. Reduce the size of data. Reduces time to retrieve and transmit data. Compression ratio = original data size/compressed data size

Similar documents
CS 253: Algorithms. LZW Data Compression

Data Compression. Lossless And Lossy Compression. Text Compression. Lossless And Lossy Compression. Lossless compression is essential.

Data Compression. Reduces storage space and hence storage cost. Compression ratio = original data size /

INVESTIGATION 2. What s the Angle?

Chp. 3_4 Trigonometry.notebook. October 01, Warm Up. Pythagorean Triples. Verifying a Pythagorean Triple... Pythagorean Theorem

Contents TRIGONOMETRIC METHODS PROBABILITY DISTRIBUTIONS

Light Loss-Less Data Compression, With GPU Implementation

PCT MINIMUM DOCUMENTATION

17.3 Find Unknown Side Lengths

Chapter 5. Triangles and Vectors

Performance Comparison of Dynamic Voltage Scaling Algorithms for Hard Real-Time Systems

SUPPLEMENT MATERIALS

Grade 6. Mathematics. Student Booklet SPRING 2011 RELEASED ASSESSMENT QUESTIONS. Record your answers on the Multiple-Choice Answer Sheet.

The Pythagorean Theorem and Its Converse Is That Right?

In any right-angle triangle the side opposite to the right angle is called the Label the Hypotenuse in each diagram above.

Chapter 4 Group of Volunteers

CS 188: Artificial Intelligence Spring Announcements

PCT MINIMUM DOCUMENTATION

TECHNICAL BULLETINApril 2016

Workrite Sierra HX & HXL Assembly Instructions for 3-leg Electric Workcenters

Recycling Bits in LZ77-Based Compression

Word-based Statistical Compressors as Natural Language Compression Boosters

Coroutines in Propeller Assembly Language

Skills Practice Skills Practice for Lesson 4.1

Data Extraction from Damage Compressed File for Computer Forensic Purposes

Samba. Brief History. Characteristics and Technique. Timing

Lesson 8: Application Technology

LFQC: a lossless compression algorithm for FASTQ files

Announcements. CS 188: Artificial Intelligence Spring Announcements II. P4: Ghostbusters 2.0. Today. Dynamic Bayes Nets (DBNs)

CS 188: Artificial Intelligence Spring Announcements

PRESSURE LOSSES DUE TO THE LEAKAGE IN THE AIR DUCTS - A SAFETY PROBLEM FOR TUNNEL USERS?

Satoshi Yoshida and Takuya Kida Graduate School of Information Science and Technology, Hokkaido University

First Aid in School Policy

Math commonly used in the US Army Pathfinder School

MTH 112: Elementary Functions

Bicycle wheel and swivel chair

How To Demonstrate Guide E24 & E26

Michelangelo,

A Universal Zombie RPG Add-On

Valve Proving System for automatic Shutoff Valves

Incremental Dependency Parsing

THERMOFLO FLUID PUMPS& SYSTEMS THERMOFLO FOR HEATING, COOLING AND WATER SUPPLY APPLICATIONS TO BS7074 SEALED SYSTEMS EXPANSION VESSELS PRESSURIZERS

Special Right Triangles

2014 WHEAT PROTEIN RESPONSE TO NITROGEN

Lesson 2 PRACTICE PROBLEMS Using Trigonometry in Any Triangle

NCSS Statistical Software

A New Searchable Variable-to-Variable Compressor

Cammie s

CT PET-2018 Part - B Phd COMPUTER APPLICATION Sample Question Paper

VALLEY FORGE. Order of March & "Route of the Army from Camp Valley Forge to Newborough on the North River opposite Fishhiln. Poor,

1970 BRITISH COHORT STUDY: SURVEY

Apply the Law of Sines. You solved right triangles. You will solve triangles that have no right angle.

GOLOMB Compression Technique For FPGA Configuration

TASK 4.2.1: "HAMILTON'S ROBOT" ==============================

Name Class Date SAMPLE. Complete the missing numbers in the sequences below. 753, ,982. The area of the shape is approximately cm 2

Skills Practice Skills Practice for Lesson 4.1

EMBEDDED systems have become more and more important

Ruth Foster, M.Ed. Author

An Efficient Code Compression Technique using Application-Aware Bitmask and Dictionary Selection Methods

Report. Honolulu City Council. The Proposed Sale of City Housing Properties

TOURNAMENT REGULATIONS OUTDOOR COMPETITIONS

Fantasy Baseball Filename: baseball

Activity Guide for Daisies, Brownies, and Juniors

DESIGN AND ANALYSIS OF ALGORITHMS (DAA 2017)

VPC3: A Fast and Effective Trace-Compression Algorithm

Drag racing system HL190 User Manual and installation guide

MEMORY is one of the key driving factors in embeddedsystem

Fast Lossless Depth Image Compression

Reduction of Bitstream Transfer Time in FPGA

LFQC: A lossless compression algorithm for FASTQ files

Robot Control User Manual /0718-V01

McAfee Change Control and Application Control Installation Guide For use with epolicy Orchestrator and 4.6.0

Right Triangle Trigonometry

Lesson 12.1 Right Triangle Trigonometry

Announcements. CS 188: Artificial Intelligence Spring Today. P4: Ghostbusters. Exact Inference in DBNs. Dynamic Bayes Nets (DBNs)

Minnesota s Wild Turkey Harvest Fall 2016, Spring 2017

FOR OWNERS OF HORSE BUSINESSES

Why? DF = 1_ EF = _ AC

Tvheadend - Bug #1407 Odd space(s) in channel name

Williams, Justin à Player name (last name, first name) CAR

CSE 3402: Intro to Artificial Intelligence Uninformed Search II

PILOT PROGRAM FOR THE EVALUATION OF NANOFILTRATION MEMBRANES PREPARED BY: WILMINGTON, MA ON UF PERMEATE

Introduction to Waves & Sound

1. Predict what will happen in the following situation. Sketch below your prediction of the interference pattern when the waves overlap:

ATTEND (Analytical Tools To Evaluate Negotiation Difficulty)

2014 Victorian Shooting Championship

IEEE TRANSACTIONS ON COMPUTERS, VOL.54, NO.11, NOVEMBER The VPC Trace-Compression Algorithms

Horse Farm Management s Report Writer. User Guide Version 1.1.xx

International Journal of Engineering Trends and Technology (IJETT) Volume 18 Number2- Dec 2014

BASKETBALL SPEED AND AGILITY

SUMMER ASSIGNMENT FOR FUNCTIONS/TRIGONOMETRY Bring to school the 1 st day of class!

Versatile Test Rig. Industrial Electrical Engineering and Automation. Further development of a test rig for pneumatic brake valves.

Solving the problem of serving large image mosaics. Using ECW Connector and Image Web Server with ArcIMS

Right Triangle Trigonometry

Listening & Speaking. Grade 1. Supports. instructi GRADE. Develops oral and receptive language. 15- to 20-minute daily activities

Using SQL in MS Access

Integration of modelling and monitoring to optimize network control: two case studies from Lisbon

CSE 3401: Intro to AI & LP Uninformed Search II

Bypass Compensator Cartridge, Size 16

EasyStart Guide Works with FitnessBoxingOnline.com and other Boxout Video & Mp3 workouts

Transcription:

Dt Compression Reduce the size of dt. Reduces storge spce nd hence storge cost. Compression rtio = originl dt size/compressed dt size Reduces time to retrieve nd trnsmit dt.

Lossless And Lossy Compression compresseddt = compress(originldt) decompresseddt = decompress(compresseddt) When originldt = decompresseddt, the compression is lossless. When originldt!= decompresseddt, the compression is lossy.

Lossless And Lossy Compression Lossy compressors generlly otin much higher compression rtios thn do lossless compressors. Sy vs.. Lossless compression is essentil in pplictions such s text file compression. Lossy compression is cceptle in mny imging pplictions. In video trnsmission, slight loss in the trnsmitted video is not noticed y the humn eye.

Text Compression Lossless compression is essentil. Populr text compressors such s zip nd Unix s compress re sed on the LZW (Lempel-Ziv-Welch) method.

LZW Compression Chrcter sequences in the originl text re replced y codes tht re dynmiclly determined. The code tle is not encoded into the The code tle is not encoded into the compressed text, ecuse it my e reconstructed from the compressed text during decompression.

LZW Compression Assume the letters in the text re limited to {, }. In prctice, the lphet my e the 56 chrcter ASCII set. The chrcters in the lphet re ssigned code numers eginning t. The initil code tle is: code

LZW Compression code Originl text = Compression is done y scnning the originl text from left to right. Find longest prefix p for which there is code in the code tle. Represent p y its code pcode nd ssign the next ville code numer to pc, where c is the next chrcter in the text tht is to e compressed.

LZW Compression Originl text = p = pcode = c = code Represent y nd enter into the code tle. Compressed text =

LZW Compression code Originl text = Compressed text = p = pcode = c = Represent y nd enter into the code tle. Compressed text =

LZW Compression code 4 Originl text = Compressed text = p = pcode = c = Represent y nd enter into the code tle. Compressed text =

LZW Compression code 4 5 Originl text = Compressed text = p = pcode = c = Represent y nd enter into the code tle. Compressed text =

code LZW Compression Originl text = Compressed text = p = pcode = c = 4 5 6 Represent y nd enter into the code tle. Compressed text =

code LZW Compression Originl text = Compressed text = p = pcode = c = 4 5 6 7 Represent y nd enter into the code tle. Compressed text =

code LZW Compression Originl text = Compressed text = p = pcode = 5 c = 4 5 6 7 8 Represent y 5 nd enter into the code tle. Compressed text = 5

code LZW Compression 4 5 Originl text = Compressed text = 5 p = pcode = 8 c = 6 7 8 9 Represent y 8 nd enter into the code tle. Compressed text = 58

code LZW Compression 4 5 Originl text = Compressed text = 58 p = pcode = 8 c = null Represent y 8. Compressed text = 588 6 7 8 9

Code Tle Representtion code 4 5 6 7 8 9 Dictionry. Pirs re (, element) = (,code). Opertions re : find() nd insert(, code) Limit numer of codes to. Use hsh tle. Convert vrile length s into fixed length s. Ech hs the form pc, where the string p is tht is lredy in the tle. Replce pc with (pcode)c.

Code Tle Representtion code 4 5 6 7 8 9 code 4 5 6 7 8 9 5 8

LZW Decompression code Originl text = Compressed text = 588 Convert codes to text from left to right. represents. Decompressed text = pcode = nd p =.

LZW Decompression code Originl text = Compressed text = 588 represents. Decompressed text = pcode = nd p =. lstp = followed y first chrcter of p is entered into the code tle.

LZW Decompression code Originl text = Compressed text = 588 represents. Decompressed text = pcode = nd p =. lstp = followed y first chrcter of p is entered into the code tle.

LZW Decompression code Originl text = Compressed text = 588 represents Decompressed text =. pcode = nd p =. 4 lstp = followed y first chrcter of p is entered into the code tle.

LZW Decompression code Originl text = Compressed text = 588 represents Decompressed text =. pcode = nd p =. 4 5 lstp = followed y first chrcter of p is entered into the code tle.

code LZW Decompression 4 5 Originl text = Compressed text = 588 represents 6 Decompressed text =. pcode = nd p =. lstp = followed y first chrcter of p is entered into the code tle.

code LZW Decompression 4 5 Originl text = Compressed text = 588 5 represents 6 7 Decompressed text =. pcode = 5 nd p =. lstp = followed y first chrcter of p is entered into the code tle.

code LZW Decompression 4 5 Originl text = Compressed text = 588 8 represents??? 6 7 When code is not in the tle, its is lstp followed y first chrcter of lstp. lstp = So 8 represents. 8

code LZW Decompression 4 5 Originl text = Compressed text = 588 8 represents 6 7 8 9 Decompressed text =. pcode = 8 nd p =. lstp = followed y first chrcter of p is entered into the code tle.

code 4 5 6 7 Code Tle Representtion 8 9 Dictionry. Pirs re (, element) = (code, wht the code represents) = (code, codekey). Opertions re : find() nd insert(, code) Keys re integers,,, Use D rry codetle. codetle[code] = codekey. Ech code hs the form pc, where the string p is code tht is lredy in the tle. Replce pc with (pcode)c.

Time Complexity Compression. O(n) expected time, where n is the length of the text tht is eing compressed. Decompression. O(n) time, where n is the length of the decompressed text.

Prepre to e confused

How to pck it codes into ytes. void output(long pcode). {// Output 8 its, sve rest in leftover.. int c, d; 4. if (itsleftover) 5. {// hlf yte remins from efore MASK = 5 () EXCESS = 4 BYTE_SIZE = 8 MASK = 55 () 6. Tke 8 right its from -it numer d = int(pcode & MASK); // right ByteSize its 7. c = int((leftover << EXCESS) (pcode >> BYTE_SIZE)); 8. out.put(c); Comine leftover its with 4 left its from new -it numer 9. out.put(d);. itsleftover = flse;. }. else. {// no its remin from efore 4. leftover = pcode & MASK; // right EXCESS its 5. c = int(pcode >> EXCESS); 6. out.put(c); 7. itsleftover = true; 8. } 9.} Chop 4 right its off -it numer nd sve for lter Output 8 left its

Compression - Initilizing. hshchins<long, int> h(divisor);. for (int i = ; i < ALPHA; i++). h.insert(pirtype(i, i)); 4. int codesused = ALPHA; 5. Note tht is going to e something like 65 nd not s suggested y the erlier exmple.

Compression. int c = in.get(); // first chrcter of input file. if (c!= EOF) {// input file is not empty. long pcode = c; // prefix code 4. while ((c = in.get())!= EOF) {// process chrcter c 5. long thekey = (pcode << BYTE_SIZE) + c; 6. // see if code for thekey is in the dictionry 7. pirtype* thepir = h.find(thekey); 8. if (thepir == NULL) {// thekey is not in the tle 9. output(pcode);. if (codesused < MAX_CODES) // crete new code. h.insert(pirtype((pcode << BYTE_SIZE) c, codesused++));. pcode = c;. } else pcode = thepir->second; // thekey is in tle 4. } 5. 6. // output lst code(s) 7. output(pcode); 8. if (itsleftover) 9. out.put(leftover << EXCESS);

Decompression. typedef pir<int, chr> pirtype;. pirtype ht[max_codes]; text(p) = text(q)c. void output(int code) 4. {// Output string corresponding to code. 5. size = -; 6. while (code >= ALPHA) 7. {// suffix in dictionry 8. s[++size] = ht[code].second; 9. code = ht[code].first;. }. s[++size] = code; // code < ALPHA.. // decompressed string is s[size]... s[] 4. for (int i = size; i >= ; i--) 5. out.put(s[i]); 6.}

Decompression. ool getcode(int& code) Turning ytes into -it codes. {// Put next code in compressed file into code.. // Return flse if no more codes. 4. int c, d; 5. if ((c = in.get()) == EOF) 6. return flse; // no more codes 7. 8. // see if ny left over its from efore 9. // if yes, conctente with left over 4 its. if (itsleftover). code = (leftover << BYTE_SIZE) c;. else. {// no left over its, need four more its 4. // to complete code 5. d = in.get(); // nother 8 its 6. code = (c << EXCESS) (d >> EXCESS); EXCESS = 4 7. leftover = d & MASK; // sve 4 its MASK = 5 () 8. } 9. itsleftover =!itsleftover;. return true;.}

Decompression. if (getcode(pcode)) {// file is not empty. s[] = pcode; // chrcter for pcode. out.put(s[]); // output string for pcode 4. size = ; //s[size] is first chrcter of lst string 5. 6. while(getcode(ccode)) {// there is nother code 7. if (ccode < codesused) {// ccode is defined 8. output(ccode); 9. if (codesused < MAX_CODES) {// crete new code. ht[codesused].first = pcode;. ht[codesused++].second = s[size];. }. } else {// specil cse, undefined code 4. ht[codesused].first = pcode; 5. ht[codesused++].second = s[size]; 6. output(ccode); 7. } 8. pcode = ccode; 9. }.}