Data Compression Algorithms for Energy-Constrained Devices in Delay Tolerant Networks Christopher M....
-
Upload
tabitha-booker -
Category
Documents
-
view
219 -
download
1
Transcript of Data Compression Algorithms for Energy-Constrained Devices in Delay Tolerant Networks Christopher M....
Data Compression Algorithms for Energy-Constrained Devices in
Delay Tolerant Networks
Christopher M. Sadler and Margaret Martonosi
In: Proc. of the 4th ACM Conference on Embedded Networked Sensor Systems (SenSys), 2006.
Reporter: 王滋農
1. Motivation
• Previous algorithms of compressing acquired data in sensor systems
- application-specific algorithms
- off-the-shelf algorithms→ Not for resource-constrained sensor nodes
• Standard compression algorithms are aimed at saving storage not energy
2. Outline
• LZW compression• LZW for Sensor Nodes (S-LZW)• S-LZW with Mini-Cache (S-LZW-MC)
3.1 LZW introduction (1/4)• The LZW Compression Algorithm is a dictionary-based algorithm, which always
tries to output short codes for strings that are already present in it's dictionary
• LZW compression uses a code table, with 4096 (12 bits) as a common choice for the number of table entries
• Codes 0-255 (ASCII code 8 bits) in the code table are always assigned to represent single bytes from the input file
• 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
• As the encoding continues, LZW identifies repeated sequences in the data, and adds them to the code table
3.1 LZW algorithm (2/4) Initialize table with single character strings P = first input character Codeword = 256 WHILE not end of input stream C = next input character IF P + C is in the string table P = P + C ELSE output the code for P
add P + C to the string table Codeword++ P = C END IF END WHILE
output code for P
3.1 LZW example (3/4)
• Compressing the string: BABAABAAA
ENCODER OUTPUT STRING TABLE
output code
representing codeword string
66 B 256 BA
65 A 257 AB
256 BA 258 BAA
257 AB 259 ABA
65 A 260 AA
260 AA
3.1 LZW example (4/4)
• Uncompressed String: aaabbbbbbaabaabaNumber of bits = Total number of characters * 8
= 16 * 8 = 128 bits
• Compressed string (codewords): <97><256><98><258><259><257><261>Number of bits = Total Number of codewords * 12
= 7 * 12 = 84 bits
Outline
• LZW compression• LZW for Sensor Nodes(S-LZW)• S-LZW with Mini-Cache (S-LZW-MC)
3.2 S-LZW introduction (1/5)
• Never deliver 100% of data to others
- dictionary size
- data size
3.2 S-LZW algorithm (2/5)
• Dictionary size
- Experimented with 512, 768, 1024 & Unlimited.
- Block sizes of 1, 2, 4 & 10 Flash pages.• S‐LZW uses 512 entry dictionary and 4 pages or less
3.2 S-LZW algorithm (3/5)
3.2 S-LZW algorithm (4/5)
• Data Size – Evaluated 1, 2 & 4 flash page sizes. – Compressed either 2 pages in one block or two individual one‐page blocks. – Also, 4 pages in either one block or two individual two page blocks. – Compression ratio benefits while using a block of 2 pages. SS, GDI, ZNet & Calgeo improvements – 25.5%, 12.9%, 4.6%, 3.3%. – Compute times benefit while using a block of 2 pages. SS, GDI, ZNet & Calgeo improvements – 24.5%, 1.7%, 5.3%, 1.1%
• S‐LZW compresses data in block of 528 Bytes (2 Pages)
→ SS (SensorScope): indoor environmental monitoring → ZNet (ZebraNet): a combination GPS data and debugging data→ GDI (Great Duck Island):Habitat and environmental monitoring data→ Calgeo (Calgary Corpus): seismic data
SENSOR DATA – N BYTES GENERATED OVER TIME
…528 B Block (2 Flash Pages)
COMP. ALGORITHM
COMP. ALGORITHM
COMP. ALGORITHM
Compressed Data
Compressed Data
Compressed Data
… … …
………
528 B Block (2 Flash Pages)
528 B Block (2 Flash Pages)
3.2 S-LZW algorithm (5/5)
Outline
• LZW compression• LZW for Sensor Nodes(S-LZW)• S-LZW with Mini-Cache (S-LZW-MC)
3.3 S-LZW-MC introduction (1/3)
• A variant of S-LZW• Data acquiring over short intervals
3.3 S-LZW-MC flow chart (2/3)
Flow chart of S-LZW-MC
3.3 S-LZW-MC example (3/3)
• Hit => Saves multiple bits: (Log2N)+1 Bit
• Miss => Costs just 1 extra escape bit: (9+1)
4. Novelty
• Proposing novel approaches tailored to the unique trade-offs and constraints of sensors
5. Strength
• An efficient and lossless data compression algorithms on the source node
• The compression algorithms are suitable for static and mobile sensor network and applicable to a wide range of applications
6. Weakness
• This paper doesn’t clearly describe how to solve the problem when the dictionary fills
• Not the optimum compression ratio
Thank you
What happens when the dictionary gets too large (i.e., when all the 4096 locations have been used)?
Here are some options usually implemented:
Simply forget about adding any more entries and use the table as is.
Throw the dictionary away when it reaches a certain size.
Throw the dictionary away when it is no longer effective at compression.
Clear entries 256-4095 and start building the dictionary again.
Some clever schemes rebuild a string table from the last N input characters.
Appendix
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
1 Initialize table with single character strings2 OLD = first input code3 output translation of OLD4 WHILE not end of input stream5 NEW = next input code6 IF NEW is not in the string table7 S = translation of OLD8 S = S + C9 ELSE10 S = translation of NEW11 output S12 C = first character of S13 OLD + C to the string table14 OLD = NEW15 END WHILE
Example 2: LZW Decompression 1
Example 2: Use LZW to decompress the output sequence of
Example 1:
<66><65><256><257><65><260>.
Example 2: LZW Decompression Step 1
<66><65><256><257><65><260> Old = 65 S = A
New = 66 C = A
ENCODER OUTPUT STRING TABLE
string codeword string
B
A 256 BA
Example 2: LZW Decompression Step 2
<66><65><256><257><65><260> Old = 256 S = BANew = 256 C =
BENCODER OUTPUT STRING TABLE
string codeword string
B
A 256 BA
BA 257 AB
Example 2: LZW Decompression Step 3
<66><65><256><257><65><260> Old = 257 S = ABNew = 257 C =
AENCODER OUTPUT STRING TABLE
string codeword string
B
A 256 BA
BA 257 AB
AB 258 BAA
Example 2: LZW Decompression Step 4
<66><65><256><257><65><260> Old = 65 S = ANew = 65 C = A
ENCODER OUTPUT STRING TABLE
string codeword string
B
A 256 BA
BA 257 AB
AB 258 BAA
A 259 ABA
Example 2: LZW Decompression Step 5
<66><65><256><257><65><260> Old = 260 S = AANew = 260 C =
AENCODER OUTPUT STRING TABLE
string codeword string
B
A 256 BA
BA 257 AB
AB 258 BAA
A 259 ABA
AA 260 AA