#+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: #+begin_quote 1. Случайно сгенерировать файл в 10 тысяч символов, используя указанный алфавит (заглавные и строчные буквы). Закодировать текстовую информацию, используя указанный в задании алгоритм. Определить цену кодирования. Декодировать информацию, определить коэффициент сжатия. Программно проверить, что декодирование произошло верно. 2. Закодировать информацию алгоритмом RLE. Декодировать информацию, определить коэффициент сжатия. Программно проверить, что декодирование произошло верно. 3. Аналогично пункту 2 закодировать информацию, применив двухступенчатое кодирование (RLE + алгоритм варианта и алгоритм варианта + RLE). Показать, какой из способов более эффективный. Алфавит: *{ й, ё, п, в, о, д, пробел, 0-9, &, . }* Алгоритм: *LZW* #+end_quote #+HTML: