1 / 10

LZW 編碼

姓名:張展翔 學號: 96360201. LZW 編碼. Lossless Compression Algorithms. 壓縮 (Compression): 可以有效減少表示某一特定資訊所需的位元數目的編碼處理。 假使壓縮與解壓縮的處理沒有造成漏失,就稱為無漏失壓縮 (lossless) ,不然就稱為漏失壓縮 (lossy). Lossless Compression Algorithms( 續 ). 而無漏失壓縮的演算法有很多,例如: Variable-Length Coding (VLC) Huffman Coding

afric
Download Presentation

LZW 編碼

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 姓名:張展翔 學號:96360201 LZW編碼

  2. Lossless Compression Algorithms • 壓縮(Compression): 可以有效減少表示某一特定資訊所需的位元數目的編碼處理。 • 假使壓縮與解壓縮的處理沒有造成漏失,就稱為無漏失壓縮(lossless),不然就稱為漏失壓縮(lossy)

  3. Lossless Compression Algorithms(續) • 而無漏失壓縮的演算法有很多,例如: • Variable-Length Coding (VLC) • Huffman Coding • Dictionary-based Coding(LZ77、LZ78、LZW) • 而我們這次要介紹的是LZW

  4. LZW簡介 • 全名Lempel-Ziv-Welch • 是Abraham Lempel、Jacob Ziv 與 Terry Welch創造的。 • 1978 年發表 • LZ78 的改進版本 • 他不需事先知道要編碼之符號發生的機率 • Unix compress壓縮工具,GIF影像標準與數據機的 V.42協定都利用了LZW

  5. LZW解說 • LZW利用固定長度的編碼來代表可變長度的字元或符號字串 • 當接收資料時,LZW編碼與解碼動態建構相同的字典。 • LZW放置較長的與較長重複的單元到一個字典,假如這個單元已經在字典內,這時將為這個單元發出一個編碼,並不是字串本身的編碼 。

  6. LZW壓縮演算法 s = 第一個字元; while (是否還有字元) { c = 下一個字元; if(s+c存在在字典中) s = s+c; else { 輸出s的編碼; 用一個新編碼 把 s+c的字串加到字典中; s = c; } } 輸出s的編碼;

  7. LZW壓縮範例: 要壓所的字串 1000101 s c 輸出 編碼 字串 ----------------------------------------------- 10 21 ------------------------------------------------ 102310 001400 00 00145001 10 10136101 1EOF2 ------------------------------------------------- 輸出的編碼為21432

  8. LZW解壓演算法 s = null; while(是否還有字元) { k = 輸入的字元; entry = 在字典裡有k的字元; if(entry == null) entry = s+s[0]; 輸出entry; if(s!=null) 用一個新編碼加入s + entry[0]到字典裡; s = entry; }

  9. LZW解壓範例: 要解壓的編碼 21432 s k entry/輸出 編碼 字串 ----------------------------------------------- 10 21 ------------------------------------------------ null21 110310 0 4 00 4 00 00 3 10 5 001 10 2 1 6 101 1 EOF ------------------------------------------------- 解壓完的字串1000101

  10. ~謝謝聆聽~

More Related