1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
#+title: LZW and RLE Text Compression
#+subtitle: with Two-Step Pipeline Analysis
* Task[fn:1]
1. Randomly generate a file of 10,000 characters using the specified
alphabet (uppercase and lowercase letters). Encode the text
information using the algorithm specified in the task. Determine
the encoding cost. Decode the information, determine the
compression ratio. Programmatically verify that the decoding was
performed correctly.
2. Encode the information using the RLE algorithm. Decode the
information, determine the compression ratio. Programmatically
verify that the decoding occurred correctly.
3. Similarly to point 2, encode the information using two-step
encoding (RLE + variant algorithm and algorithm option + RLE).
Show which method is more effective.
Alphabet: *{ й, ё, п, в, о, д, space, 0-9, &, . }*
Algorithm: *LZW*
* Documentation
Sadly, there is no report for this lab.
* Showcase
#+begin_src text
Generating data...
Generated: 1480044 bytes
LZW encode/decode...
Coding cost: 3.05
Encoded into: 588393 bytes
Compression coefficent (out/in): 0.39
Files ./out/data.txt and ./out/data-enc-lzw-dec-lzw.txt are identical
RLE encode/decode...
Encoded into: 1087997 bytes
Compression coefficent (out/in): 0.73
Files ./out/data.txt and ./out/data-enc-rle-dec-rle.txt are identical
LZW-RLE encode/decode...
Encoded into: 1001594 bytes
Compression coefficent (out/in): 0.67
Files ./out/data-enc-lzw.bin and ./out/data-enc-lzw-brle-dec-brle.bin are identical
RLE-LZW encode/decode...
Encoded into: 609561 bytes
Compression coefficent (out/in): 0.41
Files ./out/data-enc-rle.txt and ./out/data-enc-rle-lzw-dec-lzw.txt are identical
LZW encoding is the most efficient
#+end_src
* Unlicense
#+include: UNLICENSE verse
* Footnotes
[fn:1] Original text:
#+HTML: <i>
#+begin_quote
1. Случайно сгенерировать файл в 10 тысяч символов, используя
указанный алфавит (заглавные и строчные буквы). Закодировать
текстовую информацию, используя указанный в задании
алгоритм. Определить цену кодирования. Декодировать информацию,
определить коэффициент сжатия. Программно проверить, что
декодирование произошло верно.
2. Закодировать информацию алгоритмом RLE. Декодировать информацию,
определить коэффициент сжатия. Программно проверить, что
декодирование произошло верно.
3. Аналогично пункту 2 закодировать информацию, применив
двухступенчатое кодирование (RLE + алгоритм варианта и алгоритм
варианта + RLE). Показать, какой из способов более эффективный.
Алфавит: *{ й, ё, п, в, о, д, пробел, 0-9, &, . }*
Алгоритм: *LZW*
#+end_quote
#+HTML: </i>
|