1. Trang chủ
  2. » Công Nghệ Thông Tin

Mã nén Lecture_4 DictionaryMethods

44 315 2
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Dictionary methods
Tác giả Alexander Kolesnikov
Trường học Not Provided
Chuyên ngành Data Compression
Thể loại bài giảng
Năm xuất bản 2023
Thành phố Not Provided
Định dạng
Số trang 44
Dung lượng 349 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Mã nén

Trang 2

Dictionary based methods

• Statistical compression methods use a statistical model

of the data, and the quality of compression they achieve depends on how good that model is

• Dictionary-based method do not use statistical model

of data Instead they select strings of symbols and

encode each string as a token using a dictionary

• The dictionary holds strings of symbols and it may be static or dynamic (adaptive)

• To encode text one can use a (static) dictionary of the English (Finnish, etc.) language

Trang 3

Dictionary-based methods: Main idea

• Encoder: As the input is processed, develop a dictionary

and transmit the index of strings found in the dictionary

• Decoder: As the code is processed, reconstruct the

dictionary to invert the process of encoding

Trang 4

Dictionary-based methods: History

Trang 5

Sử dụng một con trỏ dịch chuyển trên xâu kí tự

đầu vào Ban đầu con trỏ trỏ vào vị trí 1

Qui ước: từ con trỏ trở về trước được gọi là quá

khứ, còn từ con trỏ trở về sau được gọi là tương lai Tránh trường hợp quá khứ dài vô tận người ta

đặt kích thước của cửa sổ quá khứ là w bằng số kí

tự dài nhất có thể trùng khớp với các kí tự trong tương lai

Trang 6

Output - thể hiện trong dạng (i, j) C:

 (i,j) thể hiện vị trí so khớp và độ dài xâu tương

ứng

 C kí tự rõ trong buffer

Trang 7

sir_sid_eastman_ea ⇒ (0,0,’r’) sir_sid_eastman_eas ⇒ (0,0,’_’) sir_sid_eastman_easi ⇒ (4,2,’d’)

Trang 9

9LZ77: Example 2

Trang 10

LZ77: Example 3

Trang 11

11LZ77: Example 4

Trang 12

 Cặp (i,j) vị trí so khớp và độ dài xâu so khớp

 Kí tự vừa đọc được hoặc xâu so khớp nhưng có độ dài nhỏ hơn MIN_LENGTH

Trang 13

13LZSS: Example 1

Trang 14

• This Dictionary starts (almost) empty

• The encoder add new entries to the Dictionary during

the message encoding

• The decoder decode codes using Dictionary and

add new entries to the Dictionary during decoding

Trang 15

LZ78- Thuật toán nén

Trang 16

LZ78-Thuật toán giải nén

Trang 17

LZ78-Example 1

Trang 18

LZW: Encoding algorithm

Initialize Dictionary with alphabet

STRING = get input character

WHILE there are still input characters DO

CHAR = get input character

IF STRING+CHAR is in the Dictionary THEN

STRING = STRING+CHAR ELSE

output the code for STRING add STRING+CHAR to Dictionary STRING=CHAR

ENDIF END of WHILE

Trang 21

output the code for STRING: 0 add STRING+CHAR=ab to Dictionary STRING=CHAR=b

ENDIF

Trang 22

output the code for STRING: 1 add STRING+CHAR=ba to Dictionary

Trang 23

ELSE output the code for STRING add STRING+CHAR to Dictionary STRING=CHAR

ENDIF

Trang 24

output the code for STRING: 2 add STRING+CHAR=aba to Dictionary

Trang 25

ELSE output the code for STRING add STRING+CHAR to Dictionary STRING=CHAR

ENDIF

Trang 26

ELSE output the code for STRING add STRING+CHAR to Dictionary

Trang 27

output the code for STRING: 4 add STRING+CHAR=abab to Dictionary STRING=CHAR= b

ENDIF

Trang 28

ELSE output the code for STRING add STRING+CHAR to Dictionary

Trang 30

LZW: Decoding

Initialize Dictionary

Input code c

Decode code c (index) to w

Output decoded string w

Put w? in Dictionary

REPEAT

a) Input code c

Decode the 1st symbol s1 of the code c

Complete the previous Dictionary entry with s1

b) Finish decoding the remainder of the code c

Output decoded string w

Trang 32

Decode code c to w=a

Output decoded string w=a

Put w?=a? in Dictionary

Trang 33

Decode the 1st symbol s1=b of the code c=1

Complete the previous Dictionary entry with s1=b

Trang 34

b) Finish decoding the remainder of the code c=1

Output decoded string w=b

Put put w?=b? in Dictionary

Trang 35

Decode the 1st symbol s1=a of the code c=2

Complete the previous Dictionary entry with s1=a

Trang 36

a) Finish decoding the remainder of the code c=2

Output decoded string w=ab

Put put w?=ab? in Dictionary

Trang 37

Decode the 1st symbol s 1 =a of the code c=4

Complete the previous Dictionary entry with s1=a

Trang 38

LZW: Example (4a) step 2

Decode the 1st symbol s1=a of the code c=4

Complete the previous Dictionary entry with s 1 =a

Trang 39

b) Finish decoding the remainder of the code c=4

Output decoded string w=aba

Put put w?=aba? in Dictionary

Trang 40

Decode the 1st symbol s1=b of the code c=3

Complete the previous Dictionary entry with s1=b

Trang 41

b) Finish decoding the remainder of the code c=3

Output decoded string w=ba

Put put w?=ba? in Dictionary

Trang 42

LZW: Example (6a) step 1

Decode the 1st symbol s 1 =b of the code c=6

Complete the previous Dictionary entry with s =b

Trang 43

Decode the 1st symbol s1=b of the code c=6

Complete the previous Dictionary entry with s 1 =b

Trang 44

a) Finish decoding the remainder of the code c=6

Output decoded string w=bab

Ngày đăng: 13/11/2012, 17:09

TỪ KHÓA LIÊN QUAN

w