Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
Ⱦ. ȼɚɬɨɥɢɧ, Ⱥ. Ɋɚɬɭɲɧɹɤ, Ɇ. ɋɦɢɪɧɨɜ, ȼ. ɘɤɢɧ
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ...
22 downloads
198 Views
1MB Size
Report
This content was uploaded by our users and we assume good faith they have the permission to share this book. If you own the copyright to this book and it is wrongfully on our website, we offer a simple DMCA procedure to remove your content from our site. Start by pressing the button below!
Report copyright / DMCA form
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
Ⱦ. ȼɚɬɨɥɢɧ, Ⱥ. Ɋɚɬɭɲɧɹɤ, Ɇ. ɋɦɢɪɧɨɜ, ȼ. ɘɤɢɧ
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ Ɋɚɡɞɟɥ 1 ɋɨɞɟɪɠɚɧɢɟ ɤɧɢɝɢ: ȼɜɟɞɟɧɢɟ Ɋɚɡɞɟɥ 1. ɍɧɢɜɟɪɫɚɥɶɧɵɟ ɦɟɬɨɞɵ ɫɠɚɬɢɹ Ɋɚɡɞɟɥ 2. Ⱥɥɝɨɪɢɬɦɵ ɫɠɚɬɢɹ ɢɡɨɛɪɚɠɟɧɢɣ Ɋɚɡɞɟɥ 3. Ⱥɥɝɨɪɢɬɦɵ ɫɠɚɬɢɹ ɜɢɞɟɨ ɉɪɢɥɨɠɟɧɢɟ 1 ɉɪɢɥɨɠɟɧɢɟ 2
Ⱦɚɬɚ ɫɨɡɞɚɧɢɹ ɮɚɣɥɚ: 05.01.2003 22
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɊȺɁȾȿɅ 1. ɆȿɌɈȾɕ ɋɀȺɌɂə ȻȿɁ ɉɈɌȿɊɖ....................................................... 25 Ƚɥɚɜɚ 1. Ʉɨɞɢɪɨɜɚɧɢɟ ɢɫɬɨɱɧɢɤɨɜ ɞɚɧɧɵɯ ɛɟɡ ɩɚɦɹɬɢ ............................................. 27 Ƚɥɚɜɚ 2. Ʉɨɞɢɪɨɜɚɧɢɟ ɢɫɬɨɱɧɢɤɨɜ ɞɚɧɧɵɯ ɬɢɩɚ «ɚɧɚɥɨɝɨɜɵɣ ɫɢɝɧɚɥ» ................... 28 Ʌɢɧɟɣɧɨ-ɩɪɟɞɫɤɚɡɵɜɚɸɳɟɟ ɤɨɞɢɪɨɜɚɧɢɟ ............................................................... 28 ɋɭɛɩɨɥɨɫɧɨɟ ɤɨɞɢɪɨɜɚɧɢɟ ........................................................................................ 44 Ƚɥɚɜɚ 3. ɋɥɨɜɚɪɧɵɟ ɦɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ .............................................................. 57 ɂɞɟɹ ɫɥɨɜɚɪɧɵɯ ɦɟɬɨɞɨɜ ......................................................................................... 57 Ʉɥɚɫɫɢɱɟɫɤɢɟ ɚɥɝɨɪɢɬɦɵ Ɂɢɜɚ-Ʌɟɦɩɟɥɚ ................................................................ 60 Ⱦɪɭɝɢɟ ɚɥɝɨɪɢɬɦɵ LZ............................................................................................... 76 Ɏɨɪɦɚɬ Deflate......................................................................................................... 82 ɉɭɬɢ ɭɥɭɱɲɟɧɢɹ ɫɠɚɬɢɹ ɞɥɹ ɦɟɬɨɞɨɜ LZ............................................................. 97 Ⱥɪɯɢɜɚɬɨɪɵ ɢ ɤɨɦɩɪɟɫɫɨɪɵ, ɢɫɩɨɥɶɡɭɸɳɢɟ ɚɥɝɨɪɢɬɦɵ LZ .............................. 110 ȼɨɩɪɨɫɵ ɞɥɹ ɫɚɦɨɤɨɧɬɪɨɥɹ ................................................................................... 111 Ʌɢɬɟɪɚɬɭɪɚ ............................................................................................................ 113 ɋɩɢɫɨɤ ɚɪɯɢɜɚɬɨɪɨɜ ɢ ɤɨɦɩɪɟɫɫɨɪɨɜ ................................................................... 114 Ƚɥɚɜɚ 4. Ɇɟɬɨɞɵ ɤɨɧɬɟɤɫɬɧɨɝɨ ɦɨɞɟɥɢɪɨɜɚɧɢɹ....................................................... 114 Ʉɥɚɫɫɢɮɢɤɚɰɢɹ ɫɬɪɚɬɟɝɢɣ ɦɨɞɟɥɢɪɨɜɚɧɢɹ ......................................................... 118 Ʉɨɧɬɟɤɫɬɧɨɟ ɦɨɞɟɥɢɪɨɜɚɧɢɟ ................................................................................ 120 Ⱥɥɝɨɪɢɬɦɵ PPM ..................................................................................................... 130 Ɉɰɟɧɤɚ ɜɟɪɨɹɬɧɨɫɬɢ ɭɯɨɞɚ ................................................................................... 144 Ɉɛɧɨɜɥɟɧɢɟ ɫɱɟɬɱɢɤɨɜ ɫɢɦɜɨɥɨɜ ........................................................................... 158 ɉɨɜɵɲɟɧɢɟ ɬɨɱɧɨɫɬɢ ɨɰɟɧɨɤ ɜ ɤɨɧɬɟɤɫɬɧɵɯ ɦɨɞɟɥɹɯ ɜɵɫɨɤɢɯ ɩɨɪɹɞɤɨɜ....... 160 Ɋɚɡɥɢɱɧɵɟ ɫɩɨɫɨɛɵ ɩɨɜɵɲɟɧɢɹ ɬɨɱɧɨɫɬɢ ɩɪɟɞɫɤɚɡɚɧɢɹ ................................... 166 PPM ɢ PPM*............................................................................................................ 173 Ⱦɨɫɬɨɢɧɫɬɜɚ ɢ ɧɟɞɨɫɬɚɬɤɢ PPM ........................................................................ 174 Ʉɨɦɩɪɟɫɫɨɪɵ ɢ ɚɪɯɢɜɚɬɨɪɵ, ɢɫɩɨɥɶɡɭɸɳɢɟ ɤɨɧɬɟɤɫɬɧɨɟ ɦɨɞɟɥɢɪɨɜɚɧɢɟ...... 177 Ɉɛɡɨɪ ɤɥɚɫɫɢɱɟɫɤɢɯ ɚɥɝɨɪɢɬɦɨɜ ɤɨɧɬɟɤɫɬɧɨɝɨ ɦɨɞɟɥɢɪɨɜɚɧɢɹ ....................... 186 ɋɪɚɜɧɟɧɢɟ ɚɥɝɨɪɢɬɦɨɜ ɤɨɧɬɟɤɫɬɧɨɝɨ ɦɨɞɟɥɢɪɨɜɚɧɢɹ ....................................... 191 Ⱦɪɭɝɢɟ ɦɟɬɨɞɵ ɤɨɧɬɟɤɫɬɧɨɝɨ ɦɨɞɟɥɢɪɨɜɚɧɢɹ.................................................... 192 ȼɨɩɪɨɫɵ ɞɥɹ ɫɚɦɨɤɨɧɬɪɨɥɹ ................................................................................... 193 Ʌɢɬɟɪɚɬɭɪɚ ............................................................................................................ 194 ɋɩɢɫɨɤ ɚɪɯɢɜɚɬɨɪɨɜ ɢ ɤɨɦɩɪɟɫɫɨɪɨɜ ................................................................... 196 Ƚɥɚɜɚ 5. ɉɪɟɨɛɪɚɡɨɜɚɧɢɟ Ȼɚɪɪɨɭɡɚ-ɍɢɥɟɪɚ.............................................................. 198 ȼɜɟɞɟɧɢɟ................................................................................................................... 198 ɉɪɟɨɛɪɚɡɨɜɚɧɢɟ Ȼɚɪɪɨɭɡɚ-ɍɢɥɟɪɚ ........................................................................ 199 Ɇɟɬɨɞɵ, ɢɫɩɨɥɶɡɭɟɦɵɟ ɫɨɜɦɟɫɬɧɨ ɫ BWT ........................................................... 212 ɋɩɨɫɨɛɵ ɫɠɚɬɢɹ ɩɪɟɨɛɪɚɡɨɜɚɧɧɵɯ ɫ ɩɨɦɨɳɶɸ BWT ɞɚɧɧɵɯ ........................... 230 ɋɨɪɬɢɪɨɜɤɚ, ɢɫɩɨɥɶɡɭɟɦɚɹ ɜ BWT......................................................................... 240 Ⱥɪɯɢɜɚɬɨɪɵ, ɢɫɩɨɥɶɡɭɸɳɢɟ BWT ɢ ST ................................................................. 251 Ɂɚɤɥɸɱɟɧɢɟ .............................................................................................................. 260 Ʌɢɬɟɪɚɬɭɪɚ ............................................................................................................ 260 Ƚɥɚɜɚ 6. Ɉɛɨɛɳɟɧɧɵɟ ɦɟɬɨɞɵ ɫɨɪɬɢɪɭɸɳɢɯ ɩɪɟɨɛɪɚɡɨɜɚɧɢɣ............................... 263
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
23
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɋɨɪɬɢɪɨɜɤɚ ɩɚɪɚɥɥɟɥɶɧɵɯ ɛɥɨɤɨɜ ........................................................................ 263 Ɏɪɚɝɦɟɧɬɢɪɨɜɚɧɢɟ................................................................................................. 276 Ƚɥɚɜɚ 7. ɉɪɟɞɜɚɪɢɬɟɥɶɧɚɹ ɨɛɪɚɛɨɬɤɚ ɞɚɧɧɵɯ .......................................................... 287 ɉɪɟɩɪɨɰɟɫɫɢɧɝ ɬɟɤɫɬɨɜ ......................................................................................... 288 ɉɪɟɩɪɨɰɟɫɫɢɧɝ ɧɟɬɟɤɫɬɨɜɵɯ ɞɚɧɧɵɯ ................................................................... 307 ȼɨɩɪɨɫɵ ɞɥɹ ɫɚɦɨɤɨɧɬɪɨɥɹ ................................................................................... 315 Ʌɢɬɟɪɚɬɭɪɚ ............................................................................................................ 315 ȼɵɛɨɪ ɦɟɬɨɞɚ ɫɠɚɬɢɹ................................................................................................. 316 ɍɄȺɁȺɌȿɅɖ ɌȿɊɆɂɇɈȼ ........................................................................................ 321
24
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɊȺɁȾȿɅ 1. ɆȿɌɈȾɕ ɋɀȺɌɂə ȻȿɁ ɉɈɌȿɊɖ ȼ ɨɫɧɨɜɟ ɜɫɟɯ ɦɟɬɨɞɨɜ ɫɠɚɬɢɹ ɥɟɠɢɬ ɩɪɨɫɬɚɹ ɢɞɟɹ: ɟɫɥɢ ɩɪɟɞɫɬɚɜɥɹɬɶ ɱɚɫɬɨ ɢɫɩɨɥɶɡɭɟɦɵɟ ɷɥɟɦɟɧɬɵ ɤɨɪɨɬɤɢɦɢ ɤɨɞɚɦɢ, ɚ ɪɟɞɤɨ ɢɫɩɨɥɶɡɭɟɦɵɟ — ɞɥɢɧɧɵɦɢ ɤɨɞɚɦɢ, ɬɨ ɞɥɹ ɯɪɚɧɟɧɢɹ ɛɥɨɤɚ ɞɚɧɧɵɯ ɬɪɟɛɭɟɬɫɹ ɦɟɧɶɲɢɣ ɨɛɴɟɦ ɩɚɦɹɬɢ, ɱɟɦ ɟɫɥɢ ɛɵ ɜɫɟ ɷɥɟɦɟɧɬɵ ɩɪɟɞɫɬɚɜɥɹɥɢɫɶ ɤɨɞɚɦɢ ɨɞɢɧɚɤɨɜɨɣ ɞɥɢɧɵ. Ⱦɚɧɧɵɣ ɮɚɤɬ ɢɡɜɟɫɬɟɧ ɞɚɜɧɨ: ɜɫɩɨɦɧɢɦ, ɧɚɩɪɢɦɟɪ, ɚɡɛɭɤɭ Ɇɨɪɡɟ, ɜ ɤɨɬɨɪɨɣ ɱɚɫɬɨ ɢɫɩɨɥɶɡɭɟɦɵɦ ɫɢɦɜɨɥɚɦ ɩɨɫɬɚɜɥɟɧɵ ɜ ɫɨɨɬɜɟɬɫɬɜɢɟ ɤɨɪɨɬɤɢɟ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ ɬɨɱɟɤ ɢ ɬɢɪɟ, ɚ ɪɟɞɤɨ ɜɫɬɪɟɱɚɸɳɢɦɫɹ — ɞɥɢɧɧɵɟ. Ɍɨɱɧɚɹ ɫɜɹɡɶ ɦɟɠɞɭ ɜɟɪɨɹɬɧɨɫɬɹɦɢ ɢ ɤɨɞɚɦɢ ɭɫɬɚɧɨɜɥɟɧɚ ɜ ɬɟɨɪɟɦɟ ɒɟɧɧɨɧɚ ɨ ɤɨɞɢɪɨɜɚɧɢɢ ɢɫɬɨɱɧɢɤɚ, ɤɨɬɨɪɚɹ ɝɥɚɫɢɬ, ɱɬɨ ɷɥɟɦɟɧɬ si, ɜɟɪɨɹɬɧɨɫɬɶ ɩɨɹɜɥɟɧɢɹ ɤɨɬɨɪɨɝɨ ɪɚɜɧɹɟɬɫɹ p(si), ɜɵɝɨɞɧɟɟ ɜɫɟɝɨ ɩɪɟɞɫɬɚɜɥɹɬɶ –log2 p(si) ɛɢɬɚɦɢ. ȿɫɥɢ ɩɪɢ ɤɨɞɢɪɨɜɚɧɢɢ ɪɚɡɦɟɪ ɤɨɞɨɜ ɜɫɟɝɞɚ ɜ ɬɨɱɧɨɫɬɢ ɩɨɥɭɱɚɟɬɫɹ ɪɚɜɧɵɦ –log2 p(si) ɛɢɬɚɦ, ɬɨ ɜ ɷɬɨɦ ɫɥɭɱɚɟ ɞɥɢɧɚ ɡɚɤɨɞɢɪɨɜɚɧɧɨɣ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ ɛɭɞɟɬ ɦɢɧɢɦɚɥɶɧɨɣ ɞɥɹ ɜɫɟɯ ɜɨɡɦɨɠɧɵɯ ɫɩɨɫɨɛɨɜ ɤɨɞɢɪɨɜɚɧɢɹ. ȿɫɥɢ ɪɚɫɩɪɟɞɟɥɟɧɢɟ ɜɟɪɨɹɬɧɨɫɬɟɣ F = {p(si)} ɧɟɢɡɦɟɧɧɨ, ɢ ɜɟɪɨɹɬɧɨɫɬɢ ɩɨɹɜɥɟɧɢɹ ɷɥɟɦɟɧɬɨɜ ɧɟɡɚɜɢɫɢɦɵ, ɬɨ ɦɵ ɦɨɠɟɦ ɧɚɣɬɢ ɫɪɟɞɧɸɸ ɞɥɢɧɭ ɤɨɞɨɜ ɤɚɤ ɫɪɟɞɧɟɟ ɜɡɜɟɲɟɧɧɨɟ H = − p ( si ) ⋅ log 2 p( si ) . (1ɚ) i
ƒ
ɗɬɨ ɡɧɚɱɟɧɢɟ ɬɚɤɠɟ ɧɚɡɵɜɚɟɬɫɹ ɷɧɬɪɨɩɢɟɣ ɪɚɫɩɪɟɞɟɥɟɧɢɹ ɜɟɪɨɹɬɧɨɫɬɟɣ F ɢɥɢ ɷɧɬɪɨɩɢɟɣ ɢɫɬɨɱɧɢɤɚ ɜ ɡɚɞɚɧɧɵɣ ɦɨɦɟɧɬ ɜɪɟɦɟɧɢ. Ɉɛɵɱɧɨ ɜɟɪɨɹɬɧɨɫɬɶ ɩɨɹɜɥɟɧɢɹ ɷɥɟɦɟɧɬɚ ɹɜɥɹɟɬɫɹ ɭɫɥɨɜɧɨɣ, ɬ.ɟ. ɡɚɜɢɫɢɬ ɨɬ ɤɚɤɨɝɨ-ɬɨ ɫɨɛɵɬɢɹ. ȼ ɷɬɨɦ ɫɥɭɱɚɟ ɩɪɢ ɤɨɞɢɪɨɜɚɧɢɢ ɨɱɟɪɟɞɧɨɝɨ ɷɥɟɦɟɧɬɚ si ɪɚɫɩɪɟɞɟɥɟɧɢɟ ɜɟɪɨɹɬɧɨɫɬɟɣ F ɩɪɢɧɢɦɚɟɬ ɨɞɧɨ ɢɡ ɜɨɡɦɨɠɧɵɯ ɡɧɚɱɟɧɢɣ Fk, ɬɨ ɟɫɬɶ F = Fk, ɢ, ɫɨɨɬɜɟɬɫɬɜɟɧɧɨ, H = Hk. Ɇɨɠɧɨ ɫɤɚɡɚɬɶ, ɱɬɨ ɢɫɬɨɱɧɢɤ ɧɚɯɨɞɢɬɫɹ ɜ ɫɨɫɬɨɹɧɢɢ k, ɤɨɬɨɪɨɦɭ ɫɨɨɬɜɟɬɫɬɜɭɟɬ ɧɚɛɨɪ ɜɟɪɨɹɬɧɨɫɬɟɣ pk(si) ɝɟɧɟɪɚɰɢɢ ɜɫɟɯ ɜɨɡɦɨɠɧɵɯ ɷɥɟɦɟɧɬɨɜ si. ɉɨɷɬɨɦɭ ɫɪɟɞɧɸɸ ɞɥɢɧɭ ɤɨɞɨɜ ɦɨɠɧɨ ɜɵɱɢɫɥɢɬɶ ɩɨ ɮɨɪɦɭɥɟ Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
25
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
H = − ƒPk ⋅ H k = − ƒPk ⋅ pk ( si ) log 2 pk ( si ) , k
(1ɛ)
k ,i
ɝɞɟ
Pk — ɜɟɪɨɹɬɧɨɫɬɶ ɬɨɝɨ, ɱɬɨ F ɩɪɢɦɟɬ k-ɨɟ ɡɧɚɱɟɧɢɟ, ɢɥɢ, ɢɧɚɱɟ, ɜɟɪɨɹɬɧɨɫɬɶ ɧɚɯɨɠɞɟɧɢɹ ɢɫɬɨɱɧɢɤɚ ɜ ɫɨɫɬɨɹɧɢɢ k. ɂɬɚɤ, ɟɫɥɢ ɧɚɦ ɢɡɜɟɫɬɧɨ ɪɚɫɩɪɟɞɟɥɟɧɢɟ ɜɟɪɨɹɬɧɨɫɬɟɣ ɷɥɟɦɟɧɬɨɜ, ɝɟɧɟɪɢɪɭɟɦɵɯ ɢɫɬɨɱɧɢɤɨɦ, ɬɨ ɦɵ ɦɨɠɟɦ ɩɪɟɞɫɬɚɜɢɬɶ ɞɚɧɧɵɟ ɧɚɢɛɨɥɟɟ ɤɨɦɩɚɤɬɧɵɦ ɨɛɪɚɡɨɦ, ɩɪɢ ɷɬɨɦ ɫɪɟɞɧɹɹ ɞɥɢɧɚ ɤɨɞɨɜ ɦɨɠɟɬ ɛɵɬɶ ɜɵɱɢɫɥɟɧɚ ɩɨ ɮɨɪɦɭɥɟ (1). ɇɨ ɜ ɩɨɞɚɜɥɹɸɳɟɦ ɛɨɥɶɲɢɧɫɬɜɟ ɫɥɭɱɚɟɜ ɢɫɬɢɧɧɚɹ ɫɬɪɭɤɬɭɪɚ ɢɫɬɨɱɧɢɤɚ ɧɚɦ ɧɟ ɢɡɜɟɫɬɧɚ, ɩɨɷɬɨɦɭ ɧɟɨɛɯɨɞɢɦɨ ɫɬɪɨɢɬɶ ɦɨɞɟɥɶ ɢɫɬɨɱɧɢɤɚ, ɤɨɬɨɪɚɹ ɩɨɡɜɨɥɢɥɚ ɛɵ ɧɚɦ ɜ ɤɚɠɞɨɣ ɩɨɡɢɰɢɢ ɜɯɨɞɧɨɣ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ ɨɰɟɧɢɬɶ ɜɟɪɨɹɬɧɨɫɬɶ p(si) ɩɨɹɜɥɟɧɢɹ ɤɚɠɞɨɝɨ ɷɥɟɦɟɧɬɚ si ɚɥɮɚɜɢɬɚ ɜɯɨɞɧɨɣ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ. ȼ ɷɬɨɦ ɫɥɭɱɚɟ ɦɵ ɨɩɟɪɢɪɭɟɦ ɨɰɟɧɤɨɣ q(si) ɜɟɪɨɹɬɧɨɫɬɢ ɷɥɟɦɟɧɬɚ si. Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɦɨɝɭɬ ɫɬɪɨɢɬɶ ɦɨɞɟɥɶ ɢɫɬɨɱɧɢɤɚ ɚɞɚɩɬɢɜɧɨ ɩɨ ɦɟɪɟ ɨɛɪɚɛɨɬɤɢ ɩɨɬɨɤɚ ɞɚɧɧɵɯ ɢɥɢ ɢɫɩɨɥɶɡɨɜɚɬɶ ɮɢɤɫɢɪɨɜɚɧɧɭɸ ɦɨɞɟɥɶ, ɫɨɡɞɚɧɧɭɸ ɧɚ ɨɫɧɨɜɟ ɚɩɪɢɨɪɧɵɯ ɩɪɟɞɫɬɚɜɥɟɧɢɣ ɨ ɩɪɢɪɨɞɟ ɬɢɩɨɜɵɯ ɞɚɧɧɵɯ, ɬɪɟɛɭɸɳɢɯ ɫɠɚɬɢɹ. ɉɪɨɰɟɫɫ ɦɨɞɟɥɢɪɨɜɚɧɢɹ ɦɨɠɟɬ ɛɵɬɶ ɥɢɛɨ ɹɜɧɵɦ, ɥɢɛɨ ɫɤɪɵɬɵɦ. ȼɟɪɨɹɬɧɨɫɬɢ ɷɥɟɦɟɧɬɨɜ ɦɨɝɭɬ ɢɫɩɨɥɶɡɨɜɚɬɶɫɹ ɜ ɦɟɬɨɞɟ ɤɚɤ ɹɜɧɵɦ, ɬɚɤ ɢ ɧɟɹɜɧɵɦ ɨɛɪɚɡɨɦ. ɇɨ ɜɫɟɝɞɚ ɫɠɚɬɢɟ ɞɨɫɬɢɝɚɟɬɫɹ ɡɚ ɫɱɟɬ ɭɫɬɪɚɧɟɧɢɹ ɫɬɚɬɢɫɬɢɱɟɫɤɨɣ ɢɡɛɵɬɨɱɧɨɫɬɢ ɜ ɩɪɟɞɫɬɚɜɥɟɧɢɢ ɢɧɮɨɪɦɚɰɢɢ. ɇɢ ɨɞɢɧ ɤɨɦɩɪɟɫɫɨɪ ɧɟ ɦɨɠɟɬ ɫɠɚɬɶ ɥɸɛɨɣ ɮɚɣɥ. ɉɨɫɥɟ ɨɛɪɚɛɨɬɤɢ ɥɸɛɵɦ ɤɨɦɩɪɟɫɫɨɪɨɦ ɪɚɡɦɟɪ ɱɚɫɬɢ ɮɚɣɥɨɜ ɭɦɟɧɶɲɢɬɫɹ, ɚ ɨɫɬɚɜɲɟɣɫɹ ɱɚɫɬɢ — ɭɜɟɥɢɱɢɬɫɹ ɢɥɢ ɨɫɬɚɧɟɬɫɹ ɧɟɢɡɦɟɧɧɵɦ. Ⱦɚɧɧɵɣ ɮɚɤɬ ɦɨɠɧɨ ɞɨɤɚɡɚɬɶ ɢɫɯɨɞɹ ɢɡ ɧɟɪɚɜɧɨɦɟɪɧɨɫɬɢ ɤɨɞɢɪɨɜɚɧɢɹ, ɬ.ɟ. ɪɚɡɧɨɣ ɞɥɢɧɵ ɢɫɩɨɥɶɡɭɟɦɵɯ ɤɨɞɨɜ, ɧɨ ɧɚɢɛɨɥɟɟ ɩɪɨɫɬ ɞɥɹ ɩɨɧɢɦɚɧɢɹ ɫɥɟɞɭɸɳɢɣ ɤɨɦɛɢɧɚɬɨɪɧɵɣ ɚɪɝɭɦɟɧɬ. ɋɭɳɟɫɬɜɭɟɬ 2n ɪɚɡɥɢɱɧɵɯ ɮɚɣɥɨɜ ɞɥɢɧɵ n ɛɢɬɨɜ, ɝɞɟ n = 0, 1, 2, … ȿɫɥɢ ɪɚɡɦɟɪ ɤɚɠɞɨɝɨ ɬɚɤɨɝɨ ɮɚɣɥɚ ɜ ɪɟɡɭɥɶɬɚɬɟ ɨɛɪɚɛɨɬɤɢ ɭɦɟɧɶɲɚɟɬɫɹ ɯɨɬɹ ɛɵ ɧɚ 1 ɛɢɬ, ɬɨ 2n ɢɫɯɨɞɧɵɦ ɮɚɣɥɚɦ ɛɭɞɟɬ ɫɨɨɬɜɟɬɫɬɜɨɜɚɬɶ ɫɚɦɨɟ ɛɨɥɶɲɟɟ 2n-1 ɪɚɡɥɢɱɚɸɳɢɯɫɹ ɚɪɯɢɜɧɵɯ ɮɚɣɥɨɜ. Ɍɨɝɞɚ ɩɨ ɤɪɚɣɧɟɣ ɦɟɪɟ ɨɞɧɨɦɭ ɚɪɯɢɜɧɨɦɭ ɮɚɣɥɭ ɛɭɞɟɬ 26
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɫɨɨɬɜɟɬɫɬɜɨɜɚɬɶ ɧɟɫɤɨɥɶɤɨ ɪɚɡɥɢɱɚɸɳɢɯɫɹ ɢɫɯɨɞɧɵɯ, ɢ, ɫɥɟɞɨɜɚɬɟɥɶɧɨ, ɟɝɨ ɞɟɤɨɞɢɪɨɜɚɧɢɟ ɛɟɡ ɩɨɬɟɪɶ ɢɧɮɨɪɦɚɰɢɢ ɧɟɜɨɡɦɨɠɧɨ ɜ ɩɪɢɧɰɢɩɟ. ȼɵɲɟɫɤɚɡɚɧɧɨɟ ɩɪɟɞɩɨɥɚɝɚɟɬ, ɱɬɨ ɮɚɣɥ ɨɬɨɛɪɚɠɚɟɬɫɹ ɜ ɨɞɢɧ ɮɚɣɥ, ɢ ɨɛɴɟɦ ɞɚɧɧɵɯ ɭɤɚɡɵɜɚɟɬɫɹ ɜ ɫɚɦɢɯ ɞɚɧɧɵɯ. ȿɫɥɢ ɷɬɨ ɧɟ ɬɚɤ, ɬɨ ɫɥɟɞɭɟɬ ɭɱɢɬɵɜɚɬɶ ɧɟ ɬɨɥɶɤɨ ɫɭɦɦɚɪɧɵɣ ɪɚɡɦɟɪ ɚɪɯɢɜɧɵɯ ɮɚɣɥɨɜ, ɧɨ ɢ ɨɛɴɟɦ ɢɧɮɨɪɦɚɰɢɢ, ɧɟɨɛɯɨɞɢɦɨɣ ɞɥɹ ɨɩɢɫɚɧɢɹ ɧɟɫɤɨɥɶɤɢɯ ɜɡɚɢɦɨɫɜɹɡɚɧɧɵɯ ɚɪɯɢɜɧɵɯ ɮɚɣɥɨɜ ɢ/ɢɥɢ ɪɚɡɦɟɪɚ ɢɫɯɨɞɧɨɝɨ ɮɚɣɥɚ. Ɉɛɳɧɨɫɬɶ ɞɨɤɚɡɚɬɟɥɶɫɬɜɚ ɩɪɢ ɷɬɨɦ ɫɨɯɪɚɧɹɟɬɫɹ.
ɉɨɷɬɨɦɭ ɧɟɜɨɡɦɨɠɟɧ «ɜɟɱɧɵɣ» ɚɪɯɢɜɚɬɨɪ, ɤɨɬɨɪɵɣ ɫɩɨɫɨɛɟɧ ɛɟɫɤɨɧɟɱɧɨɟ ɱɢɫɥɨ ɪɚɡ ɫɠɢɦɚɬɶ ɫɜɨɢ ɠɟ ɚɪɯɢɜɵ. «ɇɚɢɥɭɱɲɢɦ» ɚɪɯɢɜɚɬɨɪɨɦ ɹɜɥɹɟɬɫɹ ɩɪɨɝɪɚɦɦɚ ɤɨɩɢɪɨɜɚɧɢɹ, ɩɨɫɤɨɥɶɤɭ ɜ ɷɬɨɦ ɫɥɭɱɚɟ ɦɵ ɦɨɠɟɦ ɛɵɬɶ ɜɫɟɝɞɚ ɭɜɟɪɟɧɵ ɜ ɬɨɦ, ɱɬɨ ɨɛɴɟɦ ɞɚɧɧɵɯ ɜ ɪɟɡɭɥɶɬɚɬɟ ɨɛɪɚɛɨɬɤɢ ɧɟ ɭɜɟɥɢɱɢɬɫɹ. Ɋɟɝɭɥɹɪɧɨ ɩɨɹɜɥɹɸɳɢɟɫɹ ɡɚɹɜɥɟɧɢɹ ɨ ɫɨɡɞɚɧɢɢ ɚɥɝɨɪɢɬɦɨɜ ɫɠɚɬɢɹ, «ɨɛɟɫɩɟɱɢɜɚɸɳɢɯ ɫɠɚɬɢɟ ɜ ɞɟɫɹɬɤɢ ɪɚɡ ɥɭɱɲɟɟ, ɱɟɦ ɭ ɨɛɵɱɧɵɯ ɚɪɯɢɜɚɬɨɪɨɜ», ɹɜɥɹɸɬɫɹ ɥɢɛɨ ɥɨɠɧɵɦɢ ɫɥɭɯɚɦɢ, ɩɨɪɨɠɞɟɧɧɵɦɢ ɧɟɜɟɠɟɫɬɜɨɦ ɢ ɩɨɝɨɧɟɣ ɡɚ ɫɟɧɫɚɰɢɹɦɢ, ɥɢɛɨ ɪɟɤɥɚɦɨɣ ɚɮɟɪɢɫɬɨɜ. ȼ ɨɛɥɚɫɬɢ ɫɠɚɬɢɹ ɛɟɡ ɩɨɬɟɪɶ, ɬ.ɟ. ɫɨɛɫɬɜɟɧɧɨ ɫɠɚɬɢɹ, ɬɚɤɢɟ ɪɟɜɨɥɸɰɢɢ ɧɟɜɨɡɦɨɠɧɵ. Ȼɟɡɭɫɥɨɜɧɨ, ɫɬɟɩɟɧɶ ɫɠɚɬɢɹ ɤɨɦɩɪɟɫɫɨɪɚɦɢ ɬɢɩɢɱɧɵɯ ɞɚɧɧɵɯ ɛɭɞɟɬ ɧɟɭɤɥɨɧɧɨ ɪɚɫɬɢ, ɧɨ ɭɥɭɱɲɟɧɢɹ ɫɨɫɬɚɜɹɬ ɜ ɫɪɟɞɧɟɦ ɞɟɫɹɬɤɢ ɢɥɢ ɞɚɠɟ ɟɞɢɧɢɰɵ ɩɪɨɰɟɧɬɨɜ, ɩɪɢ ɷɬɨɦ ɤɚɠɞɵɣ ɩɨɫɥɟɞɭɸɳɢɣ ɷɬɚɩ ɷɜɨɥɸɰɢɢ ɛɭɞɟɬ ɨɛɯɨɞɢɬɶɫɹ ɡɧɚɱɢɬɟɥɶɧɨ ɞɨɪɨɠɟ ɩɪɟɞɵɞɭɳɟɝɨ. ɋ ɞɪɭɝɨɣ ɫɬɨɪɨɧɵ, ɜ ɫɮɟɪɟ ɫɠɚɬɢɹ ɫ ɩɨɬɟɪɹɦɢ, ɜ ɩɟɪɜɭɸ ɨɱɟɪɟɞɶ ɤɨɦɩɪɟɫɫɢɢ ɜɢɞɟɨɞɚɧɧɵɯ, ɜɫɟ ɟɳɟ ɜɨɡɦɨɠɧɨ ɦɧɨɝɨɤɪɚɬɧɨɟ ɭɥɭɱɲɟɧɢɟ ɫɠɚɬɢɹ ɩɪɢ ɫɨɯɪɚɧɟɧɢɢ ɫɭɛɴɟɤɬɢɜɧɨɣ ɩɨɥɧɨɬɵ ɩɨɥɭɱɚɟɦɨɣ ɢɧɮɨɪɦɚɰɢɢ.
Ƚɥɚɜɚ 1. Ʉɨɞɢɪɨɜɚɧɢɟ ɢɫɬɨɱɧɢɤɨɜ ɞɚɧɧɵɯ ɛɟɡ ɩɚɦɹɬɢ
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
27
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
Ƚɥɚɜɚ 2. Ʉɨɞɢɪɨɜɚɧɢɟ ɢɫɬɨɱɧɢɤɨɜ ɞɚɧɧɵɯ ɬɢɩɚ «ɚɧɚɥɨɝɨɜɵɣ ɫɢɝɧɚɥ» Ʌɢɧɟɣɧɨ-ɩɪɟɞɫɤɚɡɵɜɚɸɳɟɟ ɤɨɞɢɪɨɜɚɧɢɟ Ⱥɧɝɥɢɣɫɤɨɟ ɧɚɡɜɚɧɢɟ ɦɟɬɨɞɚ — Linear Prediction Coding (LPC). ɐɟɥɶ — ɫɠɚɬɢɟ ɩɨɬɨɤɚ R-ɛɢɬɧɵɯ ɷɥɟɦɟɧɬɨɜ, ɜ ɩɪɟɞɩɨɥɨɠɟɧɢɢ, ɱɬɨ ɡɧɚɱɟɧɢɟ ɤɚɠɞɨɝɨ ɢɡ ɧɢɯ ɹɜɥɹɟɬɫɹ ɥɢɧɟɣɧɨɣ ɤɨɦɛɢɧɚɰɢɟɣ ɡɧɚɱɟɧɢɣ h ɩɪɟɞɵɞɭɳɢɯ ɷɥɟɦɟɧɬɨɜ:
Si =
j =i −h
ƒK S j
j
,
j = i −1
Si — i-ɵɣ R-ɛɢɬɧɵɣ ɷɥɟɦɟɧɬ; Kj — ɧɟɤɨɬɨɪɵɟ ɤɨɷɮɮɢɰɢɟɧɬɵ, ɜ ɨɛɳɟɦ ɫɥɭɱɚɟ ɧɟɩɨɫɬɨɹɧɧɵɟ. Ɉɫɧɨɜɧɚɹ ɢɞɟɹ ɫɨɫɬɨɢɬ ɜ ɬɨɦ, ɱɬɨɛɵ ɜ ɮɨɪɦɢɪɭɟɦɵɣ ɩɨɬɨɤ ɡɚɩɢɫɵɜɚɬɶ ɨɲɢɛɤɢ ɩɪɟɞɫɤɚɡɚɧɢɣ: ɪɚɡɧɨɫɬɢ ɦɟɠɞɭ ɪɟɚɥɶɧɵɦɢ Si ɢ ɩɪɟɞɫɤɚɡɚɧɧɵɦɢ ɡɧɚɱɟɧɢɹɦɢ:
ɝɞɟ
Di = Si −
j =i − h
ƒK S j
j
.
j = i −1
Ɋɚɡɦɟɪ ɞɚɧɧɵɯ ɜ ɪɟɡɭɥɶɬɚɬɟ ɩɪɢɦɟɧɟɧɢɹ LPC ɧɟ ɢɡɦɟɧɹɟɬɫɹ. Ȼɨɥɟɟ ɬɨɝɨ, ɪɚɡɦɟɪ ɷɥɟɦɟɧɬɨɜ R ɦɨɠɟɬ ɞɚɠɟ ɭɜɟɥɢɱɢɜɚɬɶɫɹ ɧɚ 1: R`=R+1 ɡɚ ɫɱɟɬ ɞɨɛɚɜɥɟɧɢɹ ɛɢɬɚ ɞɥɹ ɫɨɯɪɚɧɟɧɢɹ ɡɧɚɤɚ ɪɚɡɧɨɫɬɢ. ɑɟɦ ɬɨɱɧɟɟ ɩɪɟɞɫɤɚɡɚɧɢɟ, ɬɟɦ ɛɨɥɶɲɟ ɜ ɩɪɟɨɛɪɚɡɨɜɚɧɧɨɣ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ ɷɥɟɦɟɧɬɨɜ ɫ ɛɥɢɡɤɢɦɢ ɤ ɧɭɥɸ ɡɧɚɱɟɧɢɹɦɢ, ɬɟɦ ɥɭɱɲɟ ɦɨɠɧɨ ɫɠɚɬɶ ɬɚɤɭɸ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɶ. Ⱦɥɹ ɫɠɚɬɢɹ ɪɟɡɭɥɶɬɚɬɚ ɪɚɛɨɬɵ ɦɟɬɨɞɚ ɦɨɠɟɬ ɛɵɬɶ ɩɪɢɦɟɧɟɧɚ ɥɸɛɚɹ ɤɨɦɛɢɧɚɰɢɹ ɦɟɬɨɞɨɜ — RLE, MTF, DC, PBS, HUFF, ARIC, ENUC, SEM... Ɇɟɬɨɞɵ ɷɬɨɣ ɝɪɭɩɩɵ ɹɜɥɹɸɬɫɹ ɬɪɚɧɫɮɨɪɦɢɪɭɸɳɢɦɢ ɢ ɩɨɬɨɱɧɵɦɢ (ɬ.ɟ. ɦɨɝɭɬ ɩɪɢɦɟɧɹɬɶɫɹ ɞɚɠɟ ɜ ɬɨɦ ɫɥɭɱɚɟ, ɤɨɝɞɚ ɞɥɢɧɚ ɛɥɨɤɚ ɫ ɞɚɧɧɵɦɢ ɧɟ ɡɚɞɚɧɚ). ɋɤɨɪɨɫɬɶ ɜɵɩɨɥɧɟɧɢɹ ɩɪɹɦɨɝɨ ɩɪɟɨɛɪɚɡɨɜɚɧɢɹ ɪɚɜɧɚ ɫɤɨɪɨɫɬɢ ɨɛɪɚɬɧɨɝɨ ɩɪɟɨɛɪɚɡɨɜɚɧɢɹ ɢ 28
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɡɚɜɢɫɢɬ ɬɨɥɶɤɨ ɨɬ ɪɚɡɦɟɪɚ ɞɚɧɧɵɯ, ɧɨ ɧɟ ɨɬ ɢɯ ɫɨɞɟɪɠɚɧɢɹ, ɬ.ɟ. ɋɤɨɪɨɫɬɶ=O(Ɋɚɡɦɟɪ). ɉɚɦɹɬɢ ɬɪɟɛɭɟɬɫɹ ɩɨɪɹɞɤɚ h ɛɚɣɬɨɜ. ɂɡ ɤɪɚɬɤɨɝɨ ɨɩɢɫɚɧɢɹ ɨɛɳɟɣ ɢɞɟɢ ɜɢɞɧɨ, ɱɬɨ 1) ɦɨɠɧɨ ɨɞɢɧ ɪɚɡ, ɩɪɢ ɢɧɢɰɢɚɥɢɡɚɰɢɢ, ɡɚɞɚɬɶ ɤɚɤ h, ɬɚɤ ɢ Kj, 2) ɧɨ ɫ ɬɨɱɤɢ ɡɪɟɧɢɹ ɫɥɨɠɧɨɫɬɢ ɜɵɱɢɫɥɟɧɢɣ ɢ ɤɚɱɟɫɬɜɚ ɫɠɚɬɢɹ, ɩɨɥɟɡɧɨ ɨɝɪɚɧɢɱɢɬɶ h, ɧɨ ɩɟɪɢɨɞɢɱɟɫɤɢ ɨɩɪɟɞɟɥɹɬɶ ɨɩɬɢɦɚɥɶɧɵɟ Kj; 3) ɬɟɨɪɟɬɢɱɟɫɤɢ, ɨɞɧɚ ɢ ɬɚ ɠɟ ɡɚɜɢɫɢɦɨɫɬɶ ɦɨɠɟɬ ɛɵɬɶ ɡɚɞɚɧɚ ɧɟɫɤɨɥɶɤɢɦɢ ɮɨɪɦɭɥɚɦɢ, ɧɚɩɪɢɦɟɪ Si=(Si–1+Si–2)/2 ɢ S`i= Si–1/2 + Si–2/2, ɧɨ ɪɟɚɥɶɧɨ, ɢɡ-ɡɚ ɢɫɩɨɥɶɡɨɜɚɧɢɹ ɰɟɥɨɱɢɫɥɟɧɧɨɣ ɚɪɢɮɦɟɬɢɤɢ, ɨɧɢ ɧɟ ɷɤɜɢɜɚɥɟɧɬɵ; ɜ ɞɚɧɧɨɦ ɫɥɭɱɚɟ ɩɪɢ ɜɵɱɢɫɥɟɧɢɢ S`i ɢɫɩɨɥɶɡɭɟɬɫɹ ɞɜɚ ɨɤɪɭɝɥɟɧɢɹ ɜɦɟɫɬɨ ɨɞɧɨɝɨ, ɩɨɷɬɨɦɭ ɦɵ ɩɨɥɭɱɢɦ ɪɚɡɥɢɱɢɟ. ɉɊəɆɈȿ ɉɊȿɈȻɊȺɁɈȼȺɇɂȿ
ȼ ɛɚɡɨɜɨɦ ɩɪɨɫɬɟɣɲɟɦ ɫɥɭɱɚɟ ɢɥɥɸɫɬɪɢɪɭɟɬɫɹ ɨɞɧɨɣ ɫɬɪɨɤɨɣ: /* ɩɪɟɞɩɨɥɚɝɚɟɦ, ɱɬɨ S[i]≈S[i–1], ɢ, ɫɥɟɞɨɜɚɬɟɥɶɧɨ, D[i]≈0 */ D[i]=S[i]–S[i–1];
S[N] — ɢɫɯɨɞɧɵɣ ɦɚɫɫɢɜ (Source, ɢɫɬɨɱɧɢɤ) D[N] — ɜɵɯɨɞɧɨɣ ɦɚɫɫɢɜ ɩɪɟɨɛɪɚɡɨɜɚɧɧɵɯ ɞɚɧɧɵɯ (Destination, ɩɪɢɟɦɧɢɤ, ɫ ɨɬɤɥɨɧɟɧɢɹɦɢ, ɬ.ɟ. ɪɚɡɧɨɫɬɹɦɢ, ɞɟɥɶɬɚɦɢ). Ɍɚɤɨɣ ɜɚɪɢɚɧɬ ɨɛɵɱɧɨ ɧɚɡɵɜɚɟɬɫɹ ɞɟɥɶɬɚ-ɤɨɞɢɪɨɜɚɧɢɟ (Delta ɋoding), ɩɨɫɤɨɥɶɤɭ ɡɚɩɢɫɵɜɚɟɦ ɩɪɢɪɚɳɟɧɢɹ ɷɥɟɦɟɧɬɨɜ ɨɬɧɨɫɢɬɟɥɶɧɨ ɡɧɚɱɟɧɢɣ ɩɪɟɞɵɞɭɳɢɯ ɷɥɟɦɟɧɬɨɜ. ȿɫɥɢ ɜ ɡɧɚɱɟɧɢɹɯ ɷɥɟɦɟɧɬɨɜ ɢɦɟɟɬɫɹ ɹɪɤɨ ɜɵɪɚɠɟɧɧɚɹ ɥɢɧɟɣɧɚɹ ɬɟɧɞɟɧɰɢɹ, ɬɨ ɜ ɪɟɡɭɥɶɬɚɬɟ ɩɨɥɭɱɚɟɦ ɪɹɞ ɱɢɫɟɥ ɫ ɛɥɢɡɤɢɦɢ ɡɧɚɱɟɧɢɹɦɢ. Ɍɪɢ ɫɬɪɨɤɢ, ɟɫɥɢ ɬɪɟɛɭɟɬɫɹ ɩɢɫɚɬɶ ɜ ɬɨɬ ɠɟ ɦɚɫɫɢɜ: current=S[i];
//ɜɨɡɶɦɟɦ ɨɱɟɪɟɞɧɨɣ ɷɥɟɦɟɧɬ
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
29
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
S[i]=current-last; //ɜɵɱɢɫɥɢɦ ɟɝɨ ɪɚɡɧɨɫɬɶ ɫ ɩɪɨɲɥɵɦ last=current; //ɬɟɩɟɪɶ ɨɱɟɪɟɞɧɨɣ ɫɬɚɥ ɩɪɨɲɥɵɦ
ɇɚɩɪɢɦɟɪ, ɢɡ ɛɥɨɤɚ (12, 14, 15, 17, 16, 15, 13, 11, 9), ɩɪɢɦɟɧɢɜ ɷɬɨɬ ɩɪɨɫɬɟɣɲɢɣ ɜɚɪɢɚɧɬ ɩɪɟɨɛɪɚɡɨɜɚɧɢɹ, ɩɨɥɭɱɢɦ: (2, 1, 2, –1, –1, –2, –2, –2). Ȼɨɥɟɟ ɫɥɨɠɧɵɣ ɜɚɪɢɚɧɬ: h=4, ɩɪɟɞɩɨɥɚɝɚɟɦ, ɱɬɨ Ki=1/4: S[i]≈( S[i–1] + S[i–2] + S[i–3] + S[i–4] )/4. Ɍɨɝɞɚ ɜ ɚɥɝɨɪɢɬɦɟ: D[i]=S[i] – (S[i–1]+S[i–2]+S[i–3]+S[i–4])/4;
Ɂɞɟɫɶ ɦɵ ɩɪɟɞɩɨɥɚɝɚɟɦ, ɱɬɨ ɹɜɧɨ ɜɵɪɚɠɟɧɧɚɹ ɥɢɧɟɣɧɚɹ ɬɟɧɞɟɧɰɢɹ ɨɬɫɭɬɫɬɜɭɟɬ, ɢ ɡɧɚɱɟɧɢɟ ɨɱɟɪɟɞɧɨɝɨ ɷɥɟɦɟɧɬɚ ɩɪɢɦɟɪɧɨ ɪɚɜɧɨ ɡɧɚɱɟɧɢɸ ɩɪɟɞɵɞɭɳɟɝɨ, ɩɪɢɱɟɦ D[i] ɩɪɢɨɛɪɟɬɚɟɬ ɨɬɪɢɰɚɬɟɥɶɧɵɟ ɢ ɩɨɥɨɠɢɬɟɥɶɧɵɟ ɡɧɚɱɟɧɢɹ ɫ ɪɚɜɧɨɣ ɜɟɪɨɹɬɧɨɫɬɶɸ. ɑɬɨɛɵ ɤɨɦɩɟɧɫɢɪɨɜɚɬɶ ɜɥɢɹɧɢɟ ɫɥɭɱɚɣɧɵɯ ɜɨɡɦɭɳɟɧɢɣ, ɡɧɚɱɟɧɢɟ ɫɥɟɞɭɸɳɟɝɨ ɷɥɟɦɟɧɬɚ ɩɪɢɧɢɦɚɟɦ ɪɚɜɧɵɦ ɫɪɟɞɧɟɦɭ ɚɪɢɮɦɟɬɢɱɟɫɤɨɦɭ ɧɟɫɤɨɥɶɤɢɯ ɩɨɫɥɟɞɧɢɯ ɷɥɟɦɟɧɬɨɜ. ɋ ɞɪɭɝɨɣ ɫɬɨɪɨɧɵ, ɱɟɦ ɛɨɥɶɲɟ ɷɥɟɦɟɧɬɨɜ ɭɫɪɟɞɧɹɟɦ, ɬɟɦ ɤɨɧɫɟɪɜɚɬɢɜɧɟɟ ɧɚɲɚ ɦɨɞɟɥɶ, ɬɟɦ ɫ ɛɨɥɶɲɢɦ ɡɚɩɚɡɞɵɜɚɧɢɟɦ ɨɧɚ ɛɭɞɟɬ ɚɞɚɩɬɢɪɨɜɚɬɶɫɹ ɤ ɫɭɳɟɫɬɜɟɧɧɵɦ ɢɡɦɟɧɟɧɢɹɦ (ɧɟɨɛɹɡɚɬɟɥɶɧɨ ɥɢɧɟɣɧɨɝɨ ɯɚɪɚɤɬɟɪɚ) ɜɨ ɜɯɨɞɧɵɯ ɞɚɧɧɵɯ. ȿɫɥɢ ɪɟɡɭɥɶɬɚɬ ɩɪɟɨɛɪɚɡɨɜɚɧɢɹ ɬɪɟɛɭɟɬɫɹ ɡɚɩɢɫɵɜɚɬɶ ɜ ɬɨɬ ɠɟ ɜɯɨɞɧɨɣ ɦɚɫɫɢɜ S, ɬɨ ɷɬɨ ɦɨɠɧɨ ɪɟɚɥɢɡɨɜɚɬɶ ɫɥɟɞɭɸɳɢɦ ɨɛɪɚɡɨɦ. ȼɜɟɞɟɦ ɜɫɩɨɦɨɝɚɬɟɥɶɧɵɣ ɦɚɫɫɢɜ Last, ɜ ɤɨɬɨɪɨɦ ɛɭɞɟɦ ɯɪɚɧɢɬɶ ɢɫ-ɯɨɞɧɵɟ ɡɧɚɱɟɧɢɹ ɩɨɫɥɟɞɧɢɯ ɱɟɬɵɪɟɯ ɩɪɟɨɛɪɚɡɨɜɚɧɧɵɯ ɷɥɟɦɟɧɬɨɜ ɦɚɫɫɢɜɚ S. int Last[4]={ 0,0,0,0 }; int last_pos=0;
ɂ ɞɚɥɟɟ ɜ ɰɢɤɥɟ ɩɪɟɨɛɪɚɡɨɜɚɧɢɹ ɞɥɹ ɤɚɠɞɨɝɨ ɷɥɟɦɟɧɬɚ S[i] ɜɵɩɨɥɧɹɟɦ: current=S[i]; // ɜɨɡɶɦɟɦ ɨɱɟɪɟɞɧɨɣ ɷɥɟɦɟɧɬ ɢ ɜɵɱɢɫɥɢɦ // ɟɝɨ ɪɚɡɧɨɫɬɶ ɫ ɩɪɟɞɫɤɚɡɵɜɚɟɦɵɦ ɡɧɚɱɟɧɢɟɦ:
30
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
S[i]=current-(Last[0]+Last[1]+Last[2]+Last[3])/4; Last[last_pos]=current; // ɜɧɟɫɟɦ current ɜ ɦɚɫɫɢɜ Last last_pos=(last_pos+1)&3; // ɧɨɜɨɟ ɡɧɚɱɟɧɢɟ ɩɨɡɢɰɢɢ ɜ Last
ɍɩɪɚɠɧɟɧɢɟ: Ʉɚɤ ɛɭɞɟɬ ɜɵɝɥɹɞɟɬɶ ɚɥɝɨɪɢɬɦ ɞɥɹ ɦɨɞɟɥɢ S[i]=( S[i–1] + S[i–2] + S[i–3] )/3 ? Ȼɭɞɟɬ ɥɢ ɨɧ ɜɵɩɨɥɧɹɬɶɫɹ ɛɵɫɬɪɟɟ ɢɥɢ ɦɟɞɥɟɧɧɟɟ ɪɚɫɫɦɨɬɪɟɧɧɨɝɨ ɜɚɪɢɚɧɬɚ ɫ h=4 ɢ Kj=1/4 ? ɈȻɊȺɌɇɈȿ ɉɊȿɈȻɊȺɁɈȼȺɇɂȿ
Ⱥɥɝɨɪɢɬɦ ɨɱɟɧɶ ɩɨɯɨɠ ɧɚ ɚɥɝɨɪɢɬɦ ɩɪɹɦɨɝɨ ɩɪɟɨɛɪɚɡɨɜɚɧɢɹ. ȿɞɢɧɫɬɜɟɧɧɨɟ ɨɬɥɢɱɢɟ — ɬɟɩɟɪɶ ɜɵɱɢɫɥɹɟɦ ɧɟ ɪɚɡɧɨɫɬɶ, ɚ ɫɭɦɦɭ ɩɪɟɞɫɤɚɡɵɜɚɟɦɨɝɨ ɡɧɚɱɟɧɢɹ ɢ ɨɬɤɥɨɧɟɧɢɹ: S[i]=D[i]+S[i-1]; // ɩɨ ɩɪɟɞɩɨɥɨɠɟɧɧɨɦɭ, S[i]=S[i-1]
ȿɫɥɢ ɞɥɹ D ɢ S ɢɫɩɨɥɶɡɭɟɦ ɨɞɢɧ ɢ ɬɨɬ ɠɟ ɦɚɫɫɢɜ (S): S[i]=S[i]+S[i-1]; // ɫɭɦɦɚ ɞɟɥɶɬɵ ɫ ɩɪɟɞɵɞɭɳɢɦ ɷɥɟɦɟɧɬɨɦ
ȼ ɫɥɭɱɚɟ h=4 , Kj=1/4 : S[i]=D[i] + (S[i-1]+S[i-2]+S[i-3]+S[i-4])/4;
ȿɫɥɢ ɩɢɲɟɦ ɜ ɬɨɬ ɠɟ ɦɚɫɫɢɜ, ɬɨ ɢ ɜ ɷɬɨɦ ɫɥɭɱɚɟ, ɜ ɨɬɥɢɱɢɟ ɨɬ ɩɪɹɦɨɝɨ ɩɪɟɨɛɪɚɡɨɜɚɧɢɹ, ɧɟ ɬɪɟɛɭɟɬɫɹ ɤɚɤɢɯ-ɬɨ ɭɯɢɳɪɟɧɢɣ: S[i]=S[i] + (S[i-1]+S[i-2]+S[i-3]+S[i-4])/4;
Ⱦɟɣɫɬɜɢɬɟɥɶɧɨ, ɤ ɦɨɦɟɧɬɭ ɨɛɪɚɬɧɨɝɨ ɩɪɟɨɛɪɚɡɨɜɚɧɢɹ ɨɱɟɪɟɞɧɨɝɨ ɷɥɟɦɟɧɬɚ S[i] ɜ ɹɱɟɣɤɚɯ S[i–1], ..., S[i–4] ɭɠɟ ɧɚɯɨɞɹɬɫɹ ɜɨɫɫɬɚɧɨɜɥɟɧɧɵɟ ɡɧɚɱɟɧɢɹ, ɚ ɧɟ ɨɬɤɥɨɧɟɧɢɹ, ɱɬɨ ɧɚɦ ɤɚɤ ɪɚɡ ɢ ɧɭɠɧɨ. Ɍɚɤɢɦ ɨɛɪɚɡɨɦ, ɢɫɩɨɥɶɡɨɜɚɬɶ ɩɪɢ ɪɚɡɠɚɬɢɢ ɞɜɚ ɦɚɫɫɢɜɚ ɫɨɜɟɪɲɟɧɧɨ ɧɟɨɛɹɡɚɬɟɥɶɧɨ.
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
31
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɉɍɌɂ ɍȼȿɅɂɑȿɇɂə ɋɄɈɊɈɋɌɂ ɋɀȺɌɂə
ȿɫɥɢ ɦɨɠɧɨ ɡɚɩɢɫɵɜɚɬɶ ɜ ɬɨɬ ɠɟ ɦɚɫɫɢɜ, ɬɨ ɦɨɠɧɨ ɨɛɨɣɬɢɫɶ ɛɟɡ ɢɡɥɢɲɧɟɝɨ ɦɚɫɫɢɜɚ Last[h] ɢ ɫɜɹɡɚɧɧɵɯ ɫ ɧɢɦ ɨɩɟɪɚɰɢɣ, ɜɵɩɨɥɧɹɟɦɵɯ ɧɚ ɤɚɠɞɨɦ ɲɚɝɟ ɰɢɤɥɚ ɩɪɟɨɛɪɚɡɨɜɚɧɢɹ. Ɋɚɫɫɦɨɬɪɢɦ ɜɫɟ ɬɨɬ ɠɟ ɩɪɢɦɟɪ ɫ h=4 , Kj=1/4. ɋɞɟɥɚɟɦ ɬɚɤ, ɱɬɨɛɵ ɜɧɭɬɪɢ ɰɢɤɥɚ ɛɵɥɨ ɩɪɢɫɜɚɢɜɚɧɢɟ: S[i-4]=S[i] - (S[i-1]+S[i-2]+S[i-3]+S[i-4])/4;
Ɍɨɝɞɚ ɩɟɪɜɵɟ ɱɟɬɵɪɟ ɷɥɟɦɟɧɬɚ ɧɚɦ ɩɪɢɞɟɬɫɹ ɡɚɩɢɫɵɜɚɬɶ ɨɬɞɟɥɶɧɨ: First[0]=S[0]; First[1]=S[1] - S[0]; First[2]=S[2] - (S[1]+S[0])/2; First[3]=S[3] - (S[2]+S[1]+S[0])/3;
Ⱦɚɥɟɟ ɫ ɩɨɦɨɳɶɸ ɰɢɤɥɚ ɩɪɟɨɛɪɚɡɭɟɦ ɰɟɩɨɱɤɭ ɢɡ ɩɨɫɥɟɞɧɢɯ (N–4) ɷɥɟɦɟɧɬɨɜ ɢ ɡɚɩɢɲɟɦ ɪɟɡɭɥɶɬɚɬɵ ɜ ɩɟɪɜɵɟ (N–4) ɹɱɟɣɤɢ ɦɚɫɫɢɜɚ S: for (i=4; i
ɂɥɢ ɞɚɠɟ ɬɚɤ: sum=S[3]+S[2]+S[1]+S[0]; for (i=4; i
Ɍɟɩɟɪɶ ɦɵ ɦɨɠɟɦ ɩɟɪɟɩɢɫɚɬɶ ɩɟɪɜɵɟ ɱɟɬɵɪɟ ɩɪɟɨɛɪɚɡɨɜɚɧɧɵɯ ɷɥɟɦɟɧɬɚ ɢɡ ɜɫɩɨɦɨɝɚɬɟɥɶɧɨɝɨ ɦɚɫɫɢɜɚ First ɜ S: for (i=0; i<4; i++)
S[N-4+i]=First[i];
Ɍɚɤɢɦ ɨɛɪɚɡɨɦ, ɞɨɩɨɥɧɢɬɟɥɶɧɨɣ ɩɚɦɹɬɢ ɜɧɟ ɮɭɧɤɰɢɢ ɩɪɟɨɛɪɚɡɨɜɚɧɢɹ ɧɟ ɬɪɟɛɭɟɬɫɹ, ɜɧɭɬɪɢ — ɬɨɥɶɤɨ h ɷɥɟɦɟɧɬɨɜ, ɫɤɨɪɨɫɬɶ ɩɪɟɨɛɪɚɡɨɜɚɧɢɹ ɜ ɨɛɳɟɦ ɫɥɭɱɚɟ ɬɚ ɠɟ, ɤɚɤɚɹ ɛɵɥɚ ɛɵ ɩɪɢ ɡɚɩɢɫɢ ɜɨ ɜɬɨɪɨɣ ɦɚɫɫɢɜ. 32
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ȿɞɢɧɫɬɜɟɧɧɨɟ ɨɫɥɨɠɧɟɧɢɟ — ɦɟɬɨɞ, ɫɠɢɦɚɸɳɢɣ ɞɚɧɧɵɟ, ɩɨɥɭɱɟɧɧɵɟ ɜ ɪɟɡɭɥɶɬɚɬɟ ɩɪɟɨɛɪɚɡɨɜɚɧɢɹ LPC, ɞɨɥɠɟɧ ɫɧɚɱɚɥɚ ɨɛɪɚɛɨɬɚɬɶ h ɷɥɟɦɟɧɬɨɜ ɢɡ ɤɨɧɰɚ ɦɚɫɫɢɜɚ S, ɚ ɥɢɲɶ ɡɚɬɟɦ (N–h) ɢɡ ɧɚɱɚɥɚ. ȿɫɥɢ ɪɚɛɨɬɚɟɦ ɧɟ ɫ ɩɨɬɨɤɨɦ, ɚ ɫ ɛɥɨɤɨɦ, ɢ ɞɥɢɧɚ ɦɚɫɫɢɜɚ S ɢɡɜɟɫɬɧɚ ɡɚɪɚɧɟɟ, ɦɨɠɧɨ ɨɛɪɚɛɚɬɵɜɚɬɶ ɢɡ ɤɨɧɰɚ ɜ ɧɚɱɚɥɨ: ɜ ɰɢɤɥɟ ɩɨ i ɨɬ N–1 ɞɨ 0 ɞɟɥɚɟɦ: S[i+1] – =S[i]. ɍȼȿɅɂɑȿɇɂȿ ɋɄɈɊɈɋɌɂ ɊȺɁɀȺɌɂə
ȿɫɥɢ ɩɚɦɹɬɢ ɞɨɫɬɚɬɨɱɧɨ ɢ ɜɯɨɞɧɵɯ ɞɚɧɧɵɯ ɦɧɨɝɨ, ɦɨɠɟɬ ɨɤɚɡɚɬɶɫɹ ɜɵɝɨɞɧɵɦ ɫɞɟɥɚɬɶ ɬɚɛɥɢɱɧɭɸ ɪɟɚɥɢɡɚɰɢɸ ɤɚɤɢɯ-ɬɨ ɚɪɢɮɦɟɬɢɱɟɫɤɢɯ ɨɩɟɪɚɰɢɣ (ɮɭɧɤɰɢɣ). ɋ ɰɟɥɶɸ ɭɫɤɨɪɟɧɢɹ ɪɚɛɨɬɵ ɨɫɧɨɜɧɨɝɨ ɰɢɤɥɚ ɦɨɠɧɨ, ɧɚɩɪɢɦɟɪ, ɡɚ ɫɱɟɬ ɷɬɨɝɨ ɢɡɛɟɠɚɬɶ ɨɩɟɪɚɰɢɢ ɞɟɥɟɧɢɹ, ɜɵɩɨɥɧɹɟɦɨɣ ɨɛɵɱɧɨ ɝɨɪɚɡɞɨ ɞɨɥɶɲɟ, ɱɟɦ ɨɩɟɪɚɰɢɢ ɫɥɨɠɟɧɢɹ/ɜɵɱɢɬɚɧɢɹ ɢ ɡɚɩɢɫɢ/ɱɬɟɧɢɹ ɜ/ɢɡ ɩɚɦɹɬɢ. ɇɚɩɪɢɦɟɪ, ɜɦɟɫɬɨ S[i-3]=S[i] - (S[i-1]+S[i-2]+S[i-3])/3;
ɧɚɦɧɨɝɨ ɛɵɫɬɪɟɟ ɧɚ ɛɨɥɶɲɢɧɫɬɜɟ ɩɪɨɰɟɫɫɨɪɨɜ ɢ ɞɥɹ ɛɨɥɶɲɢɧɫɬɜɚ ɤɨɦɩɢɥɹɬɨɪɨɜ ɛɭɞɟɬ S[i-3]=S[i]– Value[ S[i-1]+S[i-2]+S[i-3] ];
ɢɥɢ ɞɚɠɟ
// R – ɪɚɡɦɟɪ ɷɥɟɦɟɧɬɨɜ ɦɚɫɫɢɜɚ S ɜ ɛɢɬɚɯ S[i-3]=Value2[ (S[i-1]+S[i-2]+S[i-3])<
ɍɩɪɚɠɧɟɧɢɟ: ɇɚɩɢɲɢɬɟ ɰɢɤɥɵ, ɡɚɩɨɥɧɹɸɳɢɟ ɜɫɩɨɦɨɝɚɬɟɥɶɧɵɟ ɦɚɫɫɢɜɵ Value[] ɢ Value2[].
ȿɫɬɟɫɬɜɟɧɧɨ, ɬɚɤɨɣ ɩɨɞɯɨɞ ɩɪɢɦɟɧɢɦ ɢ ɞɥɹ ɭɜɟɥɢɱɟɧɢɹ ɫɤɨɪɨɫɬɢ ɫɠɚɬɢɹ.
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
33
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɉɍɌɂ ɍɅɍɑɒȿɇɂə ɋɌȿɉȿɇɂ ɋɀȺɌɂə
Ʉɚɤ ɦɵ ɭɠɟ ɨɬɦɟɱɚɥɢ, ɰɟɥɟɫɨɨɛɪɚɡɧɨ ɩɨɜɬɨɪɧɨ ɜɵɱɢɫɥɹɬɶ ɤɨɷɮɮɢɰɢɟɧɬɵ Kj ɱɟɪɟɡ ɤɚɠɞɵɟ P ɲɚɝɨɜ. ɇɚ ɨɫɧɨɜɚɧɢɢ ɩɨɫɥɟɞɧɢɯ ɨɛɪɚɛɨɬɚɧɧɵɯ ɞɚɧɧɵɯ ɧɚɯɨɞɢɦ ɡɧɚɱɟɧɢɹ ɤɨɷɮɮɢɰɢɟɧɬɨɜ, ɨɩɬɢɦɚɥɶɧɵɟ ɫ ɬɨɱɤɢ ɡɪɟɧɢɹ ɬɨɱɧɨɫɬɢ ɩɪɟɞɫɤɚɡɚɧɢɹ ɡɧɚɱɟɧɢɣ ɷɥɟɦɟɧɬɨɜ, ɜɫɬɪɟɱɟɧɧɵɯ ɜ ɛɥɨɤɟ ɩɨɫɥɟɞɧɢɯ ɨɛɪɚɛɨɬɚɧɧɵɯ ɞɚɧɧɵɯ. ȿɫɥɢ P=1, ɬɚɤɨɣ ɜɚɪɢɚɧɬ ɨɛɵɱɧɨ ɧɚɡɵɜɚɟɬɫɹ ɚɞɚɩɬɢɜɧɵɦ. ɉɪɢ ɛɨɥɶɲɨɦ ɡɧɚɱɟɧɢɢ P ɜɚɪɢɚɧɬ ɧɚɡɵɜɚɟɬɫɹ ɫɬɚɬɢɱɟɫɤɢɦ, ɟɫɥɢ ɡɧɚɱɟɧɢɹ Kj ɡɚɩɢɫɵɜɚɸɬɫɹ ɜ ɫɠɚɬɵɣ ɩɨɬɨɤ, ɢ "ɩɨɥɭɚɞɚɩɬɢɜɧɵɦ", "ɛɥɨɱɧɨ-ɚɞɚɩɬɢɜɧɵɦ" ɢɥɢ "ɤɜɚɡɢɫɬɚɬɢɱɟɫɤɢɦ", ɟɫɥɢ ɜ ɹɜɧɨɦ ɜɢɞɟ ɡɧɚɱɟɧɢɹ Kj ɧɟ ɡɚɩɢɫɵɜɚɸɬɫɹ. ɉɪɢ ɫɠɚɬɢɢ ɫ ɩɨɬɟɪɹɦɢ ɦɨɠɟɦ ɫɨɯɪɚɧɹɬɶ ɧɟ ɬɨɱɧɵɟ ɡɧɚɱɟɧɢɹ ɤɚɠɞɨɣ ɪɚɡɧɨɫɬɢ Di = Si – Ȉ(Kj·Sj), ɚ ɬɨɥɶɤɨ ɩɟɪɜɵɟ B ɛɢɬɨɜ ɢɥɢ, ɧɚɩɪɢɦɟɪ, ɧɨɦɟɪ ɩɟɪɜɨɝɨ ɧɟɧɭɥɟɜɨɝɨ ɛɢɬɚ. ɇɨ ɬɨɝɞɚ ɩɪɢ ɫɠɚɬɢɢ ɧɭɠɧɨ ɢɫɩɨɥɶɡɨɜɚɬɶ ɧɚ ɫɥɟɞɭɸɳɢɯ ɲɚɝɚɯ ɬɨ ɠɟ ɡɧɚɱɟɧɢɟ Si, ɤɨɬɨɪɨɟ ɩɨɥɭɱɢɬɫɹ ɩɪɢ ɪɚɡɠɚɬɢɢ, ɚ ɢɦɟɧɧɨ Si`= Ȉ(Kj·Sj)+Di`, ɬɨ ɟɫɬɶ ɪɟɡɭɥɶɬɚɬ ɩɪɟɞɫɤɚɡɚɧɢɹ ɩɥɸɫ ɫɨɯɪɚɧɟɧɧɚɹ ɱɚɫɬɶ ɪɚɡɧɨɫɬɢɞɟɥɶɬɵ. Ɇɟɬɨɞ LPC ɩɪɢɦɟɧɹɟɬɫɹ ɨɛɵɱɧɨ ɞɥɹ ɫɠɚɬɢɹ ɚɧɚɥɨɝɨɜɵɯ ɫɢɝɧɚɥɨɜ. ɂ ɤɚɤ ɩɪɚɜɢɥɨ, ɤɚɠɞɵɣ ɷɥɟɦɟɧɬ ɫɢɝɧɚɥɚ ɨɬɤɥɨɧɹɟɬɫɹ ɨɬ ɫɜɨɟɝɨ ɩɪɟɞɫɤɚɡɵɜɚɟɦɨɝɨ ɡɧɚɱɟɧɢɹ ɧɟ ɬɨɥɶɤɨ ɢɡ-ɡɚ «ɫɢɥɶɧɵɯ» ɨɛɭɫɥɨɜɥɟɧɧɵɯ ɢɡɦɟɧɟɧɢɣ — ɷɜɨɥɸɰɢɢ, ɧɨ ɢ ɢɡ-ɡɚ «ɫɥɚɛɵɯ» ɮɨɧɨɜɵɯ ɤɨɥɟɛɚɧɢɣ, ɬɨ ɟɫɬɶ ɲɭɦɚ. ɉɨɷɬɨɦɭ ɜɨɡɦɨɠɧɨ ɞɜɚ ɩɪɨɬɢɜɨɩɨɥɨɠɧɵɯ ɬɢɩɚ ɦɨɞɟɥɟɣ: • ɜɤɥɚɞ ɲɭɦɚ ɧɟɜɟɥɢɤ ɩɨ ɫɪɚɜɧɟɧɢɸ ɫ ɜɤɥɚɞɨɦ ɷɜɨɥɸɰɢɢ; • ɜɤɥɚɞ ɷɜɨɥɸɰɢɢ ɧɟɜɟɥɢɤ ɩɨ ɫɪɚɜɧɟɧɢɸ ɫ ɜɤɥɚɞɨɦ ɲɭɦɚ. ȼ ɩɟɪɜɨɦ ɫɥɭɱɚɟ ɦɵ ɛɭɞɟɦ ɩɪɟɞɫɤɚɡɵɜɚɬɶ ɡɧɚɱɟɧɢɟ S[i] ɧɚ ɨɫɧɨɜɚɧɢɢ ɫɥɨɠɢɜɲɟɣɫɹ ɥɢɧɟɣɧɨɣ ɬɟɧɞɟɧɰɢɢ, ɜɨ ɜɬɨɪɨɦ — ɤɚɤ ɪɚɜɧɨɟ ɫɪɟɞɧɟɦɭ ɚɪɢɮɦɟɬɢɱɟɫɤɨɦɭ h ɩɪɟɞɵɞɭɳɢɯ ɷɥɟɦɟɧɬɨɜ. Ɍɟɧɞɟɧɰɢɹ ɦɨɠɟɬ ɛɵɬɶ ɢ ɧɟɥɢɧɟɣɧɨɣ, ɧɚɩɪɢɦɟɪ S[i]=S[i–1]+2*(S[i–1]–S[i– 2]), ɧɨ ɬɚɤɢɟ ɦɨɞɟɥɢ ɧɚ ɩɪɚɤɬɢɤɟ ɜ ɛɨɥɶɲɢɧɫɬɜɟ ɫɥɭɱɚɟɜ ɦɟɧɟɟ ɜɵɝɨɞɧɵ, ɢ ɦɵ ɢɯ ɪɚɫɫɦɚɬɪɢɜɚɬɶ ɧɟ ɛɭɞɟɦ.
34
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ȿɫɥɢ ɪɟɫɭɪɫɨɜ ɞɨɫɬɚɬɨɱɧɨ, ɦɨɠɧɨ ɜɵɱɢɫɥɹɬɶ ɩɪɟɞɫɤɚɡɵɜɚɟɦɵɟ ɡɧɚɱɟɧɢɹ, ɞɚɜɚɟɦɵɟ ɧɟɫɤɨɥɶɤɢɦɢ ɦɨɞɟɥɹɦɢ, ɢ ɡɚɬɟɦ ɥɢɛɨ ɫɢɧɬɟɡɢɪɨɜɚɬɶ ɷɬɢ ɧɟɫɤɨɥɶɤɨ ɩɪɟɞɫɤɚɡɚɧɢɣ, ɥɢɛɨ ɜɵɛɢɪɚɬɶ (ɱɟɪɟɡ ɤɚɠɞɵɟ P ɲɚɝɨɜ) ɬɭ ɦɨɞɟɥɶ, ɤɨɬɨɪɚɹ ɨɩɬɢɦɚɥɶɧɚ ɧɚ ɡɚɞɚɧɧɨɦ ɱɢɫɥɟ ɩɪɟɞɵɞɭɳɢɯ ɷɥɟɦɟɧɬɨɜ. Ɍɪɟɛɭɟɬɫɹ ɦɢɧɢɦɢɡɢɪɨɜɚɬɶ ɨɲɢɛɤɢ ɩɪɟɞɫɤɚɡɚɧɢɣ, ɩɨɷɬɨɦɭ ɪɚɰɢɨɧɚɥɶɧɟɟ (ɜɵɝɨɞɧɟɟ) ɬɚ ɦɨɞɟɥɶ, ɤɨɬɨɪɚɹ ɞɚɟɬ ɧɚɢɦɟɧɶɲɭɸ ɫɭɦɦɭ ɚɛɫɨɥɸɬɧɵɯ ɡɧɚɱɟɧɢɣ ɷɬɢɯ ɨɲɢɛɨɤ:
min(
ƒ| D
i
i
|)
ɗɬɚ ɡɚɞɚɱɚ ɢɦɟɟɬ ɷɥɟɦɟɧɬɚɪɧɨɟ ɚɧɚɥɢɬɢɱɟɫɤɨɟ ɪɟɲɟɧɢɟ: min|D| = min (|YK*X|) Æ K = Y*X-1, ɝɞɟ Y – ɜɟɤɬɨɪ ɢɡ S[i] (ɪɟɚɥɶɧɨ ɧɚɛɥɸɞɚɟɦɵɯ), K – ɦɚɬɪɢɰɚ ɤɨɷɮɮɢɰɢɟɧɬɨɜ ɢ X – ɦɚɬɪɢɰɚ S[i-x] (x = 1,...,h). ɇɨ (1) ɫɥɨɠɧɨɫɬɶ ɜɵɱɢɫɥɟɧɢɹ ɨɛɪɚɬɧɨɣ ɦɚɬɪɢɰɵ ɧɟ ɦɟɧɟɟ O(h2) ɢ ɩɟɪɟɜɵɱɢɫɥɹɬɶ ɟɟ ɧɟɜɵɝɨɞɧɨ; (2) ɜɵɫɨɤɚɹ ɬɨɱɧɨɫɬɶ ɩɪɨɝɧɨɡɚ ɨɛɵɱɧɨ ɧɟ ɧɭɠɧɚ, ɬ.ɤ. ɧɚ ɩɪɚɤɬɢɤɟ ɫɬɚɰɢɨɧɚɪɧɵɟ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ ɜɫɬɪɟɱɚɸɬɫɹ ɪɟɞɤɨ.
Ɋɚɫɫɦɨɬɪɢɦ ɩɨɞɪɨɛɧɟɟ ɧɚ ɩɪɢɦɟɪɚɯ. Ɉɛɳɢɣ ɫɥɭɱɚɣ ȿɫɥɢ h=1, ɬɨ ɭɱɢɬɵɜɚɟɬɫɹ ɬɨɥɶɤɨ ɨɞɢɧ ɩɨɫɥɟɞɧɢɣ ɷɥɟɦɟɧɬ: S[i]=K·S[i–1]. Ɉɛ ɷɜɨɥɸɰɢɢ ɧɟ ɢɡɜɟɫɬɧɨ ɧɢɱɟɝɨ, ɧɨ ɦɨɠɧɨ ɩɪɟɞɩɨɥɚɝɚɬɶ, ɱɬɨ K=1.
ɍɩɪɚɠɧɟɧɢɟ: ɂɡɨɛɪɚɡɢɬɟ ɫɢɝɧɚɥ, ɨɩɬɢɦɚɥɶɧɨ ɫɠɢɦɚɟɦɵɣ ɫ ɩɨɦɨɳɶɸ ɦɨɞɟɥɢ ɫ h=1 ɢ K= –1.
ȼɫɟ ɷɬɨ, ɨɞɧɚɤɨ, ɧɟ ɩɨɦɟɲɚɟɬ ɧɚɦ ɞɟɣɫɬɜɨɜɚɬɶ ɫɥɟɞɭɸɳɢɦ ɨɛɪɚɡɨɦ: ɜɵɛɟɪɟɦ ɧɚɱɚɥɶɧɨɟ ɡɧɚɱɟɧɢɟ K0, ɲɚɝ StepK ɢɡɦɟɧɟɧɢɹ K, ɪɚɡɦɟɪ ɨɤɧɚ F, ɚ ɬɚɤɠɟ P. Ȼɭɞɟɦ ɫɥɟɞɢɬɶ, ɫ ɤɚɤɨɣ ɢɡ ɬɪɟɯ ɦɨɞɟɥɟɣ — K=K0 , Kp=K0+StepK ɢ Km=K0–StepK, ɫɠɚɬɢɟ ɩɨɫɥɟɞɧɢɯ F ɷɥɟɦɟɧɬɨɜ ɥɭɱɲɟ (ɦɟɧɶɲɟ ɫɭɦɦɚɪɧɚɹ ɨɲɢɛɤɚ ɩɪɟɞɫɤɚɡɚɧɢɹ), ɢ ɱɟɪɟɡ ɤɚɠɞɵɟ P ɷɥɟɦɟɧɬɨɜ ɜɵɛɢɪɚɬɶ ɥɭɱɲɭɸ (ɜ ɞɚɧɧɵɣ ɦɨɦɟɧɬ) ɢɡ ɬɪɟɯ ɦɨɞɟɥɟɣ, ɫ ɩɨɦɨɳɶɸ ɤɨɬɨɪɨɣ ɢ ɛɭɞɭɬ ɫɠɢɦɚɬɶɫɹ ɫɥɟɞɭɸɳɢɟ P ɷɥɟɦɟɧɬɨɜ. Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
35
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ȿɫɥɢ ɷɬɨ ɧɟ ɬɟɤɭɳɚɹ, ɚ ɨɞɧɚ ɢɡ ɞɜɭɯ ɫ ±StepK, ɬɨ ɢɡɦɟɧɹɸɬɫɹ ɢ Kp ɫ Km, ɟɫɥɢ, ɤɨɧɟɱɧɨ, ɢɯ ɡɧɚɱɟɧɢɹ ɧɟ ɫɨɜɩɚɞɚɸɬ ɫ ɝɪɚɧɢɰɚɦɢ: –1 ɢɥɢ 1. ɇɚɩɪɢɦɟɪ, ɦɨɠɧɨ ɢɫɩɨɥɶɡɨɜɚɬɶ K0=0, StepK=1/4, F=10 ɢ P=2. ɂɦɟɟɬ ɫɦɵɫɥ ɡɚɞɚɬɶ ɟɳɟ ɨɞɢɧ ɩɚɪɚɦɟɬɪ M — ɦɢɧɢɦɚɥɶɧɵɣ ɪɚɡɦɟɪ ɜɵɢɝɪɵɲɚ ɨɩɬɢɦɚɥɶɧɨɣ ɦɨɞɟɥɢ ɭ ɬɟɤɭɳɟɣ. ȿɫɥɢ ɜɵɢɝɪɵɲ ɦɟɧɶɲɟ Ɇ, ɬɨ ɨɬɤɚɡɵɜɚɟɦɫɹ ɨɬ ɫɦɟɧɵ ɦɨɞɟɥɢ. ɋɥɟɞɭɸɳɢɣ ɩɨ ɫɥɨɠɧɨɫɬɢ ɜɚɪɢɚɧɬ ɢɫɩɨɥɶɡɭɟɬ ɩɟɪɟɦɟɧɧɵɣ ɲɚɝ ɞɥɹ K. Ɍɚɤɠɟ ɦɵ ɦɨɠɟɦ ɩɨɯɨɠɢɦ ɨɛɪɚɡɨɦ ɤɨɪɪɟɤɬɢɪɨɜɚɬɶ F (ɧɚɩɪɢɦɟɪ, ɢɡɦɟɧɹɬɶ ɫ ɲɚɝɨɦ StepF, ɱɟɪɟɡ ɤɚɠɞɵɟ Q ɨɛɪɚɛɨɬɚɧɧɵɯ ɷɥɟɦɟɧɬɨɜ). ȿɫɥɢ h=2. ȼɵɪɚɠɟɧɢɟ Si =
j =i −h
ƒK S j
j
ɦɨɠɧɨ ɜɫɟɝɞɚ ɩɟɪɟɩɢɫɚɬɶ ɜ ɬɚɤɨɦ
j = i −1
ɜɢɞɟ:
S i = K `1 S i −1 +
j = h −1
ƒK `
j =1
j +1
( S i − j − S i − j −1 )
ɉɨɷɬɨɦɭ ɦɨɞɟɥɶ ɩɪɢ h=2 ɦɨɠɧɨ ɩɪɟɞɫɬɚɜɢɬɶ ɤɚɤ S[i]=K1·S[i–1] + K2·( S[i–1] – S[i–2] ). ɇɚɣɞɟɦ ɡɧɚɱɟɧɢɹ ɤɨɷɮɮɢɰɢɟɧɬɨɜ «ɷɜɨɥɸɰɢɨɧɧɨɣ» ɦɨɞɟɥɢ. ȿɫɥɢ ɲɭɦ ɫɬɪɟɦɢɬɫɹ ɤ ɧɭɥɸ, ɬɨ ɢɡɦɟɧɟɧɢɹ ɷɥɟɦɟɧɬɨɜ ɨɛɴɹɫɧɹɸɬɫɹ ɬɨɥɶɤɨ ɥɢɧɟɣɧɨɣ ɬɟɧɞɟɧɰɢɟɣ (ɷɜɨɥɸɰɢɟɣ). ɂɧɚɱɟ ɝɨɜɨɪɹ: S[i]–S[i–1]=S[i–1]–S[i–2]. Ɉɬɫɸɞɚ ɩɨɥɭɱɚɟɦ: K1=1, K2=1. Ⱦɥɹ «ɲɭɦɨɜɨɣ» ɦɨɞɟɥɢ S[i]=(S[i–1]+S[i–2])/2, ɢ ɤɨɷɮɮɢɰɢɟɧɬɵ Kj ɩɨɥɭɱɢɦ ɢɡ ɫɢɫɬɟɦɵ: K1+K2=1/2 (ɤɨɷɮɮɢɰɢɟɧɬ ɩɪɢ S[i-1]) –K2=1/2 (ɤɨɷɮɮɢɰɢɟɧɬ ɩɪɢ S[i-2]) ɇɚɯɨɞɢɦ: K1=1, K2= –1/2. Ɍɚɤɢɦ ɨɛɪɚɡɨɦ, ɢɦɟɟɬ ɫɦɵɫɥ ɤɨɪɪɟɤɬɢɪɨɜɚɬɶ K2 ɜ ɞɢɚɩɚɡɨɧɟ ɧɟ ɨɬ 0 ɞɨ 1, ɤɚɤ ɦɨɠɟɬ ɩɨɤɚɡɚɬɶɫɹ ɧɚ ɩɟɪɜɵɣ ɜɡɝɥɹɞ, ɚ ɨɬ –1/2 ɞɨ 1. 36
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ȿɫɥɢ h=3: S[i]=K1·S[i–1] + K2·( S[i–1]–S[i–2] ) + K3·( S[i–2]–S[i–3] ) (6.1) ɍ ɷɜɨɥɸɰɢɨɧɧɵɯ ɦɨɞɟɥɟɣ ɭɠɟ ɧɟɬ ɨɞɧɨɡɧɚɱɧɨɝɨ ɨɬɜɟɬɚ ɨ K1, K2 ɢ K3: K1=1, K2+K3=1 (ɬ.ɤ. ɜ ɨɛɳɟɦ ɫɥɭɱɚɟ ɱɟɪɟɡ ɬɪɢ ɬɨɱɤɢ ɧɟɥɶɡɹ ɩɪɨɜɟɫɬɢ ɩɪɹɦɭɸ). ɇɚɩɪɢɦɟɪ, ɦɨɠɧɨ ɜɡɹɬɶ K2=3/4 ɢ K3=1/4, ɬ.ɟ. ɩɨɫɥɟɞɧɟɟ ɩɪɢɪɚɳɟɧɢɟ ɢɦɟɟɬ ɜɬɪɨɟ ɛɨɥɶɲɢɣ ɜɟɫ, ɱɟɦ ɩɪɟɞɩɨɫɥɟɞɧɟɟ. ɂɥɢ ɠɟ K2=2, K3= –1 (ɜɬɨɪɚɹ ɩɪɨɢɡɜɨɞɧɚɹ ɩɨɫɬɨɹɧɧɚ). ɒɭɦɨɜɚɹ ɦɨɞɟɥɶ ɜ ɨɞɧɨɦɟɪɧɨɦ ɫɥɭɱɚɟ ɨɞɧɚ ɩɪɢ ɥɸɛɵɯ h, ɢ ɩɪɢ h=3: S[i]=(S[i–1] + S[i–2] + S[i–3])/3 (6.2) ɉɨɩɪɨɛɭɟɦ ɫɨɜɦɟɫɬɢɬɶ ɨɛɟ ɦɨɞɟɥɢ — ɲɭɦɨɜɭɸ ɢ ɷɜɨɥɸɰɢɨɧɧɭɸ. ɉɪɢ ɤɚɤɢɯ K1, K2 ɢ K3 ɷɜɨɥɸɰɢɨɧɧɚɹ (6.1) ɫɬɚɧɨɜɢɬɫɹ ɲɭɦɨɜɨɣ (6.2)? ɂɡ ɫɢɫɬɟɦɵ K1+K2=1/3 (ɤɨɷɮɮɢɰɢɟɧɬ ɩɪɢ S[i-1]) –K2+K3=1/3 (ɤɨɷɮɮɢɰɢɟɧɬ ɩɪɢ S[i-2]) –K3=1/3 (ɤɨɷɮɮɢɰɢɟɧɬ ɩɪɢ S[i-3]) ɧɚɯɨɞɢɦ: K1=1, K2= –2/3, K3= –1/3. ɂɦɟɟɬ ɫɦɵɫɥ ɩɵɬɚɬɶɫɹ ɤɨɪɪɟɤɬɢɪɨɜɚɬɶ K3 ɨɬ –1 ɞɨ 1, ɩɪɢ ɷɬɨɦ: (K2+K3) ɨɬ –1 (ɲɭɦɨɜɚɹ ɦɨɞɟɥɶ) ɞɨ 1 (ɷɜɨɥɸɰɢɨɧɧɚɹ), ɬɨ ɟɫɬɶ K2 ɨɬ (–1–K3) ɞɨ (1–K3): K2 \ K3 –1 … … 1 –1–K3 ɒ … 1–K3 ɗ ɗ ɗ ɗ ɒ — ɬɚɤɚɹ ɩɚɪɚ ɡɧɚɱɟɧɢɣ (K2= –2/3, K3= –1/3) ɫɨɨɬɜɟɬɫɬɜɭɟɬ ɲɭɦɨɜɨɣ ɦɨɞɟɥɢ, ɗ — ɬɚɤɢɟ ɩɚɪɵ K2+K3=1 ɫɨɨɬɜɟɬɫɬɜɭɸɬ ɷɜɨɥɸɰɢɨɧɧɨɣ (ɚ ɨɫɬɚɥɶɧɵɟ — «ɫɪɟɞɧɟɣ»). Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
37
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
S S ( 2 ) [i ]
S1( 3) [i ] S2( 3) [i ]
i-3
i-2
i-1
i
ɇɨɦɟɪ
Ɋɢɫ. 6.1. ɗɜɨɥɸɰɢɨɧɧɚɹ ɦɨɞɟɥɶ ɩɪɢ h=2 ɢ h=3 ɉɪɢ h = 2 ɫɭɳɟɫɬɜɭɟɬ ɬɨɥɶɤɨ ɨɞɧɚ ɷɜɨɥɸɰɢɨɧɧɚɹ ɦɨɞɟɥɶ (ɱɟɪɟɡ ɞɜɟ ɬɨɱɤɢ ɜɫɟɝɞɚ ɦɨɠɧɨ ɩɪɨɜɟɫɬɢ ɬɨɥɶɤɨ ɨɞɧɭ ɩɪɹɦɭɸ), ɩɨ ɤɨɬɨɪɨɣ ɩɪɟɞɫɤɚɡɵɜɚɟɦɨɟ ɡɧɚɱɟɧɢɟ S[i] = S ( 2 ) [i ] ; ɉɪɢ h = 3 ɜɨɡɦɨɠɧɨ ɢɫɩɨɥɶɡɨɜɚɧɢɟ ɦɧɨɠɟɫɬɜɚ ɦɨɞɟɥɟɣ: ɧɚɩɪɢɦɟɪ, ɟɫɥɢ ɫɱɢɬɚɬɶ ɢɡɦɟɧɟɧɢɟ S[i]-S[i-1] ɛɨɥɟɟ ɜɚɠɧɵɦ, ɱɟɦ S[i-2]-S[i-3], ɬɨ ɬɚɤɚɹ ɦɨɞɟɥɶ ɦɨɠɟɬ ɞɚɬɶ, ɧɚɩɪɢɦɟɪ, ɩɪɟɞɫɤɚɡɚɧɢɟ S1( 3) [i ] , ɢɥɢ, ɟɫɥɢ ɫɱɢɬɚɬɶ S[i-2]-S[i-3] ɢ S[i]-S[i-1] ɪɚɜɧɨɩɪɚɜɧɵɦɢ, ɬɨ ɬɚɤɚɹ ɦɨɞɟɥɶ ɞɚɟɬ ɩɪɨɝɧɨɡɧɨɟ ɡɧɚɱɟɧɢɟ S 2( 3) [i ] . Ʉɪɨɦɟ ɬɨɝɨ, ɩɪɢ h=3 ɜɨɡɧɢɤɚɟɬ ɜɨɡɦɨɠɧɨɫɬɶ ɭɦɟɧɶɲɚɬɶ ɲɭɦ. Ɇɟɬɨɞ ɡɚɤɥɸɱɚɟɬɫɹ ɜ ɫɥɟɞɭɸɳɟɦ. ɉɨɫɥɟ ɬɨɝɨ ɤɚɤ ɧɚɣɞɟɧɨ ɫɪɟɞɧɟɟ ɡɧɚɱɟɧɢɟ (S[i–1]+S[i–2]+S[i–3])/3 , ɨɩɪɟɞɟɥɢɦ, ɤɚɤɨɣ ɢɡ ɬɪɟɯ ɷɥɟɦɟɧɬɨɜ ɛɨɥɶɲɟ ɨɬɤɥɨɧɹɟɬɫɹ ɨɬ ɧɟɝɨ. Ȼɭɞɟɦ ɫɱɢɬɚɬɶ, ɱɬɨ ɢɦɟɧɧɨ ɷɬɨɬ ɷɥɟɦɟɧɬ ɫɨɞɟɪɠɢɬ ɛɨɥɶɲɟ ɲɭɦɚ, ɱɟɦ ɨɫɬɚɥɶɧɵɟ ɞɜɚ, ɩɨɷɬɨɦɭ ɢɦɟɧɧɨ ɟɝɨ ɭɱɢɬɵɜɚɬɶ ɧɟ ɛɭɞɟɦ (ɢɥɢ, ɱɬɨ ɬɨ ɠɟ ɫɚɦɨɟ, ɩɨɥɨɠɢɦ ɟɝɨ ɪɚɜɧɵɦ ɩɨɥɭɫɭɦɦɟ ɞɜɭɯ ɨɫɬɚɥɶɧɵɯ). ȼ ɤɚɱɟɫɬɜɟ ɩɪɟɞɫɤɚɡɚɧɢɹ, ɞɚɜɚɟɦɨɝɨ ɲɭɦɨɜɨɣ ɦɨɞɟɥɶɸ, ɜɨɡɶɦɟɦ ɩɨɥɭɫɭɦɦɭ ɞɜɭɯ ɨɫɬɚɥɶɧɵɯ ɷɥɟɦɟɧɬɨɜ. 38
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
Ⱥɧɚɥɨɝɢɱɧɨ ɩɪɢ h=4 ɟɫɬɶ ɜɨɡɦɨɠɧɨɫɬɶ ɜɡɹɬɶ ɬɪɢ ɩɪɢɪɚɳɟɧɢɹ («ɞɟɥɶɬɵ») ɢ ɨɫɬɚɜɢɬɶ ɬɟ ɞɜɚ, ɤɨɬɨɪɵɟ ɛɥɢɠɟ ɤ ɫɪɟɞɧɟɦɭ ɜɫɟɯ ɬɪɟɯ. Ɉɫɬɚɟɬɫɹ ɞɨɛɚɜɢɬɶ, ɱɬɨ ɪɹɞ ɦɟɬɨɞɨɜ ɞɥɹ ɫɠɚɬɢɹ ɪɟɱɢ ɫ ɩɨɬɟɪɹɦɢ (CELP, CS-ACELP, MELP) ɢɫɩɨɥɶɡɭɟɬ LPC ɞɥɹ ɜɵɱɢɫɥɟɧɢɹ ɧɟɫɤɨɥɶɤɢɯ ɯɚɪɚɤɬɟɪɢɫɬɢɤ ɮɪɚɝɦɟɧɬɨɜ ɫɢɝɧɚɥɚ (ɩɪɨɰɟɫɫ ɧɚɡɵɜɚɟɬɫɹ LPC analysis). ɉɨɫɥɟ ɨɛɪɚɬɧɨɝɨ ɩɪɨɰɟɫɫɚ (LPC synthesis) ɩɨɥɭɱɚɟɬɫɹ ɫɢɝɧɚɥ ɫ ɬɟɦɢ ɠɟ ɯɚɪɚɤɬɟɪɢɫɬɢɤɚɦɢ, ɧɨ ɫɨɜɟɪɲɟɧɧɨ ɞɪɭɝɢɦɢ ɞɚɧɧɵɦɢ, ɬɨ ɟɫɬɶ ɡɧɚɱɟɧɢɹɦɢ ɷɥɟɦɟɧɬɨɜ. Ⱦɜɭɦɟɪɧɵɣ ɫɥɭɱɚɣ Ɋɚɫɫɦɨɬɪɢɦ ɬɨɥɶɤɨ ɫɚɦɵɣ ɩɪɨɫɬɨɣ ɨɛɯɨɞ ɩɥɨɫɤɨɫɬɢ1 — ɫɬɪɨɤɚɦɢ. ȼ ɤɚɠɞɨɣ ɬɨɱɤɟ ɩɥɨɫɤɨɫɬɢ ɭɠɟ ɨɛɪɚɛɨɬɚɧɧɵɟ, ɢɡɜɟɫɬɧɵɟ ɷɥɟɦɟɧɬɵ — ɜɵɲɟ ɞɚɧɧɨɣ ɬɨɱɤɢ, ɚ ɬɚɤɠɟ ɧɚ ɬɨɦ ɠɟ ɭɪɨɜɧɟ, ɧɨ ɥɟɜɟɟ ɟɟ. S[i-L-1] S[i-1]
S[i-L] S[i]
S[i-L+1] …
Ɂɞɟɫɶ L — ɱɢɫɥɨ ɷɥɟɦɟɧɬɨɜ ɜ ɫɬɪɨɤɟ. Ȼɥɢɠɚɣɲɢɯ ɤ S[i] ɷɥɟɦɟɧɬɨɜ — ɱɟɬɵɪɟ. Ɉɛɨɡɧɚɱɢɦ ɞɥɹ ɤɪɚɬɤɨɫɬɢ ɬɚɤ: A D
B E
C …
ɍ «ɲɭɦɨɜɨɣ» ɦɨɞɟɥɢ ɟɫɬɶ 4 ɜɚɪɢɚɧɬɚ ɫ h=1, 6 ɜɚɪɢɚɧɬɨɜ ɫ h=2, ɱɟɬɵɪɟ ɫ h=3 ɢ ɨɞɢɧ ɫ h=4: E=K1·D + K2·C + K3·B + K4·A (6.3)
1 Ɂɚɞɚɱɚ ɨɛɯɨɞɚ ɩɥɨɫɤɨɫɬɢ ɜɨɡɧɢɤɚɟɬ ɩɪɢ ɨɛɪɚɛɨɬɤɟ ɞɜɭɦɟɪɧɵɯ ɞɚɧɧɵɯ. ɐɟɥɶ ɨɛɯɨɞɚ — ɫɨɡɞɚɧɢɟ ɨɞɧɨɦɟɪɧɨɝɨ ɦɚɫɫɢɜɚ D ɢɡ ɞɜɭɦɟɪɧɨɝɨ S. ɉɨɞɪɨɛɧɟɟ ɫɦɨɬɪɢ ɜ ɪɚɡɞɟɥɟ «Ⱥɥɝɨɪɢɬɦɵ ɫɠɚɬɢɹ ɢɡɨɛɪɚɠɟɧɢɣ».
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
39
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
Ɇɨɠɧɨ ɢɡɧɚɱɚɥɶɧɨ ɡɚɞɚɬɶ K1=K2=K3=K4=1/4 ɢ ɤɨɪɪɟɤɬɢɪɨɜɚɬɶ Ki ɜɵɲɟɢɡɥɨɠɟɧɧɵɦ ɦɟɬɨɞɨɦ. Ƚɪɚɧɢɰɵ ɛɭɞɭɬ ɡɚɞɚɧɵ ɭɫɥɨɜɢɹɦɢ: Ki>0, K1+K2+K3+K4=1, ɢ, ɧɚɩɪɢɦɟɪ, K1=K3, K2=K4 (ɢ ɬɚɤɢɦ ɨɛɪɚɡɨɦ K1+K2=1/2, ɞɨɫɬɚɬɨɱɧɨ ɤɨɪɪɟɤɬɢɪɨɜɚɬɶ K1). ɍ ɜɚɪɢɚɧɬɨɜ ɫ h>2 ɟɫɬɶ ɜɨɡɦɨɠɧɨɫɬɶ ɭɦɟɧɶɲɚɬɶ ɲɭɦ, ɬɟɦ ɠɟ ɦɟɬɨɞɨɦ, ɱɬɨ ɢ ɜ ɨɞɧɨɦɟɪɧɨɦ ɫɥɭɱɚɟ. Ɍɚɤɢɦ ɨɛɪɚɡɨɦ, ɟɫɥɢ ɢɫɩɨɥɶɡɨɜɚɬɶ ɬɨɥɶɤɨ ɱɟɬɵɪɟ ɢɥɢ ɦɟɧɶɲɟ ɛɥɢɠɚɣɲɢɯ ɷɥɟɦɟɧɬɨɜ, ɲɭɦɨɜɚɹ ɦɨɞɟɥɶ ɞɚɟɬ 20 ɜɚɪɢɚɧɬɨɜ: 4 ɫ h=1, 6 ɫ h=2, 8 ɫ h=3 ɢ 2 ɫ h=4. «ɗɜɨɥɸɰɢɨɧɧɚɹ» ɦɨɞɟɥɶ ɞɟɥɚɟɬ ɬɨ ɠɟ ɩɪɟɞɩɨɥɨɠɟɧɢɟ, ɱɬɨ ɢ ɜ ɨɞɧɨɦɟɪɧɨɦ ɫɥɭɱɚɟ: ɫɨɯɪɚɧɹɟɬɫɹ ɥɢɧɟɣɧɚɹ ɬɟɧɞɟɧɰɢɹ, ɩɪɢɪɚɳɟɧɢɟ ɧɚ ɬɟɤɭɳɟɦ ɲɚɝɟ ɩɪɢɦɟɪɧɨ ɪɚɜɧɨ ɩɪɢɪɚɳɟɧɢɸ ɧɚ ɩɪɟɞɵɞɭɳɟɦ. ɇɨ ɬɟɩɟɪɶ, ɜ ɞɜɭɦɟɪɧɨɦ ɫɥɭɱɚɟ, ɧɟɨɛɯɨɞɢɦɨ ɤɚɤ ɦɢɧɢɦɭɦ ɬɪɢ ɷɥɟɦɟɧɬɚ, ɚ ɧɟ ɞɜɚ: E=K1·B + K2·(D–A) , E=K1·D + K2·(B–A) , (6.4) E=K1·D + K2·(B–A) + K3·(C–B). (6.5) ɉɟɪɜɵɟ ɞɜɚ ɜɚɪɢɚɧɬɚ, ɩɨ ɩɪɟɞɩɨɥɨɠɟɧɢɸ ɷɜɨɥɸɰɢɨɧɧɨɣ ɦɨɞɟɥɢ, ɫɜɨɞɹɬɫɹ ɤ ɨɞɧɨɦɭ: K1=K2=1. ȼ ɬɪɟɬɶɟɦ, ɩɪɢ ɤɨɪɪɟɤɰɢɢ ɜ ɪɚɦɤɚɯ ɷɜɨɥɸɰɢɨɧɧɨɣ ɦɨɞɟɥɢ, ɝɪɚɧɢɰɵ ɬɚɤɨɜɵ: K1=1, K2+K3=1 . ɉɨɩɪɨɛɭɟɦ ɩɨɫɬɪɨɢɬɶ ɦɨɞɟɥɶ ɫ h=4, ɨɛɴɟɞɢɧɹɸɳɭɸ ɞɜɚ ɩɪɨɬɢɜɨɩɨɥɨɠɧɵɯ ɩɨɥɸɫɚ — «ɲɭɦɨɜɨɣ» ɢ «ɷɜɨɥɸɰɢɨɧɧɵɣ». ɉɪɢ ɤɚɤɢɯ K1, K2 ɢ K3 ɷɜɨɥɸɰɢɨɧɧɚɹ ɦɨɞɟɥɶ (6.5) ɫɬɚɧɨɜɢɬɫɹ ɲɭɦɨɜɨɣ: (6.3) ɫ Ki=1/4 ? K1=1/4 (ɤɨɷɮɮɢɰɢɟɧɬ ɩɪɢ D) K3=1/4 (ɩɪɢ C) K2–K3=1/4 (B) –K2= 1/4 (A) Ɋɟɲɟɧɢɣ ɧɟɬ ɢ ɩɪɚɜɢɥɶɧɵɣ ɨɬɜɟɬ: ɧɢ ɩɪɢ ɤɚɤɢɯ. ɉɨɬɨɦɭ ɱɬɨ ɜ (6.3) ɤɨɷɮɮɢɰɢɟɧɬɵ ɩɪɢ C, B ɢ A ɞɨɥɠɧɵ ɛɵɬɶ Ki>0. ɉɪɢɦɟɧɹɹ ɷɬɨ ɭɫɥɨɜɢɟ ɤ (6.5), ɩɨɥɭɱɚɟɦ: (C): K3>0 (A): K2<0 (B): K2–K3>0 (ɷɬɨ ɧɟɫɨɜɦɟɫɬɢɦɨ ɫ ɪɟɡɭɥɶɬɚɬɚɦɢ ɩɨ C ɢ A). 40
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
Ɍɟɦ ɧɟ ɦɟɧɟɟ, ɫɢɧɬɟɡ «ɲɭɦɨɜɨɣ» ɢ «ɷɜɨɥɸɰɢɨɧɧɨɣ» ɩɪɢ h=4 ɜɨɡɦɨɠɟɧ. Ȼɭɞɟɦ ɛɪɚɬɶ ɩɪɟɞɫɤɚɡɚɧɢɟ ɬɨɝɨ ɢɡ 20-ɢ ɜɚɪɢɚɧɬɨɜ «ɲɭɦɨɜɨɣ», ɤɨɬɨɪɵɣ ɛɥɢɠɟ ɜɫɟɝɨ ɤ ɩɪɟɞɫɤɚɡɚɧɢɸ «ɷɜɨɥɸɰɢɨɧɧɨɣ», ɬɨ ɟɫɬɶ ɪɚɡɧɨɫɬɶ ɦɟɠɞɭ ɧɢɦɢ ɦɢɧɢɦɚɥɶɧɚ. Ʉɚɤ ɪɚɡ ɬɚɤɨɣ ɩɭɬɶ ɪɟɚɥɢɡɨɜɚɧ ɜ ɩɨɩɭɥɹɪɧɨɦ ɚɥɝɨɪɢɬɦɟ PNG, ɚ ɢɦɟɧɧɨ ɜ ɫɚɦɨɦ ɫɥɨɠɧɨɦ, ɫɚɦɨɦ ɢɧɬɟɥɥɟɤɬɭɚɥɶɧɨɦ ɟɝɨ ɮɢɥɶɬɪɟ “Paeth”: ɬɪɢ ɜɚɪɢɚɧɬɚ ɲɭɦɨɜɨɣ (ɫ ɢɫɩɨɥɶɡɨɜɚɧɢɟɦ ɷɥɟɦɟɧɬɨɜ A, B ɢ D) ɢ ɷɜɨɥɸɰɢɨɧɧɚɹ (6.4). ɉɨ ɫɭɬɢ ɷɬɨ ɬɨɬ ɠɟ ɦɟɬɨɞ, ɱɬɨ ɢ ɨɩɢɫɚɧɧɵɣ ɜ ɩɭɧɤɬɟ «Ɉɛɳɢɣ ɫɥɭɱɚɣ», ɬɨɥɶɤɨ ɜɦɟɫɬɨ ɫɪɟɞɧɟɝɨ ɩɨ ɬɪɟɦ ɬɨɱɤɚɦ ɛɟɪɟɬɫɹ «ɞɜɭɦɟɪɧɨɟ ɷɜɨɥɸɰɢɨɧɧɨɟ» ɡɧɚɱɟɧɢɟ, ɢ ɢɫɤɥɸɱɚɸɬɫɹ ɞɜɚ ɷɥɟɦɟɧɬɚ, ɚ ɧɟ ɨɞɢɧ. Ⱦɪɭɝɨɣ ɫɢɧɬɟɡ ɜɨɡɦɨɠɟɧ, ɟɫɥɢ ɷɜɨɥɸɰɢɨɧɧɭɸ ɦɨɞɟɥɶ ɦɨɞɢɮɢɰɢɪɨɜɚɬɶ: E=K1·D +K2·(B–A) +K3·(C–B)+K4·A (5a) E=K1·D +K2·(B–A) +K3·(C–B)+K4·B (5b) E=K1·D +K2·(B–A) +K3·(C–B)+K4·C (5c) ɑɬɨɛɵ ɮɨɪɦɭɥɵ ɨɩɢɫɵɜɚɥɢ ɷɜɨɥɸɰɢɨɧɧɭɸ ɦɨɞɟɥɶ, ɞɨɥɠɧɨ ɛɵɬɶ K4=0, K1=K2+K3=1. ȼ ɲɭɦɨɜɨɣ ɦɨɞɟɥɢ K1=1/4, ɚ K2, K3 ɢ K4 ɧɚɣɞɟɦ ɢɡ ɭɫɥɨɜɢɣ: ɤɨɷɮɮɢɰɢɟɧɬɵ ɩɪɢ A, B ɢ C ɞɨɥɠɧɵ ɛɵɬɶ ɪɚɜɧɵ 1/4: ɜ ɫɥɭɱɚɟ (5a) C: K3=1/4, B: K2=1/2, A: K4= 3/4 (5b) C: K3=1/4, A: K2= –1/4, B: K4= 3/4 (5c) A: K2= –1/4, B: K3= –1/2, C: K4= 3/4 Ɋɚɫɫɦɨɬɪɢɦ, ɧɚɩɪɢɦɟɪ, (5b). ɂɦɟɟɬ ɫɦɵɫɥ ɤɨɪɪɟɤɬɢɪɨɜɚɬɶ K1 ɨɬ 1/4 (ɲɭɦɨɜɚɹ ɦɨɞɟɥɶ) ɞɨ 1 (ɷɜɨɥɸɰɢɨɧɧɚɹ); K4 ɧɚɣɞɟɬɫɹ ɢɡ ɭɫɥɨɜɢɹ K1+K4=1; K3=1/4; K2+K3 ɨɬ 0 (ɲɭɦɨɜɚɹ) ɞɨ 1 (ɷɜɨɥɸɰɢɨɧɧɚɹ), ɬɨ ɟɫɬɶ K2 ɨɬ –1/4 ɞɨ 3/4. Ɍɚɤɢɦ ɨɛɪɚɡɨɦ, ɢɡ (5b) ɩɨɥɭɱɚɟɬɫɹ ɷɜɨɥɸɰɢɨɧɧɚɹ ɦɨɞɟɥɶ ɩɪɢ K1=1, K2=3/4, ɢ ɲɭɦɨɜɚɹ ɩɪɢ K1=1/4, K2= –1/4.
ɍɩɪɚɠɧɟɧɢɟ: Ʉɚɤɢɦ ɛɭɞɟɬ ɫɢɧɬɟɡ ɷɜɨɥɸɰɢɨɧɧɨɣ ɢ ɲɭɦɨɜɨɣ ɦɨɞɟɥɟɣ ɜ ɫɥɭɱɚɹɯ (5a) ɢ (5c) ? Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
41
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
LPC ɜ ɚɥɝɨɪɢɬɦɟ PNG Ⱦɥɹ ɫɠɚɬɢɹ ɢɡɨɛɪɚɠɟɧɢɹ ɦɨɠɧɨ ɜɵɛɪɚɬɶ ɨɞɧɭ ɢɡ ɫɥɟɞɭɸɳɢɯ LPC-ɦɨɞɟɥɟɣ (ɧɚɡɵɜɚɟɦɵɯ ɬɚɤɠɟ «ɮɢɥɶɬɪɚɦɢ»): 1) E=0 (ɧɟɬ ɮɢɥɶɬɪɚ) 2) E=D (ɷɥɟɦɟɧɬ ɫɥɟɜɚ) 3) E=B (ɷɥɟɦɟɧɬ ɫɜɟɪɯɭ) 4) E=(B+D)/2 5) ɜɵɲɟɨɩɢɫɚɧɧɵɣ ɚɥɝɨɪɢɬɦ Paeth ȼɫɟ ɩɹɬɶ — ɜɚɪɢɚɧɬɵ ɲɭɦɨɜɨɣ ɦɨɞɟɥɢ, ɢ ɬɨɥɶɤɨ ɩɨɫɥɟɞɧɹɹ ɦɨɞɟɥɶ ɹɜɥɹɟɬɫɹ ɤɨɦɛɢɧɢɪɨɜɚɧɧɨɣ, ɭɱɢɬɵɜɚɸɳɟɣ ɷɜɨɥɸɰɢɸ. LPC ɜ ɚɥɝɨɪɢɬɦɟ Lossless Jpeg Ɇɨɠɟɬ ɛɵɬɶ ɡɚɞɚɧ ɨɞɢɧ ɢɡ ɜɨɫɶɦɢ ɩɪɟɞɫɤɚɡɚɬɟɥɟɣ-ɮɢɥɶɬɪɨɜ: 1) E=0 (ɧɟɬ ɮɢɥɶɬɪɚ) 2) E=B (ɷɥɟɦɟɧɬ ɫɜɟɪɯɭ) 3) E=D (ɷɥɟɦɟɧɬ ɫɥɟɜɚ) 4) E=A (ɜɵɲɟ ɢ ɥɟɜɟɟ) 5) E=B+D–A 6) E=B+(D–A)/2 7) E=D+(B–A)/2 8) E=(B+D)/2 ɉɹɬɵɣ, ɲɟɫɬɨɣ ɢ ɫɟɞɶɦɨɣ — ɜɚɪɢɚɧɬɵ ɷɜɨɥɸɰɢɨɧɧɨɣ ɦɨɞɟɥɢ, ɨɫɬɚɥɶɧɵɟ — ɲɭɦɨɜɨɣ. ȼɵɛɨɪ ɮɢɥɶɬɪɚ ɂɬɚɤ, ɢɦɟɟɦ ɦɧɨɠɟɫɬɜɨ ɮɢɥɶɬɪɨɜ Spn[X,Y]=Sn(Ki,j·S[X–i,Y–j]) ɞɚɸɳɢɯ ɨɰɟɧɤɢ-ɩɪɟɞɫɤɚɡɚɧɢɹ Spn ɞɥɹ ɡɧɚɱɟɧɢɹ ɷɥɟɦɟɧɬɚ ɜ ɩɨɡɢɰɢɢ (X,Y) ɤɚɤ ɮɭɧɤɰɢɸ Sn ɨɬ ɡɧɚɱɟɧɢɣ ɷɥɟɦɟɧɬɨɜ ɤɨɧɬɟɤɫɬɚ, ɬɨ ɟɫɬɶ ɷɥɟɦɟɧɬɨɜ, ɫɨɫɟɞɧɢɯ ɫ ɬɟɤɭɳɢɦ S[X,Y]. Ⱦɜɚ ɭɠɟ ɪɚɫɫɦɨɬɪɟɧɧɵɯ (ɜ ɩɭɧɤɬɟ «ɨɛɳɢɣ ɫɥɭɱɚɣ») ɩɭɬɢ ɞɚɥɶɧɟɣɲɢɯ ɞɟɣɫɬɜɢɣ: 1. ɜɵɛɪɚɬɶ ɨɞɧɨ ɡɧɚɱɟɧɢɟ Spn , ɞɚɜɚɟɦɨɟ ɬɨɣ ɮɭɧɤɰɢɟɣ Sn , ɤɨɬɨɪɚɹ ɬɨɱɧɟɟ ɧɚ ɡɚɞɚɧɧɨɦ ɱɢɫɥɟ ɩɪɟɞɵɞɭɳɢɯ ɷɥɟɦɟɧɬɨɜ, 2. ɜɵɛɪɚɬɶ ɡɧɚɱɟɧɢɟ, ɜɵɱɢɫɥɹɟɦɨɟ ɤɚɤ ɫɭɦɦɚ ɜɫɟɯ Spn , ɜɡɹɬɵɯ ɫ ɪɚɡɧɵɦɢ ɜɟɫɚɦɢ: Sp = Ȉ(Wn·Spn), 0Wn1. 42
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
Ʉɪɨɦɟ ɞɨɜɨɥɶɧɨ ɨɱɟɜɢɞɧɨɝɨ ɫɩɨɫɨɛɚ — ɤɨɪɪɟɤɬɢɪɨɜɤɢ Wn, ɜɟɫɨɜ, ɫ ɤɨɬɨɪɵɦɢ ɛɟɪɭɬɫɹ ɩɪɟɞɫɤɚɡɚɧɢɹ, ɞɚɜɚɟɦɵɟ ɪɚɡɧɵɦɢ ɮɢɥɶɬɪɚɦɢ, ɟɫɬɶ ɢ ɟɳɟ ɜɚɪɢɚɧɬɵ: 3. ɛɪɚɬɶ ɬɟ K ɡɧɚɱɟɧɢɣ Spn, ɤɨɬɨɪɵɟ ɞɚɸɬ Sn, ɥɭɱɲɢɟ ɧɚ K (ɡɚɞɚɜɚɟɦɨɦ ɱɢɫɥɟ) ɛɥɢɠɚɣɲɢɯ ɷɥɟɦɟɧɬɨɜ ɤɨɧɬɟɤɫɬɚ (ɧɟɤɨɬɨɪɵɟ ɢɡ ɷɬɢɯ Sn ɦɨɝɭɬ ɫɨɜɩɚɞɚɬɶ, ɢ ɢɯ ɨɫɬɚɧɟɬɫɹ ɦɟɧɶɲɟ, ɱɟɦ K). 4. ɜɫɟ ɮɭɧɤɰɢɢ Sn ɫɨɪɬɢɪɭɸɬɫɹ ɩɨ ɡɧɚɱɟɧɢɸ ɬɨɱɧɨɫɬɢ ɩɪɟɞɫɤɚɡɚɧɢɹ ɧɚ ɛɥɢɠɚɣɲɢɯ ɷɥɟɦɟɧɬɚɯ ɤɨɧɬɟɤɫɬɚ ɢ ɜɵɛɢɪɚɟɬɫɹ ɧɟɫɤɨɥɶɤɨ ɮɭɧɤɰɢɣ, ɞɚɸɳɢɯ ɥɭɱɲɭɸ ɬɨɱɧɨɫɬɶ. ɑɟɬɜɟɪɬɵɣ ɜɚɪɢɚɧɬ ɹɜɥɹɟɬɫɹ ɩɪɨɫɬɵɦ ɪɚɫɲɢɪɟɧɢɟɦ ɩɟɪɜɨɝɨ. Ɍɪɟɬɢɣ ɠɟ ɩɪɟɞɩɨɥɚɝɚɟɬ ɫɨɩɨɫɬɚɜɥɟɧɢɟ ɤɚɠɞɨɦɭ ɷɥɟɦɟɧɬɭ ɨɞɧɨɣ Sn, ɞɚɸɳɟɣ ɞɥɹ ɧɟɝɨ ɫɚɦɨɟ ɬɨɱɧɨɟ ɩɪɟɞɫɤɚɡɚɧɢɟ. ȼ ɨɛɨɢɯ ɫɥɭɱɚɹɯ, ɟɫɥɢ ɬɪɟɛɭɟɬɫɹ ɜɵɛɪɚɬɶ ɨɞɧɭ Sn ɢɡ ɧɟɫɤɨɥɶɤɢɯ Si ɫ ɨɞɢɧɚɤɨɜɵɦ ɡɧɚɱɟɧɢɟɦ ɬɨɱɧɨɫɬɢ, ɦɨɠɧɨ ɩɨɫɦɨɬɪɟɬɶ ɡɧɚɱɟɧɢɹ ɬɨɱɧɨɫɬɢ ɷɬɢɯ Si ɧɚ ɛɨɥɶɲɟɦ ɱɢɫɥɟ ɷɥɟɦɟɧɬɨɜ. ȼɨ 2-ɦ, 3-ɦ ɢ 4-ɦ ɱɚɫɬɨ ɩɨɥɟɡɧɨ ɭɦɟɧɶɲɢɬɶ ɲɭɦ ɜɵɲɟɨɩɢɫɚɧɧɵɦ ɫɩɨɫɨɛɨɦ. ɂ ɜ ɤɨɧɟɱɧɨɦ ɢɬɨɝɟ ɫɥɨɠɢɬɶ ɨɫɬɚɜɲɢɟɫɹ Sp = Ȉ(Wn·Spn). ȼ ɩɪɨɫɬɟɣɲɟɦ ɫɥɭɱɚɟ Wn=1/H, ɝɞɟ H — ɤɨɥɢɱɟɫɬɜɨ ɨɫɬɚɜɲɢɯɫɹ Sn. ɂ ɟɳɟ ɬɪɢ ɩɪɨɫɬɵɯ, ɧɨ ɜɚɠɧɵɯ ɡɚɦɟɱɚɧɢɹ: ȼɨ-ɩɟɪɜɵɯ, ɫɠɚɬɢɟ ɨɛɵɱɧɨ ɥɭɱɲɟ, ɟɫɥɢ ɡɧɚɱɟɧɢɹ ɨɰɟɧɨɤɩɪɟɞɫɤɚɡɚɧɢɣ Spn ɧɟ ɜɵɯɨɞɹɬ ɡɚ ɝɪɚɧɢɰɵ ɞɢɚɩɚɡɨɧɚ ɞɨɩɭɫɬɢɦɵɯ ɡɧɚɱɟɧɢɣ ɷɥɟɦɟɧɬɨɜ ɜɯɨɞɧɨɝɨ ɩɨɬɨɤɚ S[i]. ȿɫɥɢ A<S[i]
43
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɮɨɪɦɭɥɟ (6.3), ɲɭɦɨɜɚɹ ɦɨɞɟɥɶ ɫɤɥɚɞɵɜɚɟɬ ɡɧɚɱɟɧɢɹ ɱɟɬɵɪɟɯ ɛɥɢɠɚɣɲɢɯ ɷɥɟɦɟɧɬɨɜ ɤɨɧɬɟɤɫɬɚ ɫ ɪɚɡɧɵɦɢ ɜɟɫɚɦɢ Ki : E=K1·D + K2·C + K3·B + K4·A ɢɦɟɟɬ ɫɦɵɫɥ ɡɚɞɚɜɚɬɶ K1=K3, K2=K4, ɢ ɟɳɟ ɢɡ-ɡɚ ɭɱɟɬɚ ɪɚɫɫɬɨɹɧɢɣ K2/K1=21/2 (ɢ ɤɨɧɟɱɧɨ K1+K2+K3+K4=1). Ɍɨɱɧɨ ɬɚɤ ɠɟ ɩɪɢ ɜɵɱɢɫɥɟɧɢɢ ɬɨɱɧɨɫɬɟɣ ɮɢɥɶɬɪɨɜ ɧɚ ɷɥɟɦɟɧɬɚɯ ɤɨɧɬɟɤɫɬɚ, ɨɲɢɛɤɢ ɢɯ ɩɪɟɞɫɤɚɡɚɧɢɣ Va,b (ɚ ɬɨɱɧɟɟ, ɚɛɫɨɥɸɬɧɵɟ ɡɧɚɱɟɧɢɹ ɷɬɢɯ ɨɲɢɛɨɤ) ɞɨɥɠɧɵ ɭɱɢɬɵɜɚɬɶɫɹ ɫ ɜɟɫɚɦɢ Ka,b, ɡɚɜɢɫɹɳɢɦɢ ɨɬ ɪɚɫɫɬɨɹɧɢɣ: Ka,b=K((a2+b2)1/2) . ɍ ɷɜɨɥɸɰɢɨɧɧɨɣ ɦɨɞɟɥɢ, ɢɫɩɨɥɶɡɭɸɳɟɣ ɱɟɬɵɪɟ ɷɥɟɦɟɧɬɚ ɤɨɧɬɟɤɫɬɚ (A, B, C, D), ɩɪɢɪɚɳɟɧɢɹ (B–A), (D–A) ɢ (C–B) ɧɚɯɨɞɹɬɫɹ ɧɚ ɪɚɜɧɨɦ ɪɚɫɫɬɨɹɧɢɢ ɢ ɢɦɟɸɬ ɨɞɢɧɚɤɨɜɵɣ ɜɟɫ. ɇɨ ɟɫɥɢ ɢɫɩɨɥɶɡɭɟɬɫɹ ɛɨɥɶɲɟ ɱɟɬɵɪɟɯ ɷɥɟɦɟɧɬɨɜ — ɬɨɠɟ ɧɟɨɛɯɨɞɢɦɨ ɜɵɱɢɫɥɹɬɶ ɪɚɫɫɬɨɹɧɢɹ.
ɏɚɪɚɤɬɟɪɢɫɬɢɤɢ ɦɟɬɨɞɨɜ ɫɟɦɟɣɫɬɜɚ LPC: ɋɬɟɩɟɧɶ ɫɠɚɬɢɹ: ɭɜɟɥɢɱɢɜɚɟɬɫɹ ɩɪɢɦɟɪɧɨ ɜ 1.1 ... 1.9 ɪɚɡɚ. Ɍɢɩɵ ɞɚɧɧɵɯ: ɦɟɬɨɞɵ ɩɪɟɞɧɚɡɧɚɱɟɧɵ ɞɥɹ ɫɠɚɬɢɹ ɤɨɥɢɱɟɫɬɜɟɧɧɵɯ ɞɚɧɧɵɯ. ɋɢɦɦɟɬɪɢɱɧɨɫɬɶ ɩɨ ɫɤɨɪɨɫɬɢ: ɜ ɨɛɳɟɦ ɫɥɭɱɚɟ 1:1. ɏɚɪɚɤɬɟɪɧɵɟ ɨɫɨɛɟɧɧɨɫɬɢ: ɱɟɦ ɦɟɧɶɲɟ ɞɨɥɹ "ɲɭɦɚ" ɜ ɞɚɧɧɵɯ, ɬɟɦ ɜɵɝɨɞɧɟɟ ɩɪɢɦɟɧɟɧɢɟ ɦɟɬɨɞɨɜ LPC.
ɋɭɛɩɨɥɨɫɧɨɟ ɤɨɞɢɪɨɜɚɧɢɟ Ⱥɧɝɥɢɣɫɤɨɟ ɧɚɡɜɚɧɢɟ ɦɟɬɨɞɚ — «Subband Coding» (SC). Ⱦɨɫɥɨɜɧɵɣ ɩɟɪɟɜɨɞ — «ɤɨɞɢɪɨɜɚɧɢɟ ɩɨɞɞɢɚɩɚɡɨɧɨɜ».
44
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɐɟɥɶ ɦɟɬɨɞɚ — ɫɠɚɬɢɟ ɩɨɬɨɤɚ R-ɛɢɬɧɵɯ ɷɥɟɦɟɧɬɨɜ, ɜ ɩɪɟɞɩɨɥɨɠɟɧɢɢ, ɱɬɨ ɡɧɚɱɟɧɢɟ ɤɚɠɞɨɝɨ ɢɡ ɧɢɯ ɨɬɥɢɱɚɟɬɫɹ ɨɬ ɡɧɚɱɟɧɢɣ ɫɨɫɟɞɧɢɯ ɷɥɟɦɟɧɬɨɜ ɧɟɡɧɚɱɢɬɟɥɶɧɨ: Si ≈ Si-1. Ɉɫɧɨɜɧɚɹ ɢɞɟɹ ɫɨɫɬɨɢɬ ɜ ɬɨɦ, ɱɬɨɛɵ ɮɨɪɦɢɪɨɜɚɬɶ ɞɜɚ ɩɨɬɨɤɚ: ɞɥɹ ɤɚɠɞɨɣ ɩɚɪɵ S2i , S2i+1 ɫɨɯɪɚɧɹɬɶ ɩɨɥɭɫɭɦɦɭ (S2i + S2i+1)/2 ɢ ɪɚɡɧɨɫɬɶ (S2i – S2i+1). Ⱦɚɥɟɟ ɷɬɢ ɩɨɬɨɤɢ ɫɥɟɞɭɟɬ ɨɛɪɚɛɚɬɵɜɚɬɶ ɪɚɡɞɟɥɶɧɨ, ɩɨɫɤɨɥɶɤɭ ɢɯ ɯɚɪɚɤɬɟɪɢɫɬɢɤɢ ɫɭɳɟɫɬɜɟɧɧɨ ɪɚɡɥɢɱɧɵ. ȼ ɫɥɭɱɚɟ ɦɨɞɟɥɢ «ɚɧɚɥɨɝɨɜɵɣ ɫɢɝɧɚɥ» ɮɢɡɢɱɟɫɤɢɣ ɫɦɵɫɥ ɩɨɬɨɤɚ ɫ ɩɨɥɭɫɭɦɦɚɦɢ — ɧɢɡɤɢɟ ɱɚɫɬɨɬɵ, ɚ ɫ ɪɚɡɧɨɫɬɹɦɢ — ɜɵɫɨɤɢɟ. Ɇɟɬɨɞɵ SC ɩɪɟɞɧɚɡɧɚɱɟɧɵ ɞɥɹ ɫɠɚɬɢɹ ɷɥɟɦɟɧɬɨɜ ɫ «ɤɨɥɢɱɟɫɬɜɟɧɧɵɦɢ» ɞɚɧɧɵɦɢ, ɚ ɧɟ «ɤɚɱɟɫɬɜɟɧɧɵɦɢ». ɋɚɦɵɣ ɪɚɫɩɪɨɫɬɪɚɧɟɧɧɵɣ ɜɢɞ ɤɨɥɢɱɟɫɬɜɟɧɧɵɯ ɞɚɧɧɵɯ — ɦɭɥɶɬɢɦɟɞɢɣɧɵɟ. ɇɨ ɧɟ ɟɞɢɧɫɬɜɟɧɧɵɣ: ɧɚɩɪɢɦɟɪ, ɩɨɬɨɤɢ ɫɦɟɳɟɧɢɣ ɢ ɞɥɢɧ, ɮɨɪɦɢɪɭɟɦɵɟ ɦɟɬɨɞɨɦ ɫɟɦɟɣɫɬɜɚ LZ77, ɬɨɠɟ ɫɨɞɟɪɠɚɬ ɤɨɥɢɱɟɫɬɜɟɧɧɵɟ ɞɚɧɧɵɟ. Ɋɚɡɦɟɪ ɞɚɧɧɵɯ ɜ ɪɟɡɭɥɶɬɚɬɟ ɩɪɢɦɟɧɟɧɢɹ SC ɧɟ ɢɡɦɟɧɹɟɬɫɹ. Ȼɨɥɟɟ ɬɨɝɨ, ɜ ɩɨɬɨɤɟ ɫ ɪɚɡɧɨɫɬɹɦɢ ɪɚɡɦɟɪ ɷɥɟɦɟɧɬɨɜ R ɦɨɠɟɬ ɞɚɠɟ ɭɜɟɥɢɱɢɜɚɬɶɫɹ ɧɚ 1 ɛɢɬ: R`=R+1, ɩɨɫɤɨɥɶɤɭ ɞɥɹ ɫɨɯɪɚɧɟɧɢɹ ɪɚɡɧɨɫɬɟɣ R-ɛɢɬɧɵɯ ɷɥɟɦɟɧɬɨɜ ɬɪɟɛɭɟɬɫɹ (R+1) ɛɢɬɨɜ. Ⱦɥɹ ɫɠɚɬɢɹ ɪɟɡɭɥɶɬɚɬɚ ɪɚɛɨɬɵ ɦɟɬɨɞɚ ɦɨɠɟɬ ɛɵɬɶ ɩɪɢɦɟɧɟɧɚ ɥɸɛɚɹ ɤɨɦɛɢɧɚɰɢɹ ɦɟɬɨɞɨɜ — RLE, MTF, DC, PBS, HUFF, ARIC, ENUC, SEM... Ɇɟɬɨɞɵ ɷɬɨɣ ɝɪɭɩɩɵ ɹɜɥɹɸɬɫɹ ɬɪɚɧɫɮɨɪɦɢɪɭɸɳɢɦɢ ɢ ɩɨɬɨɱɧɵɦɢ (ɬ.ɟ. ɦɨɝɭɬ ɩɪɢɦɟɧɹɬɶɫɹ ɞɚɠɟ ɜ ɬɨɦ ɫɥɭɱɚɟ, ɤɨɝɞɚ ɞɥɢɧɚ ɛɥɨɤɚ ɫ ɞɚɧɧɵɦɢ ɧɟ ɡɚɞɚɧɚ). ȼ ɨɛɳɟɦ ɫɥɭɱɚɟ ɫɤɨɪɨɫɬɶ ɪɚɛɨɬɵ ɤɨɦɩɪɟɫɫɨɪɚ ɪɚɜɧɚ ɫɤɨɪɨɫɬɢ ɞɟɤɨɦɩɪɟɫɫɨɪɚ ɢ ɡɚɜɢɫɢɬ ɬɨɥɶɤɨ ɨɬ ɪɚɡɦɟɪɚ ɞɚɧɧɵɯ, ɧɨ ɧɟ ɨɬ ɢɯ ɫɨɞɟɪɠɚɧɢɹ: ɋɤɨɪɨɫɬɶ = O(Ɋɚɡɦɟɪ). ɉɚɦɹɬɢ ɬɪɟɛɭɟɬɫɹ ɜɫɟɝɨ ɥɢɲɶ ɧɟɫɤɨɥɶɤɨ ɛɚɣɬɨɜ. ɂɡ ɤɪɚɬɤɨɝɨ ɨɩɢɫɚɧɢɹ ɨɛɳɟɣ ɢɞɟɢ ɜɢɞɧɨ, ɱɬɨ 1) ɤ ɨɛɨɢɦ ɩɨɥɭɱɚɸɳɢɦɫɹ ɩɨɬɨɤɚɦ ɦɨɠɧɨ ɩɨɜɬɨɪɧɨ ɩɪɢɦɟɧɹɬɶ ɦɟɬɨɞ ɷɬɨɝɨ ɠɟ ɫɟɦɟɣɫɬɜɚ SC; 2) ɦɟɬɨɞ ɦɨɠɧɨ ɩɪɢɦɟɧɹɬɶ ɢ ɤ ɩɚɪɚɥɥɟɥɶɧɵɦ ɩɨɬɨɤɚɦ (ɧɚɩɪɢɦɟɪ, ɥɟɜɵɣ ɢ ɩɪɚɜɵɣ ɤɚɧɚɥɵ ɫɬɟɪɟɨɡɜɭɤɚ); Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
45
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
3)
4)
ɩɪɢ ɫɠɚɬɢɢ ɚɧɚɥɨɝɨɜɨɝɨ ɫɢɝɧɚɥɚ ɫ ɩɨɬɟɪɹɦɢ, ɫɬɟɩɟɧɶ ɫɠɚɬɢɹ ɨɛɪɚɬɧɨ ɩɪɨɩɨɪɰɢɨɧɚɥɶɧɚ ɲɢɪɢɧɟ ɫɨɯɪɚɧɹɟɦɨɝɨ ɞɢɚɩɚɡɨɧɚ ɱɚɫɬɨɬ; ɦɨɠɧɨ ɫɨɯɪɚɧɹɬɶ ɧɟ ɩɨɥɭɫɭɦɦɵ ɢ ɪɚɡɧɨɫɬɢ, ɚ ɫɭɦɦɵ ɢ ɩɨɥɭɪɚɡɧɨɫɬɢ (ɩɨɫɤɨɥɶɤɭ ɫɭɦɦɚ ɢ ɪɚɡɧɨɫɬɶ ɞɜɭɯ ɱɢɫɟɥ — ɥɢɛɨ ɨɛɟ ɱɟɬɧɵ, ɥɢɛɨ ɨɛɟ ɧɟɱɟɬɧɵ, ɨɞɧɭ ɢɡ ɧɢɯ ɦɨɠɧɨ ɞɟɥɢɬɶ ɧɚ 2 ɛɟɡ ɜɫɹɤɢɯ ɨɫɥɨɠɧɟɧɢɣ).
ɉɊəɆɈȿ ɉɊȿɈȻɊȺɁɈȼȺɇɂȿ
ȼ ɛɚɡɨɜɨɦ ɩɪɨɫɬɟɣɲɟɦ ɫɥɭɱɚɟ ɢɥɥɸɫɬɪɢɪɭɟɬɫɹ ɬɪɟɦɹ ɫɬɪɨɤɚɦɢ: for (i=0; i
ɩɨ ɞɥɢɧɟ ɢɫɯɨɞɧɨɝɨ ɦɚɫɫɢɱɟɬɧɵɟ – ɫ ɩɨɥɭɫɭɦɦɚɦɢ ɧɟɱɟɬɧɵɟ – ɫ ɪɚɡɧɨɫɬɹɦɢ (1)
S[N] — ɢɫɯɨɞɧɵɣ ɦɚɫɫɢɜ (Source, ɢɫɬɨɱɧɢɤ) D[N] — ɜɵɯɨɞɧɨɣ ɦɚɫɫɢɜ ɩɪɟɨɛɪɚɡɨɜɚɧɧɵɯ ɞɚɧɧɵɯ (Destination, ɩɪɢɟɦɧɢɤ, ɫ Ⱦɟɥɶɬɚɦɢ, ɬ.ɟ. ɪɚɡɧɨɫɬɹɦɢ, ɢ ɩɨɥɭɫɭɦɦɚɦɢ). ȿɫɥɢ ɪɟɡɭɥɶɬɚɬ ɩɢɲɟɦ ɜ ɬɨɬ ɠɟ ɦɚɫɫɢɜ S: for (i=0; i
ȿɫɥɢ ɠɟ ɮɨɪɦɢɪɭɟɦ ɞɜɚ ɜɵɯɨɞɧɵɯ ɦɚɫɫɢɜɚ: for (i=0; i
// (3) // ɩɨɥɭɫɭɦɦɚ (Average) // ɪɚɡɧɨɫɬɶ (Delta)
Ɍɨ ɤɚɠɞɵɣ ɢɡ ɧɢɯ — ɜɞɜɨɟ ɤɨɪɨɱɟ, ɱɟɦ ɢɫɯɨɞɧɵɣ S.
46
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ȿɫɥɢ ɟɝɨ ɞɥɢɧɚ N ɧɟɱɟɬɧɚ, ɞɨɛɚɜɢɦ ɤ ɤɨɧɰɭ S ɷɥɟɦɟɧɬ S[N], ɪɚɜɧɵɣ ɩɨɫɥɟɞɧɟɦɭ S[N–1]; ɜ ɪɟɡɭɥɶɬɚɬɟ ɨɧ ɞɨɛɚɜɢɬɫɹ ɤ ɦɚɫɫɢɜɭ A, ɚ ɤ D ɞɨɛɚɜɢɬɫɹ ɧɨɥɶ: A[N/2]=S[N-1]; D[N/2]=0;
// ɩɨɫɥɟɞɧɹɹ ɩɨɥɭɫɭɦɦɚ // ɩɨɫɥɟɞɧɹɹ ɪɚɡɧɨɫɬɶ
ȿɫɥɢ ɢɡɜɟɫɬɧɨ, ɱɬɨ ɜ ɪɟɡɭɥɶɬɚɬɟ ɪɚɡɧɨɫɬɢ ɦɨɠɟɬ ɜɨɡɧɢɤɧɭɬɶ ɩɟɪɟɩɨɥɧɟɧɢɟ, ɬɨ ɟɫɬɶ ɧɟɜɨɡɦɨɠɧɨ ɛɭɞɟɬ ɡɚɩɢɫɚɬɶ ɩɨɥɭɱɟɧɧɨɟ ɡɧɚɱɟɧɢɟ, ɢɫɩɨɥɶɡɭɹ ɢɫɯɨɞɧɨɟ ɱɢɫɥɨ ɛɢɬɨɜ R (R — ɪɚɡɦɟɪ ɷɥɟɦɟɧɬɨɜ ɢɫɯɨɞɧɨɝɨ ɦɚɫɫɢɜɚ S): if ( (S[2*i]-S[2*i+1])!=(S[2*i]-S[2*i+1])mod(n) ) {} // n=(2 ɜ ɫɬɟɩɟɧɢ R)
ɬɨ ɦɨɠɟɦ ɩɨɫɬɭɩɢɬɶ ɨɞɧɢɦ ɢɡ ɫɥɟɞɭɸɳɢɯ ɱɟɬɵɪɟɯ ɫɩɨɫɨɛɨɜ: 1. ɂɡɧɚɱɚɥɶɧɨ ɨɬɜɟɫɬɢ ɩɨɞ ɪɚɡɧɨɫɬɢ ɦɚɫɫɢɜ ɷɥɟɦɟɧɬɨɜ ɛɨɥɶɲɟɝɨ ɪɚɡɦɟɪɚ: char A[N]; // ɟɫɥɢ ɩɨɞ ɩɨɥɭɫɭɦɦɵ – 8 ɛɢɬɨɜ, short D[N]; // ɬɨ ɩɨɞ ɪɚɡɧɨɫɬɢ– 9 ɛɢɬɨɜ, ɚ ɪɟɚɥɶɧɨ ɞɚɠɟ 16
2. Ɏɨɪɦɢɪɨɜɚɬɶ ɬɪɟɬɢɣ (ɛɢɬɨɜɵɣ) ɦɚɫɫɢɜ ɫ ɮɥɚɝɚɦɢ ɩɟɪɟɩɨɥɧɟɧɢɣ: D[i]= S[2*i]-S[2*i+1]; //ɫɨɯɪɚɧɢɦ ɪɚɡɧɨɫɬɶ; if(D[i]!=S[2*i]-S[2*i+1]) //ɟɫɥɢ ɧɟ ɯɜɚɬɢɥɨ ɛɢɬɨɜ ɞɥɹ ɡɚɩɢɫɢ, Overflow[i]=1; //ɭɫɬɚɧɨɜɢɦ ɮɥɚɝ ɜ 1 else Overflow[i]=0; //ɢɧɚɱɟ ɟɝɨ ɡɧɚɱɟɧɢɟ – ɧɨɥɶ
3. ɂɫɩɨɥɶɡɨɜɚɬɶ ɬɟɤɭɳɟɟ ɡɧɚɱɟɧɢɟ ɪɚɡɧɨɫɬɢ ɞɥɹ ɜɵɱɢɫɥɟɧɢɹ ɩɨɥɭɫɭɦɦɵ: (4) D[i]= S[2*i]-S[2*i+1]; // ɪɟɚɥɶɧɨ D[i]=(S[2*i]-S[2*i+1])mod(n); A[i]= S[2*i]-D[i]/2; //ɷɬɨ ɩɨɥɭɫɭɦɦɚ, ɟɫɥɢ ɧɟ ɛɵɥɨ ɩɟɪɟɩɨɥɧɟɧɢɹ
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
47
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
4. ɇɚɨɛɨɪɨɬ — ɢɫɩɨɥɶɡɨɜɚɬɶ ɬɟɤɭɳɟɟ ɡɧɚɱɟɧɢɟ ɫɭɦɦɵ ɞɥɹ ɜɵɱɢɫɥɟɧɢɹ ɩɨɥɭɪɚɡɧɨɫɬɢ: (5) A[i]= S[2*i]+S[2*i+1]; // ɪɟɚɥɶɧɨ A[i]=(S[2*i]+S[2*i+1])mod(n); D[i]= S[2*i]-A[i]/2; // ɷɬɨ ɩɨɥɭɪɚɡɧɨɫɬɶ, ɟɫɥɢ ɧɟ ɛɵɥɨ ɩɟɪɟɩɨɥɧɟɧɢɹ
ɍɩɪɚɠɧɟɧɢɟ: Ɇɨɠɧɨ ɥɢ ɢɫɩɨɥɶɡɨɜɚɬɶ ɩɨɥɭɪɚɡɧɨɫɬɢ ɞɥɹ ɜɵɱɢɫɥɟɧɢɹ ɫɭɦɦ? Ⱥ ɩɨɥɭɫɭɦɦɵ ɞɥɹ ɜɵɱɢɫɥɟɧɢɹ ɪɚɡɧɨɫɬɟɣ? ɈȻɊȺɌɇɈȿ ɉɊȿɈȻɊȺɁɈȼȺɇɂȿ
Ɉɛɪɚɬɧɨɟ ɩɪɟɨɛɪɚɡɨɜɚɧɢɟ ɧɢɱɭɬɶ ɧɟ ɫɥɨɠɧɟɟ ɩɪɹɦɨɝɨ: for (i=0; i
// (3`)
ȿɫɥɢ ɢɫɩɨɥɶɡɨɜɚɥɚɫɶ ɡɚɳɢɬɚ ɨɬ ɩɟɪɟɩɨɥɧɟɧɢɹ, ɢ ɛɪɚɥɢɫɶ ɪɚɡɧɨɫɬɢ ɞɥɹ ɜɵɱɢɫɥɟɧɢɹ ɩɨɥɭɫɭɦɦ: S[2*i]= A[i]+D[i]/2; // (4`) S[2*i+1]= S[2*i]-D[i]; // ɪɟɚɥɶɧɨ D[i]=(S[2*i]-S[2*i+1])mod(n)
ɉɍɌɂ ɍɅɍɑɒȿɇɂə ɋɌȿɉȿɇɂ ɋɀȺɌɂə
Ɉɛɳɢɣ ɫɥɭɱɚɣ Ʉ ɩɨɥɭɱɚɟɦɵɦ ɩɨɬɨɤɚɦ ɦɨɠɧɨ ɢ ɞɚɥɶɲɟ ɪɟɤɭɪɫɢɜɧɨ ɩɪɢɦɟɧɹɬɶ ɪɚɡɥɨɠɟɧɢɟ ɧɚ ɩɨɥɭɫɭɦɦɵ (Average) ɢ ɪɚɡɧɨɫɬɢ (Delta). ɉɪɢ ɫɠɚɬɢɢ ɚɧɚɥɨɝɨɜɵɯ ɫɢɝɧɚɥɨɜ, ɤɚɤ ɩɪɚɜɢɥɨ, ɩɨɥɟɡɧɨ ɞɚɥɶɧɟɣɲɟɟ ɪɚɡɥɨɠɟɧɢɟ ɩɨɥɭɫɭɦɦ. ȿɫɬɶ ɞɜɚ ɩɭɬɢ ɫɨɡɞɚɜɚɬɶ ɬɪɢ ɜɵɯɨɞɧɵɯ ɩɨɬɨɤɚ ɢɥɢ ɛɥɨɤɚ:
48
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
1.
Original↓ Average1+Delta1↓ DA+DD
( DA — Average2, ɩɨɥɭɱɚɟɦɚɹ ɩɪɢ ɪɚɡɥɨɠɟɧɢɢ ɪɚɡɧɨɫɬɟɣ Delta1, DD — Delta2, ɩɨɥɭɱɚɟɦɚɹ ɩɪɢ ɪɚɡɥɨɠɟɧɢɢ Delta1. Ⱥɧɚɥɨɝɢɱɧɨ ɫ ɨɫɬɚɥɶɧɵɦɢ ɨɛɨɡɧɚɱɟɧɢɹɦɢ). 2.
Original↓ Average1↓+Delta1 AA+AD
ɉɹɬɶ ɜɚɪɢɚɧɬɨɜ ɫɨɡɞɚɧɢɹ ɱɟɬɵɪɟɯ: 1.
Original↓ Average1+Delta1↓ DA+DD↓ DDD+DDA
2.
Original↓ Average1+Delta1↓ DA↓+DD DAD+DAA
3.
Original1↓ Average1↓ + Delta1↓ AA+AD DA+DD
4.
Original↓ Average↓+Delta AA↓+AD AAA+AAD
5.
Original↓ Average↓+Delta AA+AD↓ Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
49
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ADA+ADD 14 ɜɚɪɢɚɧɬɨɜ ɫɨɡɞɚɧɢɹ ɩɹɬɢ, ɢ ɬɚɤ ɞɚɥɟɟ.
ɍɩɪɚɠɧɟɧɢɟ: ɂɡɨɛɪɚɡɢɬɟ ɷɬɢ 14 ɜɚɪɢɚɧɬɨɜ.
ɉɪɢ ɩɪɢɧɹɬɢɢ ɪɟɲɟɧɢɹ ɨ ɰɟɥɟɫɨɨɛɪɚɡɧɨɫɬɢ ɪɚɡɥɨɠɟɧɢɹ ɧɟɤɨɬɨɪɨɝɨ ɩɨɬɨɤɚ ɢɥɢ ɛɥɨɤɚ S ɧɚ A ɢ D, ɨɤɚɡɵɜɚɟɬɫɹ ɩɨɥɟɡɟɧ ɫɥɟɞɭɸɳɢɣ ɩɪɢɟɦ. Ȼɭɞɟɦ ɡɚɝɥɹɞɵɜɚɬɶ ɧɚ ɧɟɫɤɨɥɶɤɨ ɲɚɝɨɜ ɜɩɟɪɟɞ: ɟɫɥɢ ɧɟɩɨɫɪɟɞɫɬɜɟɧɧɵɟ ɪɟɡɭɥɶɬɚɬɵ ɪɚɡɥɨɠɟɧɢɹ A ɢ D ɫɠɢɦɚɟɦɵ ɫɭɦɦɚɪɧɨ ɯɭɠɟ, ɱɟɦ ɢɫɯɨɞɧɵɣ S, ɦɨɠɟɬ ɨɤɚɡɚɬɶɫɹ, ɱɬɨ ɟɫɥɢ ɪɚɡɥɨɠɢɬɶ ɞɚɥɶɲɟ A ɢ/ɢɥɢ D, ɬɨ ɬɨɥɶɤɨ ɬɨɝɞɚ ɪɟɡɭɥɶɬɚɬ — ɬɪɢ ɢɥɢ ɱɟɬɵɪɟ ɩɨɬɨɤɚ, ɩɨ ɤɨɬɨɪɵɦ ɜɨɫɫɬɚɧɨɜɢɦ S, — ɫɠɢɦɚɟɦ ɥɭɱɲɟ, ɱɟɦ S. ȿɫɥɢ ɠɟ ɢ ɷɬɢ AA, AD, DA, DD ɞɚɸɬ ɜ ɫɭɦɦɟ ɯɭɞɲɟɟ ɫɠɚɬɢɟ, ɡɚɝɥɹɧɟɦ ɟɳɟ ɧɚ ɲɚɝ ɜɩɟɪɟɞ, ɬɨ ɟɫɬɶ ɩɨɩɵɬɚɟɦɫɹ ɪɚɡɥɨɠɢɬɶ ɷɬɢ ɜɬɨɪɢɱɧɵɟ ɪɟɡɭɥɶɬɚɬɵ, ɢ ɬɚɤ ɞɚɥɟɟ, ɩɨɤɚ ɝɥɭɛɢɧɚ ɬɚɤɨɝɨ ɩɪɨɫɦɨɬɪɚ ɧɟ ɞɨɫɬɢɝɧɟɬ ɡɚɞɚɧɧɨɝɨ ɩɪɟɞɟɥɚ, ɢɥɢ ɠɟ ɞɚɥɶɧɟɣɲɟɟ ɪɚɡɥɨɠɟɧɢɟ ɨɤɚɠɟɬɫɹ ɧɟɜɨɡɦɨɠɧɵɦ ɢɡ-ɡɚ ɭɦɟɧɶɲɟɧɢɹ ɞɥɢɧ ɜ ɞɜɚ ɪɚɡɚ ɧɚ ɤɚɠɞɨɦ ɲɚɝɟ. ȿɳɟ ɨɞɧɨ ɭɫɥɨɠɧɟɧɢɟ — ɩɨɢɫɤ ɝɪɚɧɢɰ ɮɪɚɝɦɟɧɬɨɜ ɩɨɬɨɤɚ, ɪɚɡɛɢɜɚɸɳɢɯ ɟɝɨ ɧɚ ɬɚɤɢɟ ɛɥɨɤɢ, ɱɬɨɛɵ ɢɯ ɞɚɥɶɧɟɣɲɟɟ ɫɭɛɩɨɥɨɫɧɨɟ ɤɨɞɢɪɨɜɚɧɢɟ ɞɚɜɚɥɨ ɥɭɱɲɟɟ ɫɠɚɬɢɟ. ɉɪɢ ɫɠɚɬɢɢ ɩɚɪɚɥɥɟɥɶɧɵɯ ɩɨɬɨɤɨɜ ȿɫɥɢ ɢɦɟɟɦ ɞɜɚ ɩɚɪɚɥɥɟɥɶɧɵɯ ɩɨɬɨɤɚ X ɢ Y, ɤɚɠɞɚɹ ɩɚɪɚ (Xi, Yi) ɨɩɢɫɵɜɚɟɬ ɨɞɢɧ ɨɛɴɟɤɬ. ɇɚɩɪɢɦɟɪ, Xi — ɚɞɪɟɫ, ɚ Yi — ɞɥɢɧɚ, ɢɥɢ ɠɟ X — ɭɝɨɥ, Y — ɪɚɫɫɬɨɹɧɢɟ. ȼ ɫɥɭɱɚɟ «ɚɧɚɥɨɝɨɜɵɣ ɫɢɝɧɚɥ» ɩɚɪɚ (Xi,Yi) ɨɬɧɨɫɢɬɫɹ ɤ ɨɞɧɨɦɭ ɦɨɦɟɧɬɭ ɜɪɟɦɟɧɢ ti. ɑɢɫɥɨ ɩɨɬɨɤɨɜ ɢ ɢɯ ɞɥɢɧɚ N ɨɫɬɚɸɬɫɹ ɧɟɢɡɦɟɧɧɵɦɢ. Ɇɨɠɧɨ ɨɫɬɚɜɥɹɬɶ ɨɞɢɧ ɢɡ ɞɜɭɯ ɢɫɯɨɞɧɵɯ ɩɨɬɨɤɨɜ ɜɦɟɫɬɨ ɩɨɬɨɤɚ ɫ ɩɨɥɭɫɭɦɦɚɦɢ (ɚ ɩɪɢ ɫɠɚɬɢɢ ɫ ɩɨɬɟɪɹɦɢ ɢ ɜɦɟɫɬɨ ɪɚɡɧɨɫɬɟɣ): X+D ɢɥɢ Y+D, ɜɦɟɫɬɨ A+D. 50
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
Ɍɟɩɟɪɶ ɦɨɠɧɨ ɢɫɤɚɬɶ ɝɪɚɧɢɰɵ ɬɚɤɢɯ ɛɥɨɤɨɜ, ɜɧɭɬɪɢ ɤɨɬɨɪɵɯ ɨɞɢɧ ɢɡ ɷɬɢɯ ɱɟɬɵɪɟɯ ɜɚɪɢɚɧɬɨɜ X+Y, X+D, Y+D, A+D ɫɭɳɟɫɬɜɟɧɧɨ ɜɵɝɨɞɧɟɟ ɨɫɬɚɥɶɧɵɯ ɬɪɟɯ. Ɂɚɦɟɬɢɦ, ɱɬɨ ɩɪɢɦɟɧɟɧɢɟ LPC, ɜ ɬɨɦ ɱɢɫɥɟ Ⱦɟɥɶɬɚɤɨɞɢɪɨɜɚɧɢɹ, ɤ ɩɨɬɨɤɭ ɩɨɥɭɫɭɦɦ A ɜɵɝɨɞɧɟɟ, ɱɟɦ ɤ X ɢ/ɢɥɢ Y: ɩɟɪɜɚɹ ɩɪɨɢɡɜɨɞɧɚɹ ɩɨɬɨɤɚ ɫ ɩɨɥɭɫɭɦɦɚɦɢ A`[i] ɧɟ ɩɪɟɜɨɫɯɨɞɢɬ (ɩɨ ɚɛɫɨɥɸɬɧɨɦɭ ɡɧɚɱɟɧɢɸ) ɦɚɤɫɢɦɭɦɚ ɩɟɪɜɵɯ ɩɪɨɢɡɜɨɞɧɵɯ X`[i] ɢ Y`[i]: A`i = Ai+1–Ai = (Xi+1+Yi+1–αi+1) /2 – (Xi+Yi–αi)/2 , (6.6) «ɢɡɞɟɪɠɤɢ ɨɤɪɭɝɥɟɧɢɹ» αk ɪɚɜɧɵ ɟɞɢɧɢɰɟ, ɟɫɥɢ ɫɭɦɦɚ ɫɨɨɬɜɟɬɫɬɜɭɸɳɢɯ Xk+Yk ɧɟɱɟɬɧɚ, ɚ ɚɪɢɮɦɟɬɢɤɚ ɢɫɩɨɥɶɡɭɟɬɫɹ ɰɟɥɨɱɢɫɥɟɧɧɚɹ; ɢɧɚɱɟ αk=0. A`i = (Xi+1–Xi +Yi+1–Yi +αi –αi+1) /2 = ( X`i+Y`i + αi–αi+1) /2. (6.7) Ɍɚɤɢɦ ɨɛɪɚɡɨɦ, ɡɧɚɱɟɧɢɟ A`i ɥɟɠɢɬ ɜɧɭɬɪɢ ɢɧɬɟɪɜɚɥɚ [X`i ,Y`i]. Ɂɧɚɱɟɧɢɟ
X` A` Y` ȼɪɟɦɹ
Ɋɢɫ. 2.2. ɡɧɚɱɟɧɢɟ A`I ɥɟɠɢɬ ɜɧɭɬɪɢ ɢɧɬɟɪɜɚɥɚ [X`i ,Y`i] Ɂɚɦɟɬɢɦ ɬɚɤɠɟ, ɱɬɨ (ɩɪɢ ɢɫɩɨɥɶɡɨɜɚɧɢɢ ɰɟɥɨɱɢɫɥɟɧɧɨɣ ɚɪɢɮɦɟɬɢɤɢ ɢɡ-ɡɚ ɨɤɪɭɝɥɟɧɢɣ) ɜɚɠɟɧ ɩɨɪɹɞɨɤ ɞɟɣɫɬɜɢɣ: ɞɟɥɶɬɚɤɨɞɢɪɨɜɚɧɢɟ ɩɨɬɨɤɚ ɩɨɥɭɫɭɦɦ A ɞɚɫɬ ɞɪɭɝɨɣ ɪɟɡɭɥɶɬɚɬ, ɱɟɦ ɩɨ-
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
51
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɥɭɫɭɦɦɚ ɪɟɡɭɥɶɬɚɬɨɜ ɞɟɥɶɬɚ-ɤɨɞɢɪɨɜɚɧɢɹ X ɢ Y: ɜ ɩɟɪɜɨɦ ɫɥɭɱɚɟ (6.6) ɢ (6.7), ɜɨ ɜɬɨɪɨɦ A``i = ( X`i+Y`i ) /2 . ȿɫɥɢ ɫɭɦɦɚ (X`i+Y`i) ɧɟɱɟɬɧɚ, ɚ αi–αi+1=1, ɬɨ A`i ≠ A``i, A`i=A``i+1. ɇɚɩɪɢɦɟɪ, ɟɫɥɢ Xi=0, Xi+1=Yi=Yi+1=1, ɬɨ A`i =1 (ɩɨ ɮɨɪɦɭɥɟ (6.6)), ɚ A``i=(1+0)/2=0. ȿɫɥɢ ɩɨɬɨɤɨɜ ɛɨɥɟɟ ɞɜɭɯ, ɧɚɩɪɢɦɟɪ, ɩɹɬɶ (ɫɠɚɬɢɟ ɢɦɟɧɧɨ ɩɹɬɢɤɚɧɚɥɶɧɨɝɨ ɡɜɭɤɚ ɫɬɚɧɨɜɢɬɫɹ ɜɫɟ ɚɤɬɭɚɥɶɧɟɟ), ɜɨɡɧɢɤɚɟɬ ɡɚɞɚɱɚ ɧɚɯɨɠɞɟɧɢɹ ɨɩɬɢɦɚɥɶɧɵɯ ɩɚɪ ɞɥɹ ɩɪɢɦɟɧɟɧɢɹ ɤ ɧɢɦ ɫɭɛɩɨɥɨɫɧɨɝɨ ɤɨɞɢɪɨɜɚɧɢɹ. Ɂɞɟɫɶ ɬɨɠɟ ɜɨɡɦɨɠɧɵ ɨɛɚ ɜɵɲɟɨɩɢɫɚɧɧɵɯ ɩɪɢɟɦɚ: ɢ «ɩɪɨɫɦɨɬɪ ɧɚ ɧɟɫɤɨɥɶɤɨ ɲɚɝɨɜ ɜɩɟɪɟɞ», ɟɳɟ ɛɨɥɟɟ ɭɫɥɨɠɧɟɧɧɵɣ, ɢ «ɩɨɢɫɤ ɝɪɚɧɢɰ ɢɧɬɟɪɜɚɥɨɜ ɜɪɟɦɟɧɢ», ɨɩɬɢɦɚɥɶɧɵɯ ɞɥɹ ɜɵɞɟɥɹɟɦɵɯ ɡɚɬɟɦ ɩɚɪ. ɇɚɩɪɢɦɟɪ, ɦɨɠɟɬ ɜɵɹɫɧɢɬɶɫɹ, ɱɬɨ ɫɠɚɬɢɟ ɫɭɳɟɫɬɜɟɧɧɨ ɥɭɱɲɟ, ɟɫɥɢ ɢɫɩɨɥɶɡɨɜɚɬɶ ɡɧɚɧɢɟ ɬɨɝɨ, ɱɬɨ ɧɚ ɢɧɬɟɪɜɚɥɟ ɦɟɠɞɭ 32765-ɵɦ ɢ 53867-ɵɦ ɷɥɟɦɟɧɬɚɦɢ ɨɱɟɧɶ ɛɥɢɡɤɢ ɩɟɪɜɚɹ ɪɚɡɧɨɫɬɶ (ɩɪɢ ɩɟɪɜɨɦ ɪɚɡɥɨɠɟɧɢɢ) ɜɧɭɬɪɢ ɩɨɥɭɫɭɦɦɵ (1,4), ɬɨ ɟɫɬɶ ɩɨɥɭɫɭɦɦɵ 1-ɝɨ ɩɨɬɨɤɚ ɫ 4-ɵɦ, ɢ ɩɟɪɜɚɹ ɪɚɡɧɨɫɬɶ ɜɧɭɬɪɢ ɩɨɥɭɫɭɦɦɵ (3,7). Ⱦɜɭɦɟɪɧɵɣ ɫɥɭɱɚɣ Ɋɚɧɶɲɟ ɧɚ ɤɚɠɞɨɦ ɷɬɚɩɟ ɦɨɠɧɨ ɛɵɥɨ ɩɪɢɧɹɬɶ ɨɞɧɨ ɢɡ ɞɜɭɯ ɪɟɲɟɧɢɣ: ɩɪɢɦɟɧɢɬɶ SC-ɩɪɟɨɛɪɚɡɨɜɚɧɢɟ ɤ ɛɥɨɤɭ, ɢɥɢ ɧɟ ɩɪɢɦɟɧɹɬɶ. Ɍɟɩɟɪɶ ɠɟ — ɨɞɧɨ ɢɡ ɩɹɬɢ: 1. ɩɪɢɦɟɧɢɬɶ SC ɤ ɫɬɪɨɤɚɦ ɛɥɨɤɚ; 2. ɩɪɢɦɟɧɢɬɶ SC ɤ ɫɬɨɥɛɰɚɦ ɛɥɨɤɚ; 3. ɩɪɢɦɟɧɢɬɶ SC ɤ ɫɬɪɨɤɚɦ ɛɥɨɤɚ, ɚ ɡɚɬɟɦ ɤ ɫɬɨɥɛɰɚɦ; 4. ɩɪɢɦɟɧɢɬɶ SC ɤ ɫɬɨɥɛɰɚɦ ɛɥɨɤɚ, ɚ ɡɚɬɟɦ ɤ ɫɬɪɨɤɚɦ; 5. ɧɟ ɩɪɢɦɟɧɹɬɶ SC ɤ ɛɥɨɤɭ ɜɨɨɛɳɟ. 3 ɢ 4 ɧɟ ɫɨɜɫɟɦ ɷɤɜɢɜɚɥɟɧɬɧɵ ɩɪɢ ɢɫɩɨɥɶɡɨɜɚɧɢɢ ɰɟɥɨɱɢɫɥɟɧɧɨɣ ɚɪɢɮɦɟɬɢɤɢ ɢɡ-ɡɚ ɨɤɪɭɝɥɟɧɢɣ, ɧɨ ɦɚɬɟɦɚɬɢɱɟɫɤɨɟ ɨɠɢɞɚɧɢɟ ɪɚɫɯɨɠɞɟɧɢɹ ɢɯ ɪɟɡɭɥɶɬɚɬɨɜ ɪɚɜɧɨ ɧɭɥɸ.
52
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
AA2
DA2 DȺ1
AD2
DD2
ȺD1
DD1
Ɋɢɫ. 2.3. ȼɚɪɢɚɧɬ ɩɪɢɦɟɧɟɧɢɹ SC ɜ ɞɜɭɦɟɪɧɨɦ ɫɥɭɱɚɟ ɉɪɢ ɫɠɚɬɢɢ ɚɧɚɥɨɝɨɜɵɯ ɫɢɝɧɚɥɨɜ ɉɨɹɜɥɹɸɬɫɹ ɞɨɩɨɥɧɢɬɟɥɶɧɵɟ ɜɨɡɦɨɠɧɨɫɬɢ: • ɫɠɢɦɚɹ ɫ ɩɨɬɟɪɹɦɢ, ɨɤɪɭɝɥɹɬɶ ɫ ɡɚɞɚɧɧɨɣ ɬɨɱɧɨɫɬɶɸ: ɧɚ ɤɚɠɞɨɦ ɲɚɝɟ SC ɢ/ɢɥɢ ɩɨɫɥɟ ɜɫɟɯ ɷɬɚɩɨɜ SC; • ɫɨɯɪɚɧɹɬɶ ɬɨɥɶɤɨ ɡɚɞɚɧɧɭɸ ɫɭɛɩɨɥɨɫɭ, ɦɧɨɝɨɤɪɚɬɧɨ ɩɪɢɦɟɧɹɹ SC-ɪɚɡɥɨɠɟɧɢɟ ɢ ɨɫɬɚɜɥɹɹ ɬɨɥɶɤɨ ɜɟɪɯɧɸɸ ɩɨɥɨɜɢɧɭ ɱɚɫɬɨɬ (ɪɚɡɧɨɫɬɢ) ɥɢɛɨ ɧɢɠɧɸɸ (ɩɨɥɭɫɭɦɦɵ); • ɢɫɩɨɥɶɡɨɜɚɬɶ ɞɢɫɤɪɟɬɧɨɟ ɜɷɣɜɥɟɬɧɨɟ ɩɪɟɨɛɪɚɡɨɜɚɧɢɟ ɞɥɹ ɧɚɯɨɠɞɟɧɢɹ ɧɢɡɤɨɱɚɫɬɨɬɧɨɣ ɢ ɜɵɫɨɤɨɱɚɫɬɨɬɧɨɣ ɤɨɦɩɨɧɟɧɬ. Ⱦɢɫɤɪɟɬɧɨɟ ɜɷɣɜɥɟɬɧɨɟ ɩɪɟɨɛɪɚɡɨɜɚɧɢɟ Ⱦȼɉ ɨɬɥɢɱɚɟɬɫɹ ɨɬ SC ɥɢɲɶ ɬɟɦ, ɱɬɨ ɜ ɧɟɦ ɞɥɹ ɜɵɱɢɫɥɟɧɢɹ ɧɢɡɤɨ- ɢ ɜɵɫɨɤɨɱɚɫɬɨɬɧɨɣ ɤɨɦɩɨɧɟɧɬ ɢɫɩɨɥɶɡɭɟɬɫɹ ɧɟ ɞɜɚ ɫɨɫɟɞɧɢɯ ɷɥɟɦɟɧɬɚ ɫɢɝɧɚɥɚ, ɚ ɩɪɨɢɡɜɨɥɶɧɨɟ ɡɚɞɚɜɚɟɦɨɟ ɱɢɫɥɨ ɷɥɟɦɟɧɬɨɜ D>2. ɉɪɢɱɟɦ, ɜ ɨɬɥɢɱɢɟ ɨɬ ɞɪɭɝɢɯ ɤɨɧɬɟɤɫɬɧɵɯ ɦɟɬɨɞɨɜ, ɜ ɱɚɫɬɧɨɫɬɢ LPC, ɤɨɧɬɟɤɫɬ ɷɥɟɦɟɧɬɚ S[x] ɫɨɫɬɨɢɬ ɢɡ ɷɥɟɦɟɧɬɨɜ ɩɨ ɨɛɟ ɫɬɨɪɨɧɵ ɨɬ ɧɟɝɨ: S[x+i] ɢ S[x–i], i=1,2,3,…,D/2. Ɉɫɧɨɜɧɚɹ ɠɟ ɢɞɟɹ — ɬɚ ɠɟ, ɱɬɨ ɜ SC: ɫɮɨɪɦɢɪɨɜɚɬɶ ɞɜɚ ɩɨɬɨɤɚ — ɫ ɧɢɡɤɢɦɢ H[x] ɢ ɜɵɫɨɤɢɦɢ ɱɚɫɬɨɬɚɦɢ L[x] — ɬɚɤ, ɱɬɨɛɵ ɩɨ ɩɨɥɨɜɢɧɟ ɡɧɚɱɟɧɢɣ H[x] ɢ ɩɨɥɨɜɢɧɟ ɡɧɚɱɟɧɢɣ L[x] ɦɨɠɧɨ Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
53
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɛɵɥɨ ɜɨɫɫɬɚɧɨɜɢɬɶ ɢɫɯɨɞɧɵɣ ɩɨɬɨɤ S[x]. Ɉɫɬɚɜɥɹɸɬɫɹ ɥɢɛɨ ɱɟɬɧɵɟ H[2·x] ɢ ɧɟɱɟɬɧɵɟ L[2·x+1], ɥɢɛɨ ɧɚɨɛɨɪɨɬ. ɉɪɢ ɪɚɡɠɚɬɢɢ ɫɧɚɱɚɥɚ ɩɨ H[2·x] ɢ L[2·x+1] ɜɨɫɫɬɚɧɚɜɥɢɜɚɟɦ ɱɟɬɧɵɟ S[2·x], ɡɚɬɟɦ ɩɨ S[2·x] ɢ L[2·x+1] ɧɚɯɨɞɢɦ ɧɟɱɟɬɧɵɟ S[2·x+1]. ȿɫɥɢ D=3, L[x]=S[x]–(S[x–1]+S[x+1])/2, H[x]=S[x]+hi(x). Ɏɭɧɤɰɢɹ hi(S[i]) ɞɨɥɠɧɚ ɛɵɬɶ ɜɵɛɪɚɧɚ ɬɚɤ, ɱɬɨɛɵ ɨɧɚ ɛɵɥɚ ɜɵɪɚɠɚɟɦɚ ɱɟɪɟɡ L[x+j], j=2k+1. ɇɚɩɪɢɦɟɪ, hi1(x)=(L[x–1]+L[x+1])/2, hi2(x)=(L[x–1]+L[x+1])/4, hi3(x)= –(L[x–1]+L[x+1])/2, hi4(x)= –(L[x–1]+L[x+1])/4, hi5(x)=(L[x–3]+L[x–1]+L[x+1]+L[x+3])/4, ɢ ɬɚɤ ɞɚɥɟɟ. ȼɨɡɶɦɟɦ ɜɬɨɪɭɸ ɮɭɧɤɰɢɸ hi2 (ɢɦɟɧɧɨ ɷɬɨɬ ɜɚɪɢɚɧɬ ɢɫɩɨɥɶɡɭɟɬɫɹ ɜ ɚɥɝɨɪɢɬɦɟ JPEG 2000) ɢ ɩɨɫɦɨɬɪɢɦ, ɤɚɤɢɦ ɨɛɪɚɡɨɦ H ɜɵɪɚɠɚɟɬɫɹ ɱɟɪɟɡ S. H[x]=S[x]+(L[x–1]+L[x+1])/4 = =S[x]+ ( S[x–1] – (S[x–2]+S[x])/2 + S[x+1] – (S[x]+S[x+2])/2 ) /4 =S[x]+ ( 2·S[x–1] – S[x–2] – S[x] + 2·S[x+1] – S[x] – S[x+2] ) /8 =( –S[x–2] + 2·S[x–1] + 6·S[x] + 2·S[x+1] – S[x+2] ) /8. Ⱦȼɉ ɨɛɵɱɧɨ ɡɚɞɚɟɬɫɹ ɜ ɜɢɞɟ ɧɚɛɨɪɚ ɤɨɷɮɮɢɰɢɟɧɬɨɜ, ɜ ɞɚɧɧɨɦ ɫɥɭɱɚɟ (–1/8, 2/8, 6/8, 2/8, –1/8). Ƚɪɚɮɢɱɟɫɤɢ ɷɬɨ ɜɵɝɥɹɞɢɬ ɬɚɤ:
54
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
6/8
2/8
0
-1/8
Ɋɢɫ. 2.4. Ⱦȼɉ ɞɥɹ ɧɚɛɨɪɚ ɤɨɷɮɮɢɰɢɟɧɬɨɜ (–1/8, 2/8, 6/8, 2/8, –1/8)
1
0 -1/2 Ɋɢɫ. 2.5. Ⱦȼɉ ɞɥɹ ɧɚɛɨɪɚ ɤɨɷɮɮɢɰɢɟɧɬɨɜ (–1/2, 1, –1/2)
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
55
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɍɩɪɚɠɧɟɧɢɟ: Ʉɚɤɢɦ ɛɭɞɟɬ ɧɚɛɨɪ ɤɨɷɮɮɢɰɢɟɧɬɨɜ, ɟɫɥɢ ɢɫɩɨɥɶɡɭɟɦ hi5(L[i])?
ɂɬɚɤ, ɩɪɢ ɬɚɤɨɦ ɩɨɫɬɪɨɟɧɢɢ ɜɷɣɜɥɟɬ-ɮɢɥɶɬɪɨɜ, ɮɨɪɦɢɪɭɟɬɫɹ ɞɜɚ ɜɵɯɨɞɧɵɯ ɩɨɬɨɤɚ: L[2·x+1]=S[2·x+1]+lo(S[2·x+j]), j — ɱɟɬɧɵɟ: j= ±2k, (6.8) H[2·x]=S[2·x]+hi(L[2·x+i]), i — ɧɟɱɟɬɧɵɟ: i= ±(2m+1). ȿɫɥɢ ɫɠɢɦɚɟɦ ɫ ɩɨɬɟɪɹɦɢ, ɮɭɧɤɰɢɹ lo ɦɨɠɟɬ ɢɫɩɨɥɶɡɨɜɚɬɶ ɥɸɛɵɟ S[x], ɚ ɧɟ ɬɨɥɶɤɨ ɱɟɬɧɵɟ. Ɉɛɪɚɬɧɨɟ ɩɪɟɨɛɪɚɡɨɜɚɧɢɟ: ɫɧɚɱɚɥɚ ɧɚɣɞɟɦ ɜɫɟ ɱɟɬɧɵɟ ɷɥɟɦɟɧɬɵ: S[2·x]=H[2·x] – hi(L[2·x+i]), i — ɧɟɱɟɬɧɵɟ; ɡɚɬɟɦ, ɧɚ ɨɫɧɨɜɚɧɢɢ ɧɚɣɞɟɧɧɵɯ ɱɟɬɧɵɯ, ɜɨɫɫɬɚɧɨɜɢɦ ɜɫɟ ɧɟɱɟɬɧɵɟ ɷɥɟɦɟɧɬɵ: S[2·x+1]=L[2·x+1] – lo(S[2·x+j]), j — ɱɟɬɧɵɟ. ȿɫɥɢ, ɧɚɨɛɨɪɨɬ, ɛɟɪɟɦ ɱɟɬɧɵɟ L ɢ ɧɟɱɟɬɧɵɟ H — ɷɬɨ ɧɢɱɟɝɨ ɩɨ ɫɭɬɢ ɧɟ ɦɟɧɹɟɬ. Ɂɚɦɟɬɢɦ, ɱɬɨ ɩɪɢ ɫɠɚɬɢɢ ɫ ɩɨɬɟɪɹɦɢ ɫɭɳɟɫɬɜɭɟɬ ɢ ɚɥɶɬɟɪɧɚɬɢɜɧɵɣ ɩɭɬɶ. ȼ ɩɪɹɦɨɦ ɩɪɟɨɛɪɚɡɨɜɚɧɢɢ ɫɧɚɱɚɥɚ ɜɵɱɢɫɥɹɟɬɫɹ H[2·x+1]=C·S[2·x+1]+hi(S[2·x+j]), j — ɱɟɬɧɵɟ: j= ±2k, 0
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɏɚɪɚɤɬɟɪɢɫɬɢɤɢ ɦɟɬɨɞɨɜ ɫɟɦɟɣɫɬɜɚ SC: ɋɬɟɩɟɧɶ ɫɠɚɬɢɹ: ɭɜɟɥɢɱɢɜɚɟɬɫɹ ɨɛɵɱɧɨ ɜ 1.1 ... 1.9 ɪɚɡɚ. Ɍɢɩɵ ɞɚɧɧɵɯ: ɦɟɬɨɞɵ ɩɪɟɞɧɚɡɧɚɱɟɧɵ ɞɥɹ ɫɠɚɬɢɹ ɤɨɥɢɱɟɫɬɜɟɧɧɵɯ ɞɚɧɧɵɯ. ɋɢɦɦɟɬɪɢɱɧɨɫɬɶ ɩɨ ɫɤɨɪɨɫɬɢ: ɜ ɨɛɳɟɦ ɫɥɭɱɚɟ 1:1. ɏɚɪɚɤɬɟɪɧɵɟ ɨɫɨɛɟɧɧɨɫɬɢ: ɦɨɠɟɬ ɛɵɬɶ ɰɟɥɟɫɨɨɛɪɚɡɧɨ ɦɧɨɝɨɤɪɚɬɧɨɟ ɩɪɢɦɟɧɟɧɢɟ.
Ƚɥɚɜɚ 3. ɋɥɨɜɚɪɧɵɟ ɦɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ ɂɞɟɹ ɫɥɨɜɚɪɧɵɯ ɦɟɬɨɞɨɜ ȼɯɨɞɧɭɸ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɶ ɫɢɦɜɨɥɨɜ ɦɨɠɧɨ ɪɚɫɫɦɚɬɪɢɜɚɬɶ ɤɚɤ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɶ ɫɬɪɨɤ, ɫɨɞɟɪɠɚɳɢɯ ɩɪɨɢɡɜɨɥɶɧɨɟ ɤɨɥɢɱɟɫɬɜɨ ɫɢɦɜɨɥɨɜ. ɂɞɟɹ ɫɥɨɜɚɪɧɵɯ ɦɟɬɨɞɨɜ ɫɨɫɬɨɢɬ ɜ ɡɚɦɟɧɟ ɫɬɪɨɤ ɫɢɦɜɨɥɨɜ ɧɚ ɬɚɤɢɟ ɤɨɞɵ, ɱɬɨ ɢɯ ɦɨɠɧɨ ɬɪɚɤɬɨɜɚɬɶ ɤɚɤ ɢɧɞɟɤɫɵ ɫɬɪɨɤ ɧɟɤɨɬɨɪɨɝɨ ɫɥɨɜɚɪɹ. Ɉɛɪɚɡɭɸɳɢɟ ɫɥɨɜɚɪɶ ɫɬɪɨɤɢ ɛɭɞɟɦ ɞɚɥɟɟ ɧɚɡɵɜɚɬɶ ɮɪɚɡɚɦɢ. ɉɪɢ ɞɟɤɨɞɢɪɨɜɚɧɢɢ ɨɫɭɳɟɫɬɜɥɹɟɬɫɹ ɨɛɪɚɬɧɚɹ ɡɚɦɟɧɚ ɢɧɞɟɤɫɚ ɧɚ ɫɨɨɬɜɟɬɫɬɜɭɸɳɭɸ ɟɦɭ ɮɪɚɡɭ ɫɥɨɜɚɪɹ. Ɇɨɠɧɨ ɫɤɚɡɚɬɶ, ɱɬɨ ɦɵ ɩɵɬɚɟɦɫɹ ɩɪɟɨɛɪɚɡɨɜɚɬɶ ɢɫɯɨɞɧɭɸ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɶ ɩɭɬɟɦ ɟɟ ɩɪɟɞɫɬɚɜɥɟɧɢɹ ɜ ɬɚɤɨɦ ɚɥɮɚɜɢɬɟ, ɱɬɨ ɟɝɨ «ɛɭɤɜɵ» ɹɜɥɹɸɬɫɹ ɮɪɚɡɚɦɢ ɫɥɨɜɚɪɹ, ɫɨɫɬɨɹɳɢɦɢ, ɜ ɨɛɳɟɦ ɫɥɭɱɚɟ, ɢɡ ɩɪɨɢɡɜɨɥɶɧɨɝɨ ɤɨɥɢɱɟɫɬɜɚ ɫɢɦɜɨɥɨɜ ɜɯɨɞɧɨɣ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ. ɋɥɨɜɚɪɶ — ɷɬɨ ɧɚɛɨɪ ɬɚɤɢɯ ɮɪɚɡ, ɤɨɬɨɪɵɟ, ɤɚɤ ɦɵ ɩɨɥɚɝɚɟɦ, ɛɭɞɭɬ ɜɫɬɪɟɱɚɬɶɫɹ ɜ ɨɛɪɚɛɚɬɵɜɚɟɦɨɣ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ. ɂɧɞɟɤɫɵ ɮɪɚɡ ɞɨɥɠɧɵ ɛɵɬɶ ɩɨɫɬɪɨɟɧɵ ɬɚɤɢɦ ɨɛɪɚɡɨɦ, ɱɬɨɛɵ ɜ Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
57
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɫɪɟɞɧɟɦ ɢɯ ɩɪɟɞɫɬɚɜɥɟɧɢɟ ɡɚɧɢɦɚɥɨ ɦɟɧɶɲɟ ɦɟɫɬɚ, ɱɟɦ ɬɪɟɛɭɸɬ ɡɚɦɟɳɚɟɦɵɟ ɫɬɪɨɤɢ. Ɂɚ ɫɱɟɬ ɷɬɨɝɨ ɢ ɩɪɨɢɫɯɨɞɢɬ ɫɠɚɬɢɟ. ɍɦɟɧɶɲɟɧɢɟ ɪɚɡɦɟɪɚ ɜɨɡɦɨɠɧɨ ɜ ɩɟɪɜɭɸ ɨɱɟɪɟɞɶ ɡɚ ɫɱɟɬ ɬɨɝɨ, ɱɬɨ ɨɛɵɱɧɨ ɜ ɫɠɢɦɚɟɦɵɯ ɞɚɧɧɵɯ ɜɫɬɪɟɱɚɟɬɫɹ ɥɢɲɶ ɦɚɥɚɹ ɬɨɥɢɤɚ ɜɫɟɯ ɜɨɡɦɨɠɧɵɯ ɫɬɪɨɤ ɞɥɢɧɵ n, ɩɨɷɬɨɦɭ ɞɥɹ ɩɪɟɞɫɬɚɜɥɟɧɢɹ ɢɧɞɟɤɫɚ ɮɪɚɡɵ ɬɪɟɛɭɟɬɫɹ, ɤɚɤ ɩɪɚɜɢɥɨ, ɦɟɧɶɲɟɟ ɱɢɫɥɨ ɛɢɬɨɜ, ɱɟɦ ɞɥɹ ɩɪɟɞɫɬɚɜɥɟɧɢɹ ɢɫɯɨɞɧɨɣ ɫɬɪɨɤɢ. ɇɚɩɪɢɦɟɪ, ɪɚɫɫɦɨɬɪɢɦ ɤɨɥɢɱɟɫɬɜɨ ɜɡɚɢɦɧɨ ɪɚɡɥɢɱɧɵɯ ɫɬɪɨɤ ɞɥɢɧɵ ɨɬ 1 ɞɨ 5 ɜ ɬɟɤɫɬɟ ɧɚ ɪɭɫɫɤɨɦ ɹɡɵɤɟ (ɪɨɦɚɧ Ɏ.Ɇ. Ⱦɨɫɬɨɟɜɫɤɨɝɨ «Ȼɟɫɵ», ɨɛɵɱɧɵɣ ɧɟɮɨɪɦɚɬɢɪɨɜɚɧɧɵɣ ɬɟɤɫɬ, ɪɚɡɦɟɪ ɨɤɨɥɨ 1.3 Ɇɛɚɣɬ): Ⱦɥɢɧɚ ɫɬɪɨɤɢ 5 4 3 2 1
Ʉɨɥɢɱɟɫɬɜɨ ɪɚɡɥɢɱɧɵɯ ɫɬɪɨɤ 196969 72882 17481 2536 136
ɂɫɩɨɥɶɡɨɜɚɧɨ ɤɨɦɛɢɧɚɰɢɣ, % ɨɬ ɜɫɟɯ ɜɨɡɦɨɠɧɵɯ 0.0004 0.0213 0.6949 13.7111 100.0000
ɂɧɚɱɟ ɝɨɜɨɪɹ, ɪɚɡɦɟɪ (ɦɨɳɧɨɫɬɶ) ɚɥɮɚɜɢɬɚ ɪɚɜɟɧ 136 ɫɢɦɜɨɥɚɦ, ɧɨ ɪɟɚɥɶɧɨ ɢɫɩɨɥɶɡɭɟɬɫɹ ɬɨɥɶɤɨ 2536/(136·136)·100% § 13.7 % ɨɬ ɜɫɟɯ ɜɨɡɦɨɠɧɵɯ ɞɜɭɯɫɢɦɜɨɥɶɧɵɯ ɫɬɪɨɤ, ɢ ɬ.ɞ. Ⱦɚɥɟɟ, ɟɫɥɢ ɭ ɧɚɫ ɟɫɬɶ ɡɚɫɥɭɠɢɜɚɸɳɢɟ ɞɨɜɟɪɢɹ ɝɢɩɨɬɟɡɵ ɨ ɱɚɫɬɨɬɟ ɢɫɩɨɥɶɡɨɜɚɧɢɹ ɬɟɯ ɢɥɢ ɢɧɵɯ ɮɪɚɡ, ɥɢɛɨ ɩɪɨɜɨɞɢɥɫɹ ɤɚɤɨɣ-ɬɨ ɱɚɫɬɨɬɧɵɣ ɚɧɚɥɢɡ ɨɛɪɚɛɚɬɵɜɚɟɦɵɯ ɞɚɧɧɵɯ, ɬɨ ɦɵ ɦɨɠɟɦ ɧɚɡɧɚɱɢɬɶ ɛɨɥɟɟ ɜɟɪɨɹɬɧɵɦ ɮɪɚɡɚɦ ɤɨɞɵ ɦɟɧɶɲɟɣ ɞɥɢɧɵ. ɇɚɩɪɢɦɟɪ, ɞɥɹ ɬɨɣ ɠɟ ɷɥɟɤɬɪɨɧɧɨɣ ɜɟɪɫɢɢ ɪɨɦɚɧɚ «Ȼɟɫɵ» ɫɬɚɬɢɫɬɢɤɚ ɜɫɬɪɟɱɚɟɦɨɫɬɢ ɫɬɪɨɤ ɞɥɢɧɵ 5 ɢɦɟɟɬ ɜɢɞ: N
Ʉɨɥɢɱɟɫɬɜɨ ɫɬɪɨɤ ɞɥɢɧɵ Ʉɨɥɢɱɟɫɬɜɨ ɨɬɧɨɫɢɬɟɥɶɧɨ ɨɛ5, ɜɫɬɪɟɬɢɜɲɢɯɫɹ ɪɨɜɧɨ ɳɟɝɨ ɱɢɫɥɚ ɜɫɟɯ ɪɚɡɥɢɱɧɵɯ N ɪɚɡ ɫɬɪɨɤ ɞɥɢɧɵ 5, % 1 91227 46.3% 2 30650 15.6% 3 16483 8.4%
58
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
4 5 6 ȼɫɟɝɨ
10391 7224 40994 196969
5.3% 3.7% 20.7% 100.0%
Ɂɚɦɟɬɢɦ, ɱɬɨ ɢɡ ɜɫɟɯ 197 ɬɵɫɹɱ ɪɚɡɥɢɱɧɵɯ ɫɬɪɨɤ ɞɥɢɧɵ 5 ɩɨɱɬɢ ɩɨɥɨɜɢɧɚ ɜɫɬɪɟɬɢɥɚɫɶ ɥɢɲɶ ɨɞɢɧ ɪɚɡ, ɩɨɷɬɨɦɭ ɨɧɢ ɜɨɨɛɳɟ ɧɟ ɛɭɞɭɬ ɢɫɩɨɥɶɡɨɜɚɧɵ ɤɚɤ ɮɪɚɡɵ ɩɪɢ ɫɥɨɜɚɪɧɨɦ ɤɨɞɢɪɨɜɚɧɢɢ ɜ ɬɨɦ ɫɥɭɱɚɟ, ɟɫɥɢ ɫɥɨɜɚɪɶ ɫɬɪɨɢɬɫɹ ɬɨɥɶɤɨ ɢɡ ɫɬɪɨɤ ɨɛɪɚɛɨɬɚɧɧɨɣ ɱɚɫɬɢ ɩɨɬɨɤɚ. ɇɚɛɥɸɞɚɟɦɵɟ ɱɚɫɬɨɬɵ ɨɫɬɚɜɲɟɣɫɹ ɱɚɫɬɢ ɫɬɪɨɤ ɛɵɫɬɪɨ ɭɦɟɧɶɲɚɸɬɫɹ ɫ ɭɜɟɥɢɱɟɧɢɟɦ N, ɱɬɨ ɭɤɚɡɵɜɚɟɬ ɧɚ ɜɵɝɨɞɧɨɫɬɶ ɩɪɢɦɟɧɟɧɢɹ ɫɬɚɬɢɫɬɢɱɟɫɤɨɝɨ ɤɨɞɢɪɨɜɚɧɢɹ, ɤɨɝɞɚ ɱɚɫɬɨ ɢɫɩɨɥɶɡɭɟɦɵɦ ɮɪɚɡɚɦ ɫɬɚɜɹɬɫɹ ɜ ɫɨɨɬɜɟɬɫɬɜɢɟ ɤɨɞɵ ɦɟɧɶɲɟɣ ɞɥɢɧɵ. Ɉɛɵɱɧɨ ɠɟ ɩɪɨɫɬɨ ɩɪɟɞɩɨɥɚɝɚɟɬɫɹ, ɱɬɨ ɤɨɪɨɬɤɢɟ ɮɪɚɡɵ ɢɫɩɨɥɶɡɭɸɬɫɹ ɱɚɳɟ ɞɥɢɧɧɵɯ. ɉɨɷɬɨɦɭ ɜ ɛɨɥɶɲɢɧɫɬɜɟ ɫɥɭɱɚɟɜ ɢɧɞɟɤɫɵ ɫɬɪɨɹɬɫɹ ɬɚɤɢɦ ɨɛɪɚɡɨɦ, ɱɬɨɛɵ ɞɥɢɧɚ ɢɧɞɟɤɫɚ ɤɨɪɨɬɤɨɣ ɮɪɚɡɵ ɛɵɥɚ ɦɟɧɶɲɟ ɞɥɢɧɵ ɢɧɞɟɤɫɚ ɞɥɢɧɧɨɣ ɮɪɚɡɵ. Ɍɚɤɨɣ ɩɪɢɟɦ ɨɛɵɱɧɨ ɫɩɨɫɨɛɫɬɜɭɟɬ ɭɥɭɱɲɟɧɢɸ ɫɠɚɬɢɹ. Ɉɱɟɜɢɞɧɨ, ɱɬɨ ɩɪɨɰɟɫɫɵ ɦɨɞɟɥɢɪɨɜɚɧɢɹ ɢ ɤɨɞɢɪɨɜɚɧɢɹ, ɪɚɫɫɦɚɬɪɢɜɚɟɦɵɟ ɜ ɝɥɚɜɟ «Ɇɟɬɨɞɵ ɤɨɧɬɟɤɫɬɧɨɝɨ ɦɨɞɟɥɢɪɨɜɚɧɢɹ», ɞɥɹ ɫɥɨɜɚɪɧɵɯ ɦɟɬɨɞɨɜ ɫɥɢɜɚɸɬɫɹ. Ɇɨɞɟɥɢɪɨɜɚɧɢɟ ɜ ɹɜɧɨɦ ɜɢɞɟ ɦɨɠɟɬ ɜɵɩɨɥɧɹɬɶɫɹ ɭɠɟ ɬɨɥɶɤɨ ɞɥɹ ɢɧɞɟɤɫɨɜ. Ɂɚɦɟɬɢɦ, ɱɬɨ ɚɩɨɥɨɝɟɬɵ ɢɞɟɢ ɭɧɢɜɟɪɫɚɥɶɧɵɯ ɦɨɞɟɥɢɪɨɜɚɧɢɹ ɢ ɤɨɞɢɪɨɜɚɧɢɹ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨ ɢɡɭɱɚɸɬ ɥɸɛɨɣ ɦɟɬɨɞ, ɧɟ ɜɩɢɫɵɜɚɸɳɢɣɫɹ ɹɜɧɨ ɜ ɢɯ ɦɨɞɟɥɶ, ɢ ɨɛɵɱɧɨ ɞɨɫɬɚɬɨɱɧɨ ɭɛɟɞɢɬɟɥɶɧɨ ɞɨɤɚɡɵɜɚɸɬ, ɱɬɨ ɞɥɹ ɧɟɝɨ ɦɨɠɧɨ ɩɨɫɬɪɨɢɬɶ ɚɧɚɥɨɝ ɜ ɜɢɞɟ ɫɬɚɬɢɫɬɢɱɟɫɤɨɝɨ ɦɟɬɨɞɚ. Ɍɚɤ, ɧɚɩɪɢɦɟɪ, ɞɨɤɚɡɚɧɨ, ɱɬɨ ɧɟɫɤɨɥɶɤɨ ɪɚɫɫɦɚɬɪɢɜɚɟɦɵɯ ɧɢɠɟ ɫɥɨɜɚɪɧɵɯ ɚɥɝɨɪɢɬɦɨɜ ɫɟɦɟɣɫɬɜɚ ɁɢɜɚɅɟɦɩɟɥɚ ɦɨɝɭɬ ɛɵɬɶ ɜɨɫɩɪɨɢɡɜɟɞɟɧɵ ɜ ɪɚɦɤɚɯ ɤɨɧɬɟɤɫɬɧɨɝɨ ɦɨɞɟɥɢɪɨɜɚɧɢɹ ɨɝɪɚɧɢɱɟɧɧɨɝɨ ɩɨɪɹɞɤɚ, ɥɢɛɨ ɫ ɩɨɦɨɳɶɸ ɦɨɞɟɥɟɣ ɫɨɫɬɨɹɧɢɣ [6, 9].
ɇɢɠɟ ɛɭɞɭɬ ɪɚɫɫɦɨɬɪɟɧɵ ɚɥɝɨɪɢɬɦɵ ɫɥɨɜɚɪɧɨɝɨ ɫɠɚɬɢɹ, ɨɬɧɨɫɢɦɵɟ ɤ ɤɥɚɫɫɭ ɦɟɬɨɞɨɜ Ɂɢɜɚ-Ʌɟɦɩɟɥɚ. ȼ ɤɚɱɟɫɬɜɟ ɩɪɢɦɟɪɚ ɫɥɨɜɚɪɧɨɝɨ ɚɥɝɨɪɢɬɦɚ ɢɧɨɝɨ ɤɥɚɫɫɚ ɭɤɚɠɟɦ [7]. Ɇɟɬɨɞɵ Ɂɢɜɚ-Ʌɟɦɩɟɥɚ ɨɪɢɟɧɬɢɪɨɜɚɧɵ ɧɚ ɫɠɚɬɢɟ ɤɚɱɟɫɬɜɟɧɧɵɯ ɞɚɧɧɵɯ, ɩɪɢɱɟɦ ɷɮɮɟɤɬɢɜɧɨɫɬɶ ɩɪɢɦɟɧɟɧɢɹ ɞɨɫɬɢɝɚɟɬɫɹ ɜ Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
59
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɬɨɦ ɫɥɭɱɚɟ, ɤɨɝɞɚ ɫɬɚɬɢɫɬɢɱɟɫɤɢɟ ɯɚɪɚɤɬɟɪɢɫɬɢɤɢ ɨɛɪɚɛɚɬɵɜɚɟɦɵɯ ɞɚɧɧɵɯ ɫɨɨɬɜɟɬɫɬɜɭɸɬ ɦɨɞɟɥɢ ɢɫɬɨɱɧɢɤɚ ɫ ɩɚɦɹɬɶɸ.
Ʉɥɚɫɫɢɱɟɫɤɢɟ ɚɥɝɨɪɢɬɦɵ Ɂɢɜɚ-Ʌɟɦɩɟɥɚ Ⱥɥɝɨɪɢɬɦɵ ɫɥɨɜɚɪɧɨɝɨ ɫɠɚɬɢɹ Ɂɢɜɚ-Ʌɟɦɩɟɥɚ ɩɨɹɜɢɥɢɫɶ ɜɨ ɜɬɨɪɨɣ ɩɨɥɨɜɢɧɟ 1970-ɯ ɝɨɞɨɜ. ɗɬɨ ɛɵɥɢ ɬɚɤ ɧɚɡɵɜɚɟɦɵɟ ɚɥɝɨɪɢɬɦɵ LZ77 ɢ LZ78, ɪɚɡɪɚɛɨɬɚɧɧɵɟ ɫɨɜɦɟɫɬɧɨ Ɂɢɜɨɦ (Ziv) ɢ Ʌɟɦɩɟɥɨɦ (Lempel). ȼ ɞɚɥɶɧɟɣɲɟɦ ɩɟɪɜɨɧɚɱɚɥɶɧɵɟ ɫɯɟɦɵ ɩɨɞɜɟɪɝɚɥɢɫɶ ɦɧɨɠɟɫɬɜɟɧɧɵɦ ɢɡɦɟɧɟɧɢɹɦ, ɜ ɪɟɡɭɥɶɬɚɬɟ ɱɟɝɨ ɦɵ ɫɟɝɨɞɧɹ ɢɦɟɟɦ ɞɟɫɹɬɤɢ ɞɨɫɬɚɬɨɱɧɨ ɫɚɦɨɫɬɨɹɬɟɥɶɧɵɯ ɚɥɝɨɪɢɬɦɨɜ ɢ ɛɟɫɫɱɟɬɧɨɟ ɤɨɥɢɱɟɫɬɜɨ ɦɨɞɢɮɢɤɚɰɢɣ. LZ77 ɢ LZ78 ɹɜɥɹɸɬɫɹ ɭɧɢɜɟɪɫɚɥɶɧɵɦɢ ɚɥɝɨɪɢɬɦɚɦɢ ɫɠɚɬɢɹ, ɜ ɤɨɬɨɪɵɯ ɫɥɨɜɚɪɶ ɮɨɪɦɢɪɭɟɬɫɹ ɧɚ ɨɫɧɨɜɚɧɢɢ ɭɠɟ ɨɛɪɚɛɨɬɚɧɧɨɣ ɱɚɫɬɢ ɜɯɨɞɧɨɝɨ ɩɨɬɨɤɚ, ɬ.ɟ. ɚɞɚɩɬɢɜɧɨ. ɉɪɢɧɰɢɩɢɚɥɶɧɵɦ ɨɬɥɢɱɢɟɦ ɹɜɥɹɟɬɫɹ ɥɢɲɶ ɫɩɨɫɨɛ ɮɨɪɦɢɪɨɜɚɧɢɹ ɮɪɚɡ. ȼ ɦɨɞɢɮɢɤɚɰɢɹɯ ɩɟɪɜɨɧɚɱɚɥɶɧɵɯ ɚɥɝɨɪɢɬɦɨɜ ɷɬɚ ɫɜɨɣɫɬɜɨ ɫɨɯɪɚɧɹɟɬɫɹ. ɉɨɷɬɨɦɭ ɫɥɨɜɚɪɧɵɟ ɚɥɝɨɪɢɬɦɵ Ɂɢɜɚ-Ʌɟɦɩɟɥɚ ɪɚɡɞɟɥɹɸɬ ɧɚ ɞɜɚ ɫɟɦɟɣɫɬɜɚ — ɚɥɝɨɪɢɬɦɵ ɬɢɩɚ LZ77 ɢ ɚɥɝɨɪɢɬɦɵ ɬɢɩɚ LZ78. ɂɧɨɝɞɚ ɬɚɤɠɟ ɝɨɜɨɪɹɬ ɨ ɫɥɨɜɚɪɧɵɯ ɦɟɬɨɞɚɯ LZ1 ɢ LZ2. ɉɭɛɥɢɤɚɰɢɢ Ɂɢɜɚ ɢ Ʌɟɦɩɟɥɚ ɧɨɫɢɥɢ ɱɢɫɬɨ ɬɟɨɪɟɬɢɱɟɫɤɢɣ ɯɚɪɚɤɬɟɪ, ɬɚɤ ɤɚɤ ɷɬɢ ɢɫɫɥɟɞɨɜɚɬɟɥɢ ɧɚ ɫɚɦɨɦ ɞɟɥɟ ɡɚɧɢɦɚɥɢɫɶ ɩɪɨɛɥɟɦɨɣ ɢɡɦɟɪɟɧɢɹ «ɫɥɨɠɧɨɫɬɢ» ɫɬɪɨɤɢ, ɢ ɩɪɢɦɟɧɟɧɢɟ ɜɵɪɚɛɨɬɚɧɧɵɯ ɚɥɝɨɪɢɬɦɨɜ ɤ ɫɠɚɬɢɸ ɞɚɧɧɵɯ ɹɜɢɥɨɫɶ, ɫɤɨɪɟɟ, ɥɢɲɶ ɱɚɫɬɧɵɦ ɪɟɡɭɥɶɬɚɬɨɦ. ɉɨɬɪɟɛɨɜɚɥɨɫɶ ɧɟɤɨɬɨɪɨɟ ɜɪɟɦɹ, ɱɬɨɛɵ ɢɞɟɹ ɨɪɝɚɧɢɡɚɰɢɢ ɫɥɨɜɚɪɹ, ɱɚɫɬɨ ɜ ɩɟɪɟɥɨɠɟɧɢɢ ɭɠɟ ɞɪɭɝɢɯ ɥɸɞɟɣ, ɞɨɫɬɢɝɥɚ ɪɚɡɪɚɛɨɬɱɢɤɨɜ ɩɪɨɝɪɚɦɦɧɨɝɨ ɢ ɚɩɩɚɪɚɬɧɨɝɨ ɨɛɟɫɩɟɱɟɧɢɹ. ɉɨɷɬɨɦɭ ɩɪɚɤɬɢɱɟɫɤɨɟ ɢɫɩɨɥɶɡɨɜɚɧɢɟ ɚɥɝɨɪɢɬɦɨɜ ɧɚɱɚɥɨɫɶ ɫɩɭɫɬɹ ɩɚɪɭ ɥɟɬ. ɋ ɬɟɯ ɩɨɪ ɦɟɬɨɞɵ ɞɚɧɧɨɝɨ ɫɟɦɟɣɫɬɜɚ ɧɟɢɡɦɟɧɧɨ ɹɜɥɹɸɬɫɹ ɫɚɦɵɦɢ ɩɨɩɭɥɹɪɧɵɦɢ ɫɪɟɞɢ ɜɫɟɯ ɦɟɬɨɞɨɜ ɫɠɚɬɢɹ ɞɚɧɧɵɯ, ɯɨɬɹ ɜ ɩɨɫɥɟɞɧɟɟ ɜɪɟɦɹ ɫɢɬɭɚɰɢɹ ɧɚɱɚɥɚ ɦɟɧɹɬɶɫɹ ɜ ɩɨɥɶɡɭ BWT ɢ PPM, ɤɚɤ ɨɛɟɫɩɟɱɢɜɚɸɳɢɯ ɥɭɱɲɟɟ ɫɠɚɬɢɟ. Ʉɪɨɦɟ ɬɨɝɨ, ɩɪɚɤɬɢɱɟɫɤɢ ɜɫɟ ɪɟɚɥɶɧɨ ɢɫɩɨɥɶɡɭɟɦɵɟ ɫɥɨɜɚɪɧɵɟ ɚɥɝɨɪɢɬɦɵ ɨɬɧɨɫɹɬɫɹ ɤ ɫɟɦɟɣɫɬɜɭ Ɂɢɜɚ-Ʌɟɦɩɟɥɚ. 60
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɇɟɨɛɯɨɞɢɦɨ ɫɤɚɡɚɬɶ ɧɟɫɤɨɥɶɤɨ ɫɥɨɜ ɨ ɧɚɢɦɟɧɨɜɚɧɢɹɯ ɚɥɝɨɪɢɬɦɨɜ ɢ ɦɟɬɨɞɨɜ. ɉɪɢ ɨɛɨɡɧɚɱɟɧɢɢ ɫɟɦɟɣɫɬɜɚ ɨɛɳɟɩɪɢɧɹɬɨɣ ɹɜɥɹɟɬɫɹ ɚɛɛɪɟɜɢɚɬɭɪɚ «LZ», ɧɨ ɪɚɫɲɢɮɪɨɜɵɜɚɬɶɫɹ ɨɧɚ ɞɨɥɠɧɚ ɤɚɤ «Ziv-Lempel», ɩɨɷɬɨɦɭ ɢ ɚɥɝɨɪɢɬɦɵ «Ɂɢɜɚ-Ʌɟɦɩɟɥɚ», ɚ ɧɟ «Ʌɟɦɩɟɥɚ-Ɂɢɜɚ». ɋɨɝɥɚɫɧɨ ɨɛɳɟɩɪɢɧɹɬɨɦɭ ɨɛɴɹɫɧɟɧɢɸ ɷɬɨɝɨ ɤɭɪɶɟɡɚ, əɤɨɛ Ɂɢɜ ɜɧɟɫ ɛɨɥɶɲɢɣ ɜɤɥɚɞ ɜ ɨɬɤɪɵɬɢɟ ɫɨɨɬɜɟɬɫɬɜɭɸɳɢɯ ɫɥɨɜɚɪɧɵɯ ɫɯɟɦ ɢ ɢɫɫɥɟɞɨɜɚɧɢɟ ɢɯ ɫɜɨɣɫɬɜ ɢ ɬɚɤɢɦ ɨɛɪɚɡɨɦ ɡɚɫɥɭɠɢɥ, ɱɬɨɛɵ ɩɟɪɜɵɦ ɫɬɨɹɥɚ ɟɝɨ ɮɚɦɢɥɢɹ, ɱɬɨ ɦɵ ɢ ɜɢɞɢɦ ɜ ɡɚɝɨɥɨɜɤɚɯ ɫɬɚɬɟɣ [12, 13]. ɇɨ ɫɥɭɱɚɣɧɨ ɛɵɥɚ ɞɨɩɭɳɟɧɚ ɨɲɢɛɤɚ, ɢ ɩɪɢɤɪɟɩɢɥɨɫɶ ɫɨɤɪɚɳɟɧɢɟ «LZ» (ɛɭɤɜɵ ɭɩɨɪɹɞɨɱɟɧɵ ɜ ɚɥɮɚɜɢɬɧɨɦ ɩɨɪɹɞɤɟ). ɂɧɨɝɞɚ, ɤɫɬɚɬɢ, ɜɫɬɪɟɱɚɟɬɫɹ ɢ ɨɛɨɡɧɚɱɟɧɢɟ «ZL» (ɩɨɪɹɞɨɤ ɛɭɤɜ ɫɨɨɬɜɟɬɫɬɜɭɟɬ ɩɨɪɹɞɤɭ ɮɚɦɢɥɢɣ ɚɜɬɨɪɨɜ ɜ ɩɭɛɥɢɤɚɰɢɹɯ [12, 13]). ȼ ɞɚɥɶɧɟɣɲɟɦ, ɟɫɥɢ ɧɟɤɢɣ ɢɫɫɥɟɞɨɜɚɬɟɥɶ ɫɭɳɟɫɬɜɟɧɧɨ ɢɡɦɟɧɹɥ ɤɚɤɨɣ-ɬɨ ɚɥɝɨɪɢɬɦ, ɨɬɧɨɫɢɦɵɣ ɤ ɫɟɦɟɣɫɬɜɭ LZ, ɬɨ ɜ ɧɚɡɜɚɧɢɢ ɩɨɥɭɱɟɧɧɨɣ ɦɨɞɢɮɢɤɚɰɢɢ ɤ ɫɬɪɨɱɤɟ «LZ» ɨɛɵɱɧɨ ɞɨɩɢɫɵɜɚɥɚɫɶ ɩɟɪɜɚɹ ɛɭɤɜɚ ɟɝɨ ɮɚɦɢɥɢɢ, ɧɚɩɪɢɦɟɪ: ɚɥɝɨɪɢɬɦ LZB, ɚɜɬɨɪ Ȼɟɥɥ (Bell). ɉɨɞɱɟɪɤɧɟɦ ɬɚɤɠɟ ɧɚɥɢɱɢɟ ɛɨɥɶɲɨɣ ɩɭɬɚɧɢɰɵ ɫ ɤɥɚɫɫɢɮɢɤɚɰɢɟɣ ɚɥɝɨɪɢɬɦɨɜ. Ɉɛɵɱɧɨ ɨɧɚ ɩɪɨɹɜɥɹɟɬɫɹ ɜ ɧɟɠɟɥɚɧɢɢ ɩɪɢɡɧɚɜɚɬɶ ɫɭɳɟɫɬɜɨɜɚɧɢɟ ɞɜɭɯ ɫɚɦɨɫɬɨɹɬɟɥɶɧɵɯ ɫɟɦɟɣɫɬɜ LZ, ɚ ɬɚɤɠɟ ɜ ɧɟɩɪɚɜɢɥɶɧɨɦ ɨɬɧɟɫɟɧɢɢ ɚɥɝɨɪɢɬɦɨɜ ɤ ɤɨɧɤɪɟɬɧɨɦɭ ɫɟɦɟɣɫɬɜɭ. Ȼɟɫɩɨɪɹɞɤɭ ɱɚɫɬɨ ɫɩɨɫɨɛɫɬɜɭɸɬ ɫɚɦɢ ɪɚɡɪɚɛɨɬɱɢɤɢ: ɦɧɨɝɢɦ ɧɟɜɵɝɨɞɧɨ ɪɚɫɤɪɵɜɚɬɶ, ɧɚ ɨɫɧɨɜɟ ɤɚɤɨɝɨ ɚɥɝɨɪɢɬɦɚ ɫɨɡɞɚɧɚ ɞɚɧɧɚɹ ɦɨɞɢɮɢɤɚɰɢɹ ɢɡ-ɡɚ ɤɨɦɦɟɪɱɟɫɤɢɯ, ɩɚɬɟɧɬɧɵɯ ɢɥɢ ɢɧɵɯ ɦɟɪɤɚɧɬɢɥɶɧɵɯ ɫɨɨɛɪɚɠɟɧɢɣ. ɇɚɩɪɢɦɟɪ, ɜ ɫɥɭɱɚɟ ɤɨɦɦɟɪɱɟɫɤɨɝɨ ɩɪɨɝɪɚɦɦɧɨɝɨ ɨɛɟɫɩɟɱɟɧɢɹ ɨɛɳɟɩɪɢɧɹɬɨɣ ɹɜɥɹɟɬɫɹ ɩɪɚɤɬɢɤɚ ɤɥɚɫɫɢɮɢɤɚɰɢɢ ɢɫɩɨɥɶɡɭɟɦɨɝɨ ɚɥɝɨɪɢɬɦɚ ɫɠɚɬɢɹ ɤɚɤ «ɦɨɞɢɮɢɤɚɰɢɢ LZ77». ɂ ɜ ɷɬɨɦ ɧɟɬ ɧɢɱɟɝɨ ɭɞɢɜɢɬɟɥɶɧɨɝɨ, ɜɟɞɶ ɚɥɝɨɪɢɬɦ LZ77 ɧɟ ɡɚɩɚɬɟɧɬɨɜɚɧ. ȺɅȽɈɊɂɌɆ LZ77
ɗɬɨɬ ɫɥɨɜɚɪɧɵɣ ɚɥɝɨɪɢɬɦ ɫɠɚɬɢɹ ɹɜɥɹɟɬɫɹ ɫɚɦɵɦ ɫɬɚɪɵɦ ɫɪɟɞɢ ɦɟɬɨɞɨɜ LZ. Ɉɩɢɫɚɧɢɟ ɛɵɥɨ ɨɩɭɛɥɢɤɨɜɚɧɨ ɜ 1977 ɝɨɞɭ [12], ɧɨ ɫɚɦ ɚɥɝɨɪɢɬɦ ɪɚɡɪɚɛɨɬɚɧ ɧɟ ɩɨɡɞɧɟɟ 1975 ɝɨɞɚ. Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
61
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
Ⱥɥɝɨɪɢɬɦ LZ77 ɹɜɥɹɟɬɫɹ «ɪɨɞɨɧɚɱɚɥɶɧɢɤɨɦ» ɰɟɥɨɝɨ ɫɟɦɟɣɫɬɜɚ ɫɥɨɜɚɪɧɵɯ ɫɯɟɦ — ɬɚɤ ɧɚɡɵɜɚɟɦɵɯ ɚɥɝɨɪɢɬɦɨɜ ɫɨ ɫɤɨɥɶɡɹɳɢɦ ɫɥɨɜɚɪɟɦ, ɢɥɢ ɫɤɨɥɶɡɹɳɢɦ ɨɤɧɨɦ. Ⱦɟɣɫɬɜɢɬɟɥɶɧɨ, ɜ LZ77 ɜ ɤɚɱɟɫɬɜɟ ɫɥɨɜɚɪɹ ɢɫɩɨɥɶɡɭɟɬɫɹ ɛɥɨɤ ɭɠɟ ɡɚɤɨɞɢɪɨɜɚɧɧɨɣ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ. Ʉɚɤ ɩɪɚɜɢɥɨ, ɩɨ ɦɟɪɟ ɜɵɩɨɥɧɟɧɢɹ ɨɛɪɚɛɨɬɤɢ ɩɨɥɨɠɟɧɢɟ ɷɬɨɝɨ ɛɥɨɤɚ ɨɬɧɨɫɢɬɟɥɶɧɨ ɧɚɱɚɥɚ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ ɩɨɫɬɨɹɧɧɨ ɦɟɧɹɟɬɫɹ, ɫɥɨɜɚɪɶ «ɫɤɨɥɶɡɢɬ» ɩɨ ɜɯɨɞɧɨɦɭ ɩɨɬɨɤɭ ɞɚɧɧɵɯ. ɋɤɨɥɶɡɹɳɟɟ ɨɤɧɨ ɢɦɟɟɬ ɞɥɢɧɭ N, ɬ.ɟ. ɜ ɧɟɝɨ ɩɨɦɟɳɚɟɬɫɹ N ɫɢɦɜɨɥɨɜ, ɢ ɫɨɫɬɨɢɬ ɢɡ 2 ɱɚɫɬɟɣ: • ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ ɞɥɢɧɵ W = N–n ɭɠɟ ɡɚɤɨɞɢɪɨɜɚɧɧɵɯ ɫɢɦɜɨɥɨɜ, ɤɨɬɨɪɚɹ ɢ ɹɜɥɹɟɬɫɹ ɫɥɨɜɚɪɟɦ; • ɭɩɪɟɠɞɚɸɳɟɝɨ ɛɭɮɟɪɚ, ɢɥɢ ɛɭɮɟɪɚ ɩɪɟɞɜɚɪɢɬɟɥɶɧɨɝɨ ɩɪɨɫɦɨɬɪɚ (lookahead), ɞɥɢɧɵ n; ɨɛɵɱɧɨ n ɧɚ ɩɨɪɹɞɤɢ ɦɟɧɶɲɟ W. ɉɭɫɬɶ ɤ ɬɟɤɭɳɟɦɭ ɦɨɦɟɧɬɭ ɜɪɟɦɟɧɢ ɦɵ ɭɠɟ ɡɚɤɨɞɢɪɨɜɚɥɢ t ɫɢɦɜɨɥɨɜ s1, s2, …, st. Ɍɨɝɞɚ ɫɥɨɜɚɪɟɦ ɛɭɞɭɬ ɹɜɥɹɬɶɫɹ W ɩɪɟɞɲɟɫɬɜɭɸɳɢɯ ɫɢɦɜɨɥɨɜ st-(W-1), st-(W-1)+1, …, st. ɋɨɨɬɜɟɬɫɬɜɟɧɧɨ, ɜ ɛɭɮɟɪɟ ɧɚɯɨɞɹɬɫɹ ɨɠɢɞɚɸɳɢɟ ɤɨɞɢɪɨɜɚɧɢɹ ɫɢɦɜɨɥɵ st+1, st+2, …, st+n. Ɉɱɟɜɢɞɧɨ, ɱɬɨ ɟɫɥɢ W t, ɬɨ ɫɥɨɜɚɪɟɦ ɛɭɞɟɬ ɹɜɥɹɬɶɫɹ ɜɫɹ ɭɠɟ ɨɛɪɚɛɨɬɚɧɧɚɹ ɱɚɫɬɶ ɜɯɨɞɧɨɣ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ. ɂɞɟɹ ɚɥɝɨɪɢɬɦɚ ɡɚɤɥɸɱɚɟɬɫɹ ɜ ɩɨɢɫɤɟ ɫɚɦɨɝɨ ɞɥɢɧɧɨɝɨ ɫɨɜɩɚɞɟɧɢɹ ɦɟɠɞɭ ɫɬɪɨɤɨɣ ɛɭɮɟɪɚ, ɧɚɱɢɧɚɸɳɟɣɫɹ ɫ ɫɢɦɜɨɥɚ st+1, ɢ ɜɫɟɦɢ ɮɪɚɡɚɦɢ ɫɥɨɜɚɪɹ. ɗɬɢ ɮɪɚɡɵ ɦɨɝɭɬ ɧɚɱɢɧɚɬɶɫɹ ɫ ɥɸɛɨɝɨ ɫɢɦɜɨɥɚ st-(W-1), st-(W-1)+1, …, st ɢ ɜɵɯɨɞɢɬɶ ɡɚ ɩɪɟɞɟɥɵ ɫɥɨɜɚɪɹ, ɜɬɨɪɝɚɹɫɶ ɜ ɨɛɥɚɫɬɶ ɛɭɮɟɪɚ, ɧɨ ɞɨɥɠɧɵ ɥɟɠɚɬɶ ɜ ɨɤɧɟ. ɋɥɟɞɨɜɚɬɟɥɶɧɨ, ɮɪɚɡɵ ɧɟ ɦɨɝɭɬ ɧɚɱɢɧɚɬɶɫɹ ɫ st+1, ɩɨɷɬɨɦɭ ɛɭɮɟɪ ɧɟ ɦɨɠɟɬ ɫɪɚɜɧɢɜɚɬɶɫɹ ɫɚɦ ɫ ɫɨɛɨɣ. Ⱦɥɢɧɚ ɫɨɜɩɚɞɟɧɢɹ ɧɟ ɞɨɥɠɧɚ ɩɪɟɜɵɲɚɬɶ ɪɚɡɦɟɪ ɛɭɮɟɪɚ. ɉɨɥɭɱɟɧɧɚɹ ɜ ɪɟɡɭɥɶɬɚɬɟ ɩɨɢɫɤɚ ɮɪɚɡɚ st-(i-1), st-(i-1)+1, …, st-(i-1)+(j-1) ɤɨɞɢɪɭɟɬɫɹ ɫ ɩɨɦɨɳɶɸ ɞɜɭɯ ɱɢɫɟɥ: 1) ɫɦɟɳɟɧɢɹ (offset) ɨɬ ɧɚɱɚɥɚ ɛɭɮɟɪɚ, i; 2) ɞɥɢɧɵ ɫɨɨɬɜɟɬɫɬɜɢɹ, ɢɥɢ ɫɨɜɩɚɞɟɧɢɹ (match length), j. ɋɦɟɳɟɧɢɟ ɢ ɞɥɢɧɚ ɫɨɨɬɜɟɬɫɬɜɢɹ ɢɝɪɚɸɬ ɪɨɥɶ ɭɤɚɡɚɬɟɥɹ (ɫɫɵɥɤɢ), ɨɞɧɨɡɧɚɱɧɨ ɨɩɪɟɞɟɥɹɸɳɟɝɨ ɮɪɚɡɭ. Ⱦɨɩɨɥɧɢɬɟɥɶɧɨ ɜ ɜɵ62
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɯɨɞɧɨɣ ɩɨɬɨɤ ɡɚɩɢɫɵɜɚɟɬɫɹ ɫɢɦɜɨɥ s, ɧɟɩɨɫɪɟɞɫɬɜɟɧɧɨ ɫɥɟɞɭɸɳɢɣ ɡɚ ɫɨɜɩɚɜɲɟɣ ɫɬɪɨɤɨɣ ɛɭɮɟɪɚ. Ɍɚɤɢɦ ɨɛɪɚɡɨɦ, ɧɚ ɤɚɠɞɨɦ ɲɚɝɟ ɤɨɞɟɪ ɜɵɞɚɟɬ ɨɩɢɫɚɧɢɟ ɬɪɟɯ ɨɛɴɟɤɬɨɜ: ɫɦɟɳɟɧɢɹ ɢ ɞɥɢɧɵ ɫɨɨɬɜɟɬɫɬɜɢɹ, ɨɛɪɚɡɭɸɳɢɯ ɤɨɞ ɮɪɚɡɵ, ɪɚɜɧɨɣ ɨɛɪɚɛɨɬɚɧɧɨɣ ɫɬɪɨɤɟ ɛɭɮɟɪɚ, ɢ ɨɞɧɨɝɨ ɫɢɦɜɨɥɚ s (ɥɢɬɟɪɚɥɚ). Ɂɚɬɟɦ ɨɤɧɨ ɫɦɟɳɚɟɬɫɹ ɧɚ j+1 ɫɢɦɜɨɥɨɜ ɜɩɪɚɜɨ ɢ ɨɫɭɳɟɫɬɜɥɹɟɬɫɹ ɩɟɪɟɯɨɞ ɤ ɧɨɜɨɦɭ ɰɢɤɥɭ ɤɨɞɢɪɨɜɚɧɢɹ. ȼɟɥɢɱɢɧɚ ɫɞɜɢɝɚ ɨɛɴɹɫɧɹɟɬɫɹ ɬɟɦ, ɱɬɨ ɦɵ ɪɟɚɥɶɧɨ ɡɚɤɨɞɢɪɨɜɚɥɢ ɢɦɟɧɧɨ j+1 ɫɢɦɜɨɥɨɜ: j ɫ ɩɨɦɨɳɶɸ ɭɤɚɡɚɬɟɥɹ ɧɚ ɮɪɚɡɭ ɜ ɫɥɨɜɚɪɟ, ɢ 1 ɫ ɩɨɦɨɳɶɸ ɬɪɢɜɢɚɥɶɧɨɝɨ ɤɨɩɢɪɨɜɚɧɢɹ. ɉɟɪɟɞɚɱɚ ɨɞɧɨɝɨ ɫɢɦɜɨɥɚ ɜ ɹɜɧɨɦ ɜɢɞɟ ɩɨɡɜɨɥɹɟɬ ɪɚɡɪɟɲɢɬɶ ɩɪɨɛɥɟɦɭ ɨɛɪɚɛɨɬɤɢ ɟɳɟ ɧɢ ɪɚɡɭ ɧɟ ɜɢɞɟɧɧɵɯ ɫɢɦɜɨɥɨɜ, ɧɨ ɫɭɳɟɫɬɜɟɧɧɨ ɭɜɟɥɢɱɢɜɚɟɬ ɪɚɡɦɟɪ ɫɠɚɬɨɝɨ ɛɥɨɤɚ. ɉɪɢɦɟɪ ɉɨɩɪɨɛɭɟɦ ɫɠɚɬɶ ɫɬɪɨɤɭ «ɤɨɬ_ɥɨɦɨɦ_ɤɨɥɨɥ_ɫɥɨɧɚ» ɞɥɢɧɨɣ 21 ɫɢɦɜɨɥ. ɉɭɫɬɶ ɞɥɢɧɚ ɛɭɮɟɪɚ ɪɚɜɧɚ 7 ɫɢɦɜɨɥɚɦ, ɚ ɪɚɡɦɟɪ ɫɥɨɜɚɪɹ ɛɨɥɶɲɟ ɞɥɢɧɵ ɫɠɢɦɚɟɦɨɣ ɫɬɪɨɤɢ. ɍɫɥɨɜɢɦɫɹ ɬɚɤɠɟ, ɱɬɨ: • ɧɭɥɟɜɨɟ ɫɦɟɳɟɧɢɟ ɡɚɪɟɡɟɪɜɢɪɨɜɚɥɢ ɞɥɹ ɨɛɨɡɧɚɱɟɧɢɹ ɤɨɧɰɚ ɤɨɞɢɪɨɜɚɧɢɹ; • ɫɢɦɜɨɥ st ɫɨɨɬɜɟɬɫɬɜɭɟɬ ɟɞɢɧɢɱɧɨɦɭ ɫɦɟɳɟɧɢɸ ɨɬɧɨɫɢɬɟɥɶɧɨ ɫɢɦɜɨɥɚ st+1, ɫ ɤɨɬɨɪɨɝɨ ɧɚɱɢɧɚɟɬɫɹ ɛɭɮɟɪ; • ɟɫɥɢ ɢɦɟɟɬɫɹ ɧɟɫɤɨɥɶɤɨ ɮɪɚɡ ɫ ɨɞɢɧɚɤɨɜɨɣ ɞɥɢɧɨɣ ɫɨɜɩɚɞɟɧɢɹ, ɬɨ ɜɵɛɢɪɚɟɦ ɛɥɢɠɚɣɲɭɸ ɤ ɛɭɮɟɪɭ; • ɜ ɧɟɨɩɪɟɞɟɥɟɧɧɵɯ ɫɢɬɭɚɰɢɹɯ — ɤɨɝɞɚ ɞɥɢɧɚ ɫɨɜɩɚɞɟɧɢɹ ɧɭɥɟɜɚɹ — ɫɦɟɳɟɧɢɸ ɩɪɢɫɜɚɢɜɚɟɦ ɟɞɢɧɢɱɧɨɟ ɡɧɚɱɟɧɢɟ. Ɍɚɛɥɢɰɚ 3.1 ɒɚɝ ɋɤɨɥɶɡɹɳɟɟ ɨɤɧɨ ɋɨɜɩɚɞɚɸɳɚɹ Ɂɚɤɨɞɢɪɨɜɚɧɧɵɟ ɞɚɧɧɵɟ ɮɪɚɡɚ ɋɥɨɜɚɪɶ Ȼɭɮɟɪ i j s 1 - ɤɨɬ_ɥɨɦ 1 0 ‘ɤ’ 2 ɤ ɨɬ_ɥɨɦɨ 1 0 ‘ɨ’ 3 ɤɨ ɬ_ɥɨɦɨɦ 1 0 ‘ɬ’ 4 ɤɨɬ _ɥɨɦɨɦ_ 1 0 ‘_’ Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
63
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɒɚɝ
ɋɤɨɥɶɡɹɳɟɟ ɨɤɧɨ ɋɥɨɜɚɪɶ
5 6 7 8 9 10 11 12
ɤɨɬ_ ɤɨɬ_ɥ ɤɨɬ_ɥɨɦ ɤɨɬ_ɥɨɦɨɦ_ ɤɨɬ_ɥɨɦɨɦ_ɤɨɥ ..._ɥɨɦɨɦ_ɤɨɥɨɥ_ ...ɥɨɦɨɦ_ɤɨɥɨɥ_ɫ ...ɨɦ_ɤɨɥɨɥ_ɫɥɨɧ
ɋɨɜɩɚɞɚɸɳɚɹ ɮɪɚɡɚ Ȼɭɮɟɪ ɥɨɦɨɦ_ɤ ɨɦɨɦ_ɤɨ ɨɦ_ɤɨɥɨ ɤɨɥɨɥ_ɫ ɨɥ_ɫɥɨɧ ɫɥɨɧɚ ɥɨɧɚ ɚ
ɨ ɨɦ ɤɨ ɨɥ ɥɨ -
Ɂɚɤɨɞɢɪɨɜɚɧɧɵɟ ɞɚɧɧɵɟ i j s 1 0 ‘ɥ’ 4 1 ‘ɦ’ 2 2 ‘_’ 10 2 ‘ɥ’ 2 2 ‘_’ 1 0 ‘ɫ’ 5 2 ‘ɧ’ 1 0 ‘ɚ’
Ⱦɥɹ ɤɨɞɢɪɨɜɚɧɢɹ i ɧɚɦ ɞɨɫɬɚɬɨɱɧɨ 5 ɛɢɬɨɜ, ɞɥɹ j ɧɭɠɧɨ 3 ɛɢɬɚ, ɢ ɩɭɫɬɶ ɫɢɦɜɨɥɵ ɬɪɟɛɭɸɬ 1 ɛɚɣɬɚ ɞɥɹ ɫɜɨɟɝɨ ɩɪɟɞɫɬɚɜɥɟɧɢɹ. Ɍɨɝɞɚ ɜɫɟɝɨ ɦɵ ɩɨɬɪɚɬɢɦ 12·(5+3+8) = 192 ɛɢɬɚ. ɂɫɯɨɞɧɨ ɫɬɪɨɤɚ ɡɚɧɢɦɚɥɚ 21·8 = 168 ɛɢɬɨɜ, ɬ.ɟ. LZ77 ɤɨɞɢɪɭɟɬ ɧɚɲɭ ɫɬɪɨɤɭ ɟɳɟ ɛɨɥɟɟ ɪɚɫɬɨɱɢɬɟɥɶɧɵɦ ɨɛɪɚɡɨɦ. ɇɟ ɫɥɟɞɭɟɬ ɬɚɤɠɟ ɡɚɛɵɜɚɬɶ, ɱɬɨ ɦɵ ɨɩɭɫɬɢɥɢ ɲɚɝ ɤɨɞɢɪɨɜɚɧɢɹ ɤɨɧɰɚ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ, ɤɨɬɨɪɵɣ ɩɨɬɪɟɛɨɜɚɥ ɛɵ ɟɳɟ ɤɚɤ ɦɢɧɢɦɭɦ 5 ɛɢɬɨɜ (ɪɚɡɦɟɪ ɩɨɥɹ i = 5 ɛɢɬɚɦ). ɉɪɨɰɟɫɫ ɤɨɞɢɪɨɜɚɧɢɹ ɦɨɠɧɨ ɨɩɢɫɚɬɶ ɫɥɟɞɭɸɳɢɦ ɨɛɪɚɡɨɦ. while ( ! DataFile.EOF() ){ /*ɧɚɣɞɟɦ ɦɚɤɫɢɦɚɥɶɧɨɟ ɫɨɜɩɚɞɟɧɢɟ; ɜ match_pos ɩɨɥɭɱɢɦ ɫɦɟɳɟɧɢɟ i, ɜ match_len — ɞɥɢɧɭ j, ɜ unmatched_sym — ɩɟɪɜɵɣ ɧɟɫɨɜɩɚɜɲɢɣ ɫɢɦɜɨɥ st+1+j; ɫɱɢɬɚɟɦ ɬɚɤɠɟ, ɱɬɨ ɜ ɮɭɧɤɰɢɢ find_match ɭɱɢɬɵɜɚɟɬɫɹ ɨɝɪɚɧɢɱɟɧɢɟ ɧɚ ɞɥɢɧɭ ɫɨɜɩɚɞɟɧɢɹ */ find_match (&match_pos, &match_len, &unmatched_sym); /*ɡɚɩɢɲɟɦ ɜ ɮɚɣɥ ɫɠɚɬɵɯ ɞɚɧɧɵɯ ɨɩɢɫɚɧɢɟ ɧɚɣɞɟɧɧɨɣ ɮɪɚɡɵ, ɩɪɢ ɷɬɨɦ ɞɥɢɧɚ ɛɢɬɨɜɨɝɨ ɩɪɟɞɫɬɚɜɥɟɧɢɹ i ɡɚɞɚɟɬɫɹ ɤɨɧɫɬɚɧɬɨɣ OFFS_LN, ɞɥɢɧɚ ɩɪɟɞɫɬɚɜɥɟɧɢɹ j — ɤɨɧɫɬɚɧɬɨɣ LEN_LN, ɪɚɡɦɟɪ ɫɢɦɜɨɥɚ s ɩɪɢɧɢɦɚɟɦ ɪɚɜɧɵɦ 8 ɛɢɬɚɦ */ CompressedFile.WriteBits (match_pos, OFFS_LN); CompressedFile.WriteBits (match_len, LEN_LN);
64
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
CompressedFile.WriteBits (unmatched_sym, 8); for (i = 0; i <= match_len; i++){ // ɩɪɨɱɬɟɦ ɨɱɟɪɟɞɧɨɣ ɫɢɦɜɨɥ c = DataFile.ReadSymbol(); //ɭɞɚɥɢɦ ɢɡ ɫɥɨɜɚɪɹ ɨɞɧɭ ɫɚɦɭɸ ɫɬɚɪɭɸ ɮɪɚɡɭ DeletePhrase (); /*ɞɨɛɚɜɢɦ ɜ ɫɥɨɜɚɪɶ ɨɞɧɭ ɮɪɚɡɭ, ɧɚɱɢɧɚɸɳɭɸɫɹ ɫ ɩɟɪɜɨɝɨ ɫɢɦɜɨɥɚ ɛɭɮɟɪɚ */ AddPhrase (); /*ɫɞɜɢɧɟɦ ɨɤɧɨ ɧɚ 1 ɩɨɡɢɰɢɸ, ɞɨɛɚɜɢɦ ɜ ɤɨɧɟɰ ɛɭɮɟɪɚ ɫɢɦɜɨɥ ɫ */ MoveWindow(c); } } CompressedFile.WriteBits (0, OFFS_LN);
ɉɪɢɦɟɪ ɩɨɞɬɜɟɪɞɢɥ, ɱɬɨ ɫɩɨɫɨɛ ɮɨɪɦɢɪɨɜɚɧɢɹ ɤɨɞɨɜ ɜ LZ77 ɧɟɷɮɮɟɤɬɢɜɟɧ ɢ ɩɨɡɜɨɥɹɟɬ ɫɠɢɦɚɬɶ ɬɨɥɶɤɨ ɫɪɚɜɧɢɬɟɥɶɧɨ ɞɥɢɧɧɵɟ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ. Ⱦɨ ɧɟɤɨɬɨɪɨɣ ɫɬɟɩɟɧɢ ɫɠɚɬɢɟ ɧɟɛɨɥɶɲɢɯ ɮɚɣɥɨɜ ɦɨɠɧɨ ɭɥɭɱɲɢɬɶ, ɢɫɩɨɥɶɡɭɹ ɤɨɞɵ ɩɟɪɟɦɟɧɧɨɣ ɞɥɢɧɵ ɞɥɹ ɫɦɟɳɟɧɢɹ i. Ⱦɟɣɫɬɜɢɬɟɥɶɧɨ, ɞɚɠɟ ɟɫɥɢ ɦɵ ɢɫɩɨɥɶɡɭɟɦ ɫɥɨɜɚɪɶ ɜ 32 ɤɛɚɣɬ, ɧɨ ɡɚɤɨɞɢɪɨɜɚɥɢ ɟɳɟ ɬɨɥɶɤɨ 3 ɤɛɚɣɬ, ɬɨ ɫɦɟɳɟɧɢɟ ɪɟɚɥɶɧɨ ɬɪɟɛɭɟɬ ɧɟ 15, ɚ 12 ɛɢɬɨɜ. Ʉɪɨɦɟ ɬɨɝɨ, ɩɪɨɢɫɯɨɞɢɬ ɫɭɳɟɫɬɜɟɧɧɵɣ ɩɪɨɢɝɪɵɲ ɢɡ-ɡɚ ɢɫɩɨɥɶɡɨɜɚɧɢɹ ɤɨɞɨɜ ɨɞɢɧɚɤɨɜɨɣ ɞɥɢɧɵ ɩɪɢ ɭɤɚɡɚɧɢɢ ɞɥɢɧ ɫɨɜɩɚɞɟɧɢɹ j. ɇɚɩɪɢɦɟɪ, ɞɥɹ ɭɠɟ ɭɩɨɦɢɧɚɜɲɟɣɫɹ ɷɥɟɤɬɪɨɧɧɨɣ ɜɟɪɫɢɢ ɪɨɦɚɧɚ «Ȼɟɫɵ» ɛɵɥɢ ɩɨɥɭɱɟɧɵ ɫɥɟɞɭɸɳɢɟ ɱɚɫɬɨɬɵ ɢɫɩɨɥɶɡɨɜɚɧɢɹ ɞɥɢɧ ɫɨɜɩɚɞɟɧɢɹ: j 0 1 2 3 4 5 6 7
Ʉɨɥɢɱɟɫɬɜɨ ɪɚɡ, ɤɨɝɞɚ ɦɚɤɫɢɦɚɥɶɧɚɹ ɞɥɢɧɚ ɫɨɜɩɚɞɟɧɢɹ ɛɵɥɚ ɪɚɜɧɚ j 136 1593 4675 11165 20047 26939 28653 24725
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
65
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
8 9 10 11
19702 14767 10820 27903
ɂɡ ɬɚɛɥɢɰɵ ɫɥɟɞɭɟɬ, ɱɬɨ ɜ ɰɟɥɹɯ ɦɢɧɢɦɢɡɚɰɢɢ ɡɚɤɨɞɢɪɨɜɚɧɧɨɝɨ ɩɪɟɞɫɬɚɜɥɟɧɢɹ ɞɥɹ j = 6 ɫɥɟɞɭɟɬ ɢɫɩɨɥɶɡɨɜɚɬɶ ɤɨɞ ɧɚɢɦɟɧɶɲɟɣ ɞɥɢɧɵ, ɬɚɤ ɤɚɤ ɷɬɚ ɞɥɢɧɚ ɫɨɜɩɚɞɟɧɢɹ ɜɫɬɪɟɱɚɟɬɫɹ ɱɚɳɟ ɜɫɟɝɨ. ɏɨɬɹ ɚɜɬɨɪɵ ɚɥɝɨɪɢɬɦɚ ɢ ɞɨɤɚɡɚɥɢ, ɱɬɨ LZ77 ɦɨɠɟɬ ɫɠɚɬɶ ɞɚɧɧɵɟ ɧɟ ɯɭɠɟ, ɱɟɦ ɥɸɛɨɣ ɫɩɟɰɢɚɥɶɧɨ ɧɚ ɧɢɯ ɧɚɫɬɪɨɟɧɧɵɣ ɩɨɥɭɚɞɚɩɬɢɜɧɵɣ ɫɥɨɜɚɪɧɵɣ ɦɟɬɨɞ, ɢɡ-ɡɚ ɭɤɚɡɚɧɧɵɯ ɧɟɞɨɫɬɚɬɤɨɜ ɷɬɨ ɜɵɩɨɥɧɹɟɬɫɹ ɬɨɥɶɤɨ ɞɥɹ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɟɣ ɞɨɫɬɚɬɨɱɧɨ ɛɨɥɶɲɨɝɨ ɪɚɡɦɟɪɚ. ɑɬɨ ɤɚɫɚɟɬɫɹ ɞɟɤɨɞɢɪɨɜɚɧɢɹ ɫɠɚɬɵɯ ɞɚɧɧɵɯ, ɬɨ ɨɧɨ ɨɫɭɳɟɫɬɜɥɹɟɬɫɹ ɩɭɬɟɦ ɩɪɨɫɬɨɣ ɡɚɦɟɧɵ ɤɨɞɚ ɧɚ ɛɥɨɤ ɫɢɦɜɨɥɨɜ, ɫɨɫɬɨɹɳɢɣ ɢɡ ɮɪɚɡɵ ɫɥɨɜɚɪɹ ɢ ɹɜɧɨ ɩɟɪɟɞɚɜɚɟɦɨɝɨ ɫɢɦɜɨɥɚ. ȿɫɬɟɫɬɜɟɧɧɨ, ɞɟɤɨɞɟɪ ɞɨɥɠɟɧ ɜɵɩɨɥɧɹɬɶ ɬɟ ɠɟ ɞɟɣɫɬɜɢɹ ɩɨ ɢɡɦɟɧɟɧɢɸ ɨɤɧɚ, ɱɬɨ ɢ ɤɨɞɟɪ. Ɏɪɚɡɚ ɫɥɨɜɚɪɹ ɷɥɟɦɟɧɬɚɪɧɨ ɨɩɪɟɞɟɥɹɟɬɫɹ ɩɨ ɫɦɟɳɟɧɢɸ ɢ ɞɥɢɧɟ, ɩɨɷɬɨɦɭ ɜɚɠɧɵɦ ɫɜɨɣɫɬɜɨɦ LZ77 ɢ ɩɪɨɱɢɯ ɚɥɝɨɪɢɬɦɨɜ ɫɨ ɫɤɨɥɶɡɹɳɢɦ ɨɤɧɨɦ ɹɜɥɹɟɬɫɹ ɨɱɟɧɶ ɛɵɫɬɪɚɹ ɪɚɛɨɬɚ ɞɟɤɨɞɟɪɚ. Ⱥɥɝɨɪɢɬɦ ɞɟɤɨɞɢɪɨɜɚɧɢɹ ɦɨɠɟɬ ɢɦɟɬɶ ɫɥɟɞɭɸɳɢɣ ɜɢɞ. for (;;) { // ɱɢɬɚɟɦ ɫɦɟɳɟɧɢɟ match_pos = CompressedFile.ReadBits (OFFS_LN); if (!match_pos) // ɨɛɧɚɪɭɠɟɧ ɩɪɢɡɧɚɤ ɤɨɧɰɚ ɮɚɣɥɚ, ɜɵɯɨɞɢɦ ɢɡ ɰɢɤɥɚ break; // ɱɢɬɚɟɦ ɞɥɢɧɭ ɫɨɜɩɚɞɟɧɢɹ match_len = CompressedFile.ReadBits (LEN_LN); for (i = 0; i < match_len; i++) { /*ɧɚɯɨɞɢɦ ɜ ɫɥɨɜɚɪɟ ɨɱɟɪɟɞɧɨɣ ɫɢɦɜɨɥ ɫɨɜɩɚɜɲɟɣ ɮɪɚɡɵ */ c = Dict (match_pos + i); /*ɫɞɜɢɝɚɟɦ ɫɥɨɜɚɪɶ ɧɚ 1 ɩɨɡɢɰɢɸ, ɞɨɛɚɜɥɹɟɦ ɜ ɟɝɨ ɧɚɱɚɥɨ ɫ */
66
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
MoveDict (c) /*ɡɚɩɢɫɵɜɚɟɦ ɨɱɟɪɟɞɧɨɣ ɪɚɫɤɨɞɢɪɨɜɚɧɧɵɣ ɫɢɦɜɨɥ ɜ ɜɵɯɨɞɧɨɣ ɮɚɣɥ */ DataFile.WriteSymbol (c); } /*ɱɢɬɚɟɦ ɧɟɫɨɜɩɚɜɲɢɣ ɫɢɦɜɨɥ, ɞɨɛɚɜɥɹɟɦ ɟɝɨ ɜ ɫɥɨɜɚɪɶ ɢ ɡɚɩɢɫɵɜɚɟɦ ɜ ɜɵɯɨɞɧɨɣ ɮɚɣɥ */ c = CompressedFile.ReadBits (8); MoveDict (c) DataFile.WriteSymbol (c); }
Ⱥɥɝɨɪɢɬɦɵ ɫɨ ɫɤɨɥɶɡɹɳɢɦ ɨɤɧɨɦ ɯɚɪɚɤɬɟɪɢɡɭɸɬɫɹ ɫɢɥɶɧɨɣ ɧɟɫɢɦɦɟɬɪɢɱɧɨɫɬɶɸ ɩɨ ɜɪɟɦɟɧɢ — ɤɨɞɢɪɨɜɚɧɢɟ ɡɧɚɱɢɬɟɥɶɧɨ ɦɟɞɥɟɧɧɟɟ ɞɟɤɨɞɢɪɨɜɚɧɢɹ, ɩɨɫɤɨɥɶɤɭ ɩɪɢ ɫɠɚɬɢɢ ɦɧɨɝɨ ɜɪɟɦɟɧɢ ɬɪɚɬɢɬɫɹ ɧɚ ɩɨɢɫɤ ɮɪɚɡ. ɍɩɪɚɠɧɟɧɢɟ: ɉɪɟɞɥɨɠɢɬɟ ɧɟɫɤɨɥɶɤɨ ɛɨɥɟɟ ɷɮɮɟɤɬɢɜɧɵɯ ɫɩɨɫɨɛɨɜ ɤɨɞɢɪɨɜɚɧɢɹ ɪɟɡɭɥɶɬɚɬɨɜ ɪɚɛɨɬɵ LZ77, ɱɟɦ ɢɫɩɨɥɶɡɨɜɚɧɢɟ ɩɪɨɫɬɵɯ ɤɨɞɨɜ ɮɢɤɫɢɪɨɜɚɧɧɨɣ ɞɥɢɧɵ. ȺɅȽɈɊɂɌɆ LZSS
Ⱥɥɝɨɪɢɬɦ LZSS ɩɨɡɜɨɥɹɟɬ ɞɨɫɬɚɬɨɱɧɨ ɝɢɛɤɨ ɫɨɱɟɬɚɬɶ ɜ ɜɵɯɨɞɧɨɣ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ ɫɢɦɜɨɥɵ ɢ ɭɤɚɡɚɬɟɥɢ (ɤɨɞɵ ɮɪɚɡ), ɱɬɨ ɞɨ ɧɟɤɨɬɨɪɨɣ ɫɬɟɩɟɧɢ ɭɫɬɪɚɧɹɟɬ ɩɪɢɫɭɳɭɸ LZ77 ɪɚɫɬɨɱɢɬɟɥɶɧɨɫɬɶ, ɩɪɨɹɜɥɹɸɳɭɸɫɹ ɜ ɪɟɝɭɥɹɪɧɨɣ ɩɟɪɟɞɚɱɟ ɨɞɧɨɝɨ ɫɢɦɜɨɥɚ ɜ ɩɪɹɦɨɦ ɜɢɞɟ. ɗɬɚ ɦɨɞɢɮɢɤɚɰɢɹ LZ77 ɛɵɥɚ ɩɪɟɞɥɨɠɟɧɚ ɜ 1982 ɝɨɞɭ ɋɬɨɪɟɪɨɦ (Storer) ɢ ɀɢɦɚɧɫɤɢ (Szymanski) [10]. ɂɞɟɹ ɚɥɝɨɪɢɬɦɚ ɡɚɤɥɸɱɚɟɬɫɹ ɜ ɞɨɛɚɜɥɟɧɢɟ ɤ ɤɚɠɞɨɦɭ ɭɤɚɡɚɬɟɥɸ ɢ ɫɢɦɜɨɥɭ ɨɞɧɨɛɢɬɨɜɨɝɨ ɩɪɟɮɢɤɫɚ f, ɩɨɡɜɨɥɹɸɳɟɝɨ ɪɚɡɥɢɱɚɬɶ ɷɬɢ ɨɛɴɟɤɬɵ. ɂɧɚɱɟ ɝɨɜɨɪɹ, ɨɞɧɨɛɢɬɨɜɵɣ ɮɥɚɝ f ɭɤɚɡɵɜɚɟɬ ɬɢɩ ɢ, ɫɨɨɬɜɟɬɫɬɜɟɧɧɨ, ɞɥɢɧɭ ɧɟɩɨɫɪɟɞɫɬɜɟɧɧɨ ɫɥɟɞɭɸɳɢɯ ɡɚ ɧɢɦ ɞɚɧɧɵɯ. Ɍɚɤɚɹ ɬɟɯɧɢɤɚ ɩɨɡɜɨɥɹɟɬ: Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
67
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
• •
ɡɚɩɢɫɵɜɚɬɶ ɫɢɦɜɨɥɵ ɜ ɹɜɧɨɦ ɜɢɞɟ, ɤɨɝɞɚ ɫɨɨɬɜɟɬɫɬɜɭɸɳɢɣ ɢɦ ɤɨɞ ɢɦɟɟɬ ɛɨɥɶɲɭɸ ɞɥɢɧɭ, ɢ, ɫɥɟɞɨɜɚɬɟɥɶɧɨ, ɫɥɨɜɚɪɧɨɟ ɤɨɞɢɪɨɜɚɧɢɟ ɬɨɥɶɤɨ ɜɪɟɞɢɬ; ɨɛɪɚɛɚɬɵɜɚɬɶ ɧɢ ɪɚɡɭ ɧɟ ɜɫɬɪɟɱɟɧɧɵɟ ɞɨ ɬɟɤɭɳɟɝɨ ɦɨɦɟɧɬɚ ɫɢɦɜɨɥɵ.
ɉɪɢɦɟɪ Ɂɚɤɨɞɢɪɭɟɦ ɫɬɪɨɤɭ «ɤɨɬ_ɥɨɦɨɦ_ɤɨɥɨɥ_ɫɥɨɧɚ» ɢɡ ɩɪɟɞɵɞɭɳɟɝɨ ɩɪɢɦɟɪɚ ɢ ɫɪɚɜɧɢɦ ɤɨɷɮɮɢɰɢɟɧɬ ɫɠɚɬɢɹ ɞɥɹ LZ77 ɢ LZSS. ɉɭɫɬɶ ɦɵ ɩɟɪɟɩɢɫɵɜɚɟɦ ɫɢɦɜɨɥ ɜ ɹɜɧɨɦ ɜɢɞɟ, ɟɫɥɢ ɬɟɤɭɳɚɹ ɞɥɢɧɚ ɦɚɤɫɢɦɚɥɶɧɨɝɨ ɫɨɜɩɚɞɟɧɢɹ ɛɭɮɟɪɚ ɢ ɤɚɤɨɣ-ɬɨ ɮɪɚɡɵ ɫɥɨɜɚɪɹ ɦɟɧɶɲɟ ɢɥɢ ɪɚɜɧɚ 1. ȿɫɥɢ ɦɵ ɡɚɩɢɫɵɜɚɟɦ ɫɢɦɜɨɥ, ɬɨ ɩɟɪɟɞ ɧɢɦ ɜɵɞɚɟɦ ɮɥɚɝ ɫɨ ɡɧɚɱɟɧɢɟɦ 0, ɟɫɥɢ ɭɤɚɡɚɬɟɥɶ — ɬɨ ɫɨ ɡɧɚɱɟɧɢɟɦ 1. ȿɫɥɢ ɢɦɟɟɬɫɹ ɧɟɫɤɨɥɶɤɨ ɫɨɜɩɚɞɚɸɳɢɯ ɮɪɚɡ ɨɞɢɧɚɤɨɜɨɣ ɞɥɢɧɵ, ɬɨ ɜɵɛɢɪɚɟɦ ɛɥɢɠɚɣɲɭɸ ɤ ɛɭɮɟɪɭ. Ɍɚɛɥɢɰɚ 3.2 Ɂɚɤɨɞɢɪɨɜɚɧɧɵɟ ɒɚɝ ɋɤɨɥɶɡɹɳɟɟ ɨɤɧɨ ɋɨɜɩɚɞɚɧɧɵɟ ɞɚɸɳɚɹ ɮɪɚɡɚ ɋɥɨɜɚɪɶ Ȼɭɮɟɪ f i j s 1 - ɤɨɬ_ɥɨɦ 0 ‘ɤ’ 2 ɤ ɨɬ_ɥɨɦɨ 0 ‘ɨ’ 3 ɤɨ ɬ_ɥɨɦɨɦ 0 ‘ɬ’ 4 ɤɨɬ _ɥɨɦɨɦ_ 0 ‘_’ 5 ɤɨɬ_ ɥɨɦɨɦ_ɤ 0 ‘ɥ’ 6 ɤɨɬ_ɥ ɨɦɨɦ_ɤɨ ɨ 0 ‘ɨ’ 7 ɤɨɬ_ɥɨ ɦɨɦ_ɤɨɥ 0 ‘ɦ’ 8 ɤɨɬ_ɥɨɦ ɨɦ_ɤɨɥɨ ɨɦ 1 2 2 9 ɤɨɬ_ɥɨɦɨɦ _ɤɨɥɨɥ_ _ 0 ‘_’ 10 ɤɨɬ_ɥɨɦɨɦ_ ɤɨɥɨɥ_ɫ ɤɨ 1 10 2 11 ɤɨɬ_ɥɨɦɨɦ_ɤɨ ɥɨɥ_ɫɥɨ ɥɨ 1 8 2 12 ...ɨɬ_ɥɨɦɨɦ_ɤɨɥɨ ɥ_ɫɥɨɧɚ ɥ 0 ‘ɥ’ 13 ...ɬ_ɥɨɦɨɦ_ɤɨɥɨɥ _ɫɥɨɧɚ _ 0 ‘_’ 14 ..._ɥɨɦɨɦ_ɤɨɥɨɥ_ ɫɥɨɧɚ 0 ‘c’ 15 ...ɥɨɦɨɦ_ɤɨɥɨɥ_ɫ ɥɨɧɚ ɥɨ 1 5 2 68
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɒɚɝ
ɋɤɨɥɶɡɹɳɟɟ ɨɤɧɨ
16 17
ɋɥɨɜɚɪɶ Ȼɭɮɟɪ ...ɦɨɦ_ɤɨɥɨɥ_ɫɥɨ ɧɚ ...ɨɦ_ɤɨɥɨɥ_ɫɥɨɧ ɚ
ɋɨɜɩɚɞɚɸɳɚɹ ɮɪɚɡɚ -
Ɂɚɤɨɞɢɪɨɜɚɧɧɵɟ ɞɚɧɧɵɟ f i j s 0 ‘ɧ’ 0 ‘ɚ’
Ɍɚɤɢɦ ɨɛɪɚɡɨɦ, ɞɥɹ ɤɨɞɢɪɨɜɚɧɢɹ ɫɬɪɨɤɢ ɩɨ ɚɥɝɨɪɢɬɦɭ LZSS ɧɚɦ ɩɨɬɪɟɛɨɜɚɥɨɫɶ 17 ɲɚɝɨɜ: 13 ɪɚɡ ɫɢɦɜɨɥɵ ɛɵɥɢ ɩɟɪɟɞɚɧɵ ɜ ɹɜɧɨɦ ɜɢɞɟ, ɢ 4 ɪɚɡɚ ɦɵ ɩɪɢɦɟɧɢɥɢ ɭɤɚɡɚɬɟɥɢ. Ɂɚɦɟɬɢɦ, ɱɬɨ ɩɪɢ ɪɚɛɨɬɟ ɩɨ ɚɥɝɨɪɢɬɦɭ LZ77 ɧɚɦ ɩɨɬɪɟɛɨɜɚɥɨɫɶ ɜɫɟɝɨ ɥɢɲɶ 12 ɲɚɝɨɜ. ɋ ɞɪɭɝɨɣ ɫɬɨɪɨɧɵ, ɟɫɥɢ ɡɚɞɚɬɶɫɹ ɬɟɦɢ ɠɟ ɞɥɢɧɚɦɢ ɞɥɹ i ɢ j, ɬɨ ɪɚɡɦɟɪ ɡɚɤɨɞɢɪɨɜɚɧɧɵɯ ɩɨ LZSS ɞɚɧɧɵɯ ɪɚɜɟɧ 13·(1+8) + 4·(1+5+3) = 153 ɛɢɬɚɦ. ɗɬɨ ɨɡɧɚɱɚɟɬ, ɱɬɨ ɫɬɪɨɤɚ ɞɟɣɫɬɜɢɬɟɥɶɧɨ ɛɵɥɚ ɫɠɚɬɚ, ɬɚɤ ɤɚɤ ɟɟ ɢɫɯɨɞɧɵɣ ɪɚɡɦɟɪ 168 ɛɢɬɨɜ. Ɋɚɫɫɦɨɬɪɢɦ ɚɥɝɨɪɢɬɦ ɫɠɚɬɢɹ ɩɨɞɪɨɛɧɟɟ. const int // ɩɨɪɨɝ ɞɥɹ ɜɤɥɸɱɟɧɢɹ ɫɥɨɜɚɪɧɨɝɨ ɤɨɞɢɪɨɜɚɧɢɹ THRESHOLD = 2, // ɪɚɡɦɟɪ ɩɪɟɞɫɬɚɜɥɟɧɢɹ ɫɦɟɳɟɧɢɹ, ɜ ɛɢɬɚɯ OFFS_LN = 14, // ɪɚɡɦɟɪ ɩɪɟɞɫɬɚɜɥɟɧɢɹ ɞɥɢɧɵ ɫɨɜɩɚɞɟɧɢɹ, ɜ ɛɢɬɚɯ LEN_LN = 4; const int WIN_SIZE = (1 << OFFS_LN), // ɪɚɡɦɟɪ ɨɤɧɚ BUF_SIZE = (1 << LEN_LN) — 1; // ɪɚɡɦɟɪ ɛɭɮɟɪɚ //ɮɭɧɤɰɢɹ ɜɵɱɢɫɥɟɧɢɹ ɪɟɚɥɶɧɨɝɨ ɩɨɥɨɠɟɧɢɹ ɫɢɦɜɨɥɚ ɜ ɨɤɧɟ inline int MOD (int i) { return i & (WIN_SIZE-1); }; ... //ɫɨɛɫɬɜɟɧɧɨ ɚɥɝɨɪɢɬɦ ɫɠɚɬɢɹ int buf_sz = BUF_SIZE; /* ɢɧɢɰɢɚɥɢɡɚɰɢɹ: ɡɚɩɨɥɧɟɧɢɟ ɛɭɮɟɪɚ, ɩɨɢɫɤ ɫɨɜɩɚɞɟɧɢɹ ɞɥɹ ɩɟɪɜɨɝɨ ɲɚɝɚ */ ... while ( buf_sz ) { if ( match_len > buf_sz) match_len = buf_sz; if ( match_len < THRESHOLD ) { /*ɟɫɥɢ ɞɥɢɧɚ ɫɨɜɩɚɞɟɧɢɹ ɦɟɧɶɲɟ ɩɨɪɨɝɚ (2 ɜ
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
69
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɩɪɢɦɟɪɟ), ɬɨ ɡɚɩɢɲɟɦ ɜ ɮɚɣɥ ɫɠɚɬɵɯ ɞɚɧɧɵɯ ɮɥɚɝ ɢ ɫɢɦɜɨɥ; pos ɨɩɪɟɞɟɥɹɟɬ ɩɨɡɢɰɢɸ ɧɚɱɚɥɚ ɛɭɮɟɪɚ */ CompressedFile.WriteBit (0); CompressedFile.WriteBits (window [pos], 8); // ɷɬɨ ɩɨɧɚɞɨɛɢɬɫɹ ɩɪɢ ɨɛɧɨɜɥɟɧɢɢ ɫɥɨɜɚɪɹ match_len = 1; }else{ /*ɢɧɚɱɟ ɡɚɩɢɲɟɦ ɮɥɚɝ ɢ ɭɤɚɡɚɬɟɥɶ, ɫɨɫɬɨɹɳɢɣ ɢɡ ɫɦɟɳɟɧɢɹ ɢ ɞɥɢɧɵ ɫɨɜɩɚɞɟɧɢɹ */ CompressedFile.WriteBit (1); CompressedFile.WriteBits (match_offs, OFFS_LN); CompressedFile.WriteBits (match_len, LEN_LN); } for (int i = 0; i < match_len; i++) { /*ɭɞɚɥɢɦ ɢɡ ɫɥɨɜɚɪɹ ɮɪɚɡɭ, ɧɚɱɢɧɚɸɳɭɸɫɹ ɜ ɩɨɡɢɰɢɢ MOD (pos+buf_sz) */ DeletePhrase ( MOD (pos+buf_sz) ); if ( (c = DataFile.ReadSymbol ()) == EOF) // ɦɵ ɜ ɤɨɧɰɟ ɮɚɣɥɚ, ɧɚɞɨ ɫɨɤɪɚɬɢɬɶ ɛɭɮɟɪ buf_sz--; else /*ɢɧɚɱɟ ɧɚɞɨ ɞɨɛɚɜɢɬɶ ɜ ɤɨɧɟɰ ɛɭɮɟɪɚ ɧɨɜɵɣ ɫɢɦɜɨɥ */ window [MOD (pos+buf_sz)] = c; pos = MOD (pos+1); // ɫɞɜɢɝ ɨɤɧɚ ɧɚ 1 ɫɢɦɜɨɥ if (buf_sz) /*ɟɫɥɢ ɛɭɮɟɪ ɧɟ ɩɭɫɬ, ɬɨ ɞɨɛɚɜɢɦ ɜ ɫɥɨɜɚɪɶ ɧɨɜɭɸ ɮɪɚɡɭ, ɧɚɱɢɧɚɸɳɭɸɫɹ ɜ ɩɨɡɢɰɢɢ pos; ɫɱɢɬɚɟɦ, ɱɬɨ ɜ ɮɭɧɤɰɢɢ AddPhrase ɨɞɧɨɜɪɟɦɟɧɧɨ ɜɵɩɨɥɧɹɟɬɫɹ ɩɨɢɫɤ ɦɚɤɫɢɦɚɥɶɧɨɝɨ ɫɨɜɩɚɞɟɧɢɹ ɦɟɠɞɭ ɛɭɮɟɪɨɦ ɢ ɮɪɚɡɚɦɢ ɫɥɨɜɚɪɹ */ AddPhrase (pos, &match_offs, &match_len) ; } } CompressedFile.WriteBit (1); CompressedFile.WriteBits (0, ɮɚɣɥɚ
OFFS_LN);
//
ɡɧɚɤ
ɤɨɧɰɚ
ɋɤɨɥɶɡɹɳɟɟ ɨɤɧɨ ɦɨɠɧɨ ɪɟɚɥɢɡɨɜɵɜɚɬɶ ɫ ɩɨɦɨɳɶɸ «ɰɢɤɥɢɱɟɫɤɨɝɨ» ɦɚɫɫɢɜɚ, ɱɬɨ ɢ ɛɵɥɨ ɩɪɨɞɟɥɚɧɨ ɜ ɜɵɲɟɩɪɢɜɟɞɟɧɧɨɦ 70
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɭɱɟɛɧɨɦ ɮɪɚɝɦɟɧɬɟ ɩɪɨɝɪɚɦɦɵ ɫɠɚɬɢɹ. ɂɫɩɨɥɶɡɨɜɚɧɧɵɣ ɩɨɞɯɨɞ ɧɟ ɹɜɥɹɟɬɫɹ ɥɭɱɲɢɦ, ɧɨ ɫɪɚɜɧɢɬɟɥɶɧɨ ɩɪɨɫɬ ɞɥɹ ɩɨɧɢɦɚɧɢɹ. Ⱥɥɝɨɪɢɬɦ ɞɟɤɨɞɢɪɨɜɚɧɢɹ ɦɨɠɟɬ ɛɵɬɶ ɪɟɚɥɢɡɨɜɚɧ ɫɥɟɞɭɸɳɢɦ ɨɛɪɚɡɨɦ. for (;;) { if ( !CompressedFile.ReadBit () ){ /*ɷɬɨ ɫɢɦɜɨɥ, ɩɪɨɫɬɨ ɜɵɜɟɞɟɦ ɟɝɨ ɜ ɮɚɣɥ ɢ ɡɚɩɢɲɟɦ ɜ ɤɨɧɟɰ ɫɥɨɜɚɪɹ (ɫɢɦɜɨɥ ɛɭɞɟɬ ɫɨɨɬɜɟɬɫɬɜɨɜɚɬɶ ɫɦɟɳɟɧɢɸ i = 1) */ c = CompressedFile.ReadBits (8); DataFile.WriteSymbol (c); window [pos] = c; pos = MOD (pos+1); }else{ // ɷɬɨ ɭɤɚɡɚɬɟɥɶ, ɩɪɨɱɢɬɚɟɦ ɟɝɨ match_pos = CompressedFile.ReadBits (OFFS_LN); if (!match_pos) break; // ɤɨɧɟɰ ɮɚɣɥɚ match_pos = MOD (pos - match_pos); match_len = CompressedFile.ReadBits (LEN_LN); // ɰɢɤɥ ɤɨɩɢɪɨɜɚɧɢɹ ɫɨɜɩɚɜɲɟɣ ɮɪɚɡɵ ɫɥɨɜɚɪɹ ɜ ɮɚɣɥ for (int i = 0; i < match_len; i++) { //ɜɵɞɚɟɦ ɨɱɟɪɟɞɧɨɣ ɫɨɜɩɚɜɲɢɣ ɫɢɦɜɨɥ c c = window [MOD (match_pos+i)]; DataFile.WriteSymbol (c); window [pos] = c; pos = MOD (pos+1); } } }
ɍɩɪɚɠɧɟɧɢɟ: ɂɡ-ɡɚ ɧɚɥɢɱɢɹ ɩɨɪɨɝɚ THRESHOLD ɱɚɫɬɶ ɞɨɩɭɫɬɢɦɵɯ ɡɧɚɱɟɧɢɣ ɞɥɢɧɵ ɪɟɚɥɶɧɨ ɧɟ ɢɫɩɨɥɶɡɭɟɬɫɹ, ɩɨɷɬɨɦɭ ɪɚɡɦɟɪ ɛɭɮɟɪɚ BUF_SIZE ɦɨɠɟɬ ɛɵɬɶ ɭɜɟɥɢɱɟɧ ɩɪɢ ɧɟɢɡɦɟɧɧɨɦ LEN_LN. ɉɪɨɞɟɥɚɣɬɟ ɫɨɨɬɜɟɬɫɬɜɭɸɳɢɟ ɦɨɞɢɮɢɤɚɰɢɢ ɮɪɚɝɦɟɧɬɨɜ ɩɪɨɝɪɚɦɦ ɤɨɞɢɪɨɜɚɧɢɹ ɢ ɞɟɤɨɞɢɪɨɜɚɧɢɹ.
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
71
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ȺɅȽɈɊɂɌɆ LZ78
Ⱥɥɝɨɪɢɬɦ LZ78 ɛɵɥ ɨɩɭɛɥɢɤɨɜɚɧ ɜ 1978 ɝɨɞɭ [13], ɢ ɜɩɨɫɥɟɞɫɬɜɢɢ ɫɬɚɥ «ɨɬɰɨɦ» ɫɟɦɟɣɫɬɜɚ ɫɥɨɜɚɪɧɵɯ ɦɟɬɨɞɨɜ LZ78. Ⱥɥɝɨɪɢɬɦɵ ɷɬɨɣ ɝɪɭɩɩɵ ɧɟ ɢɫɩɨɥɶɡɭɸɬ ɫɤɨɥɶɡɹɳɟɝɨ ɨɤɧɚ ɢ ɜ ɫɥɨɜɚɪɶ ɩɨɦɟɳɚɸɬ ɧɟ ɜɫɟ ɜɫɬɪɟɱɚɟɦɵɟ ɩɪɢ ɤɨɞɢɪɨɜɚɧɢɢ ɫɬɪɨɤɢ, ɚ ɥɢɲɶ «ɩɟɪɫɩɟɤɬɢɜɧɵɟ» ɫ ɬɨɱɤɢ ɡɪɟɧɢɹ ɜɟɪɨɹɬɧɨɫɬɢ ɩɨɫɥɟɞɭɸɳɟɝɨ ɢɫɩɨɥɶɡɨɜɚɧɢɹ. ɇɚ ɤɚɠɞɨɦ ɲɚɝɟ ɜ ɫɥɨɜɚɪɶ ɜɫɬɚɜɥɹɟɬɫɹ ɧɨɜɚɹ ɮɪɚɡɚ, ɤɨɬɨɪɚɹ ɩɪɟɞɫɬɚɜɥɹɟɬ ɫɨɛɨɣ ɫɰɟɩɥɟɧɢɟ (ɤɨɧɤɚɬɟɧɚɰɢɸ) ɨɞɧɨɣ ɢɡ ɮɪɚɡ S ɫɥɨɜɚɪɹ, ɢɦɟɸɳɟɣ ɫɚɦɨɟ ɞɥɢɧɧɨɟ ɫɨɜɩɚɞɟɧɢɟ ɫɨ ɫɬɪɨɤɨɣ ɛɭɮɟɪɚ, ɢ ɫɢɦɜɨɥɚ s. ɋɢɦɜɨɥ s ɹɜɥɹɟɬɫɹ ɫɢɦɜɨɥɨɦ, ɫɥɟɞɭɸɳɢɦ ɡɚ ɫɬɪɨɤɨɣ ɛɭɮɟɪɚ, ɞɥɹ ɤɨɬɨɪɨɣ ɧɚɣɞɟɧɚ ɫɨɜɩɚɞɚɸɳɚɹ ɮɪɚɡɚ S. ȼ ɨɬɥɢɱɢɟ ɨɬ ɫɟɦɟɣɫɬɜɚ LZ77, ɜ ɫɥɨɜɚɪɟ ɧɟ ɦɨɠɟɬ ɛɵɬɶ ɨɞɢɧɚɤɨɜɵɯ ɮɪɚɡ. Ʉɨɞɟɪ ɩɨɪɨɠɞɚɟɬ ɬɨɥɶɤɨ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɶ ɤɨɞɨɜ ɮɪɚɡ. Ʉɚɠɞɵɣ ɤɨɞ ɫɨɫɬɨɢɬ ɢɡ ɧɨɦɟɪɚ (ɢɧɞɟɤɫɚ) n «ɪɨɞɢɬɟɥɶɫɤɨɣ» ɮɪɚɡɵ S, ɢɥɢ ɩɪɟɮɢɤɫɚ, ɢ ɫɢɦɜɨɥɚ s. ȼ ɧɚɱɚɥɟ ɨɛɪɚɛɨɬɤɢ ɫɥɨɜɚɪɶ ɩɭɫɬ. Ⱦɚɥɟɟ, ɬɟɨɪɟɬɢɱɟɫɤɢ, ɫɥɨɜɚɪɶ ɦɨɠɟɬ ɪɚɫɬɢ ɛɟɫɤɨɧɟɱɧɨ, ɬ.ɟ. ɧɚ ɟɝɨ ɪɨɫɬ ɫɚɦ ɚɥɝɨɪɢɬɦ ɧɟ ɧɚɥɚɝɚɟɬ ɨɝɪɚɧɢɱɟɧɢɣ. ɇɚ ɩɪɚɤɬɢɤɟ ɩɪɢ ɞɨɫɬɢɠɟɧɢɢ ɨɩɪɟɞɟɥɟɧɧɨɝɨ ɨɛɴɟɦɚ ɡɚɧɢɦɚɟɦɨɣ ɩɚɦɹɬɢ ɫɥɨɜɚɪɶ ɞɨɥɠɟɧ ɨɱɢɳɚɬɶɫɹ ɩɨɥɧɨɫɬɶɸ ɢɥɢ ɱɚɫɬɢɱɧɨ. ɉɪɢɦɟɪ ɂ ɟɳɟ ɪɚɡ ɡɚɤɨɞɢɪɭɟɦ ɫɬɪɨɤɭ «ɤɨɬ_ɥɨɦɨɦ_ɤɨɥɨɥ_ɫɥɨɧɚ» ɞɥɢɧɨɣ 21 ɫɢɦɜɨɥ. Ⱦɥɹ LZ78 ɛɭɮɟɪ, ɜ ɩɪɢɧɰɢɩɟ, ɧɟ ɬɪɟɛɭɟɬɫɹ, ɩɨɫɤɨɥɶɤɭ ɞɨɫɬɚɬɨɱɧɨ ɥɟɝɤɨ ɬɚɤ ɪɟɚɥɢɡɨɜɚɬɶ ɩɨɢɫɤ ɫɨɜɩɚɞɚɸɳɟɣ ɮɪɚɡɵ ɦɚɤɫɢɦɚɥɶɧɨɣ ɞɥɢɧɵ, ɱɬɨ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɶ ɧɟɡɚɤɨɞɢɪɨɜɚɧɧɵɯ ɫɢɦɜɨɥɨɜ ɛɭɞɟɬ ɩɪɨɫɦɚɬɪɢɜɚɬɶɫɹ ɬɨɥɶɤɨ ɨɞɢɧ ɪɚɡ. ɉɨɷɬɨɦɭ ɛɭɮɟɪ ɩɨɤɚɡɚɧ ɬɨɥɶɤɨ ɫ ɰɟɥɶɸ ɛɨɥɶɲɟɣ ɞɨɯɨɞɱɢɜɨɫɬɢ ɩɪɢɦɟɪɚ. Ɏɪɚɡɭ ɫ ɧɨɦɟɪɨɦ 0 ɡɚɪɟɡɟɪɜɢɪɭɟɦ ɞɥɹ ɨɛɨɡɧɚɱɟɧɢɹ ɤɨɧɰɚ ɫɠɚɬɨɣ ɫɬɪɨɤɢ, ɧɨɦɟɪɨɦ 1 ɛɭɞɟɦ ɡɚɞɚɜɚɬɶ ɩɭɫɬɭɸ ɮɪɚɡɭ ɫɥɨɜɚɪɹ.
72
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɒɚɝ
1 2 3 4 5 6 7 8 9 10 11 12 13
Ⱦɨɛɚɜɥɹɟɦɚɹ ɜ ɫɥɨɜɚɪɶ ɮɪɚɡɚ ɫɚɦɚ ɟɟ ɮɪɚɡɚ ɧɨɦɟɪ ɤ 2 ɨ 3 ɬ 4 _ 5 ɥ 6 ɨɦ 7 ɨɦ_ 8 ɤɨ 9 ɥɨ 10 ɥ_ 11 c 12 ɥɨɧ 13 a 14
Ȼɭɮɟɪ
ɤɨɬ_ɥɨɦ ɨɬ_ɥɨɦɨ ɬ_ɥɨɦɨɦ _ɥɨɦɨɦ_ ɥɨɦɨɦ_ɤ ɨɦɨɦ_ɤɨ ɨɦ_ɤɨɥɨ ɤɨɥɨɥ_ɫ ɥɨɥ_ɫɥɨ ɥ_ɫɥɨɧɚ ɫɥɨɧɚ ɥɨɧɚ ɚ
Ɍɚɛɥɢɰɚ 3.3 ɋɨɜɩɚɞɚɸɁɚɤɨɞɢɪɨɜɚɧɧɵɟ ɳɚɹ ɮɪɚɡɚ S ɞɚɧɧɵɟ n s ɨ ɨɦ ɤ ɥ ɥ ɥɨ -
1 1 1 1 1 3 7 2 6 6 1 10 1
‘ɤ’ ‘ɨ’ ‘ɬ’ ‘_’ ‘ɥ’ ‘ɦ’ ‘_’ ‘ɨ’ ‘ɨ’ ‘_’ ‘c’ ‘ɧ’ ‘ɚ’
ɋɬɪɨɤɭ ɭɞɚɥɨɫɶ ɡɚɤɨɞɢɪɨɜɚɬɶ ɡɚ 13 ɲɚɝɨɜ. Ɍɚɤ ɤɚɤ ɧɚ ɤɚɠɞɨɦ ɲɚɝɟ ɜɵɞɚɜɚɥɫɹ ɨɞɢɧ ɤɨɞ, ɫɠɚɬɚɹ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɶ ɫɨɫɬɨɢɬ ɢɡ 13 ɤɨɞɨɜ. ȼɨɡɦɨɠɧɨ ɢɫɩɨɥɶɡɨɜɚɧɢɟ 15 ɧɨɦɟɪɨɜ ɮɪɚɡ (ɨɬ 0 ɞɨ 14), ɩɨɷɬɨɦɭ ɞɥɹ ɩɪɟɞɫɬɚɜɥɟɧɢɹ n ɩɨɫɪɟɞɫɬɜɨɦ ɤɨɞɨɜ ɮɢɤɫɢɪɨɜɚɧɧɨɣ ɞɥɢɧɵ ɧɚɦ ɩɨɬɪɟɛɭɟɬɫɹ 4 ɛɢɬɚ. Ɍɨɝɞɚ ɪɚɡɦɟɪ ɫɠɚɬɨɣ ɫɬɪɨɤɢ ɪɚɜɟɧ 13·(4+8) = 156 ɛɢɬɚɦ. ɇɢɠɟ ɩɪɢɜɟɞɟɧ ɩɪɢɦɟɪ ɪɟɚɥɢɡɚɰɢɢ ɚɥɝɨɪɢɬɦɚ ɫɠɚɬɢɹ LZ78. n = 1; while ( ! DataFile.EOF() ){ s = DataFile.ReadSymbol; // ɱɢɬɚɟɦ ɨɱɟɪɟɞɧɨɣ ɫɢɦɜɨɥ /*ɩɵɬɚɟɦɫɹ ɧɚɣɬɢ ɜ ɫɥɨɜɚɪɟ ɮɪɚɡɭ, ɩɪɟɞɫɬɚɜɥɹɸɳɭɸ ɫɨɛɨɣ ɤɨɧɤɚɬɟɧɚɰɢɸ ɪɨɞɢɬɟɥɶɫɤɨɣ ɮɪɚɡɵ ɫ ɧɨɦɟɪɨɦ n ɢ ɫɢɦɜɨɥɚ s; ɮɭɧɤɰɢɹ ɜɨɡɜɪɚɳɚɟɬ ɧɨɦɟɪ ɢɫɤɨɦɨɣ ɮɪɚɡɵ ɜ phrase_num; ɟɫɥɢ ɠɟ ɮɪɚɡɵ ɧɟɬ, ɬɨ phrase_num ɩɪɢɧɢɦɚɟɬ ɡɧɚɱɟɧɢɟ 1, ɬ.ɟ. ɭɤɚɡɵɜɚɟɬ ɧɚ ɩɭɫɬɭɸ ɮɪɚɡɭ
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
73
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
*/ FindPhrase (&phrase_num, n, s); if (phrase_num != 1) /*ɬɚɤɚɹ ɮɪɚɡɚ ɢɦɟɟɬɫɹ ɜ ɫɥɨɜɚɪɟ, ɩɪɨɞɨɥɠɢɦ ɩɨɢɫɤ ɫɨɜɩɚɞɚɸɳɟɣ ɮɪɚɡɵ ɦɚɤɫɢɦɚɥɶɧɨɣ ɞɥɢɧɵ */ n = phrase_num; else { /*ɬɚɤɨɣ ɮɪɚɡɵ ɧɟɬ, ɡɚɩɢɲɟɦ ɜ ɜɵɯɨɞɧɨɣ ɮɚɣɥ ɤɨɞ; INDEX_LN — ɷɬɨ ɤɨɧɫɬɚɧɬɚ, ɨɩɪɟɞɟɥɹɸɳɚɹ ɞɥɢɧɭ ɛɢɬɨɜɨɝɨ ɩɪɟɞɫɬɚɜɥɟɧɢɹ ɧɨɦɟɪɚ n */ CompressedFile.WriteBits (n, INDEX_LN); CompressedFile.WriteBits (s, 8); AddPhrase (n, s); // ɞɨɛɚɜɢɦ ɮɪɚɡɭ ɜ ɫɥɨɜɚɪɶ n = 1; // ɩɨɞɝɨɬɨɜɢɦɫɹ ɤ ɫɥɟɞɭɸɳɟɦɭ ɲɚɝɭ } } // ɩɪɢɡɧɚɤ ɤɨɧɰɚ ɮɚɣɥɚ CompressedFile.WriteBits (0, INDEX_LN);
ɉɪɢ ɞɟɤɨɞɢɪɨɜɚɧɢɢ ɧɟɨɛɯɨɞɢɦɨ ɨɛɟɫɩɟɱɢɜɚɬɶ ɬɚɤɨɣ ɠɟ ɩɨɪɹɞɨɤ ɨɛɧɨɜɥɟɧɢɹ ɫɥɨɜɚɪɹ, ɱɬɨ ɢ ɩɪɢ ɫɠɚɬɢɢ. Ɋɟɚɥɢɡɭɟɦ ɚɥɝɨɪɢɬɦ ɫɥɟɞɭɸɳɢɦ ɨɛɪɚɡɨɦ. for (;;){ // ɱɢɬɚɟɦ ɢɧɞɟɤɫ ɪɨɞɢɬɟɥɶɫɤɨɣ ɮɪɚɡɵ n = CompressedFile.ReadBits (INDEX_LN); if (!n) break; // ɤɨɧɟɰ ɮɚɣɥɚ // ɱɢɬɚɟɦ ɧɟɫɨɜɩɚɜɲɢɣ ɫɢɦɜɨɥ s s = CompressedFile.ReadBits (8); /*ɧɚɯɨɞɢɦ ɜ ɫɥɨɜɚɪɟ ɩɨɡɢɰɢɸ ɧɚɱɚɥɚ ɮɪɚɡɵ ɫ ɢɧɞɟɤɫɨɦ n ɢ ɟɟ ɞɥɢɧɭ */ GetPhrase (&pos, &len, n) /*ɡɚɩɢɫɵɜɚɟɦ ɮɪɚɡɭ ɫ ɢɧɞɟɤɫɨɦ n ɜ ɮɚɣɥ ɪɚɫɤɨɞɢɪɨɜɚɧɧɵɯ ɞɚɧɧɵɯ */ for (i = 0; i < len; i++) DataFile.WriteSymbol (Dict[pos+i]); // ɡɚɩɢɫɵɜɚɟɦ ɜ ɮɚɣɥ ɫɢɦɜɨɥ s DataFile.WriteSymbol (s); AddPhrase (n, s); // ɞɨɛɚɜɥɹɟɦ ɧɨɜɭɸ ɮɪɚɡɭ ɜ ɫɥɨɜɚɪɶ }
74
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
Ɉɱɟɜɢɞɧɨ, ɱɬɨ ɫɤɨɪɨɫɬɶ ɪɚɫɤɨɞɢɪɨɜɚɧɢɹ ɞɥɹ ɚɥɝɨɪɢɬɦɨɜ ɫɟɦɟɣɫɬɜɚ LZ78 ɩɨɬɟɧɰɢɚɥɶɧɨ ɜɫɟɝɞɚ ɦɟɧɶɲɟ ɫɤɨɪɨɫɬɢ ɞɥɹ ɚɥɝɨɪɢɬɦɨɜ ɫɨ ɫɤɨɥɶɡɹɳɢɦ ɨɤɧɨɦ, ɬ.ɤ. ɜ ɫɥɭɱɚɟ ɩɨɫɥɟɞɧɢɯ ɡɚɬɪɚɬɵ ɩɨ ɩɨɞɞɟɪɠɚɧɢɸ ɫɥɨɜɚɪɹ ɜ ɩɪɚɜɢɥɶɧɨɦ ɫɨɫɬɨɹɧɢɢ ɦɢɧɢɦɚɥɶɧɵ. ɋ ɞɪɭɝɨɣ ɫɬɨɪɨɧɵ, ɞɥɹ LZ78 ɢ ɟɝɨ ɩɨɬɨɦɤɨɜ, ɧɚɩɪɢɦɟɪ LZW, ɫɭɳɟɫɬɜɭɸɬ ɷɮɮɟɤɬɢɜɧɵɟ ɪɟɚɥɢɡɚɰɢɢ ɩɪɨɰɟɞɭɪ ɩɨɢɫɤɚ ɢ ɞɨɛɚɜɥɟɧɢɹ ɮɪɚɡ ɜ ɫɥɨɜɚɪɶ, ɱɬɨ ɨɛɟɫɩɟɱɢɜɚɟɬ ɡɧɚɱɢɬɟɥɶɧɨɟ ɩɪɟɢɦɭɳɟɫɬɜɨ ɧɚɞ ɚɥɝɨɪɢɬɦɚɦɢ ɫɟɦɟɣɫɬɜɚ LZ77 ɜ ɫɤɨɪɨɫɬɢ ɫɠɚɬɢɹ. ɇɟɫɦɨɬɪɹ ɧɚ ɨɬɧɨɫɢɬɟɥɶɧɭɸ ɛɵɫɬɪɨɬɭ ɤɨɞɢɪɨɜɚɧɢɹ LZ78, ɩɪɢ ɝɪɚɦɨɬɧɨɣ ɪɟɚɥɢɡɚɰɢɢ ɚɥɝɨɪɢɬɦɚ ɨɧɨ ɜɫɟ ɠɟ ɦɟɞɥɟɧɧɟɟ ɞɟɤɨɞɢɪɨɜɚɧɢɹ, ɫɨɨɬɧɨɲɟɧɢɟ ɫɤɨɪɨɫɬɟɣ ɪɚɜɧɨ ɨɛɵɱɧɨ 3:2. ɂɧɬɟɪɟɫɧɨɟ ɫɜɨɣɫɬɜɨ LZ78 ɡɚɤɥɸɱɚɟɬɫɹ ɜ ɬɨɦ, ɱɬɨ ɟɫɥɢ ɢɫɯɨɞɧɵɟ ɞɚɧɧɵɟ ɩɨɪɨɠɞɟɧɵ ɢɫɬɨɱɧɢɤɨɦ ɫ ɨɩɪɟɞɟɥɟɧɧɵɦɢ ɯɚɪɚɤɬɟɪɢɫɬɢɤɚɦɢ (ɨɧ ɞɨɥɠɟɧ ɛɵɬɶ ɫɬɚɰɢɨɧɚɪɧɵɦ2 ɢ ɷɪɝɨɞɢɱɟɫɤɢɦ3), ɬɨ ɤɨɷɮɮɢɰɢɟɧɬ ɫɠɚɬɢɹ ɩɪɢɛɥɢɠɚɟɬɫɹ ɩɨ ɦɟɪɟ ɤɨɞɢɪɨɜɚɧɢɹ ɤ ɦɢɧɢɦɚɥɶɧɨɦɭ ɞɨɫɬɢɠɢɦɨɦɭ [13]. ɂɧɚɱɟ ɝɨɜɨɪɹ, ɤɨɥɢɱɟɫɬɜɨ ɛɢɬɨɜ, ɡɚɬɪɚɱɢɜɚɟɦɵɯ ɧɚ ɤɨɞɢɪɨɜɚɧɢɟ ɤɚɠɞɨɝɨ ɫɢɦɜɨɥɚ, ɜ ɫɪɟɞɧɟɦ ɪɚɜɧɨ ɬɚɤ ɧɚɡɵɜɚɟɦɨɣ ɷɧɬɪɨɩɢɢ ɢɫɬɨɱɧɢɤɚ. ɇɨ, ɤ ɫɨɠɚɥɟɧɢɸ, ɫɯɨɞɢɦɨɫɬɶ ɦɟɞɥɟɧɧɚɹ, ɢ ɧɚ ɞɚɧɧɵɯ ɪɟɚɥɶɧɨɣ ɞɥɢɧɵ ɚɥɝɨɪɢɬɦ ɜɟɞɟɬ ɫɟɛɹ ɧɟ ɥɭɱɲɢɦ ɨɛɪɚɡɨɦ. Ɍɚɤ, ɧɚɩɪɢɦɟɪ, ɤɨɷɮɮɢɰɢɟɧɬ ɫɠɚɬɢɹ ɬɟɤɫɬɨɜ ɜ ɡɚɜɢɫɢɦɨɫɬɢ ɨɬ ɢɯ ɪɚɡɦɟɪɚ ɨɛɵɱɧɨ ɤɨɥɟɛɥɟɬɫɹ ɨɬ 3.5 ɞɨ 5 ɛɢɬɨɜ/ɫɢɦɜɨɥ. Ʉɪɨɦɟ ɬɨɝɨ, ɧɟɪɟɞɤɢ ɫɢɬɭɚɰɢɢ, ɤɨɝɞɚ ɨɛɪɚɛɚɬɵɜɚɟɦɵɟ ɞɚɧɧɵɟ ɩɨɪɨɠɞɟɧɵ ɢɫɬɨɱɧɢɤɨɦ ɫ ɹɪɤɨ ɜɵɪɚɠɟɧɧɨɣ ɧɟɫɬɚɰɢɨɧɚɪɧɨɫɬɶɸ. ɉɨɷɬɨɦɭ ɩɪɢ ɨɰɟɧɤɟ ɪɟɚɥɶɧɨɝɨ ɩɨɜɟɞɟɧɢɹ ɚɥɝɨɪɢɬɦɚ ɫɥɟɞɭɟɬ ɨɬɧɨɫɢɬɶɫɹ ɫ ɛɨɥɶɲɨɣ
2
Ɇɧɨɝɨɦɟɪɧɵɟ ɪɚɫɩɪɟɞɟɥɟɧɢɹ ɜɟɪɨɹɬɧɨɫɬɟɣ ɝɟɧɟɪɚɰɢɢ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɟɣ (ɫɥɨɜ) ɢɡ n ɫɢɦɜɨɥɨɜ ɧɟ ɦɟɧɹɸɬɫɹ ɜɨ ɜɪɟɦɟɧɢ, ɩɪɢɱɟɦ n — ɥɸɛɨɟ ɤɨɧɟɱɧɨɟ ɱɢɫɥɨ 3 ɋɪɟɞɧɟɟ ɩɨ ɜɪɟɦɟɧɢ ɪɚɜɧɨ ɫɪɟɞɧɟɦɭ ɩɨ ɱɢɫɥɭ ɪɟɚɥɢɡɚɰɢɣ; ɢɧɚɱɟ ɝɨɜɨɪɹ, ɞɥɹ ɨɰɟɧɤɢ ɫɜɨɣɫɬɜ ɢɫɬɨɱɧɢɤɚ ɞɨɫɬɚɬɨɱɧɨ ɬɨɥɶɤɨ ɨɞɧɨɣ ɞɥɢɧɧɨɣ ɫɝɟɧɟɪɢɪɨɜɚɧɧɨɣ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
75
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɨɫɬɨɪɨɠɧɨɫɬɶɸ ɤ ɬɟɨɪɟɬɢɱɟɫɤɢɦ ɜɵɤɥɚɞɤɚɦ, ɨɛɪɚɳɚɹ ɜɧɢɦɚɧɢɟ ɧɚ ɜɵɩɨɥɧɟɧɢɟ ɫɨɨɬɜɟɬɫɬɜɭɸɳɢɯ ɭɫɥɨɜɢɣ. Ⱦɨɤɚɡɚɧɨ, ɱɬɨ ɚɧɚɥɨɝɢɱɧɵɦ ɫɜɨɣɫɬɜɨɦ ɫɯɨɞɢɦɨɫɬɢ ɨɛɥɚɞɚɟɬ ɢ ɤɥɚɫɫɢɱɟɫɤɢɣ ɚɥɝɨɪɢɬɦ LZ77, ɧɨ ɫɤɨɪɨɫɬɶ ɩɪɢɛɥɢɠɟɧɢɹ ɤ ɷɧɬɪɨɩɢɢ ɢɫɬɨɱɧɢɤɚ ɦɟɧɶɲɟ, ɱɟɦ ɭ ɚɥɝɨɪɢɬɦɚ LZ78 [12].
Ⱦɪɭɝɢɟ ɚɥɝɨɪɢɬɦɵ LZ ȼ ɬɚɛɥ. 3.4 ɩɪɢɜɟɞɟɧɵ ɧɟɫɤɨɥɶɤɨ ɞɨɫɬɚɬɨɱɧɨ ɯɚɪɚɤɬɟɪɧɵɯ ɚɥɝɨɪɢɬɦɨɜ LZ. ɍɤɚɡɚɧɧɵɣ ɫɩɢɫɨɤ ɞɚɥɟɤɨ ɧɟ ɩɨɥɨɧ, ɪɟɚɥɶɧɨ ɫɭɳɟɫɬɜɭɟɬ ɜ ɧɟɫɤɨɥɶɤɨ ɪɚɡ ɛɨɥɶɲɟ ɚɥɝɨɪɢɬɦɨɜ, ɨɫɧɨɜɚɧɧɵɯ ɥɢɛɨ ɧɚ LZ77, ɥɢɛɨ ɧɚ LZ78. ɂɡɜɟɫɬɧɵ ɢ ɝɢɛɪɢɞɧɵɟ ɫɯɟɦɵ, ɫɨɱɟɬɚɸɳɢɟ ɨɛɚ ɩɨɞɯɨɞɚ ɤ ɩɨɫɬɪɨɟɧɢɸ ɫɥɨɜɚɪɹ. Ɍɚɛɥɢɰɚ 3.4 ʋ ɇɚɡɜɚɧɢɟ Ⱥɜɬɨɪɵ, ɝɨɞ Ɍɢɩ ɚɥɝɨɪɢɬɦɚ 1 LZMV Ɇɢɥɥɟɪ (Miller) ɢ Ⱥɥɝɨɪɢɬɦ ɫɟɦɟɣɫɬɜɚ ɍɷɝɧɚɦ (Wegman), LZ78 1984 2 LZW ɍɷɥɱ (Welch), Ɇɨɞɢɮɢɤɚɰɢɹ LZ78 1984 3 LZB Ȼɟɥɥ (Bell), 1987 Ɇɨɞɢɮɢɤɚɰɢɹ LZSS 4 LZH Ȼɪɟɧɬ (Brent), Ɇɨɞɢɮɢɤɚɰɢɹ LZSS 1987 5 LZFG Ɏɚɣɷɥɷ (Fiala) ɢ Ɇɨɞɢɮɢɤɚɰɢɹ LZ77 Ƚɪɢɧɢ (Greene), 1989 6 LZBW Ȼɟɧɞɟɪ (Bender) ɢ ɋɩɨɫɨɛ ɦɨɞɢɮɢɤɚɰɢɹ ȼɭɥɮ (Wolf), 1991 ɚɥɝɨɪɢɬɦɨɜ ɫɟɦɟɣɫɬɜɚ LZ77 7 LZRW1 ɍɢɥɥɶɹɦɫ Ɇɨɞɢɮɢɤɚɰɢɹ LZSS (Williams), 1991 8 LZCB Ȼɥɭɦ (Bloom), Ɇɨɞɢɮɢɤɚɰɢɹ LZ77 1995 9 LZP Ȼɥɭɦ (Bloom), Ɉɫɧɨɜɚɧ ɧɚ LZ77 1995 76
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ʋ 10
ɇɚɡɜɚɧɢɟ LZ77-PM, LZFG-PM, LZW-PM
Ⱥɜɬɨɪɵ, ɝɨɞ ɏɨɚɧɝ (Hoang), Ʌɨɧɝ (Long) ɢ ȼɢɬɬɟɪ (Vitter), 1995
Ɍɢɩ ɚɥɝɨɪɢɬɦɚ Ɇɨɞɢɮɢɤɚɰɢɢ ɚɥɝɨɪɢɬɦɨɜ LZ
1)
LZMV Ⱥɥɝɨɪɢɬɦ ɫɟɦɟɣɫɬɜɚ LZ78. ɂɧɬɟɪɟɫɟɧ ɫɩɨɫɨɛɨɦ ɩɨɫɬɪɨɟɧɢɹ ɫɥɨɜɚɪɹ: ɧɨɜɚɹ ɮɪɚɡɚ ɫɨɡɞɚɟɬɫɹ ɫ ɩɨɦɨɳɶɸ ɤɨɧɤɚɬɟɧɚɰɢɢ ɞɜɭɯ ɩɨɫɥɟɞɧɢɯ ɢɫɩɨɥɶɡɨɜɚɧɧɵɯ ɮɪɚɡ, ɚ ɧɟ ɤɨɧɤɚɬɟɧɚɰɢɢ ɮɪɚɡɵ ɢ ɫɢɦɜɨɥɚ, ɬ.ɟ. ɫɥɨɜɚɪɶ ɧɚɩɨɥɧɹɟɬɫɹ «ɚɝɪɟɫɫɢɜɧɟɟ». ɉɪɚɤɬɢɱɟɫɤɢɟ ɪɟɚɥɢɡɚɰɢɢ LZMV ɧɟɢɡɜɟɫɬɧɵ. ɉɪɢɱɢɧɚ, ɩɨɜɢɞɢɦɨɦɭ, ɫɨɫɬɨɢɬ ɜ ɬɨɦ, ɱɬɨ ɭɫɥɨɠɧɟɧɢɟ ɚɥɝɨɪɢɬɦɚ ɧɟ ɩɪɢɜɨɞɢɬ ɤ ɚɞɟɤɜɚɬɧɨɦɭ ɭɥɭɱɲɟɧɢɸ ɫɠɚɬɢɹ ɩɨ ɫɪɚɜɧɟɧɢɸ ɫ ɢɫɯɨɞɧɵɦ LZW. ɋ ɞɪɭɝɨɣ ɫɬɨɪɨɧɵ, ɜɵɝɨɞɚ ɨɬ ɛɵɫɬɪɨɝɨ ɡɚɩɨɥɧɟɧɢɹ ɢ ɨɛɧɨɜɥɟɧɢɹ ɫɥɨɜɚɪɹ ɩɪɨɹɜɥɹɟɬɫɹ ɝɥɚɜɧɵɦ ɨɛɪɚɡɨɦ ɩɪɢ ɨɛɪɚɛɨɬɤɟ ɧɟɨɞɧɨɪɨɞɧɵɯ ɞɚɧɧɵɯ. ɇɨ ɞɥɹ ɫɠɚɬɢɹ ɞɚɧɧɵɯ ɬɚɤɨɝɨ ɬɢɩɚ ɡɚɜɟɞɨɦɨ ɥɭɱɲɟ ɩɨɞɯɨɞɢɬ ɦɟɬɨɞ ɫɤɨɥɶɡɹɳɟɝɨ ɫɥɨɜɚɪɹ (ɫɟɦɟɣɫɬɜɨ LZ77).
2)
LZW Ɇɨɞɢɮɢɤɚɰɢɹ LZ78. Ɂɚ ɫɱɟɬ ɩɪɟɞɜɚɪɢɬɟɥɶɧɨɝɨ ɡɚɧɟɫɟɧɢɹ ɜ ɫɥɨɜɚɪɶ ɜɫɟɯ ɫɢɦɜɨɥɨɜ ɚɥɮɚɜɢɬɚ ɜɯɨɞɧɨɣ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ ɪɟɡɭɥɶɬɚɬ ɪɚɛɨɬɵ LZW ɫɨɫɬɨɢɬ ɬɨɥɶɤɨ ɢɡ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ ɢɧɞɟɤɫɨɜ ɮɪɚɡ ɫɥɨɜɚɪɹ. ɂɡ-ɡɚ ɭɫɬɪɚɧɟɧɢɹ ɧɟɨɛɯɨɞɢɦɨɫɬɢ ɪɟɝɭɥɹɪɧɨɣ ɩɟɪɟɞɚɱɢ ɨɞɧɨɝɨ ɫɢɦɜɨɥɚ ɜ ɹɜɧɨɦ ɜɢɞɟ LZW ɨɛɟɫɩɟɱɢɜɚɟɬ ɥɭɱɲɟɟ ɫɠɚɬɢɟ, ɱɟɦ LZ78. ɉɨɞɪɨɛɧɟɟ ɨɛ LZW ɫɦ. ɜ ɪɚɡɞɟɥɟ «Ⱥɥɝɨɪɢɬɦɵ ɫɠɚɬɢɹ ɢɡɨɛɪɚɠɟɧɢɣ», ɚ ɬɚɤɠɟ ɜ [11].
3)
LZB Ɇɨɞɢɮɢɤɚɰɢɹ LZSS. ɂɡɦɟɧɟɧɢɹ ɡɚɬɪɚɝɢɜɚɸɬ ɤɨɞɢɪɨɜɚɧɢɟ ɭɤɚɡɚɬɟɥɟɣ. ɋɦɟɳɟɧɢɟ ɡɚɞɚɟɬɫɹ ɩɟɪɟɦɟɧɧɵɦ ɤɨɥɢɱɟɫɬɜɨɦ ɛɢɬɨɜ ɜ ɡɚɜɢɫɢɦɨɫɬɢ ɨɬ ɪɟɚɥɶɧɨɝɨ ɪɚɡɦɟɪɚ ɫɥɨɜɚɪɹ (ɜ ɧɚɱɚɥɟ ɫɠɚɬɢɹ ɨɧ ɦɚɥ). Ⱦɥɢɧɚ ɫɨɜɩɚɞɟɧɢɹ ɡɚɩɢɫɵɜɚɟɬɫɹ Ȗ-ɤɨɞɚɦɢ ɗɥɢɚɫɚ. ɂ ɩɟɪɜɵɣ, ɢ ɜɬɨɪɨɣ ɦɟɯɚɧɢɡɦɵ ɱɚɫɬɨ ɩɪɢɦɟɧɹɸɬɫɹ Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
77
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɩɪɢ ɪɚɡɪɚɛɨɬɤɟ ɩɪɨɫɬɵɯ ɢ ɨɛɟɫɩɟɱɢɜɚɸɳɢɯ ɜɵɫɨɤɭɸ ɫɤɨɪɨɫɬɶ ɚɥɝɨɪɢɬɦɨɜ ɫɟɦɟɣɫɬɜɚ LZ77. 4)
LZH Ɇɨɞɢɮɢɤɚɰɢɹ LZSS. Ⱥɧɚɥɨɝɢɱɧɚ LZB, ɧɨ ɞɥɹ ɫɠɚɬɢɹ ɫɦɟɳɟɧɢɣ ɢ ɞɥɢɧ ɫɨɨɬɜɟɬɫɬɜɢɹ ɢɫɩɨɥɶɡɭɸɬɫɹ ɤɨɞɵ ɏɚɮɮɦɚɧɚ. Ɂɚɦɟɬɢɦ, ɱɬɨ ɛɨɥɶɲɢɧɫɬɜɨ ɫɨɜɪɟɦɟɧɧɵɯ ɚɪɯɢɜɚɬɨɪɨɜ ɬɚɤɠɟ ɩɪɢɦɟɧɹɸɬ ɤɨɞɢɪɨɜɚɧɢɟ ɩɨ ɦɟɬɨɞɭ ɏɚɮɮɦɚɧɚ ɜ ɷɬɢɯ ɰɟɥɹɯ.
5)
LZFG Ɇɨɞɢɮɢɤɚɰɢɹ LZ77. ɇɚ ɫɚɦɨɦ ɞɟɥɟ ɩɪɟɞɫɬɚɜɥɹɟɬ ɫɨɛɨɣ ɧɟɫɤɨɥɶɤɨ ɚɥɝɨɪɢɬɦɨɜ. ɂɞɟɹ ɫɚɦɨɝɨ ɫɥɨɠɧɨɝɨ (C2 ɜ ɨɛɨɡɧɚɱɟɧɢɢ ɚɜɬɨɪɨɜ LZFG) ɡɚɤɥɸɱɚɟɬɫɹ ɜ ɤɨɞɢɪɨɜɚɧɢɢ ɮɪɚɡɵ ɧɟ ɩɚɪɨɣ <ɞɥɢɧɚ, ɫɦɟɳɟɧɢɟ>, ɚ ɢɧɞɟɤɫɨɦ ɫɨɨɬɜɟɬɫɬɜɭɸɳɟɝɨ ɮɪɚɡɟ ɭɡɥɚ ɞɟɪɟɜɚ ɰɢɮɪɨɜɨɝɨ ɩɨɢɫɤɚ. Ɉɞɢɧɚɤɨɜɵɟ ɮɪɚɡɵ ɫɥɨɜɚɪɹ ɢɦɟɸɬ ɨɞɢɧ ɢ ɬɨɬ ɠɟ ɢɧɞɟɤɫ, ɱɬɨ ɢ ɨɛɟɫɩɟɱɢɜɚɟɬ ɛɨɥɟɟ ɷɤɨɧɨɦɧɨɟ ɤɨɞɢɪɨɜɚɧɢɟ ɫɬɪɨɤ. Ⱥɥɝɨɪɢɬɦɵ LZFG ɧɟ ɩɨɥɭɱɢɥɢ ɪɚɫɩɪɨɫɬɪɚɧɟɧɢɹ ɧɚ ɩɪɚɤɬɢɤɟ. ȼ ɡɧɚɱɢɬɟɥɶɧɨɣ ɫɬɟɩɟɧɢ ɷɬɨɦɭ ɫɩɨɫɨɛɫɬɜɨɜɚɥɢ ɩɚɬɟɧɬɧɵɟ ɨɝɪɚɧɢɱɟɧɢɹ.
6)
LZBW ɋɩɨɫɨɛ ɦɨɞɢɮɢɤɚɰɢɢ ɚɥɝɨɪɢɬɦɨɜ ɫɟɦɟɣɫɬɜɚ LZ77. Ɂɚ ɫɱɟɬ ɭɱɟɬɚ ɢɦɟɸɳɢɯɫɹ ɜ ɫɥɨɜɚɪɟ ɨɞɢɧɚɤɨɜɵɯ ɮɪɚɡ ɩɨɡɜɨɥɹɟɬ ɭɦɟɧɶɲɢɬɶ ɤɨɥɢɱɟɫɬɜɨ ɛɢɬɨɜ, ɬɪɟɛɭɟɦɵɯ ɞɥɹ ɤɨɞɢɪɨɜɚɧɢɹ ɞɥɢɧɵ ɫɨɜɩɚɞɟɧɢɹ. ɉɨɞɪɨɛɧɟɟ ɫɦ. ɜ ɩɭɧɤɬɟ «ɉɭɬɢ ɭɥɭɱɲɟɧɢɹ ɫɠɚɬɢɹ ɚɥɝɨɪɢɬɦɨɜ LZ».
7)
LZRW1 Ⱥɥɝɨɪɢɬɦ ɹɜɥɹɟɬɫɹ ɦɨɞɢɮɢɤɚɰɢɟɣ LZSS, ɬɨɱɧɟɟ, ɚɥɝɨɪɢɬɦɚ A1 ɝɪɭɩɩɵ LZFG, ɢ ɪɚɡɪɚɛɨɬɚɧ ɫ ɰɟɥɶɸ ɨɛɟɫɩɟɱɟɧɢɹ ɦɚɤɫɢɦɚɥɶɧɨɣ ɫɤɨɪɨɫɬɢ ɫɠɚɬɢɹ ɢ ɪɚɡɠɚɬɢɹ. Ʉɨɞɵ ɮɪɚɡ ɫɨɫɬɨɹɬ ɢɡ 16 ɛɢɬɨɜ: 12 ɛɢɬɨɜ ɭɤɚɡɵɜɚɸɬ ɫɦɟɳɟɧɢɟ i ɢ 4 ɛɢɬɚ ɡɚɞɚɸɬ ɞɥɢɧɭ ɫɨɜɩɚɞɟɧɢɹ j, ɚ ɫɢɦɜɨɥɵ s ɩɟɪɟɞɚɸɬɫɹ ɤɚɤ ɛɚɣɬɵ (ɬɪɟɛɭɸɬ 8 ɛɢɬɨɜ). Ɏɥɚɝɢ f ɡɚɞɚɸɬɫɹ ɫɪɚɡɭ ɞɥɹ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ ɢɡ 16 ɤɨɞɨɜ ɢ ɥɢɬɟɪɚɥɨɜ, ɬ.ɟ. ɫɧɚɱɚɥɚ ɜɵɞɚɟɬɫɹ 2-ɛɚɣɬɨɜɨɟ ɫɥɨɜɨ ɡɧɚɱɟɧɢɣ ɮɥɚɝɨɜ, ɡɚɬɟɦ ɝɪɭɩɩɚ ɢɡ 16 ɤɨɞɨɜ ɢ/ɢɥɢ ɥɢɬɟɪɚɥɨɜ. Ⱦɥɹ ɩɨɢɫɤɚ ɜ ɫɥɨɜɚɪɟ ɩɪɢ ɫɠɚɬɢɢ ɢɫɩɨɥɶɡɭɟɬɫɹ ɯɟɲ-
78
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɬɚɛɥɢɰɚ ɫɨ ɫɦɟɲɢɜɚɧɢɟɦ ɩɨ 3 ɫɢɦɜɨɥɚɦ. ɏɟɲ-ɰɟɩɨɱɤɢ ɤɚɤ ɬɚɤɨɜɵɟ ɨɬɫɭɬɫɬɜɭɸɬ, ɬ.ɟ. ɤɚɠɞɚɹ ɧɨɜɚɹ ɮɪɚɡɚ ɡɚɦɟɧɹɟɬ ɜ ɬɚɛɥɢɰɟ ɫɬɚɪɭɸ ɫ ɬɚɤɢɦ ɠɟ ɡɧɚɱɟɧɢɟɦ ɯɟɲ-ɮɭɧɤɰɢɢ. Ɂɚ ɫɱɟɬ ɭɫɬɪɚɧɟɧɢɹ ɩɨɛɢɬɨɜɨɝɨ ɜɜɨɞɚ-ɜɵɜɨɞɚ ɢ ɢɫɩɨɥɶɡɨɜɚɧɢɹ ɫɥɨɜɚɪɹ ɦɚɥɨɝɨ ɪɚɡɦɟɪɚ ɞɨɫɬɢɝɚɟɬɫɹ ɜɵɫɨɤɚɹ ɫɤɨɪɨɫɬɶ ɤɨɞɢɪɨɜɚɧɢɹ ɢ ɞɟɤɨɞɢɪɨɜɚɧɢɹ. ɋɬɟɩɟɧɶ ɫɠɚɬɢɹ LZRW1 ɪɚɜɧɚ ɩɪɢɦɟɪɧɨ 1.5…2. 8)
LZCB ɉɨ ɫɭɬɢ, ɰɟɥɚɹ ɝɪɭɩɩɚ ɚɥɝɨɪɢɬɦɨɜ, ɹɜɥɹɸɳɢɯɫɹ ɬɨɣ ɢɥɢ ɢɧɨɣ ɦɨɞɢɮɢɤɚɰɢɟɣ LZ77. Ɉɫɧɨɜɧɚɹ ɢɞɟɹ ɡɚɤɥɸɱɚɟɬɫɹ ɜɨ ɜɜɟɞɟɧɢɢ ɞɨɫɬɚɬɨɱɧɨ ɫɢɥɶɧɨɝɨ ɨɝɪɚɧɢɱɟɧɢɹ ɧɚ ɦɢɧɢɦɚɥɶɧɭɸ ɞɥɢɧɭ ɫɨɜɩɚɞɟɧɢɹ — ɨɬ 4 ɫɢɦɜɨɥɨɜ ɢ ɛɨɥɟɟ. ȿɫɥɢ ɮɪɚɡɚ ɭɞɨɜɥɟɬɜɨɪɹɸɳɟɣ ɞɥɢɧɵ ɧɟ ɧɚɣɞɟɧɚ, ɬɨ ɤɨɞɢɪɭɟɬɫɹ ɨɞɢɧ ɫɢɦɜɨɥ (ɥɢɬɟɪɚɥ). ɏɚɪɚɤɬɟɪ ɬɢɩɢɱɧɵɯ ɞɚɧɧɵɯ ɬɚɤɨɜ, ɱɬɨ ɥɢɬɟɪɚɥɵ ɢ ɭɫɩɟɲɧɨ ɡɚɤɨɞɢɪɨɜɚɧɧɵɟ ɫ ɩɨɦɨɳɶɸ ɫɥɨɜɚɪɹ ɫɬɪɨɤɢ ɢɦɟɸɬ ɬɟɧɞɟɧɰɢɸ ɨɛɴɟɞɢɧɹɬɶɫɹ ɜ ɝɪɭɩɩɵ ɫ ɫɟɛɟ ɩɨɞɨɛɧɵɦɢ, ɬ.ɟ., ɧɚɩɪɢɦɟɪ, ɧɚ ɜɵɯɨɞɟ LZCB ɦɨɝɭɬ ɩɨɹɜɢɬɶɫɹ 10 ɥɢɬɟɪɚɥɨɜ ɩɨɞɪɹɞ, ɡɚɬɟɦ 5 ɡɚɤɨɞɢɪɨɜɚɧɧɵɯ ɫɬɪɨɤ, ɡɚɬɟɦ ɨɩɹɬɶ ɧɟɫɤɨɥɶɤɨ ɥɢɬɟɪɚɥɨɜ ɢ ɬ.ɞ. ɗɬɚ ɨɫɨɛɟɧɧɨɫɬɶ ɩɨɡɜɨɥɹɟɬ ɪɟɚɥɢɡɨɜɚɬɶ ɞɨɫɬɚɬɨɱɧɨ ɷɮɮɟɤɬɢɜɧɨɟ ɫɬɚɬɢɫɬɢɱɟɫɤɨɟ ɤɨɞɢɪɨɜɚɧɢɟ ɩɨɬɨɤɨɜ ɥɢɬɟɪɚɥɨɜ ɢ ɭɤɚɡɚɬɟɥɟɣ ɮɪɚɡ. Ɍɟɦ ɧɟ ɦɟɧɟɟ, ɪɚɫɬɟɪɹɜ ɩɪɟɢɦɭɳɟɫɬɜɨ ɜ ɫɤɨɪɨɫɬɢ, LZCB ɭɫɬɭɩɚɟɬ ɫɨɜɪɟɦɟɧɧɵɦ ɚɥɝɨɪɢɬɦɚɦ PPM ɩɨ ɤɨɷɮɮɢɰɢɟɧɬɭ ɫɠɚɬɢɹ.
9)
LZ77-PM, LZFG-PM, LZW-PM Ɇɨɞɢɮɢɤɚɰɢɢ ɚɥɝɨɪɢɬɦɨɜ LZ. ɂɫɩɨɥɶɡɭɟɬɫɹ ɧɟɫɤɨɥɶɤɨ ɤɨɧɬɟɤɫɬɧɨ-ɡɚɜɢɫɢɦɵɯ ɫɥɨɜɚɪɟɣ, ɚ ɧɟ ɨɞɢɧ ɫɥɨɜɚɪɶ. ȼ ɤɨɧɬɟɤɫɬɧɨ-ɡɚɜɢɫɢɦɵɣ ɫɥɨɜɚɪɶ ɩɨɪɹɞɤɚ L ɫ ɧɨɦɟɪɨɦ i ɩɨɩɚɞɚɸɬ ɬɨɥɶɤɨ ɫɬɪɨɤɢ, ɜɫɬɪɟɱɚɟɦɵɟ ɩɨɫɥɟ ɤɨɧɬɟɤɫɬɚ4 Ci ɞɥɢɧɵ L. Ʉɨɞɢɪɨɜɚɧɢɟ ɫɬɪɨɤɢ ɛɭɮɟɪɚ S ɩɪɨɢɡɜɨɞɢɬɫɹ ɫ ɩɨɦɨɳɶɸ ɨɞɧɨɝɨ
4
Ʉɨɧɬɟɤɫɬ — ɷɬɨ ɜ ɞɚɧɧɨɦ ɫɥɭɱɚɟ ɤɨɧɟɱɧɚɹ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɶ ɫɢɦɜɨɥɨɜ. ɋɦ. ɬɚɤɠɟ ɝɥɚɜɭ «ɋɠɚɬɢɟ ɞɚɧɧɵɯ ɫ ɩɨɦɨɳɶɸ ɤɨɧɬɟɤɫɬɧɵɯ ɦɟɬɨɞɨɜ ɦɨɞɟɥɢɪɨɜɚɧɢɹ»
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
79
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɢɥɢ ɧɟɫɤɨɥɶɤɢɯ ɫɥɨɜɚɪɟɣ, ɧɨɦɟɪɚ ɤɨɬɨɪɵɯ ɨɩɪɟɞɟɥɹɸɬɫɹ ɩɨɫɥɟɞɧɢɦɢ ɡɚɤɨɞɢɪɨɜɚɧɧɵɦɢ ɩɟɪɟɞ S ɫɢɦɜɨɥɚɦɢ. ɍɱɟɬ ɤɨɧɬɟɤɫɬɚ ɩɨɡɜɨɥɹɟɬ ɫɭɳɟɫɬɜɟɧɧɨ ɭɥɭɱɲɢɬɶ ɫɠɚɬɢɟ ɢɫɯɨɞɧɵɯ ɫɥɨɜɚɪɧɵɯ ɫɯɟɦ. ɉɨɞɪɨɛɧɟɟ ɫɦ. ɜ ɩɭɧɤɬɟ «ɉɭɬɢ ɭɥɭɱɲɟɧɢɹ ɫɠɚɬɢɹ ɚɥɝɨɪɢɬɦɨɜ LZ». 10) LZP Ɉɫɧɨɜɚɧ ɧɚ LZ77. Ⱦɥɹ ɤɚɠɞɨɝɨ ɜɯɨɞɧɨɝɨ ɫɢɦɜɨɥɚ ɫɬɪɨɤɚ ɢɡ ɩɪɟɞɲɟɫɬɜɭɸɳɢɯ L ɫɢɦɜɨɥɨɜ ɪɚɫɫɦɚɬɪɢɜɚɟɬɫɹ ɤɚɤ ɤɨɧɬɟɤɫɬ C ɞɥɢɧɵ N. ɋ ɩɨɦɨɳɶɸ ɯɟɲ-ɮɭɧɤɰɢɢ ɜ ɫɥɨɜɚɪɟ ɧɚɯɨɞɢɬɫɹ ɨɞɧɚ ɢɡ ɫɨɜɩɚɞɚɸɳɢɯ ɫ ɤɨɧɬɟɤɫɬɨɦ C ɮɪɚɡ, ɧɚɡɨɜɟɦ ɷɬɭ ɮɪɚɡɭ C’: C’ = C. ɋɬɪɨɤɚ S ɛɭɮɟɪɚ ɫɪɚɜɧɢɜɚɟɬɫɹ ɫ ɮɪɚɡɨɣ, ɧɟɩɨɫɪɟɞɫɬɜɟɧɧɨ ɫɥɟɞɭɸɳɟɣ ɡɚ C’. ȿɫɥɢ ɞɥɢɧɚ ɫɨɜɩɚɞɟɧɢɹ L > 0, ɬɨ ɜɵɞɚɟɬɫɹ ɮɥɚɝ ɭɫɩɟɯɚ f = 1 ɢ S ɤɨɞɢɪɭɟɬɫɹ ɱɟɪɟɡ ɞɥɢɧɭ L. Ɍɚɤ ɤɚɤ C’ ɧɚɯɨɞɢɬɫɹ ɞɟɬɟɪɦɢɧɢɪɨɜɚɧɧɵɦ ɨɛɪɚɡɨɦ, ɬɨ ɫɦɟɳɟɧɢɟ ɤɨɞɢɪɨɜɚɬɶ ɧɟ ɧɚɞɨ. ȿɫɥɢ L = 0, ɢɥɢ C’ ɧɟ ɛɵɥɚ ɧɚɣɞɟɧɚ, ɬɨ ɜɵɞɚɟɬɫɹ f = 0 ɢ ɩɟɪɜɵɣ ɫɢɦɜɨɥ S ɤɨɞɢɪɭɟɬɫɹ ɧɟɩɨɫɪɟɞɫɬɜɟɧɧɨ. Ⱦɟɤɨɞɟɪ ɞɨɥɠɟɧ ɢɫɩɨɥɶɡɨɜɚɬɶ ɬɚɤɨɣ ɠɟ ɦɟɯɚɧɢɡɦ ɞɥɹ ɩɨɢɫɤɚ C’. ɂɡɥɨɠɟɧɧɵɣ ɚɥɝɨɪɢɬɦ ɫɩɪɚɜɟɞɥɢɜ ɞɥɹ ɚɥɝɨɪɢɬɦɚ LZP1, ɞɨɫɬɨɢɧɫɬɜɨɦ ɤɨɬɨɪɨɝɨ ɹɜɥɹɟɬɫɹ ɜɵɫɨɤɚɹ ɫɤɨɪɨɫɬɶ. ȼ ɛɨɥɟɟ ɫɥɨɠɧɵɯ ɦɨɞɢɮɢɤɚɰɢɹɯ ɩɪɨɰɟɫɫ ɩɨɢɫɤɚ C’ ɩɨɜɬɨɪɹɟɬɫɹ ɞɥɹ ɤɨɧɬɟɤɫɬɚ ɞɥɢɧɵ N–1 ɢ ɬ.ɞ. ȼ LZP1 ɥɢɬɟɪɚɥɵ ɩɪɨɫɬɨ ɤɨɩɢɪɭɸɬɫɹ, ɚ ɞɥɹ ɤɨɞɢɪɨɜɚɧɢɹ ɮɥɚɝɨɜ ɢ ɞɥɢɧ ɢɫɩɨɥɶɡɭɸɬɫɹ ɤɨɞɵ ɩɟɪɟɦɟɧɧɨɣ ɞɥɢɧɵ. ȼ LZP3 ɩɪɢɦɟɧɹɟɬɫɹ ɞɨɫɬɚɬɨɱɧɨ ɫɥɨɠɧɚɹ ɫɯɟɦɚ ɤɨɞɢɪɨɜɚɧɢɹ ɩɨɬɨɤɨɜ ɮɥɚɝɨɜ, ɞɥɢɧ ɢ ɥɢɬɟɪɚɥɨɜ ɧɚ ɨɫɧɨɜɟ ɚɥɝɨɪɢɬɦɚ ɏɚɮɮɦɚɧɚ. ȼ ɫɨɱɟɬɚɧɢɢ ɫ PPM ɬɟɯɧɢɤɚ LZP ɨɛɟɫɩɟɱɢɜɚɟɬ ɜɵɫɨɤɭɸ ɫɬɟɩɟɧɶ ɫɠɚɬɢɹ ɩɪɢ ɧɟɩɥɨɯɢɯ ɫɤɨɪɨɫɬɧɵɯ ɯɚɪɚɤɬɟɪɢɫɬɢɤɚɯ. ȼ ɬɚɛɥ. 3.5 ɩɪɢɜɟɞɟɧɵ ɪɟɡɭɥɶɬɚɬɵ ɫɪɚɜɧɟɧɢɹ ɧɟɫɤɨɥɶɤɢɯ ɚɥɝɨɪɢɬɦɨɜ ɩɨ ɫɬɟɩɟɧɢ ɫɠɚɬɢɹ ɧɚ ɧɚɛɨɪɟ CalgCC. Ɍɚɛɥɢɰɚ 3.5
Bib Book1 80
LZP1
LZSS LZW
LZB
LZWPM
LZFG
LZFGPM
LZP3
1.98 1.42
2.81 2.33
2.52 2.07
3.07 2.92
2.76 2.21
3.28 2.44
3.32 2.50
2.48 2.52
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
Book2 Geo News Obj1 Obj2 Paper1 Paper2 Pic Progc Progl Progp Trans ɂɬɨɝɨ
LZP1
LZSS LZW
LZB
LZWPM
LZFG
LZFGPM
LZP3
1.76 1.19 1.76 1.55 2.21 1.72 1.62 6.30 1.86 2.66 2.82 3.27
2.68 1.19 2.28 1.57 2.28 2.47 2.50 3.98 2.44 3.28 3.31 3.46
2.61 1.38 2.21 1.58 1.96 2.21 2.37 8.51 2.15 2.71 2.67 2.53
2.44 1.30 2.25 1.88 2.55 2.48 2.33 7.92 2.60 3.79 3.85 3.77
3.14 1.23 2.52 1.56 2.34 2.60 2.72 8.16 2.52 3.38 3.33 3.46
2.62 1.40 2.33 1.99 2.70 2.64 2.53 9.20 2.77 4.06 4.21 4.55
2.88 1.42 2.46 1.85 2.63 2.92 2.86 8.60 2.92 4.44 4.42 4.79
3.01 1.51 2.78 1.83 2.79 2.73 2.72 9.30 2.73 4.19 3.98 4.79
2.29
2.61
2.71
2.98
3.07
3.28
3.42
3.44
ȼɢɞɧɨ, ɱɬɨ ɡɚ ɫɱɟɬ ɨɩɬɢɦɢɡɚɰɢɢ ɫɬɪɭɤɬɭɪɵ ɫɥɨɜɚɪɹ ɞɨɫɬɢɝɚɟɬɫɹ ɡɧɚɱɢɬɟɥɶɧɨɟ ɭɥɭɱɲɟɧɢɟ ɫɠɚɬɢɹ. ɇɨ, ɫ ɞɪɭɝɨɣ ɫɬɨɪɨɧɵ, ɫɥɨɠɧɵɟ ɚɥɝɨɪɢɬɦɵ ɩɨɫɬɪɨɟɧɢɹ ɫɥɨɜɚɪɹ ɨɛɵɱɧɨ ɫɭɳɟɫɬɜɟɧɧɨ ɡɚɦɟɞɥɹɸɬ ɪɚɛɨɬɭ ɞɟɤɨɞɟɪɚ, ɱɬɨ ɫɜɨɞɢɬ ɧɚ ɧɟɬ ɞɨɫɬɨɢɧɫɬɜɚ LZ. ɉɪɢɜɟɞɟɧɧɵɟ ɧɢɠɟ ɯɚɪɚɤɬɟɪɢɫɬɢɤɢ ɫɬɟɩɟɧɢ ɫɠɚɬɢɹ ɢ ɫɤɨɪɨɫɬɢ ɚɥɝɨɪɢɬɦɨɜ ɫɟɦɟɣɫɬɜ LZ77 ɢ LZ78 ɨɬɧɨɫɹɬɫɹ ɤ ɬɢɩɢɱɧɵɦ ɩɪɟɞɫɬɚɜɢɬɟɥɹɦ ɫɟɦɟɣɫɬɜ — LZH ɢ LZW ɫɨɨɬɜɟɬɫɬɜɟɧɧɨ.
ɏɚɪɚɤɬɟɪɢɫɬɢɤɢ ɚɥɝɨɪɢɬɦɨɜ ɫɟɦɟɣɫɬɜɚ LZ77: ɋɬɟɩɟɧɢ ɫɠɚɬɢɹ: ɨɩɪɟɞɟɥɹɸɬɫɹ ɞɚɧɧɵɦɢ, ɨɛɵɱɧɨ 2…4. Ɍɢɩɵ ɞɚɧɧɵɯ: ɚɥɝɨɪɢɬɦɵ ɭɧɢɜɟɪɫɚɥɶɧɵ, ɧɨ ɥɭɱɲɟ ɜɫɟɝɨ ɩɨɞɯɨɞɹɬ ɞɥɹ ɫɠɚɬɢɹ ɪɚɡɧɨɪɨɞɧɵɯ ɞɚɧɧɵɯ, ɧɚɩɪɢɦɟɪ, ɮɚɣɥɨɜ ɪɟɫɭɪɫɨɜ. ɋɢɦɦɟɬɪɢɱɧɨɫɬɶ ɩɨ ɫɤɨɪɨɫɬɢ: ɩɪɢɦɟɪɧɨ 10:1; ɟɫɥɢ ɚɥɝɨɪɢɬɦ ɨɛɟɫɩɟɱɢɜɚɟɬ ɯɨɪɨɲɟɟ ɫɠɚɬɢɟ, ɬɨ ɞɟɤɨɞɟɪ ɨɛɵɱɧɨ ɝɨɪɚɡɞɨ ɛɵɫɬɪɟɟ ɤɨɞɟɪɚ. Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
81
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɏɚɪɚɤɬɟɪɧɵɟ ɨɫɨɛɟɧɧɨɫɬɢ: ɨɛɵɱɧɨ ɦɟɞɥɟɧɧɨ ɫɠɢɦɚɸɬ ɜɵɫɨɤɨ ɢɡɛɵɬɨɱɧɵɟ ɞɚɧɧɵɟ; ɢɡ-ɡɚ ɜɵɫɨɤɨɣ ɫɤɨɪɨɫɬɢ ɪɚɡɠɚɬɢɹ ɢɞɟɚɥɶɧɨ ɩɨɞɯɨɞɹɬ ɞɥɹ ɫɨɡɞɚɧɢɹ ɞɢɫɬɪɢɛɭɬɢɜɨɜ ɩɪɨɝɪɚɦɦɧɨɝɨ ɨɛɟɫɩɟɱɟɧɢɹ.
ɏɚɪɚɤɬɟɪɢɫɬɢɤɢ ɚɥɝɨɪɢɬɦɨɜ ɫɟɦɟɣɫɬɜɚ LZ78: ɋɬɟɩɟɧɢ ɫɠɚɬɢɹ: ɨɩɪɟɞɟɥɹɸɬɫɹ ɞɚɧɧɵɦɢ, ɨɛɵɱɧɨ 2…3. Ɍɢɩɵ ɞɚɧɧɵɯ: ɚɥɝɨɪɢɬɦɵ ɭɧɢɜɟɪɫɚɥɶɧɵ, ɧɨ ɥɭɱɲɟ ɜɫɟɝɨ ɩɨɞɯɨɞɹɬ ɞɥɹ ɫɠɚɬɢɹ ɬɟɤɫɬɨɜ ɢ ɬɨɦɭ ɩɨɞɨɛɧɵɯ ɨɞɧɨɪɨɞɧɵɯ ɞɚɧɧɵɯ, ɧɚɩɪɢɦɟɪ, ɪɢɫɨɜɚɧɧɵɯ ɤɚɪɬɢɧɨɤ; ɩɥɨɯɨ ɫɠɢɦɚɸɬ ɪɚɡɧɨɪɨɞɧɵɟ ɞɚɧɧɵɟ. ɋɢɦɦɟɬɪɢɱɧɨɫɬɶ ɩɨ ɫɤɨɪɨɫɬɢ: ɩɪɢɦɟɪɧɨ 3:2, ɞɟɤɨɞɟɪ ɨɛɵɱɧɨ ɜ ɩɨɥɬɨɪɚ ɪɚɡɚ ɛɵɫɬɪɟɟ ɤɨɞɟɪɚ. ɏɚɪɚɤɬɟɪɧɵɟ ɨɫɨɛɟɧɧɨɫɬɢ: ɢɡ-ɡɚ ɨɬɧɨɫɢɬɟɥɶɧɨ ɧɟɛɨɥɶɲɨɣ ɫɬɟɩɟɧɢ ɫɠɚɬɢɹ ɢ ɧɟɜɵɫɨɤɨɣ ɫɤɨɪɨɫɬɢ ɞɟɤɨɞɢɪɨɜɚɧɢɹ ɭɫɬɭɩɚɸɬ ɩɨ ɪɚɫɩɪɨɫɬɪɚɧɟɧɧɨɫɬɢ ɚɥɝɨɪɢɬɦɚɦ ɫɟɦɟɣɫɬɜɚ LZ77.
Ɏɨɪɦɚɬ Deflate Ɏɨɪɦɚɬ ɫɥɨɜɚɪɧɨɝɨ ɫɠɚɬɢɹ Deflate, ɩɪɟɞɥɨɠɟɧɧɵɣ Ʉɚɰɟɦ (Katz), ɢɫɩɨɥɶɡɭɟɬɫɹ ɩɨɩɭɥɹɪɧɵɦ ɚɪɯɢɜɚɬɨɪɨɦ PKZIP [3]. ɋɠɚɬɢɟ ɨɫɭɳɟɫɬɜɥɹɟɬɫɹ ɫ ɩɨɦɨɳɶɸ ɚɥɝɨɪɢɬɦɚ ɬɢɩɚ LZH, ɢɧɚɱɟ ɝɨɜɨɪɹ, ɭɤɚɡɚɬɟɥɢ ɢ ɥɢɬɟɪɚɥɵ ɤɨɞɢɪɭɸɬɫɹ ɩɨ ɦɟɬɨɞɭ ɏɚɮɮɦɚɧɚ. Ɏɨɪɦɚɬ ɫɩɟɰɢɮɢɰɢɪɭɟɬ ɬɨɥɶɤɨ ɪɚɛɨɬɭ ɞɟɤɨɞɟɪɚ, ɬ.ɟ. ɨɩɪɟɞɟɥɹɟɬ ɚɥɝɨɪɢɬɦ ɞɟɤɨɞɢɪɨɜɚɧɢɹ, ɢ ɧɟ ɧɚɥɚɝɚɟɬ ɫɟɪɶɟɡɧɵɯ ɨɝɪɚɧɢɱɟɧɢɣ ɧɚ ɪɟɚɥɢɡɚɰɢɸ ɤɨɞɟɪɚ. ȼ ɩɪɢɧɰɢɩɟ, ɜ ɤɚɱɟɫɬɜɟ ɚɥɝɨɪɢɬɦɚ ɫɠɚɬɢɹ ɦɨɠɟɬ ɩɪɢɦɟɧɹɬɶɫɹ ɥɸɛɨɣ ɪɚɛɨɬɚɸɳɢɣ ɫɨ ɫɤɨɥɶɡɹɳɢɦ ɨɤ82
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɧɨɦ, ɥɢɲɶ ɛɵ ɨɧ ɢɫɯɨɞɢɥ ɢɡ ɫɬɚɧɞɚɪɬɧɨɣ ɩɪɨɰɟɞɭɪɵ ɨɛɧɨɜɥɟɧɢɹ ɫɥɨɜɚɪɹ ɞɥɹ ɚɥɝɨɪɢɬɦɨɜ ɫɟɦɟɣɫɬɜɚ LZ77 ɢ ɢɫɩɨɥɶɡɨɜɚɥ ɡɚɞɚɜɚɟɦɵɟ ɮɨɪɦɚɬɨɦ ɬɢɩɵ ɤɨɞɨɜ ɏɚɮɮɦɚɧɚ. Ɉɫɨɛɟɧɧɨɫɬɢ ɮɨɪɦɚɬɚ: • ɹɜɥɹɟɬɫɹ ɭɧɢɜɟɪɫɚɥɶɧɵɦ, ɬ.ɟ. ɧɟ ɨɪɢɟɧɬɢɪɨɜɚɧ ɧɚ ɤɨɧɤɪɟɬɧɵɣ ɬɢɩ ɞɚɧɧɵɯ; • ɩɪɨɫɬ ɜ ɪɟɚɥɢɡɚɰɢɢ; • ɞɟ-ɮɚɤɬɨ ɹɜɥɹɟɬɫɹ ɨɞɧɢɦ ɢɡ ɩɪɨɦɵɲɥɟɧɧɵɯ ɫɬɚɧɞɚɪɬɨɜ ɧɚ ɫɠɚɬɢɟ ɞɚɧɧɵɯ. ɋɭɳɟɫɬɜɭɟɬ ɦɧɨɠɟɫɬɜɨ ɩɚɬɟɧɬɨɜ, ɩɨɤɪɵɜɚɸɳɢɯ ɜɟɫɶ ɮɨɪɦɚɬ ɩɨɥɧɨɫɬɶɸ ɢɥɢ ɤɚɤɢɟ-ɬɨ ɞɟɬɚɥɢ ɟɝɨ ɪɟɚɥɢɡɚɰɢɢ. ɋ ɞɪɭɝɨɣ ɫɬɨɪɨɧɵ, Deflate ɢɫɩɨɥɶɡɭɟɬɫɹ ɜ ɨɝɪɨɦɧɨɦ ɤɨɥɢɱɟɫɬɜɟ ɩɪɨɝɪɚɦɦɧɵɯ ɢ ɚɩɩɚɪɚɬɧɵɯ ɩɪɢɥɨɠɟɧɢɣ, ɢ ɨɬɪɚɛɨɬɚɧɵ ɦɟɬɨɞɵ ɡɚɳɢɬɵ ɜ ɫɭɞɟ ɜ ɫɥɭɱɚɟ ɩɪɟɞɴɹɜɥɟɧɢɹ ɫɨɨɬɜɟɬɫɬɜɭɸɳɟɝɨ ɢɫɤɚ ɨɬ ɤɨɦɩɚɧɢɢ, ɨɛɥɚɞɚɸɳɟɣ ɩɚɬɟɧɬɨɦ ɧɚ ɮɨɪɦɚɬ ɢɥɢ ɟɝɨ ɱɚɫɬɶ. ɉɨɭɱɢɬɟɥɶɧɚɹ ɪɟɦɚɪɤɚ. ȼ 1994 ɝɨɞɭ ɤɨɪɩɨɪɚɰɢɹ Unisys «ɜɫɩɨɦɧɢɥɚ» ɨ ɫɜɨɟɦ ɩɚɬɟɧɬɟ ɜ ɋɒȺ ɧɚ ɚɥɝɨɪɢɬɦ LZW, ɡɚɪɟɝɢɫɬɪɢɪɨɜɚɧɧɨɦ ɜ 1985 ɝɨɞɭ, ɢ ɨɛɴɹɜɢɥɚ ɨ ɧɟɡɚɤɨɧɧɨɫɬɢ ɢɫɩɨɥɶɡɨɜɚɧɢɹ LZW ɛɟɡ ɫɨɨɬɜɟɬɫɬɜɭɸɳɟɣ ɥɢɰɟɧɡɢɢ. ȼ ɱɚɫɬɧɨɫɬɢ, Unisys ɡɚɹɜɢɥɚ ɨ ɧɚɪɭɲɟɧɢɢ ɫɜɨɢɯ ɩɪɚɜ ɤɚɤ ɩɚɬɟɧɬɨɜɥɚɞɟɥɶɰɚ ɜ ɫɥɭɱɚɟ ɧɟɥɢɰɟɧɡɢɪɨɜɚɧɧɨɝɨ ɢɫɩɨɥɶɡɨɜɚɧɢɹ ɚɥɝɨɪɢɬɦɚ LZW ɜ ɮɨɪɦɚɬɟ GIF. Ȼɵɥɨ ɨɛɴɹɜɥɟɧɨ, ɱɬɨ ɩɪɨɢɡɜɨɞɢɬɟɥɢ, ɩɪɨɝɪɚɦɦɵ ɢɥɢ ɚɩɩɚɪɚɬɧɨɟ ɨɛɟɫɩɟɱɟɧɢɟ ɤɨɬɨɪɵɯ ɱɢɬɚɸɬ ɢɥɢ ɡɚɩɢɫɵɜɚɸɬ ɮɚɣɥɵ ɜ ɮɨɪɦɚɬɟ GIF, ɞɨɥɠɧɵ ɩɨɤɭɩɚɬɶ ɥɢɰɟɧɡɢɸ ɧɚ ɢɫɩɨɥɶɡɨɜɚɧɢɟ, ɚ ɬɚɤɠɟ ɜɵɩɥɚɱɢɜɚɬɶ ɨɩɪɟɞɟɥɟɧɧɵɣ ɩɪɨɰɟɧɬ ɫ ɩɪɢɛɵɥɢ ɩɪɢ ɤɨɦɦɟɪɱɟɫɤɨɦ ɩɪɢɦɟɧɟɧɢɢ. Ⱦɚɥɟɟ Unisys ɜ ɥɭɱɲɢɯ ɬɪɚɞɢɰɢɹɯ ɬɨɬɚɥɢɬɚɪɧɨɣ ɩɪɨɩɚɝɚɧɞɵ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨ ɩɪɨɞɨɥɠɚɥɚ ɩɟɪɟɩɢɫɵɜɚɬɶ ɢɫɬɨɪɢɸ ɡɚɞɧɢɦ ɱɢɫɥɨɦ, ɧɟɨɞɧɨɤɪɚɬɧɨ ɦɟɧɹɹ ɫɜɨɢ ɬɪɟɛɨɜɚɧɢɹ ɤ ɥɢɰɟɧɡɢɪɭɟɦɵɦ ɩɪɨɞɭɤɬɚɦ ɢ ɭɫɥɨɜɢɹ ɨɩɥɚɬɵ. ȼ ɱɚɫɬɧɨɫɬɢ, ɛɵɥɨ ɨɝɨɜɨɪɟɧɨ, ɱɬɨ ɩɥɚɬɚ ɜɡɢɦɚɟɬɫɹ ɬɨɥɶɤɨ ɜ ɫɥɭɱɚɟ ɤɨɦɦɟɪɱɟɫɤɢɯ ɩɪɨɞɭɤɬɨɜ, ɧɨ ɜ ɥɸɛɨɦ ɫɥɭɱɚɟ ɬɪɟɛɭɟɬɫɹ ɩɨɥɭɱɢɬɶ ɨɮɢɰɢɚɥɶɧɨɟ ɪɚɡɪɟɲɟɧɢɟ ɨɬ Unisys. ɇɨ, ɫ ɞɪɭɝɨɣ ɫɬɨɪɨɧɵ, Unisys ɬɪɟɛɭɟɬ ɭ ɜɫɟɯ ɜɥɚɞɟɥɶɰɟɜ Internet (intranet) ɫɚɣɬɨɜ, ɢɫɩɨɥɶɡɭɸɳɢɯ ɪɢɫɭɧɤɢ ɜ ɮɨɪɦɚɬɟ GIF, ɩɪɢɨɛɪɟɫɬɢ ɥɢɰɟɧɡɢɸ ɫɬɨɢɦɨɫɬɶɸ ɩɨɪɹɞɤɚ $5000 ɜ ɬɨɦ ɫɥɭɱɚɟ, ɟɫɥɢ ɉɈ, ɫ ɩɨɦɨɳɶɸ ɤɨɬɨɪɨɝɨ ɛɵɥɢ ɫɨɡɞɚɧɵ ɷɬɢ ɮɚɣɥɵ GIF, ɧɟ ɢɦɟɟɬ ɫɨɨɬɜɟɬɫɬɜɭɸɳɟɣ ɥɢɰɟɧɡɢɢ Unisys. ɋ ɬɨɱɤɢ ɡɪɟɧɢɹ ɧɟɤɨɬɨɪɵɯ ɧɟɡɚɜɢɫɢɦɵɯ ɷɤɫɩɟɪɬɨɜ ɩɨ ɩɚɬɟɧɬɧɨɦɭ ɩɪɚɜɭ, ɱɬɟɧɢɟ (ɞɟɤɨɞɢɪɨɜɚɧɢɟ) GIF ɮɚɣɥɨɜ ɧɟ ɧɚɪɭɲɚɟɬ ɩɪɚɜɚ Unisys, ɧɨ, ɫɭɞɹ ɩɨ ɜɫɟɦɭ, ɫɚɦɚ ɤɨɪɩɨɪɚɰɢɹ ɩɪɢɞɟɪɠɢɜɚɟɬɫɹ ɞɪɭɝɨɣ ɬɨɱɤɢ ɡɪɟɧɢɹ. Ɍɚɤɠɟ ɞɨɫɬɚɬɨɱɧɨ ɫɬɪɚɧɧɨ ɩɨɜɟɞɟɧɢɟ ɤɨɪɩɨɪɚɰɢɢ CompuServ, ɪɚɡɪɚɛɨɬɚɜɲɟɣ ɮɨɪɦɚɬ GIF ɢ ɨɩɭɛɥɢɤɨɜɚɜɲɟɣ ɟɝɨ ɜ 1987 ɝɨɞɭ, ɬ.ɟ. ɭɠɟ ɩɨɫɥɟ ɪɟɝɢɫɬɪɚɰɢɢ ɩɚɬɟɧɬɚ ɧɚ LZW, ɤɚɤ ɨɬɤɪɵɬɵɣ ɢ ɫɜɨɛɨɞɧɵɣ ɨɬ ɨɩɥɚɬɵ. ɉɨ ɫɨɫɬɨɹɧɢɸ ɧɚ 2001 ɝɨɞ, LZW ɡɚɩɚɬɟɧɬɨɜɚɧ Unisys ɩɨ ɦɟɧɶɲɟɣ ɦɟɪɟ ɜ ɫɥɟɞɭɸɳɢɯ ɫɬɪɚɧɚɯ: ɋɒȺ,
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
83
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
Ʉɚɧɚɞɚ, ȼɟɥɢɤɨɛɪɢɬɚɧɢɹ, Ƚɟɪɦɚɧɢɹ, Ɏɪɚɧɰɢɹ, əɩɨɧɢɹ. Ɍɟɤɭɳɟɟ ɫɨɫɬɨɹɧɢɟ ɞɟɥ ɦɨɠɧɨ ɜɵɹɫɧɢɬɶ ɧɚ ɫɚɣɬɟ ɤɨɦɩɚɧɢɢ www.unisys.com. ɋɪɨɤ ɞɟɣɫɬɜɢɹ ɨɫɧɨɜɧɨɝɨ ɩɚɬɟɧɬɚ ɜ ɋɒȺ ɢɫɬɟɤɚɟɬ ɧɟ ɪɚɧɟɟ 19 ɢɸɧɹ 2003 ɝɨɞɚ.
ɈȻɓȿȿ ɈɉɂɋȺɇɂȿ
Ɂɚɤɨɞɢɪɨɜɚɧɧɵɟ ɜ ɫɨɨɬɜɟɬɫɬɜɢɢ ɫ ɮɨɪɦɚɬɨɦ Deflate ɞɚɧɧɵɟ ɩɪɟɞɫɬɚɜɥɹɸɬ ɫɨɛɨɣ ɧɚɛɨɪ ɛɥɨɤɨɜ, ɩɨɪɹɞɨɤ ɤɨɬɨɪɵɯ ɫɨɜɩɚɞɚɟɬ ɫ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɶɸ ɫɨɨɬɜɟɬɫɬɜɭɸɳɢɯ ɛɥɨɤɨɜ ɢɫɯɨɞɧɵɯ ɞɚɧɧɵɯ. ɂɫɩɨɥɶɡɭɟɬɫɹ ɬɪɢ ɬɢɩɚ ɛɥɨɤɨɜ ɡɚɤɨɞɢɪɨɜɚɧɧɵɯ ɞɚɧɧɵɯ: 1) ɫɨɫɬɨɹɳɢɟ ɢɡ ɧɟɫɠɚɬɵɯ ɞɚɧɧɵɯ; 2) ɢɫɩɨɥɶɡɭɸɳɢɟ ɮɢɤɫɢɪɨɜɚɧɧɵɟ ɤɨɞɵ ɏɚɮɮɦɚɧɚ; 3) ɢɫɩɨɥɶɡɭɸɳɢɟ ɞɢɧɚɦɢɱɟɫɤɢɟ ɤɨɞɵ ɏɚɮɮɦɚɧɚ. Ⱦɥɢɧɚ ɛɥɨɤɨɜ ɩɟɪɜɨɝɨ ɬɢɩɚ ɧɟ ɦɨɠɟɬ ɩɪɟɜɵɲɚɬɶ 64 ɤɛɚɣɬ, ɨɬɧɨɫɢɬɟɥɶɧɨ ɞɪɭɝɢɯ ɨɝɪɚɧɢɱɟɧɢɣ ɩɨ ɪɚɡɦɟɪɭ ɧɟɬ. Ʉɚɠɞɵɣ ɛɥɨɤ ɬɢɩɚ 2 ɢ 3 ɫɨɫɬɨɢɬ ɢɡ ɞɜɭɯ ɱɚɫɬɟɣ: • ɨɩɢɫɚɧɢɹ ɞɜɭɯ ɬɚɛɥɢɰ ɤɨɞɨɜ ɏɚɮɮɦɚɧɚ, ɢɫɩɨɥɶɡɨɜɚɧɧɵɯ ɞɥɹ ɤɨɞɢɪɨɜɚɧɢɹ ɞɚɧɧɵɯ ɛɥɨɤɚ; • ɫɨɛɫɬɜɟɧɧɨ ɡɚɤɨɞɢɪɨɜɚɧɧɵɯ ɞɚɧɧɵɯ. Ʉɨɞɵ ɏɚɮɮɦɚɧɚ ɤɚɠɞɨɝɨ ɛɥɨɤɚ ɧɟ ɡɚɜɢɫɹɬ ɨɬ ɢɫɩɨɥɶɡɨɜɚɧɧɵɯ ɜ ɩɪɟɞɵɞɭɳɢɯ ɛɥɨɤɚɯ. ɋɚɦɨ ɨɩɢɫɚɧɢɟ ɞɢɧɚɦɢɱɟɫɤɢ ɫɨɡɞɚɜɚɟɦɵɯ ɤɨɞɨɜ ɏɚɮɮɦɚɧɚ ɹɜɥɹɟɬɫɹ, ɜ ɫɜɨɸ ɨɱɟɪɟɞɶ, ɬɚɤɠɟ ɫɠɚɬɵɦ ɫ ɩɨɦɨɳɶɸ ɮɢɤɫɢɪɨɜɚɧɧɵɯ ɤɨɞɨɜ ɏɚɮɮɦɚɧɚ, ɬɚɛɥɢɰɚ ɤɨɬɨɪɵɯ ɡɚɞɚɟɬɫɹ ɮɨɪɦɚɬɨɦ. Ⱥɥɝɨɪɢɬɦ ɫɥɨɜɚɪɧɨɝɨ ɫɠɚɬɢɹ ɦɨɠɟɬ ɢɫɩɨɥɶɡɨɜɚɬɶ ɜ ɤɚɱɟɫɬɜɟ ɫɥɨɜɚɪɹ ɱɚɫɬɶ ɩɪɟɞɵɞɭɳɟɝɨ ɛɥɨɤɚ (ɛɥɨɤɨɜ), ɧɨ ɜɟɥɢɱɢɧɚ ɫɦɟɳɟɧɢɹ ɧɟ ɦɨɠɟɬ ɛɵɬɶ ɛɨɥɶɲɟ 32 ɤɛɚɣɬ. Ⱦɚɧɧɵɟ ɜ ɤɨɦɩɚɤɬɧɨɦ ɩɪɟɞɫɬɚɜɥɟɧɢɢ ɫɨɫɬɨɹɬ ɢɡ ɤɨɞɨɜ ɷɥɟɦɟɧɬɨɜ ɞɜɭɯ ɬɢɩɨɜ: • ɥɢɬɟɪɚɥɨɜ (ɨɞɢɧɨɱɧɵɯ ɫɢɦɜɨɥɨɜ); • ɭɤɚɡɚɬɟɥɟɣ ɢɦɟɸɳɢɯɫɹ ɜ ɫɥɨɜɚɪɟ ɮɪɚɡ; ɭɤɚɡɚɬɟɥɢ ɫɨɫɬɨɹɬ ɢɡ ɩɚɪɵ <ɞɥɢɧɚ ɫɨɜɩɚɞɟɧɢɹ, ɫɦɟɳɟɧɢɟ>. Ⱦɥɢɧɚ ɫɨɜɩɚɜɲɟɣ ɫɬɪɨɤɢ ɧɟ ɦɨɠɟɬ ɩɪɟɜɵɲɚɬɶ 258 ɛɚɣɬɨɜ, ɚ ɫɦɟɳɟɧɢɟ ɮɪɚɡɵ — 32 ɤɛɚɣɬ. Ʌɢɬɟɪɚɥɵ ɢ ɞɥɢɧɵ ɫɨɜɩɚɞɟɧɢɹ ɤɨɞɢɪɭɸɬɫɹ ɫ ɩɨɦɨɳɶɸ ɨɞɧɨɣ ɬɚɛɥɢɰɵ ɤɨɞɨɜ ɏɚɮɮɦɚɧɚ, ɚ ɞɥɹ ɫɦɟɳɟɧɢɣ ɢɫɩɨɥɶɡɭɟɬɫɹ ɞɪɭɝɚɹ ɬɚɛɥɢɰɚ; ɢɧɚɱɟ ɝɨɜɨɪɹ, ɥɢɬɟɪɚɥɵ 84
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɢ ɞɥɢɧɵ ɫɨɜɩɚɞɟɧɢɹ ɨɛɪɚɡɭɸɬ ɨɞɢɧ ɚɥɮɚɜɢɬ. ɂɦɟɧɧɨ ɷɬɢ ɬɚɛɥɢɰɵ ɤɨɞɨɜ ɢ ɩɟɪɟɞɚɸɬɫɹ ɜ ɧɚɱɚɥɟ ɛɥɨɤɚ ɬɪɟɬɶɟɝɨ ɬɢɩɚ. ȺɅȽɈɊɂɌɆ ȾȿɄɈȾɂɊɈȼȺɇɂə
ɋɠɚɬɵɟ ɞɚɧɧɵɟ ɞɟɤɨɞɢɪɭɸɬɫɹ ɩɨ ɫɥɟɞɭɸɳɟɦɭ ɚɥɝɨɪɢɬɦɭ. do{ Block.ReadHeader (); // ɱɢɬɚɟɦ ɡɚɝɨɥɨɜɨɤ ɛɥɨɤɚ /*ɨɩɪɟɞɟɥɹɟɦ ɧɟɨɛɯɨɞɢɦɵɟ ɞɟɣɫɬɜɢɹ ɩɨ ɪɚɡɠɚɬɢɸ ɜ ɫɨɨɬɜɟɬɫɬɜɢɢ ɫ ɬɢɩɨɦ ɛɥɨɤɚ */ switch (Block.Type) { case NO_COMP:// ɞɚɧɧɵɟ ɧɟ ɫɠɚɬɵ, ɩɪɨɫɬɨ ɤɨɩɢɪɭɟɦ ɢɯ /*ɡɚɝɨɥɨɜɨɤ ɛɥɨɤɚ ɧɟ ɜɵɪɨɜɧɟɧ ɧɚ ɝɪɚɧɢɰɭ ɛɚɣɬɚ, ɫɞɟɥɚɟɦ ɷɬɨ */ Block.SeekNextByte (); Block.ReadLen (); // ɱɢɬɚɟɦ ɞɥɢɧɭ ɛɥɨɤɚ /*ɤɨɩɢɪɭɟɦ ɞɚɧɧɵɟ ɛɥɨɤɚ ɢɡ ɜɯɨɞɧɨɝɨ ɮɚɣɥɚ ɫɠɚɬɵɯ ɞɚɧɧɵɯ ɜ ɪɟɡɭɥɶɬɢɪɭɸɳɢɣ DataFile */ PutRawData (Window, Block, DataFile); break; case DYN_HUF: /*ɛɥɨɤ ɞɚɧɧɵɯ ɫɠɚɬ ɫ ɩɨɦɨɳɶɸ ɞɢɧɚɦɢɱɟɫɤɢ ɩɨɫɬɪɨɟɧɧɵɯ ɤɨɞɨɜ ɏɚɮɮɦɚɧɚ, ɩɪɨɱɢɬɚɟɦ ɢɯ */ Block.ReadHuffmanCodes (); case FIXED_HUF: for (;;) { /*ɩɪɨɱɬɟɦ ɨɞɢɧ ɫɢɦɜɨɥ ɚɥɮɚɜɢɬɚ ɥɢɬɟɪɚɥɨɜ ɢ ɞɥɢɧ ɫɨɜɩɚɞɟɧɢɹ */ value = Block.DecodeSymbol (); if ( value < 256) // ɷɬɨ ɥɢɬɟɪɚɥ, ɡɚɩɢɲɟɦ ɟɝɨ ɜ ɜɵɯɨɞɧɨɣ ɮɚɣɥ DataFile.WriteSymbol (value); else if ( value == 256) // ɡɧɚɤ ɤɨɧɰɚ ɛɥɨɤɚ break; else { // ɷɬɨ ɡɚɤɨɞɢɪɨɜɚɧɧɵɣ ɭɤɚɡɚɬɟɥɶ match_len = Block.DecodeLen (); match_pos = Block.DecodePos (); /*ɫɤɨɩɢɪɭɟɦ ɫɨɨɬɜɟɬɫɬɜɭɸɳɭɸ ɮɪɚɡɭ ɢɡ ɫɥɨɜɚɪɹ ɜ ɜɵɯɨɞɧɨɣ ɮɚɣɥ
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
85
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
*/ CopyPhrase (Window, match_len, match_pos, DataFile); } }; break; default: // Ɉɲɢɛɤɚ ɜ ɛɥɨɤɟ ɞɚɧɧɵɯ throw BadData (Block); }while ( !IsLastBlock );
ɉɪɟɞɩɨɥɚɝɚɟɬɫɹ, ɱɬɨ ɢɫɩɨɥɶɡɭɟɦɵɟ ɚɥɝɨɪɢɬɦɵ ɩɨɞɞɟɪɠɢɜɚɸɬ ɩɪɚɜɢɥɶɧɨɟ ɨɛɧɨɜɥɟɧɢɟ ɫɤɨɥɶɡɹɳɟɝɨ ɨɤɧɚ. ɄɈȾɂɊɈȼȺɇɂȿ ȾɅɂɇ ɂ ɋɆȿɓȿɇɂɃ
Ʉɚɤ ɭɠɟ ɭɤɚɡɵɜɚɥɨɫɶ, ɥɢɬɟɪɚɥɵ ɢ ɞɥɢɧɵ ɫɨɜɩɚɞɟɧɢɹ ɨɛɴɟɞɢɧɟɧɵ ɜ ɟɞɢɧɵɣ ɚɥɮɚɜɢɬ ɫɢɦɜɨɥɨɜ ɫɨ ɡɧɚɱɟɧɢɹɦɢ {0, 1, …, 285}, ɬɚɤ ɱɬɨ 0…255 ɨɬɜɟɞɟɧɵ ɩɨɞ ɥɢɬɟɪɚɥɵ, 256 ɭɤɚɡɵɜɚɟɬ ɧɚ ɤɨɧɟɰ ɬɟɤɭɳɟɝɨ ɛɥɨɤɚ, ɚ 257…285 ɨɩɪɟɞɟɥɹɸɬ ɞɥɢɧɵ ɫɨɜɩɚɞɟɧɢɹ. Ʉɨɞ ɞɥɢɧɵ ɫɨɜɩɚɞɟɧɢɹ ɫɨɫɬɨɢɬ ɢɡ ɤɨɞɚ ɱɢɫɥɚ, ɥɟɠɚɳɟɝɨ ɜ ɞɢɚɩɚɡɨɧɟ 257…285 (ɛɚɡɵ ɞɥɢɧɵ ɫɨɜɩɚɞɟɧɢɹ), ɢ, ɜɨɡɦɨɠɧɨ, ɞɨɩɨɥɧɢɬɟɥɶɧɨ ɱɢɬɚɟɦɵɯ ɛɢɬɨɜ, ɧɟɩɨɫɪɟɞɫɬɜɟɧɧɨ ɫɥɟɞɭɸɳɢɯ ɡɚ ɤɨɞɨɦ ɷɬɨɝɨ ɱɢɫɥɚ. Ȼɚɡɚ ɨɩɪɟɞɟɥɹɟɬ ɤɜɚɧɬɨɜɚɧɧɭɸ ɞɥɢɧɭ ɫɨɜɩɚɞɟɧɢɹ, ɩɨɷɬɨɦɭ ɨɞɧɨɦɭ ɡɧɚɱɟɧɢɸ ɛɚɡɵ ɦɨɠɟɬ ɫɨɨɬɜɟɬɫɬɜɨɜɚɬɶ ɧɟɫɤɨɥɶɤɨ ɞɥɢɧ. Ɂɧɚɱɟɧɢɟ ɩɨɥɹ ɞɨɩɨɥɧɢɬɟɥɶɧɨ ɱɢɬɚɟɦɵɯ ɛɢɬɨɜ ɢɫɩɨɥɶɡɭɟɬɫɹ ɞɥɹ ɞɨɨɩɪɟɞɟɥɟɧɢɹ ɞɥɢɧɵ ɫɨɜɩɚɞɟɧɢɹ. Ɍɚɛɥɢɰɚ ɨɬɨɛɪɚɠɟɧɢɹ ɡɧɚɱɟɧɢɣ ɤɨɞɨɜ ɜ ɞɥɢɧɵ ɮɪɚɡ ɩɪɢɜɟɞɟɧɚ ɧɢɠɟ.
Ɂɧɚɱɟɧɢɟ ɛɚɡɵ 257 258 259 260 261 262 86
Ɍɚɛɥɢɰɚ 3.6 ɑɢɫɥɨ Ⱦɥɢɧɚ Ɂɧɚɱɟɧɢɟ ɑɢɫɥɨ Ⱦɥɢɧɚ ɞɨɩ. ɫɨɜɩɚɞɟɧɢɹ ɛɚɡɵ ɞɨɩ. ɫɨɜɩɚɞɟɧɢɹ ɛɢɬɨɜ ɛɢɬɨɜ 0 3 272 2 31…34 0 4 273 3 35…42 0 5 274 3 43…50 0 6 275 3 51…58 0 7 276 3 59…66 0 8 277 4 67…82
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
Ɂɧɚɱɟɧɢɟ ɛɚɡɵ 263 264 265 266 267 268 269 270 271
ɑɢɫɥɨ Ⱦɥɢɧɚ Ɂɧɚɱɟɧɢɟ ɑɢɫɥɨ Ⱦɥɢɧɚ ɞɨɩ. ɫɨɜɩɚɞɟɧɢɹ ɛɚɡɵ ɞɨɩ. ɫɨɜɩɚɞɟɧɢɹ ɛɢɬɨɜ ɛɢɬɨɜ 0 9 278 4 83…98 0 10 279 4 99…114 1 11,12 280 4 115…130 1 13,14 281 5 131…162 1 15,16 282 5 163…194 1 17,18 283 5 195…226 2 19…22 284 5 227…257 2 23…26 285 0 258 2 27…30
ɉɨɥɟ ɞɨɩɨɥɧɢɬɟɥɶɧɵɯ ɛɢɬɨɜ ɩɪɟɞɫɬɚɜɥɹɟɬ ɫɨɛɨɣ ɰɟɥɨɟ ɱɢɫɥɨ ɡɚɞɚɧɧɨɣ ɞɥɢɧɵ, ɜ ɤɨɬɨɪɨɦ ɩɟɪɜɵɦ ɡɚɩɢɫɚɧ ɫɚɦɵɣ ɫɬɚɪɲɢɣ ɛɢɬ. Ⱦɥɢɧɚ ɫɨɜɩɚɞɟɧɢɹ 258 ɤɨɞɢɪɭɟɬɫɹ ɫ ɩɨɦɨɳɶɸ ɧɟɛɨɥɶɲɨɝɨ ɱɢɫɥɚ ɛɢɬɨɜ, ɩɨɫɤɨɥɶɤɭ ɷɬɨ ɦɚɤɫɢɦɚɥɶɧɨ ɞɨɩɭɫɬɢɦɚɹ ɜ Deflate ɞɥɢɧɚ ɫɨɜɩɚɞɟɧɢɹ, ɢ ɬɚɤɨɣ ɩɪɢɟɦ ɩɨɡɜɨɥɹɟɬ ɭɜɟɥɢɱɢɬɶ ɫɬɟɩɟɧɶ ɫɠɚɬɢɹ ɜɵɫɨɤɨɢɡɛɵɬɨɱɧɵɯ ɮɚɣɥɨɜ. Ɍɚɤɢɦ ɨɛɪɚɡɨɦ, ɮɭɧɤɰɢɹ Block.DecodeSymbol, ɭɩɨɦɹɧɭɬɚɹ ɜ ɩɪɟɞɵɞɭɳɟɦ ɩɨɞɩɭɧɤɬɟ, ɱɢɬɚɟɬ ɫɢɦɜɨɥ, ɤɨɬɨɪɵɣ ɦɨɠɟɬ ɛɵɬɶ ɥɢɛɨ ɥɢɬɟɪɚɥɨɦ, ɥɢɛɨ ɡɧɚɤɨɦ ɤɨɧɰɚ ɛɥɨɤɚ, ɥɢɛɨ ɛɚɡɨɣ ɫɨɜɩɚɞɟɧɢɹ. ȼ ɩɨɫɥɟɞɧɟɦ ɫɥɭɱɚɟ, ɬ.ɟ. ɤɨɝɞɚ ɡɧɚɱɟɧɢɟ ɫɢɦɜɨɥɚ > 256, ɞɨɩɨɥɧɢɬɟɥɶɧɵɟ ɛɢɬɵ ɱɢɬɚɸɬɫɹ ɫ ɩɨɦɨɳɶɸ ɮɭɧɤɰɢɢ Block.DecodeLen. ɉɪɟɞɫɬɚɜɥɟɧɢɟ ɫɦɟɳɟɧɢɣ ɬɚɤɠɟ ɫɨɫɬɨɢɬ ɢɡ ɞɜɭɯ ɩɨɥɟɣ: ɛɚɡɵ ɢ ɩɨɥɹ ɞɨɩɨɥɧɢɬɟɥɶɧɵɯ ɛɢɬɨɜ (ɬɚɛɥ. 3.7). Ɉɛɴɟɞɢɧɟɧɢɟ ɫɦɟɳɟɧɢɣ ɜ ɝɪɭɩɩɵ ɩɨɡɜɨɥɹɟɬ ɢɫɩɨɥɶɡɨɜɚɬɶ ɞɨɫɬɚɬɨɱɧɨ ɷɮɮɟɤɬɢɜɧɵɟ ɤɨɞɵ ɏɚɮɮɦɚɧɚ ɧɟɛɨɥɶɲɨɣ ɞɥɢɧɵ, ɤɚɧɨɧɢɱɟɫɤɢɣ ɚɥɝɨɪɢɬɦ ɩɨɫɬɪɨɟɧɢɹ ɤɨɬɨɪɵɯ ɨɛɟɫɩɟɱɢɜɚɟɬ ɛɵɫɬɪɨɟ ɞɟɤɨɞɢɪɨɜɚɧɢɟ. Ɉɛɴɟɞɢɧɟɧɢɟ ɰɟɥɟɫɨɨɛɪɚɡɧɨ ɬɚɤɠɟ ɩɨɬɨɦɭ, ɱɬɨ ɪɚɫɩɪɟɞɟɥɟɧɢɟ ɜɟɥɢɱɢɧ ɫɦɟɳɟɧɢɣ ɜ ɨɬɞɟɥɶɧɨɣ ɝɪɭɩɩɟ ɨɛɵɱɧɨ ɧɨɫɢɬ ɫɥɭɱɚɣɧɵɣ ɯɚɪɚɤɬɟɪ. Ɍɚɛɥɢɰɚ 3.7 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
87
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
Ɂɧɚɱɟ- ɑɢɫɥɨ Ɂɧɚɱɟɧɢɟ Ɂɧɚɱɟɑɢɫɥɨ Ɂɧɚɱɟɧɢɟ ɧɢɟ ɞɨɩ. ɫɦɟɳɟɧɢɹ ɧɢɟ ɛɚɡɵ ɞɨɩ. ɫɦɟɳɟɧɢɹ ɛɚɡɵ ɛɢɬɨɜ ɛɢɬɨɜ 0 0 1 15 6 193…256 1 0 2 16 7 257…384 2 0 3 17 7 385…512 3 0 4 18 8 513…768 4 1 5,6 19 8 769…1024 5 1 7,8 20 9 1025…1536 6 2 9…12 21 9 1537…2048 7 2 13…16 22 10 2049…3072 8 3 17…24 23 10 3073…4096 9 3 25…32 24 11 4097…6144 10 4 33…48 25 11 6145…8192 11 4 49…64 26 12 8193…12288 12 5 65…96 27 12 12289…16384 13 5 97…128 28 13 16385…24576 14 6 129…192 29 13 24577…32768 Ɏɭɧɤɰɢɹ Block.DecodePos ɞɨɥɠɧɚ ɜɵɩɨɥɧɢɬɶ ɞɜɚ ɞɟɣɫɬɜɢɹ: ɩɪɨɱɢɬɚɬɶ ɛɚɡɭ ɫɦɟɳɟɧɢɹ ɢ, ɧɚ ɨɫɧɨɜɚɧɢɢ ɡɧɚɱɟɧɢɹ ɛɚɡɵ, ɩɪɨɱɢɬɚɬɶ ɧɟɨɛɯɨɞɢɦɨɟ ɤɨɥɢɱɟɫɬɜɨ ɞɨɩɨɥɧɢɬɟɥɶɧɵɯ ɛɢɬɨɜ. Ʉɚɤ ɢ ɜ ɫɥɭɱɚɟ ɥɢɬɟɪɚɥɨɜ/ɞɥɢɧ ɫɨɜɩɚɞɟɧɢɹ, ɞɨɩɨɥɧɢɬɟɥɶɧɵɟ ɛɢɬɵ ɫɨɨɬɜɟɬɫɬɜɭɸɬ ɰɟɥɵɦ ɱɢɫɥɚɦ ɡɚɞɚɧɧɨɣ ɞɥɢɧɵ, ɜ ɤɨɬɨɪɵɯ ɩɟɪɜɵɦ ɡɚɩɢɫɚɧ ɫɚɦɵɣ ɫɬɚɪɲɢɣ ɛɢɬ. ɄɈȾɂɊɈȼȺɇɂȿ ȻɅɈɄɈȼ ɎɂɄɋɂɊɈȼȺɇɇɕɆɂ ɄɈȾȺɆɂ ɏȺɎɎɆȺɇȺ
ȼ ɷɬɨɦ ɫɥɭɱɚɟ ɞɥɹ ɫɠɚɬɢɹ ɫɢɦɜɨɥɨɜ ɚɥɮɚɜɢɬɚ ɥɢɬɟɪɚɥɨɜ ɢ ɞɥɢɧ ɫɨɜɩɚɞɟɧɢɹ ɢɫɩɨɥɶɡɭɸɬɫɹ ɡɚɪɚɧɟɟ ɩɨɫɬɪɨɟɧɧɵɟ ɤɨɞɵ ɏɚɮɮɦɚɧɚ, ɢɡɜɟɫɬɧɵɟ ɤɨɞɟɪɭ ɢ ɞɟɤɨɞɟɪɭ, ɬ.ɟ. ɧɚɦ ɧɟ ɧɭɠɧɨ ɩɟɪɟɞɚɜɚɬɶ ɢɯ ɨɩɢɫɚɧɢɹ. Ⱦɥɢɧɵ ɤɨɞɨɜ ɨɩɪɟɞɟɥɹɸɬɫɹ ɡɧɚɱɟɧɢɟɦ ɫɢɦɜɨɥɨɜ (ɫɦ. ɬɚɛɥ. 3.8).
88
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
Ɍɚɛɥɢɰɚ 3.8 Ɂɧɚɱɟɧɢɟ Ⱦɥɢɧɚ ɤɨɞɚ ɜ Ɂɧɚɱɟɧɢɟ ɤɨɞɚ (ɜ ɞɜɨɢɱɧɨɣ ɫɢɦɜɨɥɚ ɛɢɬɚɯ ɫɢɫɬɟɦɟ ɫɱɢɫɥɟɧɢɹ) 0–143 8 00110000 … 10111111 144–255 9 110010000 … 111111111 256–279 7 0000000 … 0010111 280–287 8 11000000 … 11000111 ɋɢɦɜɨɥɵ ɫɨ ɡɧɚɱɟɧɢɹɦɢ 286 ɢ 287 ɧɟ ɞɨɥɠɧɵ ɩɨɹɜɥɹɬɶɫɹ ɜ ɫɠɚɬɵɯ ɞɚɧɧɵɯ, ɯɨɬɹ ɞɥɹ ɧɢɯ ɢ ɨɬɜɟɞɟɧɨ ɤɨɞɨɜɨɟ ɩɪɨɫɬɪɚɧɫɬɜɨ. Ȼɚɡɵ ɫɦɟɳɟɧɢɣ ɤɨɞɢɪɭɸɬɫɹ 5-ɛɢɬɨɜɵɦɢ ɱɢɫɥɚɦɢ ɬɚɤ, ɱɬɨ 00000 ɫɨɨɬɜɟɬɫɬɜɭɟɬ 0, 11111 — 31. ɉɪɢ ɷɬɨɦ ɡɚɩɪɟɳɚɟɬɫɹ ɢɫɩɨɥɶɡɨɜɚɬɶ ɛɚɡɵ ɫɨ ɡɧɚɱɟɧɢɹɦɢ 30 ɢ 31, ɬɚɤ ɤɚɤ ɢɯ ɫɦɵɫɥ ɧɟ ɨɩɪɟɞɟɥɟɧ. ɉɪɢɦɟɪ ɉɨɤɚɠɟɦ, ɤɚɤ ɜɵɝɥɹɞɢɬ ɜ ɡɚɤɨɞɢɪɨɜɚɧɧɨɦ ɜɢɞɟ ɫɥɟɞɭɸɳɚɹ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɶ ɡɚɦɟɳɟɧɧɵɯ ɫɬɪɨɤ ɢ ɥɢɬɟɪɚɥɚ: ɗɥɟɦɟɧɬ ɋɦɟɳɟɧɢɟ i Ⱦɥɢɧɚ ɫɨɜɩɚɞɟɧɢɹ j Ʌɢɬɟɪɚɥ 1 260 5 2 45 20 3 3 Ⱦɥɢɧɚ ɫɨɜɩɚɞɟɧɢɹ ɪɚɫɤɥɚɞɵɜɚɟɬɫɹ ɧɚ 2 ɩɨɥɹ, ɩɨɷɬɨɦɭ ɞɥɹ j = 5 ɩɨɥɭɱɚɟɦ (ɫɦ. ɬɚɛɥ. 3.6):
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
89
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
Ⱦɥɢɧɚ ɫɨɜɩɚɞɟɧɢɹ
ɋɨɨɬɜɟɬɫɬɜɭɸɳɢɣ Ȼɚɡɚ ɑɢɫɥɨ ɫɢɦɜɨɥ ɜ ɚɥɮɚɜɢɬɟ ɥɢɞɨɩɨɥɧɢɬɟɥɶɧɵɯ ɛɢɬɟɪɚɥɨɜ/ɞɥɢɧ ɬɨɜ 5 259 259 0 Ⱦɥɢɧɚ ɫɨɜɩɚɞɟɧɢɹ ɤɨɞɢɪɭɟɬɫɹ ɤɚɤ 0000011 (ɫɦ. ɬɚɛɥ. 3.8). ȼ ɨɛɳɟɦ ɫɥɭɱɚɟ ɫɦɟɳɟɧɢɟ ɫɨɫɬɨɢɬ ɬɚɤɠɟ ɢɡ 2 ɩɨɥɟɣ, ɢ ɞɥɹ i = 260 ɩɨɥɭɱɚɟɦ: ɋɦɟɳɟɧɢɟ Ȼɚɡɚ ɑɢɫɥɨ Ɂɧɚɱɟɧɢɟ ɞɨɩɨɥɧɢɬɟɥɶɧɵɯ ɛɢɬɨɜ ɞɨɩɨɥɧɢɬɟɥɶɧɵɯ ɛɢɬɨɜ 260 16 7 3 ɋɦɟɳɟɧɢɟ 260 ɡɚɩɢɫɵɜɚɟɬɫɹ ɤɚɤ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɶ ɛɢɬɨɜ 10000_0000011 (ɩɨɞɱɟɪɤɢɜɚɧɢɟɦ ɩɨɤɚɡɚɧɚ ɝɪɚɧɢɰɚ ɱɢɫɟɥ), ɝɞɟ ɩɟɪɜɨɟ ɱɢɫɥɨ — ɛɚɡɚ, ɜɬɨɪɨɟ — ɩɨɥɟ ɞɨɩɨɥɧɢɬɟɥɶɧɵɯ ɛɢɬɨɜ, ɪɚɜɧɨɟ 260 – 257 = 3. Ⱦɟɣɫɬɜɭɹ ɚɧɚɥɨɝɢɱɧɵɦ ɨɛɪɚɡɨɦ, ɧɚ ɨɫɧɨɜɚɧɢɢ ɬɚɛɥ. 3.6, 3.7, 3.8 ɧɚɯɨɞɢɦ ɨɬɨɛɪɚɠɟɧɢɟ ɜɫɟɣ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ: ɗɥɟɦɟɧɬ 1
2
ɉɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɶ ɛɢɬɨɜ 0000011 10000_0000011
0001101_01 01010_1100
3
00110011 90
Ʉɨɦɦɟɧɬɚɪɢɢ • ɛɚɡɚ ɞɥɢɧɵ ɫɨɜɩɚɞɟɧɢɹ = 259 • ɩɨɥɟ ɞɨɩɨɥɧɢɬɟɥɶɧɵɯ ɛɢɬɨɜ ɩɚɞɟɧɢɹ ɨɬɫɭɬɫɬɜɭɟɬ • ɛɚɡɚ ɫɦɟɳɟɧɢɹ = 16 • ɩɨɥɟ ɞɨɩɨɥɧɢɬɟɥɶɧɵɯ ɛɢɬɨɜ ɳɟɧɢɹ = 3, ɞɥɢɧɚ ɩɨɥɹ = 7 • ɛɚɡɚ ɞɥɢɧɵ ɫɨɜɩɚɞɟɧɢɹ = 269 • ɩɨɥɟ ɞɨɩɨɥɧɢɬɟɥɶɧɵɯ ɛɢɬɨɜ ɩɚɞɟɧɢɹ = 1, ɞɥɢɧɚ ɩɨɥɹ = 2 • ɛɚɡɚ ɫɦɟɳɟɧɢɹ = 10 • ɩɨɥɟ ɞɨɩɨɥɧɢɬɟɥɶɧɵɯ ɛɢɬɨɜ ɳɟɧɢɹ = 12, ɞɥɢɧɚ ɩɨɥɹ = 4 ɥɢɬɟɪɚɥ = 3
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
ɫɨɜ-
ɫɦɟ-
ɫɨɜ-
ɫɦɟ-
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɄɈȾɂɊɈȼȺɇɂȿ ȻɅɈɄɈȼ ȾɂɇȺɆɂɑȿɋɄɂ ɋɈɁȾȺȼȺȿɆɕɆɂ ɄɈȾȺɆɂ ɏȺɎɎɆȺɇȺ
ȼ ɷɬɨɦ ɫɥɭɱɚɟ ɩɟɪɟɞ ɫɨɛɫɬɜɟɧɧɨ ɫɠɚɬɵɦɢ ɞɚɧɧɵɦɢ ɩɟɪɟɞɚɟɬɫɹ ɨɩɢɫɚɧɢɟ ɤɨɞɨɜ ɥɢɬɟɪɚɥɨɜ/ɞɥɢɧ ɢ ɨɩɢɫɚɧɢɟ ɤɨɞɨɜ ɫɦɟɳɟɧɢɣ. ȼ ɦɟɬɨɞɟ Deflate ɢɫɩɨɥɶɡɭɟɬɫɹ ɤɚɧɨɧɢɱɟɫɤɢɣ ɚɥɝɨɪɢɬɦ ɏɚɮɮɦɚɧɚ, ɩɨɷɬɨɦɭ ɞɥɹ ɭɤɚɡɚɧɢɹ ɤɨɞɚ ɫɢɦɜɨɥɚ ɞɨɫɬɚɬɨɱɧɨ ɡɚɞɚɬɶ ɬɨɥɶɤɨ ɞɥɢɧɭ ɷɬɨɝɨ ɤɨɞɚ. ɇɟɹɜɧɵɦ ɩɚɪɚɦɟɬɪɨɦ ɹɜɥɹɟɬɫɹ ɩɨɥɨɠɟɧɢɟ ɫɢɦɜɨɥɚ ɜ ɭɩɨɪɹɞɨɱɟɧɧɨɦ ɫɩɢɫɤɟ ɫɢɦɜɨɥɨɜ. Ɍɚɤɢɦ ɨɛɪɚɡɨɦ, ɞɢɧɚɦɢɱɟɫɤɢɟ ɤɨɞɵ ɏɚɮɮɦɚɧɚ ɨɩɢɫɵɜɚɸɬɫɹ ɰɟɩɨɱɤɨɣ ɞɥɢɧ ɤɨɞɨɜ, ɭɩɨɪɹɞɨɱɟɧɧɵɯ ɩɨ ɡɧɚɱɟɧɢɸ ɫɨɨɬɜɟɬɫɬɜɭɸɳɟɝɨ ɤɨɞɚɦ ɱɢɫɥɚ (ɥɢɬɟɪɚɥɚ/ɞɥɢɧɵ ɫɨɜɩɚɞɟɧɢɹ, ɜ ɨɞɧɨɦ ɫɥɭɱɚɟ, ɢ ɫɦɟɳɟɧɢɹ, ɜ ɞɪɭɝɨɦ). ɉɪɢ ɷɬɨɦ ɚɥɮɚɜɢɬ CWL (codeword lengths) ɞɥɢɧ ɤɨɞɨɜ ɢɦɟɟɬ ɜɢɞ, ɨɩɢɫɚɧɧɵɣ ɜ ɬɚɛɥ. 3.9. Ɍɚɛɥɢɰɚ 3.9 Ɂɧɚɱɟɧɢɟ ɑɬɨ ɨɩɪɟɞɟɥɹɟɬ ɫɢɦɜɨɥɚ ɚɥɮɚɜɢɬɚ CWL 0…15 ɋɨɨɬɜɟɬɫɬɜɭɟɬ ɞɥɢɧɚɦ ɤɨɞɨɜ ɨɬ 0 ɞɨ 15 16 Ʉɨɩɢɪɨɜɚɬɶ ɩɪɟɞɵɞɭɳɭɸ ɞɥɢɧɭ ɤɨɞɚ x ɪɚɡ, ɝɞɟ x ɨɩɪɟɞɟɥɹɟɬɫɹ ɡɧɚɱɟɧɢɟɦ ɞɜɭɯ ɛɢɬɨɜ, ɱɢɬɚɟɦɵɯ ɩɨɫɥɟ ɤɨɞɚ ɫɢɦɜɨɥɚ ‘16’; ɦɨɠɧɨ ɭɤɚɡɚɬɶ ɧɟɨɛɯɨɞɢɦɨɫɬɶ ɩɨɜɬɨɪɢɬɶ ɩɪɟɞɵɞɭɳɭɸ ɞɥɢɧɭ 3…6 ɪɚɡ 17 ɉɨɡɜɨɥɹɟɬ ɡɚɞɚɬɶ ɞɥɹ x ɤɨɞɨɜ, ɧɚɱɢɧɚɹ ɫ ɬɟɤɭɳɟɝɨ, ɞɥɢɧɭ 0; x ɦɨɠɟɬ ɩɪɢɧɢɦɚɬɶ ɡɧɚɱɟɧɢɹ ɨɬ 3 ɞɨ 10 ɢ ɨɩɪɟɞɟɥɹɟɬɫɹ ɬɚɤɢɦ ɠɟ ɨɛɪɚɡɨɦ, ɤɚɤ ɢ ɞɥɹ 16 18 Ⱥɧɚɥɨɝɢɱɧɨ 17, ɧɨ x ɦɨɠɟɬ ɛɵɬɶ ɨɬ 11 ɞɨ 138 ɇɚɩɪɢɦɟɪ, ɟɫɥɢ ɜ ɪɟɡɭɥɶɬɚɬɟ ɞɟɤɨɞɢɪɨɜɚɧɢɹ ɨɩɢɫɚɧɢɹ ɤɨɞɨɜ ɛɵɥɚ ɩɨɥɭɱɟɧɚ ɰɟɩɨɱɤɚ ɞɥɢɧ ‘2’, ‘3’, ‘16’ (x = 4), ‘17’ (x=3), ‘4’,…, ɬɨ ɞɥɢɧɚ ɤɨɞɨɜ ɫɢɦɜɨɥɨɜ ɛɭɞɟɬ ɪɚɜɧɚ: Ɂɧɚɱɟɧɢɟ ɫɢɦɜɨɥɚ 0 1 2 3 4 5 6 7 8 9 … Ⱦɥɢɧɚ ɤɨɞɚ ɫɢɦ- 2 3 3 3 3 3 0 0 0 4 ? ɜɨɥɚ Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
91
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
Ɉɛɪɚɬɢɬɟ ɜɧɢɦɚɧɢɟ, ɱɬɨ ɫɢɦɜɨɥɵ ɭɩɨɪɹɞɨɱɟɧɵ ɩɨ ɜɨɡɪɚɫɬɚɧɢɸ ɢɯ ɡɧɚɱɟɧɢɣ. ɋ ɰɟɥɶɸ ɭɜɟɥɢɱɟɧɢɹ ɫɠɚɬɢɹ ɫɚɦɢ ɷɬɢ ɰɟɩɨɱɤɢ ɞɥɢɧ ɤɨɞɢɪɭɸɬɫɹ ɫ ɩɨɦɨɳɶɸ ɤɨɞɨɜ ɏɚɮɮɦɚɧɚ. ȿɫɥɢ ɞɥɢɧɚ ɤɨɞɚ ɫɢɦɜɨɥɚ (ɬ.ɟ. ɞɥɢɧɚ ɤɨɞɚ ɞɥɢɧ ɤɨɞɨɜ) ɪɚɜɧɚ ɧɭɥɸ, ɬɨ ɷɬɨ ɡɧɚɱɢɬ, ɱɬɨ ɫɨɨɬɜɟɬɫɬɜɭɸɳɢɣ ɫɢɦɜɨɥ ɜ ɞɚɧɧɵɯ ɧɟ ɜɫɬɪɟɱɚɟɬɫɹ, ɢ ɤɨɞ ɟɦɭ ɧɟ ɨɬɜɨɞɢɬɫɹ. Ɏɨɪɦɚɬ ɛɥɨɤɚ ɫ ɞɢɧɚɦɢɱɟɫɤɢɦɢ ɤɨɞɚɦɢ ɏɚɮɮɦɚɧɚ ɨɩɢɫɚɧ ɜ ɬɚɛɥ. 3.10. Ɍɚɛɥɢɰɚ 3.10 ɉɨɥɟ Ɉɩɢɫɚɧɢɟ Ɋɚɡɦɟɪ HLIT ɏɪɚɧɢɬ ɤɨɥɢɱɟɫɬɜɨ ɤɨɞɨɜ ɥɢɬɟɪɚɥɨɜ/ɞɥɢɧ 5 ɛɢɬɨɜ ɦɢɧɭɫ 257 HDIST ɏɪɚɧɢɬ ɤɨɥɢɱɟɫɬɜɨ ɤɨɞɨɜ ɫɦɟɳɟɧɢɣ ɦɢɧɭɫ 5 ɛɢɬɨɜ 1 HCLEN ɏɪɚɧɢɬ ɤɨɥɢɱɟɫɬɜɨ ɤɨɞɨɜ ɞɥɢɧ ɤɨɞɨɜ ɦɢ- 4 ɛɢɬɚ ɧɭɫ 4 ɋɨɞɟɪɠɢɬ ɨɩɢɫɚɧɢɟ (ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɶ (HCLEN+ Ɍɚɛɥɢɰɚ ɞɥɢɧ ɤɨɞɨɜ) ɞɥɢɧ ɤɨɞɨɜ ɜ ɫɥɟɞɭɸɳɟɦ ɩɨ- 4)·3 ɛɢɬɚ ɨɩɢɫɚɧɢɹ ɤɨɞɨɜ ɞɥɢɧ ɪɹɞɤɟ: 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, ɤɨɞɨɜ (ɤɨ- 12, 3, 13, 2, 14, 1, 15. ɂɧɚɱɟ ɝɨɜɨɪɹ, ɷɬɨ ɩɨɪɹɞɨɤ ɫɢɦɜɨɥɨɜ ɜ ɚɥɮɚɜɢɬɟ CWL. ɞɵ 2) Ⱦɥɢɧɚ ɤɨɞɚ ɥɸɛɨɝɨ ɫɢɦɜɨɥɚ CWL ɡɚɞɚɟɬɫɹ ɫ ɩɨɦɨɳɶɸ 3 ɛɢɬɨɜ; ɬɚɤɢɦ ɨɛɪɚɡɨɦ, ɞɥɢɧɚ ɤɨɞɚ ɞɥɢɧɵ ɤɨɞɚ ɦɨɠɟɬ ɛɵɬɶ ɨɬ 0 (ɫɨɨɬɜɟɬɫɬɜɭɸɳɢɣ ɫɢɦɜɨɥ ɢɡ CWL ɧɟ ɢɫɩɨɥɶɡɭɟɬɫɹ) ɞɨ 23 – 1 = 7 ɛɢɬɨɜ. Ⱦɥɢɧɵ ɨɞɧɨɡɧɚɱɧɨ ɡɚɞɚɸɬ ɫɨɜɨɤɭɩɧɨɫɬɶ ɤɨɞɨɜ ɋɨɞɟɪɠɢɬ ɨɩɢɫɚɧɢɟ HLIT+257 ɤɨɞɨɜ ɥɢɬɟ- ɉɟɪɟɦɟɧɌɚɛɥɢɰɚ ɪɚɥɨɜ/ɞɥɢɧ ɫɨɜɩɚɞɟɧɢɹ, ɡɚɤɨɞɢɪɨɜɚɧɨ ɤɨ- ɧɵɣ ɨɩɢɫɚɧɢɹ ɤɨɞɨɜ ɥɢ- ɞɚɦɢ ɞɥɢɧ ɤɨɞɨɜ ɬɟɪɚɥɨɜ/ ɞɥɢɧ (ɤɨɞɵ 1) 92
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɉɨɥɟ Ɍɚɛɥɢɰɚ ɨɩɢɫɚɧɢɹ ɤɨɞɨɜ ɫɦɟɳɟɧɢɣ ɋɠɚɬɵɟ ɞɚɧɧɵɟ Ɂɧɚɤ ɤɨɧɰɚ ɛɥɨɤɚ
Ɉɩɢɫɚɧɢɟ Ɋɚɡɦɟɪ ɋɨɞɟɪɠɢɬ ɨɩɢɫɚɧɢɟ HDIST+1 ɤɨɞɨɜ ɫɦɟ- ɉɟɪɟɦɟɧɳɟɧɢɣ, ɡɚɤɨɞɢɪɨɜɚɧɨ ɤɨɞɚɦɢ ɞɥɢɧ ɤɨɞɨɜ ɧɵɣ ɋɨɞɟɪɠɢɬ ɞɚɧɧɵɟ, ɫɠɚɬɵɟ ɫ ɩɨɦɨɳɶɸ ɞɜɭɯ ɡɚɞɚɧɧɵɯ ɜɵɲɟ ɫɨɜɨɤɭɩɧɨɫɬɟɣ ɤɨɞɨɜ ɑɢɫɥɨ 256, ɫɠɚɬɨɟ ɫ ɩɨɦɨɳɶɸ ɤɨɞɨɜ ɥɢɬɟɪɚɥɨɜ/ɞɥɢɧ
ɉɟɪɟɦɟɧɧɵɣ ɉɟɪɟɦɟɧɧɵɣ
ɇɚ ɨɫɧɨɜɚɧɢɢ ɜɵɲɟɫɤɚɡɚɧɧɨɝɨ ɦɨɠɧɨ ɞɚɬɶ ɬɚɤɨɟ ɨɩɢɫɚɧɢɟ ɚɥɝɨɪɢɬɦɚ ɤɨɞɢɪɨɜɚɧɢɹ ɥɢɬɟɪɚɥɨɜ/ɞɥɢɧ: • ɥɢɬɟɪɚɥɵ/ɞɥɢɧɵ ɫɨɜɩɚɞɟɧɢɹ ɤɨɞɢɪɭɸɬɫɹ ɫ ɩɨɦɨɳɶɸ ɤɨɞɨɜ ɏɚɮɮɦɚɧɚ ɞɥɹ ɥɢɬɟɪɚɥɨɜ/ɞɥɢɧ, ɧɚɡɨɜɟɦ ɢɯ ɤɨɞɚɦɢ 1; • ɨɩɢɫɚɧɢɟ ɤɨɞɨɜ 1 ɩɟɪɟɞɚɟɬɫɹ ɜ ɜɢɞɟ ɰɟɩɨɱɤɢ ɞɥɢɧ ɷɬɢɯ ɤɨɞɨɜ; • ɩɪɢ ɭɤɚɡɚɧɢɢ ɞɥɢɧ ɤɨɞɨɜ ɦɨɝɭɬ ɢɫɩɨɥɶɡɨɜɚɬɶɫɹ ɫɩɟɰɢɚɥɶɧɵɟ ɫɢɦɜɨɥɵ (ɫɦ. ɚɥɮɚɜɢɬ CWL); • ɞɥɢɧɵ ɤɨɞɨɜ, ɬ.ɟ. ɫɢɦɜɨɥɵ ɚɥɮɚɜɢɬɚ CWL, ɤɨɞɢɪɭɸɬɫɹ ɫ ɩɨɦɨɳɶɸ ɤɨɞɨɜ ɏɚɮɮɦɚɧɚ ɞɥɹ ɞɥɢɧ ɤɨɞɨɜ, ɧɚɡɨɜɟɦ ɢɯ ɤɨɞɚɦɢ 2; • ɤɨɞɵ 2 ɬɚɤɠɟ ɨɩɢɫɵɜɚɸɬɫɹ ɱɟɪɟɡ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɶ ɢɯ ɞɥɢɧ; • ɞɥɢɧɵ ɤɨɞɨɜ 2 ɡɚɞɚɸɬɫɹ ɫ ɩɨɦɨɳɶɸ 3-ɛɢɬɨɜɵɯ ɱɢɫɟɥ. Ⱦɥɹ ɤɨɞɢɪɨɜɚɧɢɹ ɫɦɟɳɟɧɢɣ ɢɫɩɨɥɶɡɭɟɬɫɹ ɬɚɤɨɣ ɠɟ ɩɨɞɯɨɞ, ɩɪɢ ɷɬɨɦ ɞɥɢɧɵ ɤɨɞɨɜ ɫɦɟɳɟɧɢɣ ɬɚɤɠɟ ɫɠɢɦɚɸɬɫɹ ɫ ɩɨɦɨɳɶɸ ɤɨɞɨɜ 2. ɍɩɪɚɠɧɟɧɢɟ: Ɉɛɴɹɫɧɢɬɟ, ɩɨɱɟɦɭ ɪɚɡɦɟɪɵ ɩɨɥɟɣ, ɯɪɚɧɹɳɢɯ ɜɟɥɢɱɢɧɵ HLIT, HDIST ɢ HCLEN, ɢɦɟɧɧɨ ɬɚɤɨɜɵ, ɤɚɤ ɷɬɨ ɭɤɚɡɚɧɨ ɜ ɬɚɛɥ. 3.10.
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
93
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ȺɅȽɈɊɂɌɆ ɋɅɈȼȺɊɇɈȽɈ ɋɀȺɌɂə ȾɅə DEFLATE
Ʉɚɤ ɭɠɟ ɭɤɚɡɵɜɚɥɨɫɶ, ɮɨɪɦɚɬ Deflate ɧɟ ɢɦɟɟɬ ɱɟɬɤɨɣ ɫɩɟɰɢɮɢɤɚɰɢɢ ɚɥɝɨɪɢɬɦɚ ɫɥɨɜɚɪɧɨɝɨ ɫɠɚɬɢɹ. Ɋɚɡɪɚɛɨɬɱɢɤɢ ɦɨɝɭɬ ɢɫɩɨɥɶɡɨɜɚɬɶ ɤɚɤɢɟ-ɬɨ ɫɜɨɢ ɚɥɝɨɪɢɬɦɵ, ɩɨɞɯɨɞɹɳɢɟ ɞɥɹ ɪɟɲɟɧɢɹ ɫɩɟɰɢɮɢɱɟɫɤɢɯ ɡɚɞɚɱ. Ɋɚɫɫɦɨɬɪɢɦ ɫɜɨɛɨɞɧɵɣ ɨɬ ɩɚɬɟɧɬɨɜ ɚɥɝɨɪɢɬɦ ɫɠɚɬɢɹ ɞɥɹ Deflate, ɢɫɩɨɥɶɡɭɟɦɵɣ ɜ ɪɚɡɪɚɛɚɬɵɜɚɟɦɨɣ Info-ZIP group ɭɬɢɥɢɬɟ Zip. Ⱦɥɹ ɩɨɢɫɤɚ ɮɪɚɡ ɢɫɩɨɥɶɡɭɟɬɫɹ ɦɟɬɨɞ ɯɟɲ-ɰɟɩɨɱɟɤ. ɏɟɲɮɭɧɤɰɢɹ ɜɵɱɢɫɥɹɟɬɫɹ ɧɚ ɨɫɧɨɜɚɧɢɢ ɬɪɟɯ ɛɚɣɬɨɜ ɞɚɧɧɵɯ (ɧɚɩɨɦɧɢɦ, ɱɬɨ ɮɨɪɦɚɬ Deflate ɧɟ ɩɨɡɜɨɥɹɟɬ ɤɨɞɢɪɨɜɚɬɶ ɫɬɪɨɤɢ ɞɥɢɧɨɣ ɦɟɧɟɟ ɬɪɟɯ ɛɚɣɬɨɜ). Ɏɭɧɤɰɢɹ ɦɨɠɟɬ ɩɪɢɧɢɦɚɬɶ ɡɧɚɱɟɧɢɹ ɨɬ 0 ɞɨ ɡɚɞɚɧɧɨɝɨ ɱɢɫɥɚ HASH_MASK – 1 ɢ ɢɦɟɟɬ ɜɢɞ ɜɵɪɚɠɟɧɢɹ, ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨ ɜɵɱɢɫɥɹɟɦɨɝɨ ɞɥɹ ɤɚɠɞɨɝɨ ɨɱɟɪɟɞɧɨɝɨ ɫɢɦɜɨɥɚ: int UPDATE_HASH (int h, char c) { return ( (h<
ɝɞɟ
h — ɬɟɤɭɳɟɟ ɡɧɚɱɟɧɢɟ ɯɟɲ-ɮɭɧɤɰɢɢ; c — ɨɱɟɪɟɞɧɨɣ ɫɢɦɜɨɥ; H_SHIFT — ɩɚɪɚɦɟɬɪ ɫɞɜɢɝɚ ɡɧɚɱɟɧɢɹ ɮɭɧɤɰɢɢ. H_SHIFT ɧɚɡɧɚɱɚɟɬɫɹ ɬɚɤɢɦ ɨɛɪɚɡɨɦ, ɱɬɨɛɵ ɩɨɫɥɟ ɨɱɟɪɟɞɧɨɝɨ ɫɞɜɢɝɚ ɡɧɚɱɟɧɢɟ ɫɚɦɨɝɨ ɫɬɚɪɨɝɨ ɛɚɣɬɚ ɧɟ ɜɥɢɹɥɨ ɧɚ ɡɧɚɱɟɧɢɟ ɯɟɲ-ɮɭɧɤɰɢɢ. ɇɚ ɤɚɠɞɨɦ ɲɚɝɟ ɤɨɦɩɪɟɫɫɨɪ ɱɢɬɚɟɬ ɨɱɟɪɟɞɧɭɸ 3-ɛɚɣɬɨɜɭɸ ɫɬɪɨɤɭ, ɪɚɫɩɨɥɚɝɚɸɳɭɸɫɹ ɜ ɧɚɱɚɥɟ ɛɭɮɟɪɚ. ɉɨɫɥɟ ɫɨɨɬɜɟɬɫɬɜɭɸɳɟɝɨ ɨɛɧɨɜɥɟɧɢɹ ɯɟɲ-ɮɭɧɤɰɢɢ ɩɪɨɢɡɜɨɞɢɬɫɹ ɨɛɪɚɳɟɧɢɟ ɤ ɩɟɪɜɨɦɭ ɷɥɟɦɟɧɬɭ ɯɟɲ-ɰɟɩɨɱɤɢ, ɚɞɪɟɫ ɤɨɬɨɪɨɝɨ ɨɩɪɟɞɟɥɹɟɬɫɹ ɡɧɚɱɟɧɢɟɦ ɮɭɧɤɰɢɢ. ȿɫɥɢ ɰɟɩɨɱɤɚ ɩɭɫɬɚ, ɬɨ ɤɨɞɢɪɭɟɬɫɹ ɥɢɬɟɪɚɥ, ɩɪɨɢɡɜɨɞɢɬɫɹ ɫɞɜɢɝ ɨɤɧɚ ɧɚ 1 ɫɢɦɜɨɥ ɢ ɨɫɭɳɟɫɬɜɥɹɟɬɫɹ ɩɟɪɟɯɨɞ ɤ ɫɥɟɞɭɸɳɟɦɭ ɲɚɝɭ. ɂɧɚɱɟ ɯɟɲ-ɰɟɩɨɱɤɚ ɚɧɚɥɢɡɢɪɭɟɬɫɹ ɫ ɰɟɥɶɸ ɧɚɣɬɢ ɫɚɦɨɟ ɞɥɢɧɧɨɟ ɫɨɜɩɚɞɟɧɢɟ ɦɟɠɞɭ ɛɭɮɟɪɨɦ ɢ ɮɪɚɡɚɦɢ, ɧɚ ɤɨɬɨɪɵɟ ɫɫɵɥɚɸɬɫɹ ɷɥɟɦɟɧɬɵ (ɭɡɥɵ) ɯɟɲ-ɰɟɩɨɱɤɢ. Ɉɛɧɨɜɥɟɧɢɟ ɯɟɲ-ɰɟɩɨɱɟɤ ɨɪɝɚɧɢɡɨɜɚɧɨ ɬɚɤ, ɱɬɨ ɩɨɢɫɤ ɧɚɱɢɧɚɟɬɫɹ ɫ ɫɚɦɵɯ «ɧɨɜɵɯ» ɭɡɥɨɜ, ɱɬɨ ɩɨɡɜɨɥɹɟɬ ɫɦɟɫɬɢɬɶ ɪɚɫɩɪɟɞɟɥɟɧɢɟ ɱɚɫɬɨɬ ɫɦɟɳɟɧɢɣ ɤɨɞɢɪɭɟɦɵɯ ɮɪɚɡ ɜ ɩɨɥɶɡɭ ɤɨɪɨɬɤɢɯ ɫɦɟɳɟɧɢɣ ɢ,
94
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɫɥɟɞɨɜɚɬɟɥɶɧɨ, ɭɥɭɱɲɢɬɶ ɫɠɚɬɢɟ, ɬ.ɤ. ɧɟɛɨɥɶɲɢɟ ɫɦɟɳɟɧɢɹ ɢɦɟɸɬ ɤɨɞɵ ɦɚɥɨɣ ɞɥɢɧɵ. Ⱦɥɹ ɭɫɤɨɪɟɧɢɹ ɤɨɞɢɪɨɜɚɧɢɹ ɜ ɫɥɭɱɚɟ ɨɛɪɚɛɨɬɤɢ ɢɡɛɵɬɨɱɧɵɯ ɞɚɧɧɵɯ ɨɱɟɧɶ ɞɥɢɧɧɵɟ ɯɟɲ-ɰɟɩɨɱɤɢ ɨɛɪɭɛɚɸɬɫɹ ɞɨ ɨɩɪɟɞɟɥɟɧɧɨɣ ɞɥɢɧɵ, ɡɚɞɚɜɚɟɦɨɣ ɩɚɪɚɦɟɬɪɚɦɢ ɚɥɝɨɪɢɬɦɚ. ɍɫɟɱɟɧɢɟ ɩɪɨɢɡɜɨɞɢɬɫɹ ɜ ɡɚɜɢɫɢɦɨɫɬɢ ɨɬ ɞɥɢɧɵ ɭɠɟ ɧɚɣɞɟɧɧɨɝɨ ɫɨɜɩɚɞɟɧɢɹ: ɱɟɦ ɨɧɨ ɞɥɢɧɧɟɟ, ɬɟɦ ɛɨɥɶɲɟ ɨɬɪɟɡɚɟɦ. ɋɠɚɬɢɟ ɦɨɠɟɬ ɛɵɬɶ ɭɥɭɱɲɟɧɨ ɡɚ ɫɱɟɬ ɦɟɯɚɧɢɡɦɚ «ɥɟɧɢɜɨɝɨ» ɫɪɚɜɧɟɧɢɹ (lazy matching, ɢɥɢ lazy evaluation). ɗɬɨɬ ɩɨɞɯɨɞ ɩɨɡɜɨɥɹɟɬ ɨɬɨɣɬɢ ɨɬ ɩɪɹɦɨɥɢɧɟɣɧɨɝɨ, «ɠɚɞɧɨɝɨ» ɪɚɡɛɨɪɚ ɜɯɨɞɧɨɣ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ ɢ ɩɨɜɵɫɢɬɶ ɷɮɮɟɤɬɢɜɧɨɫɬɶ ɫɠɚɬɢɹ ɩɭɬɟɦ ɛɨɥɟɟ ɚɤɤɭɪɚɬɧɨɝɨ ɜɵɛɨɪɚ ɮɪɚɡ ɫɥɨɜɚɪɹ. ɉɨɫɥɟ ɬɨɝɨ, ɤɚɤ ɨɩɪɟɞɟɥɹɟɬɫɹ ɫɨɜɩɚɞɚɸɳɚɹ ɮɪɚɡɚ match (t+1) ɞɥɢɧɵ match_len (t+1) = L ɞɥɹ ɫɬɪɨɤɢ st+1, st+2, st+3, …, ɧɚɯɨɞɹɳɟɣɫɹ ɜ ɧɚɱɚɥɟ ɛɭɮɟɪɚ, ɜɵɩɨɥɧɹɟɬɫɹ ɩɨɢɫɤ ɫɨɜɩɚɞɟɧɢɹ match (t+2) ɞɥɹ ɫɬɪɨɤɢ st+2, st+3, st+4… ȿɫɥɢ match_len (t+2) > match_len (t+1) = L, ɬɨ ɨɬɤɚɡɵɜɚɟɦɫɹ ɨɬ ɡɚɦɟɳɟɧɢɹ ɫɬɪɨɤɢ st+1, st+2, st+3… Ɋɟɲɟɧɢɟ ɨ ɬɨɦ, ɫɥɟɞɭɟɬ ɤɨɞɢɪɨɜɚɬɶ match (t+2) ɢɥɢ ɧɟɬ, ɩɪɢɧɢɦɚɟɬɫɹ ɧɚ ɲɚɝɟ t+3 ɩɨ ɪɟɡɭɥɶɬɚɬɚɦ ɚɧɚɥɨɝɢɱɧɨɣ ɩɪɨɜɟɪɤɢ. ɂɧɚɱɟ ɤɨɞɢɪɨɜɚɧɢɟ ɩɪɨɬɟɤɚɟɬ ɨɛɵɱɧɵɦ ɨɛɪɚɡɨɦ, ɧɨ ɫ «ɡɚɩɚɡɞɵɜɚɧɢɟɦ» ɧɚ ɨɞɢɧ ɲɚɝ. ɉɨɞɪɨɛɧɟɟ: // ɦɢɧɢɦɚɥɶɧɚɹ ɞɥɢɧɚ ɫɨɜɩɚɞɟɧɢɹ const int THRESHOLD = 3; // ɫɦɟɳɟɧɢɟ ɢ ɞɥɢɧɚ ɫɨɜɩɚɞɟɧɢɹ ɞɥɹ match(t+1) int prev_pos, prev_len; // ɫɦɟɳɟɧɢɟ ɢ ɞɥɢɧɚ ɫɨɜɩɚɞɟɧɢɹ ɞɥɹ match(t+2) int match_pos, match_len = THRESHOLD - 1; // ɩɪɢɡɧɚɤ ɨɬɥɨɠɟɧɧɨɝɨ ɤɨɞɢɪɨɜɚɧɢɹ ɮɪɚɡɵ match(t+1) int match_available = 0; ... prev_pos = match_pos; prev_len = match_len; /*ɧɚɣɞɟɦ ɦɚɤɫɢɦɚɥɶɧɨɟ (ɢɥɢ ɞɨɫɬɚɬɨɱɧɨ ɞɥɢɧɧɨɟ) ɫɨɜɩɚɞɟɧɢɟ ɞɥɹ ɩɨɡɢɰɢɢ t+2 */ find_phrase (&match_pos, &match_len); if ( prev_len >= THRESHOLD &&
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
95
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
match_len <= prev_len ) { /* ɫɱɢɬɚɟɦ, ɱɬɨ ɜɵɝɨɞɧɟɟ ɡɚɤɨɞɢɪɨɜɚɬɶ ɮɪɚɡɭ match(t+1) */ encode_phrase (prev_pos, prev_len); match_available = 0; match_len = THRESHOLD – 1; // ɫɞɜɢɧɟɦ ɨɤɧɨ ɧɚ match_len(t+1)-1 ɫɢɦɜɨɥɨɜ move_window (prev_len-1); t += prev_len-1; } else { // ɨɬɥɨɠɢɦ ɪɟɲɟɧɢɟ ɨ ɤɨɞɢɪɨɜɚɧɢɢ ɧɚ ɨɞɢɧ ɲɚɝ if (match_available) { /*ɤɨɞɢɪɨɜɚɧɢɟ ɥɢɬɟɪɚɥɚ st+1 ɢɥɢ ɮɪɚɡɵ match(t+1) ɛɵɥɨ ɨɬɥɨɠɟɧɨ; ɤɨɞɢɪɭɟɦ ɥɢɬɟɪɚɥ st+1 */ encode_literal (window[t+1]); }else{ match_available = 1; } move_window (1); t++; }
Ɇɨɠɧɨ ɫɤɚɡɚɬɶ, ɱɬɨ ɷɬɨ ɨɞɧɚ ɢɡ ɜɨɡɦɨɠɧɵɯ ɪɟɚɥɢɡɚɰɢɣ ɫɯɟɦɵ ɥɟɧɢɜɨɝɨ ɫɪɚɜɧɟɧɢɹ ɫ ɩɪɨɫɦɨɬɪɨɦ ɧɚ ɨɞɢɧ ɫɢɦɜɨɥ ɜɩɟɪɟɞ. ȼ ɡɚɜɢɫɢɦɨɫɬɢ ɨɬ ɩɚɪɚɦɟɬɪɨɜ ɚɥɝɨɪɢɬɦɚ, ɞɥɹ ɨɛɟɫɩɟɱɟɧɢɹ ɠɟɥɚɟɦɨɝɨ ɫɨɨɬɧɨɲɟɧɢɹ ɫɤɨɪɨɫɬɢ ɢ ɤɨɷɮɮɢɰɢɟɧɬɚ ɫɠɚɬɢɹ ɦɟɯɚɧɢɡɦ ɥɟɧɢɜɨɝɨ ɫɪɚɜɧɟɧɢɹ ɦɨɠɟɬ ɡɚɩɭɫɤɚɬɶɫɹ ɩɪɢ ɪɚɡɥɢɱɧɵɯ ɡɧɚɱɟɧɢɹɯ L. ɇɟɞɨɫɬɚɬɤɨɦ ɪɚɫɫɦɨɬɪɟɧɧɨɣ ɪɟɚɥɢɡɚɰɢɢ ɥɟɧɢɜɨɝɨ ɫɪɚɜɧɟɧɢɹ ɹɜɥɹɟɬɫɹ ɩɨɪɨɠɞɟɧɢɟ ɞɥɢɧɧɨɣ ɰɟɩɨɱɤɢ ɥɢɬɟɪɚɥɨɜ, ɟɫɥɢ ɧɚ ɤɚɠɞɨɦ ɩɨɫɥɟɞɭɸɳɟɦ ɲɚɝɟ ɞɥɢɧɚ ɫɨɜɩɚɞɟɧɢɹ ɛɨɥɶɲɟ, ɱɟɦ ɧɚ ɩɪɟɞɵɞɭɳɟɦ. ɍɩɪɚɠɧɟɧɢɟ: Ɉɛɴɹɫɧɢɬɟ, ɩɨɱɟɦɭ ɢɫɩɨɥɶɡɨɜɚɧɢɟ ɥɟɧɢɜɨɝɨ ɫɪɚɜɧɟɧɢɹ ɩɪɢ ɫɠɚɬɢɢ ɧɟ ɬɪɟɛɭɟɬ ɜɧɟɫɟɧɢɹ ɢɡɦɟɧɟɧɢɣ ɜ ɚɥɝɨɪɢɬɦ ɞɟɤɨɞɟɪɚ.
96
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
Ʉɨɞɟɪ ɨɛɪɵɜɚɟɬ ɬɟɤɭɳɢɣ ɛɥɨɤ ɞɚɧɧɵɯ, ɟɫɥɢ ɨɩɪɟɞɟɥɹɟɬ, ɱɬɨ ɢɡɦɟɧɟɧɢɟ ɤɨɞɨɜ ɏɚɮɮɦɚɧɚ ɦɨɠɟɬ ɭɥɭɱɲɢɬɶ ɫɠɚɬɢɟ, ɢɥɢ ɤɨɝɞɚ ɩɪɨɢɫɯɨɞɢɬ ɩɟɪɟɩɨɥɧɟɧɢɟ ɛɭɮɟɪɚ ɯɪɚɧɟɧɢɹ ɛɥɨɤɚ.
ɉɭɬɢ ɭɥɭɱɲɟɧɢɹ ɫɠɚɬɢɹ ɞɥɹ ɦɟɬɨɞɨɜ LZ ɍɥɭɱɲɚɬɶ ɫɠɚɬɢɟ ɚɥɝɨɪɢɬɦɨɜ ɫɟɦɟɣɫɬɜɚ Ɂɢɜɚ-Ʌɟɦɩɟɥɚ ɦɨɠɧɨ ɞɜɭɦɹ ɩɭɬɹɦɢ: 1) ɭɦɟɧɶɲɟɧɢɟɦ ɤɨɥɢɱɟɫɬɜɚ ɭɤɚɡɚɬɟɥɟɣ ɩɪɢ ɧɟɢɡɦɟɧɧɨɣ ɢɥɢ ɛɨɥɶɲɟɣ ɨɛɳɟɣ ɞɥɢɧɟ ɡɚɤɨɞɢɪɨɜɚɧɧɵɯ ɮɪɚɡ ɡɚ ɫɱɟɬ ɛɨɥɟɟ ɷɮɮɟɤɬɢɜɧɨɝɨ ɪɚɡɛɢɟɧɢɹ ɜɯɨɞɧɨɣ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ ɧɚ ɮɪɚɡɵ ɫɥɨɜɚɪɹ; 2) ɭɜɟɥɢɱɟɧɢɟɦ ɷɮɮɟɤɬɢɜɧɨɫɬɢ ɤɨɞɢɪɨɜɚɧɢɹ ɢɧɞɟɤɫɨɜ ɮɪɚɡ ɫɥɨɜɚɪɹ ɢ ɥɢɬɟɪɚɥɨɜ, ɬ.ɟ. ɭɦɟɧɶɲɟɧɢɟɦ ɤɨɥɢɱɟɫɬɜɚ ɛɢɬɨɜ, ɜ ɫɪɟɞɧɟɦ ɬɪɟɛɭɟɦɵɯ ɞɥɹ ɤɨɞɢɪɨɜɚɧɢɹ ɢɧɞɟɤɫɚ ɢɥɢ ɥɢɬɟɪɚɥɚ. ɂɞɟɹ ɩɪɢɟɦɨɜ, ɨɬɧɨɫɹɳɢɯɫɹ ɤ ɩɟɪɜɨɦɭ ɩɭɬɢ, ɛɵɥɚ ɩɪɨɞɟɦɨɧɫɬɪɢɪɨɜɚɧɚ ɧɚ ɩɪɢɦɟɪɟ ɥɟɧɢɜɨɝɨ ɫɪɚɜɧɟɧɢɹ ɩɪɢ ɨɩɢɫɚɧɢɢ Deflate. Ⱦɟɣɫɬɜɢɬɟɥɶɧɨ, ɞɥɹ ɨɞɧɨɝɨ ɢ ɬɨɝɨ ɠɟ ɫɥɨɜɚɪɹ ɦɵ ɢɦɟɟɦ ɨɝɪɨɦɧɨɟ ɤɨɥɢɱɟɫɬɜɨ ɜɚɪɢɚɧɬɨɜ ɩɨɫɬɪɨɟɧɢɹ ɧɚɛɨɪɚ ɮɪɚɡ ɞɥɹ ɡɚɦɟɳɟɧɢɹ ɢɦ ɫɠɢɦɚɟɦɨɣ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ. ȿɫɬɟɫɬɜɟɧɧɵɦ ɹɜɥɹɟɬɫɹ ɬɚɤ ɧɚɡɵɜɚɟɦɵɣ «ɠɚɞɧɵɣ» ɪɚɡɛɨɪ (greedy parsing), ɩɪɢ ɤɨɬɨɪɨɦ ɧɚ ɤɚɠɞɨɦ ɲɚɝɟ ɤɨɞɟɪ ɜɵɛɢɪɚɟɬ ɫɚɦɭɸ ɞɥɢɧɧɭɸ ɮɪɚɡɭ. Ɂɚɦɟɬɢɦ, ɱɬɨ ɬɚɤɨɣ ɫɩɨɫɨɛ ɪɚɡɛɢɟɧɢɹ ɞɚɧɧɵɯ ɢɫɩɨɥɶɡɭɸɬ ɜɫɟ ɪɚɫɫɦɨɬɪɟɧɧɵɟ ɧɚɦɢ ɤɥɚɫɫɢɱɟɫɤɢɟ ɚɥɝɨɪɢɬɦɵ LZ. ȿɫɥɢ ɩɨɢɫɤ ɜɟɞɟɬɫɹ ɩɨ ɜɫɟɦɭ ɫɥɨɜɚɪɸ, ɬɨ ɠɚɞɧɵɣ ɪɚɡɛɨɪ ɨɛɟɫɩɟɱɢɜɚɟɬ ɧɚɢɛɨɥɶɲɭɸ ɫɤɨɪɨɫɬɶ, ɧɨ ɢ ɩɪɚɤɬɢɱɟɫɤɢ ɜɫɟɝɞɚ ɧɚɢɯɭɞɲɟɟ ɫɠɚɬɢɟ. ɋɬɪɚɬɟɝɢɢ ɨɩɬɢɦɚɥɶɧɨɝɨ ɪɚɡɛɨɪɚ ɩɨɡɜɨɥɹɸɬ ɡɧɚɱɢɬɟɥɶɧɨ ɭɥɭɱɲɢɬɶ ɫɠɚɬɢɟ, ɞɨ 10% ɢ ɛɨɥɟɟ, ɧɨ ɫɟɪɶɟɡɧɵɦ ɨɛɪɚɡɨɦ ɡɚɦɟɞɥɹɸɬ ɪɚɛɨɬɭ ɤɨɦɩɪɟɫɫɨɪɚ. Ⱥɥɝɨɪɢɬɦɵ ɨɩɬɢɦɚɥɶɧɨɝɨ ɪɚɡɛɨɪɚ ɞɥɹ ɚɥɝɨɪɢɬɦɨɜ ɫɟɦɟɣɫɬɜɚ LZ77 ɪɚɫɫɦɨɬɪɟɧɵ, ɧɚɩɪɢɦɟɪ, ɜ [1, 10], ɚ ɞɥɹ ɫɟɦɟɣɫɬɜɚ LZ78 — ɜ [8]. Ⱦɨɛɢɜɚɬɶɫɹ ɛɨɥɶɲɟɣ ɤɨɦɩɚɤɬɧɨɫɬɢ ɩɪɟɞɫɬɚɜɥɟɧɢɹ ɢɧɞɟɤɫɨɜ ɫɥɨɜɚɪɹ ɦɨɠɧɨ ɡɚ ɫɱɟɬ: • ɩɪɢɦɟɧɟɧɢɹ ɛɨɥɟɟ ɫɥɨɠɧɵɯ ɚɥɝɨɪɢɬɦɨɜ ɫɠɚɬɢɹ, ɧɚɩɪɢɦɟɪ, ɧɚ ɛɚɡɟ ɤɨɧɬɟɤɫɬɧɵɯ ɦɟɬɨɞɨɜ ɦɨɞɟɥɢɪɨɜɚɧɢɹ; Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
97
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
•
ɦɢɧɢɦɢɡɚɰɢɢ ɨɛɴɟɦɚ ɫɥɨɜɚɪɹ ɩɭɬɟɦ ɭɞɚɥɟɧɢɹ ɢɡɥɢɲɧɢɯ ɫɨɜɩɚɞɚɸɳɢɯ ɮɪɚɡ. ȼ ɤɚɱɟɫɬɜɟ ɫɩɨɫɨɛɚ ɭɜɟɥɢɱɟɧɢɹ ɷɮɮɟɤɬɢɜɧɨɫɬɢ ɤɨɞɢɪɨɜɚɧɢɹ ɥɢɬɟɪɚɥɨɜ ɦɨɠɟɬ ɜɵɫɬɭɩɚɬɶ ɹɜɧɨɟ ɫɬɚɬɢɫɬɢɱɟɫɤɨɟ ɦɨɞɟɥɢɪɨɜɚɧɢɹ ɜɟɪɨɹɬɧɨɫɬɟɣ ɩɨɹɜɥɟɧɢɹ ɥɢɬɟɪɚɥɨɜ ɜ ɫɨɱɟɬɚɧɢɢ ɫ ɚɪɢɮɦɟɬɢɱɟɫɤɢɦ ɤɨɞɢɪɨɜɚɧɢɟɦ, ɤɨɬɨɪɨɟ ɫɨɛɫɬɜɟɧɧɨ ɢ ɨɛɟɫɩɟɱɢɜɚɟɬ ɫɠɚɬɢɟ. ɉɪɢ ɷɬɨɦ, ɤɚɤ ɩɨɤɚɡɵɜɚɸɬ ɷɤɫɩɟɪɢɦɟɧɬɵ, ɞɥɹ ɭɥɭɱɲɟɧɢɹ ɫɠɚɬɢɹ ɰɟɥɟɫɨɨɛɪɚɡɧɨ ɢɫɩɨɥɶɡɨɜɚɬɶ ɤɨɧɬɟɤɫɬɧɨɟ ɦɨɞɟɥɢɪɨɜɚɧɢɟ 1 ɢɥɢ 2 ɩɨɪɹɞɤɨɜ. ɂɞɟɢ ɧɟɫɤɨɥɶɤɢɯ ɫɩɨɫɨɛɨɜ ɭɜɟɥɢɱɟɧɢɹ ɫɬɟɩɟɧɢ ɫɠɚɬɢɹ ɞɥɹ ɦɟɬɨɞɨɜ Ɂɢɜɚ-Ʌɟɦɩɟɥɚ ɞɨɫɬɚɬɨɱɧɨ ɩɨɞɪɨɛɧɨ ɨɩɢɫɚɧɵ ɧɢɠɟ. ɋɌɊȺɌȿȽɂə ɊȺɁȻɈɊȺ LFF
Ʉɚɤ ɜɨɡɦɨɠɧɭɸ ɬɟɯɧɢɤɭ ɭɥɭɱɲɟɧɢɹ ɤɚɱɟɫɬɜɚ ɪɚɡɛɨɪɚ ɜɯɨɞɧɨɣ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ ɧɚ ɮɪɚɡɵ ɫɥɨɜɚɪɹ LZ77 ɭɤɚɠɟɦ ɦɟɬɨɞ ɤɨɞɢɪɨɜɚɧɢɹ ɫɚɦɨɣ ɞɥɢɧɧɨɣ ɫɬɪɨɤɢ ɩɟɪɜɨɣ — Longest Fragment First, ɢɥɢ LFF. ɋɭɬɶ LFF ɡɚɤɥɸɱɚɟɬɫɹ ɜ ɬɨɦ, ɱɬɨ ɪɚɫɫɦɚɬɪɢɜɚɟɬɫɹ ɧɟɫɤɨɥɶɤɨ ɜɚɪɢɚɧɬɨɜ ɪɚɡɛɢɟɧɢɹ ɛɭɮɟɪɚ ɧɚ ɮɪɚɡɵ ɫɥɨɜɚɪɹ ɢ ɩɟɪɜɨɣ ɡɚɦɟɳɚɟɬɫɹ ɫɬɪɨɤɚ, ɫ ɤɨɬɨɪɨɣ ɫɨɜɩɚɥɚ ɮɪɚɡɚ ɦɚɤɫɢɦɚɥɶɧɨɣ ɞɥɢɧɵ, ɩɪɢɱɟɦ ɫɬɪɨɤɚ ɦɨɠɟɬ ɧɚɱɢɧɚɬɶɫɹ ɜ ɥɸɛɨɣ ɩɨɡɢɰɢɢ ɛɭɮɟɪɚ. ɉɪɢɦɟɪ Ⱦɨɩɭɫɬɢɦ, ɭ ɧɚɫ ɜ ɛɭɮɟɪɟ ɧɚɯɨɞɢɬɫɹ ɫɬɪɨɤɚ «ɚɛɪɚɤɚɞɚɛɪɚ». ɉɭɫɬɶ ɜ ɫɥɨɜɚɪɟ ɞɥɹ ɤɚɠɞɨɣ ɩɨɡɢɰɢɢ ɛɭɮɟɪɚ ɦɨɠɧɨ ɧɚɣɬɢ ɫɥɟɞɭɸɳɢɟ ɫɨɜɩɚɞɚɸɳɢɟ ɮɪɚɡɵ ɦɚɤɫɢɦɚɥɶɧɨɣ ɞɥɢɧɵ: ʋ ɋɨɜɩɚɞɚɸɳɚɹ ɮɪɚɡɚ ɦɚɤɫɢɦɚɥɶɧɨɣ ɞɥɢ- Ⱦɥɢɧɚ ɮɪɚɡɵ ɩɨɡɢɰɢɢ ɧɵ 1 ɚɛ 2 2 ɛɪɚɤ 4 3 ɪɚɤ 3 4 ɚɤɚ 3 5 ɤɚɞɚɛ 5 6 ɚɞɚɛ 4 7 ɞɚɛ 3 98
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ʋ ɋɨɜɩɚɞɚɸɳɚɹ ɮɪɚɡɚ ɦɚɤɫɢɦɚɥɶɧɨɣ ɞɥɢ- Ⱦɥɢɧɚ ɮɪɚɡɵ ɩɨɡɢɰɢɢ ɧɵ … ɉɨɢɫɤ ɩɪɟɪɜɚɧ ɧɚ 7 ɩɨɡɢɰɢɢ, ɩɨɫɤɨɥɶɤɭ ɭɠɟ ɧɢɤɚɤɨɟ ɫɨɜɩɚɞɟɧɢɟ ɧɟ ɦɨɠɟɬ ɛɵɬɶ ɞɥɢɧɧɟɟ ɦɚɤɫɢɦɚɥɶɧɨɝɨ ɜɫɬɪɟɱɟɧɧɨɝɨ 5. Ɍɚɤ ɤɚɤ ɫɩɨɫɨɛ ɤɨɞɢɪɨɜɚɧɢɹ ɫɚɦɨɣ ɞɥɢɧɧɨɣ ɫɬɪɨɤɢ «ɤɚɞɚɛ» ɨɩɪɟɞɟɥɟɧ, ɬɨ ɬɟɩɟɪɶ ɞɥɹ ɨɫɬɚɜɲɟɣɫɹ ɩɨɞɫɬɪɨɤɢ «ɚɛɪɚ» ɫɧɨɜɚ ɢɳɟɬɫɹ ɫɚɦɚɹ ɞɥɢɧɧɚɹ ɫɨɜɩɚɞɚɸɳɚɹ ɮɪɚɡɚ. ɗɬɨ ɛɭɞɟɬ «ɛɪɚ». Ɉɫɬɚɜɲɚɹɫɹ ɫɥɟɜɚ ɫɬɪɨɤɚ «ɚ» ɦɨɠɟɬ ɛɵɬɶ ɡɚɤɨɞɢɪɨɜɚɧɚ ɤɚɤ ɥɢɬɟɪɚɥ. Ɍɨɝɞɚ ɪɚɡɛɨɪ ɛɭɮɟɪɚ ɛɭɞɟɬ ɢɦɟɬɶ ɜɢɞ: «ɚɛɪɚɤɚɞɚɛ…» Æ <ɚ> <ɛɪɚ> <ɤɚɞɚɛ>. ɗɬɚ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɶ ɢɡ ɥɢɬɟɪɚɥɚ ɢ ɞɜɭɯ ɮɪɚɡ ɤɨɞɢɪɭɟɬɫɹ; ɨɤɧɨ ɫɦɟɳɚɟɬɫɹ ɧɚ 9 ɫɢɦɜɨɥɨɜ, ɚ ɛɭɮɟɪ ɩɪɢɨɛɪɟɬɚɟɬ ɜɢɞ «ɪɚ…». Ɂɚɦɟɬɢɦ, ɱɬɨ ɜ ɫɥɭɱɚɟ ɠɚɞɧɨɝɨ ɪɚɡɛɨɪɚ ɛɭɮɟɪ ɛɵɥ ɛɵ ɪɚɡɛɢɬ ɬɚɤɢɦ ɨɛɪɚɡɨɦ: «ɚɛɪɚɤɚɞɚɛ…» Æ <ɚɛ> <ɪɚɤ> <ɚɞɚɛ>. LFF ɩɨɡɜɨɥɹɟɬ ɭɥɭɱɲɢɬɶ ɫɠɚɬɢɟ ɧɚ 0.5…1% ɩɨ ɫɪɚɜɧɟɧɢɸ ɫ ɠɚɞɧɵɦ ɪɚɡɛɨɪɨɦ. ɈɉɌɂɆȺɅɖɇɕɃ ɊȺɁȻɈɊ ȾɅə ɆȿɌɈȾɈȼ LZ77
ɗɜɪɢɫɬɢɱɟɫɤɢɟ ɬɟɯɧɢɤɢ ɩɨɜɵɲɟɧɢɹ ɷɮɮɟɤɬɢɜɧɨɫɬɢ ɪɚɡɛɨɪɚ ɜɯɨɞɧɨɣ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ — ɧɚɩɪɢɦɟɪ, ɪɚɫɫɦɨɬɪɟɧɧɵɟ ɥɟɧɢɜɨɟ ɫɪɚɜɧɟɧɢɟ ɢ ɦɟɬɨɞ LFF, ɧɟ ɪɟɲɚɸɬ ɩɪɨɛɥɟɦɵ ɩɨɥɭɱɟɧɢɹ ɨɱɟɧɶ ɯɨɪɨɲɟɝɨ ɪɚɡɛɢɟɧɢɹ ɜ ɨɛɳɟɦ ɫɥɭɱɚɟ. Ɉɱɟɜɢɞɧɨ, ɱɬɨ ɯɨɬɟɥɨɫɶ ɛɵ ɢɦɟɬɶ ɨɩɬɢɦɚɥɶɧɭɸ ɫɬɪɚɬɟɝɢɸ ɪɚɡɛɨɪɚ, ɜɨ ɜɫɟɯ ɫɥɭɱɚɹɯ ɨɛɟɫɩɟɱɢɜɚɸɳɭɸ ɦɢɧɢɦɢɡɚɰɢɸ ɞɥɢɧɵ ɡɚɤɨɞɢɪɨɜɚɧɧɨɣ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ, ɩɨɪɨɠɞɚɟɦɨɣ ɤɨɦɩɪɟɫɫɨɪɚɦɢ ɫ ɚɥɝɨɪɢɬɦɨɦ ɫɥɨɜɚɪɧɨɝɨ ɫɠɚɬɢɹ ɬɢɩɚ LZ77 ɢɥɢ LZ78. Ⱦɥɹ ɚɥɝɨɪɢɬɦɨɜ ɫɟɦɟɣɫɬɜɚ LZ77 ɷɬɚ ɡɚɞɚɱɚ ɛɵɥɚ ɪɚɫɫɦɨɬɪɟɧɚ ɜ [10] ɢ ɩɪɢɡɧɚɧɚ NP-ɩɨɥɧɨɣ, ɬ.ɟ. ɬɪɟɛɭɸɳɟɣ ɩɨɥɧɨɝɨ ɩɟɪɟɛɨɪɚ ɜɫɟɯ ɜɚɪɢɚɧɬɨɜ ɞɥɹ ɧɚɯɨɠɞɟɧɢɹ ɨɩɬɢɦɚɥɶɧɨɝɨ ɪɟɲɟɧɢɹ. ȼ ɞɢɫɫɟɪɬɚɰɢɢ [1] ɛɵɥ ɢɡɥɨɠɟɧ ɨɞɧɨɩɪɨɯɨɞɧɨɣ ɚɥɝɨɪɢɬɦ, ɤɨɬɨɪɵɣ, ɤɚɤ ɭɬɜɟɪɠɞɚɟɬɫɹ, ɩɨɡɜɨɥɹɟɬ ɩɨɥɭɱɢɬɶ ɨɩɬɢɦɚɥɶɧɨɟ ɪɚɡɛɢɟɧɢɟ ɩɪɢ ɡɚɬɪɚɬɚɯ ɜɪɟɦɟɧɢ ɧɟ ɛɨɥɶɲɢɯ, ɱɟɦ ɜɧɨɫɢɦɵɯ ɥɟɧɢɜɵɦ ɫɪɚɜɧɟɧɢɟɦ. Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
99
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
Ɇɵ ɪɚɫɫɦɨɬɪɢɦ ɚɥɝɨɪɢɬɦ, ɨɛɟɫɩɟɱɢɜɚɸɳɢɣ ɩɨɥɭɱɟɧɢɟ ɩɨɱɬɢ ɨɩɬɢɦɚɥɶɧɨɝɨ ɪɟɲɟɧɢɹ ɞɥɹ ɦɟɬɨɞɨɜ LZ77. ɉɨɯɨɠɚɹ ɫɯɟɦɚ ɢɫɩɨɥɶɡɭɟɬɫɹ, ɧɚɩɪɢɦɟɪ, ɜ ɤɨɦɩɪɟɫɫɨɪɟ CABARC. ȼ ɨɛɳɟɦ ɫɥɭɱɚɟ, ɞɥɹ ɤɚɠɞɨɣ ɩɨɡɢɰɢɢ t ɧɚɯɨɞɢɦ ɜɫɟ ɫɨɜɩɚɞɚɸɳɢɟ ɮɪɚɡɵ ɞɥɢɧɵ ɨɬ 2 ɞɨ ɦɚɤɫɢɦɚɥɶɧɨɣ MAX_LEN. ɇɚ ɨɫɧɨɜɚɧɢɢ ɢɧɮɨɪɦɚɰɢɢ ɨɛ ɢɫɩɨɥɶɡɭɟɦɵɯ ɞɥɹ ɫɠɚɬɢɹ ɮɪɚɡ ɢ ɥɢɬɟɪɚɥɨɜ ɤɨɞɚɯ ɦɵ ɦɨɠɟɦ ɨɰɟɧɢɬɶ, ɫɤɨɥɶɤɨ ɩɪɢɦɟɪɧɨ ɛɢɬɨɜ ɩɨɬɪɟɛɭɟɬɫɹ ɞɥɹ ɤɨɞɢɪɨɜɚɧɢɹ ɤɚɠɞɨɣ ɮɪɚɡɵ (ɥɢɬɟɪɚɥɚ), ɢɥɢ ɤɚɤɨɜɚ ɰɟɧɚ price ɟɟ ɤɨɞɢɪɨɜɚɧɢɹ. Ɍɨɝɞɚ ɦɵ ɦɨɠɟɦ ɧɚɣɬɢ ɛɥɢɡɤɨɟ ɤ ɨɩɬɢɦɚɥɶɧɨɦɭ ɪɟɲɟɧɢɟ ɡɚ ɨɞɢɧ ɩɪɨɯɨɞ ɫɥɟɞɭɸɳɢɦ ɨɛɪɚɡɨɦ. ȼ ɦɚɫɫɢɜ offsets ɛɭɞɟɦ ɡɚɩɢɫɵɜɚɬɶ ɫɫɵɥɤɢ ɧɚ ɮɪɚɡɵ, ɩɨɞɯɨɞɹɳɢɟ ɞɥɹ ɡɚɦɟɳɟɧɢɹ ɫɬɪɨɤɢ ɛɭɮɟɪɚ, ɞɥɢɧɵ ɨɬ 2 ɞɨ max_len, ɝɞɟ max_len ɹɜɥɹɟɬɫɹ ɞɥɢɧɨɣ ɦɚɤɫɢɦɚɥɶɧɨɝɨ ɫɨɜɩɚɞɟɧɢɹ ɞɥɹ ɬɟɤɭɳɟɣ ɩɨɡɢɰɢɢ t. ȼ ɩɨɥɟ offs[len] ɫɨɯɪɚɧɹɟɦ ɫɦɟɳɟɧɢɟ ɮɪɚɡɵ ɫ ɞɥɢɧɨɣ len. ȿɫɥɢ ɢɦɟɟɬɫɹ ɧɟɫɤɨɥɶɤɨ ɜɚɪɢɚɧɬɨɜ ɮɪɚɡ ɫ ɨɞɧɨɣ ɢ ɬɨɣ ɠɟ len, ɬɨ ɜɵɛɢɪɚɟɦ ɮɪɚɡɭ ɫ ɧɚɢɦɟɧɶɲɟɣ ɰɟɧɨɣ price: offsets [t].offs[len] = offset_min_price (t, len). Ɋɚɡɦɟɪ ɨɛɪɚɛɚɬɵɜɚɟɦɨɝɨ ɛɥɨɤɚ ɪɚɜɟɧ MAX_T. Ⱦɥɹ ɨɛɟɫɩɟɱɟɧɢɹ ɷɮɮɟɤɬɢɜɧɨɫɬɢ ɪɚɡɛɨɪɚ MAX_T ɞɨɥɠɧɨ ɛɵɬɶ ɞɨɫɬɚɬɨɱɧɨ ɛɨɥɶɲɢɦ — ɧɟɫɤɨɥɶɤɨ ɫɨɬɟɧ ɛɚɣɬɨɜ ɢ ɛɨɥɟɟ. struct { int max_len; int offs[MAX_LEN+1]; } offsets[MAX_T+1];
ȼ ɹɱɟɣɤɚɯ path[t] ɦɚɫɫɢɜɚ path ɛɭɞɟɦ ɯɪɚɧɢɬɶ ɢɧɮɨɪɦɚɰɢɸ ɨ ɬɨɦ, ɤɚɤ ɞɨɛɪɚɬɶɫɹ ɞɨ ɩɨɡɢɰɢɢ t, «ɡɚɩɥɚɬɢɜ» ɦɢɧɢɦɚɥɶɧɭɸ ɰɟɧɭ. struct Node { /*ɰɟɧɚ ɫɚɦɨɝɨ «ɞɟɲɟɜɨɝɨ» ɩɭɬɢ ɞɨ t (ɢɡ ɩɨɤɚ ɢɡɜɟɫɬɧɵɯ ɩɭɬɟɣ) */ int price; //ɫ ɤɚɤɨɣ ɩɨɡɢɰɢɢ ɦɵ ɩɨɩɚɞɚɟɦ ɜ t int prev_t; /*ɟɫɥɢ ɦɵ ɩɨɩɚɞɟɦ ɜ t, ɤɨɞɢɪɭɹ ɮɪɚɡɭ, ɬɨ ɡɞɟɫɶ
100 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɯɪɚɧɢɬɫɹ ɫɦɟɳɟɧɢɟ ɷɬɨɣ ɮɪɚɡɵ ɜ ɫɥɨɜɚɪɟ */ int offs; } path[MAX_T+1];
Ɉɫɧɨɜɧɨɣ ɰɢɤɥ ɪɚɡɛɨɪɚ: path[0].price = 0; for (t = 1; t < MAX_T; t++){ //ɭɫɬɚɧɨɜɢɦ ɧɟɞɨɫɬɢɠɢɦɨ ɛɨɥɶɲɭɸ ɰɟɧɭ ɞɥɹ ɜɫɟɯ t path[t].price = INFINITY; } for (t = 0; t < MAX_T; t++){ /*ɧɚɣɞɟɦ ɜɫɟ ɫɨɜɩɚɞɚɸɳɢɟ ɮɪɚɡɵ ɞɥɹ ɫɬɪɨɤɢ, ɧɚɱɢɧɚɸɳɟɣɫɹ ɜ ɩɨɡɢɰɢɢ t */ find_matches (offsets[t]); for (len = 1; len <= offsets[t].max_len; len++){ /*ɨɩɪɟɞɟɥɹɟɦ ɰɟɧɭ ɪɚɫɫɦɚɬɪɢɜɚɟɦɨɝɨ ɩɟɪɟɯɨɞɚ ɧɚ len ɫɢɦɜɨɥɨɜ ɜɩɟɪɟɞ */ if (len == 1) // ɧɚɣɞɟɦ ɰɟɧɭ ɤɨɞɢɪɨɜɚɧɢɹ ɥɢɬɟɪɚɥɚ price = get_literal_price (t); else // ɧɚɣɞɟɦ ɰɟɧɭ ɤɨɞɢɪɨɜɚɧɢɹ ɮɪɚɡɵ ɞɥɢɧɵ len price = get_match_price (len, offsets[t].offs[len]); // ɜɵɱɢɫɥɢɦ ɰɟɧɭ ɩɭɬɢ ɞɨ t + len new_price = path[t].price + price; if (new_price < path[t+len].price){ /*ɪɚɫɫɦɚɬɪɢɜɚɟɦɵɣ ɩɭɬɶ ɞɨ t + len ɜɵɝɨɞɧɟɟ ɯɪɚɧɹɳɟɝɨɫɹ ɜ path[t+len] */ path[t+len].price = new_price; path[t+len].prev_t = t; if (len > 1) path[t+len].offs = offsets[t].offs[len]; } } }
ȼ ɪɟɡɭɥɶɬɚɬɟ ɪɚɛɨɬɵ ɚɥɝɨɪɢɬɦɚ ɩɨɥɭɱɚɟɦ ɩɨɱɬɢ ɨɩɬɢɦɚɥɶɧɨɟ ɪɟɲɟɧɢɟ, ɡɚɩɢɫɚɧɧɨɟ ɜ ɜɢɞɟ ɨɞɧɨɫɜɹɡɧɨɝɨ ɫɩɢɫɤɚ. ȿɫɥɢ ɩɪɟɞɩɨɥɨɠɢɬɶ, ɱɬɨ ɞɥɢɧɚ max_len ɨɝɪɚɧɢɱɢɜɚɟɬɫɹ ɜ ɮɭɧɤɰɢɢ find_matches ɬɚɤ, ɱɬɨɛɵ ɦɵ ɧɟ «ɩɟɪɟɩɪɵɝɧɭɥɢ» ɩɨɡɢɰɢɸ MAX_T, Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X 101 http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɬɨ ɝɨɥɨɜɨɣ ɫɩɢɫɤɚ ɹɜɥɹɟɬɫɹ ɷɥɟɦɟɧɬ path[MAX_T]. ɉɭɬɶ ɡɚɩɢɫɚɧ ɜ ɨɛɪɚɬɧɨɦ ɩɨɪɹɞɤɟ, ɬ.ɟ. ɮɪɚɡɚ ɫɨ ɫɦɟɳɟɧɢɟɦ path[MAX_T].offs ɢ ɞɥɢɧɨɣ MAX_T – path[MAX_T].prev_t (ɢɥɢ ɥɢɬɟɪɚɥ ɜ ɩɨɡɢɰɢɢ MAX_T–1) ɞɨɥɠɧɚ ɤɨɞɢɪɨɜɚɬɶɫɹ ɫɚɦɨɣ ɩɨɫɥɟɞɧɟɣ. ɇɚ ɩɪɚɤɬɢɤɟ ɩɪɢɦɟɧɹɟɬɫɹ ɧɟɫɤɨɥɶɤɨ ɷɜɪɢɫɬɢɱɟɫɤɢɯ ɩɪɚɜɢɥ, ɭɫɤɨɪɹɸɳɢɯ ɩɨɢɫɤ ɡɚ ɫɱɟɬ ɭɦɟɧɶɲɟɧɢɹ ɱɢɫɥɚ ɪɚɫɫɦɚɬɪɢɜɚɟɦɵɯ ɜɚɪɢɚɧɬɨɜ ɜɟɬɜɥɟɧɢɹ. Ɉɩɢɫɚɧɧɵɣ ɚɥɝɨɪɢɬɦ ɩɨɡɜɨɥɹɟɬ ɭɥɭɱɲɢɬɶ ɫɠɚɬɢɟ ɞɥɹ ɚɥɝɨɪɢɬɦɨɜ ɫɟɦɟɣɫɬɜɚ LZ77 ɧɚ ɧɟɫɤɨɥɶɤɨ ɩɪɨɰɟɧɬɨɜ. ɍɩɪɚɠɧɟɧɢɟ: ɉɪɢɞɭɦɚɣɬɟ ɚɥɝɨɪɢɬɦ ɤɨɞɢɪɨɜɚɧɢɹ ɧɚɣɞɟɧɧɨɣ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ ɮɪɚɡ ɢ ɥɢɬɟɪɚɥɨɜ. ȺɅȽɈɊɂɌɆ ȻȿɇȾȿɊȺ-ȼɍɅɎȺ
Ɉɱɟɜɢɞɧɨ, ɱɬɨ ɤɥɚɫɫɢɱɟɫɤɢɟ ɚɥɝɨɪɢɬɦɵ ɫɟɦɟɣɫɬɜɚ LZ77 ɨɛɥɚɞɚɸɬ ɛɨɥɶɲɨɣ ɢɡɛɵɬɨɱɧɨɫɬɶɸ ɫɥɨɜɚɪɹ. Ɍɚɤ, ɧɚɩɪɢɦɟɪ, ɜ ɫɥɨɜɚɪɟ ɦɨɠɟɬ ɛɵɬɶ ɧɟɫɤɨɥɶɤɨ ɨɞɢɧɚɤɨɜɵɯ ɮɪɚɡ ɞɥɢɧɵ ɨɬ match_len ɢ ɦɟɧɟɟ, ɫɨɜɩɚɞɚɸɳɢɯ ɫɨ ɫɬɪɨɤɨɣ ɜ ɧɚɱɚɥɟ ɛɭɮɟɪɟ. ɇɨ ɤɥɚɫɫɢɱɟɫɤɢɣ LZ77 ɧɢɤɚɤ ɧɟ ɢɫɩɨɥɶɡɭɟɬ ɬɚɤɭɸ ɢɧɮɨɪɦɚɰɢɸ ɢ, ɮɚɤɬɢɱɟɫɤɢ, ɨɬɜɨɞɢɬ ɤɚɠɞɨɣ ɮɪɚɡɟ ɨɞɢɧɚɤɨɜɵɣ ɨɛɴɟɦ ɤɨɞɨɜɨɝɨ ɩɪɨɫɬɪɚɧɫɬɜɚ, ɫɱɢɬɚɟɬ ɢɯ ɪɚɜɧɨɜɟɪɨɹɬɧɵɦɢ. ȼ 1991 Ȼɟɧɞɟɪ (Bender) ɢ ȼɭɥɮ (Wolf) ɨɩɢɫɚɥɢ ɩɪɢɟɦ, ɩɨɡɜɨɥɹɸɳɢɣ ɞɨ ɧɟɤɨɬɨɪɨɣ ɫɬɟɩɟɧɢ ɤɨɦɩɟɧɫɢɪɨɜɚɬɶ ɞɚɧɧɭɸ «ɜɪɨɠɞɟɧɧɭɸ» ɢɡɛɵɬɨɱɧɨɫɬɶ ɚɥɝɨɪɢɬɦɨɜ LZ ɫɨ ɫɤɨɥɶɡɹɳɢɦ ɨɤɧɨɦ [2]. ȼ ɷɬɨɦ ɚɥɝɨɪɢɬɦɟ (LZBW) ɩɨɫɥɟ ɧɚɯɨɠɞɟɧɢɹ ɮɪɚɡɵ S, ɢɦɟɸɳɟɣ ɫɚɦɨɟ ɞɥɢɧɧɨɟ ɫɨɜɩɚɞɟɧɢɟ ɫ ɛɭɮɟɪɨɦ, ɩɪɨɢɡɜɨɞɢɬɫɹ ɩɨɢɫɤ ɫɚɦɨɣ ɞɥɢɧɧɨɣ ɫɨɜɩɚɞɚɸɳɟɣ ɮɪɚɡɵ S’ ɫɪɟɞɢ ɞɨɛɚɜɥɟɧɧɵɯ ɜ ɫɥɨɜɚɪɶ ɩɨɡɠɟ S ɢ ɩɨɥɧɨɫɬɶɸ ɧɚɯɨɞɹɳɢɯɫɹ ɜ ɫɥɨɜɚɪɟ (ɧɟ ɜɬɨɪɝɚɸɳɢɯɫɹ ɜ ɨɛɥɚɫɬɶ ɛɭɮɟɪɚ). Ⱦɥɢɧɚ S ɩɟɪɟɞɚɟɬɫɹ ɞɟɤɨɞɟɪɭ ɤɚɤ ɪɚɡɧɢɰɚ ɦɟɠɞɭ ɞɥɢɧɨɣ S ɢ ɞɥɢɧɨɣ S’. ɇɚɩɪɢɦɟɪ, ɟɫɥɢ S = “ɚɛɫɞ” ɢ S’ = “ɚɛ”, ɬɨ ɞɥɢɧɚ S ɩɟɪɟɞɚɟɬɫɹ ɫ ɩɨɦɨɳɶɸ ɪɚɡɧɨɫɬɧɨɣ ɞɥɢɧɵ 2. ɉɪɢɦɟɪ Ɇɨɞɢɮɢɰɢɪɭɟɦ LZSS ɫ ɩɨɦɨɳɶɸ ɬɟɯɧɢɤɢ Ȼɟɧɞɟɪɚ-ȼɭɥɮɚ. Ɋɚɫɫɦɨɬɪɢɦ ɩɪɨɰɟɫɫ ɤɨɞɢɪɨɜɚɧɢɹ ɫɬɪɨɤɢ 102 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
“ɤɨɥɨɥ_ɤɨɬ_ɥɨɦɨɦ_ɤɨɥɟɫɨ”, ɧɚɱɢɧɚɹ ɫ ɩɟɪɜɨɝɨ ɩɨɹɜɥɟɧɢɹ ɫɢɦɜɨɥɚ ‘ɦ’. ȼ ɨɬɥɢɱɢɟ ɨɬ ɪɚɫɫɦɨɬɪɟɧɧɨɝɨ ɜɵɲɟ ɩɪɢɦɟɪɚ LZSS, ɫɥɨɜɚɪɧɨɟ ɤɨɞɢɪɨɜɚɧɢɟ ɛɭɞɟɦ ɩɪɢɦɟɧɹɬɶ ɩɪɢ ɞɥɢɧɟ ɫɨɜɩɚɞɟɧɢɹ 1 ɢ ɛɨɥɟɟ.
ɒɚɝ
ɋɤɨɥɶɡɹɳɟɟ ɨɤɧɨ
k k+1 k+2 k+3 k+4
ɋɥɨɜɚɪɶ ɤɨɥɨɥ_ɤɨɬ_ɥɨ ɤɨɥɨɥ_ɤɨɬ_ɥɨɦ ɤɨɥɨɥ_ɤɨɬ_ɥɨɦɨɦ ɤɨɥɨɥ_ɤɨɬ_ɥɨɦɨɦ_ …ɥ_ɤɨɬ_ɥɨɦɨɦ_ɤɨ ɥ
Ȼɭɮɟɪ ɦɨɦ_ɤɨɥ ɨɦ_ɤɨɥɟ _ɤɨɥɟɫɨ ɤɨɥɟɫɨ ɟɫɨ
Ɍɚɛɥɢɰɚ 3.11 Ɂɚɤɨɞɢɪɨɜɚɧɧɵɟ ɋɨɜɩɚɞɚɸɳɚɹ ɞɚɧɧɵɟ ɮɪɚɡɚ f i j s 0 - ‘ɦ’ ɨɦ 1 2 2 _ 1 6 1 ɤɨɥ 1 16 1 0 - ‘ɟ’
ɇɚ ɲɚɝɟ k ɦɵ ɜɫɬɪɟɬɢɥɢ ɫɢɦɜɨɥ ‘ɦ’, ɨɬɫɭɬɫɬɜɭɸɳɢɣ ɜ ɫɥɨɜɚɪɟ, ɩɨɷɬɨɦɭ ɩɟɪɟɞɚɟɦ ɟɝɨ ɜ ɹɜɧɨɦ ɜɢɞɟ. ɋɞɜɢɝɚɟɦ ɨɤɧɨ ɧɚ 1 ɩɨɡɢɰɢɸ. ɇɚ ɲɚɝɟ k+1 ɫɨɜɩɚɞɚɸɳɚɹ ɮɪɚɡɚ ɪɚɜɧɚ “ɨɦ”, ɢ ɜ ɫɥɨɜɚɪɟ ɧɟɬ ɧɢɤɚɤɢɯ ɞɪɭɝɢɯ ɮɪɚɡ, ɞɨɛɚɜɥɟɧɧɵɯ ɩɨɡɠɟ “ɨɦ”. ɉɨɷɬɨɦɭ ɩɨɥɨɠɢɦ ɞɥɢɧɭ S’ ɪɚɜɧɨɣ 0, ɬɨɝɞɚ ɩɟɪɟɞɚɜɚɟɦɚɹ ɪɚɡɧɨɫɬɶ j ɟɫɬɶ 2. ɋɞɜɢɝɚɟɦ ɨɤɧɨ ɧɚ 2 ɫɢɦɜɨɥɚ. ɇɚ ɲɚɝɟ k+2 ɫɨɜɩɚɞɚɸɳɚɹ ɮɪɚɡɚ ɫɨɫɬɨɢɬ ɢɡ ɨɞɧɨɝɨ ɫɢɦɜɨɥɚ ‘_’, ɩɨɫɥɟɞɧɢɣ ɪɚɡ ɜɫɬɪɟɱɟɧɧɨɝɨ 6 ɫɢɦɜɨɥɨɜ ɧɚɡɚɞ. Ɂɞɟɫɶ, ɤɚɤ ɢ ɧɚ ɲɚɝɟ k+1, ɪɚɡɧɨɫɬɧɚɹ ɞɥɢɧɚ ɫɨɜɩɚɞɚɸɳɟɣ ɮɪɚɡɵ ɪɚɜɧɚ ɟɟ ɞɥɢɧɟ, ɬ.ɟ. ɟɞɢɧɢɰɟ. ɋɞɜɢɝɚɟɦ ɨɤɧɨ ɧɚ 1 ɫɢɦɜɨɥ. ɇɚ ɲɚɝɟ k+3 ɫɨɜɩɚɞɚɸɳɚɹ ɮɪɚɡɚ ɦɚɤɫɢɦɚɥɶɧɨɣ ɞɥɢɧɵ ɟɫɬɶ “ɤɨɥ”, ɧɨ ɫɪɟɞɢ ɮɪɚɡ, ɞɨɛɚɜɥɟɧɧɵɯ ɜ ɫɥɨɜɚɪɶ ɩɨɫɥɟ “ɤɨɥ”, ɢɦɟɟɬɫɹ ɮɪɚɡɚ “ɤɨ”, ɩɨɷɬɨɦɭ ɞɥɢɧɚ “ɤɨɥ” ɤɨɞɢɪɭɟɬɫɹ ɤɚɤ ɪɚɡɧɢɰɚ 3 ɢ 2. ȿɫɥɢ ɛɵ ɜ ɱɚɫɬɢ ɫɥɨɜɚɪɹ, ɨɝɪɚɧɢɱɟɧɧɨɣ ɮɪɚɡɨɣ “ɤɨɥ” ɫɥɟɜɚ ɢ ɧɚɱɚɥɨɦ ɛɭɮɟɪɚ ɫɩɪɚɜɚ, ɧɟ ɧɚɲɥɨɫɶ ɛɵ ɮɪɚɡɵ “ɤɨ” ɫ ɞɥɢɧɨɣ ɫɨɜɩɚɞɟɧɢɹ 2, ɚ ɛɵɥɚ ɛɵ ɨɛɧɚɪɭɠɟɧɚ, ɧɚɩɪɢɦɟɪ, ɬɨɥɶɤɨ ɮɪɚɡɚ “ɤ” ɫ ɞɥɢɧɨɣ ɫɨɜɩɚɞɟɧɢɹ 1, ɬɨ ɞɥɢɧɚ “ɤɨɥ” ɛɵɥɚ ɛɵ ɩɪɟɞɫɬɚɜɥɟɧɚ ɤɚɤ 3 – 1 = 2. Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X 103 http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɉɪɢ ɞɟɤɨɞɢɪɨɜɚɧɢɢ ɧɟɨɛɯɨɞɢɦɨ ɩɨɞɞɟɪɠɢɜɚɬɶ ɫɥɨɜɚɪɶ ɜ ɬɚɤɨɦ ɠɟ ɜɢɞɟ, ɱɬɨ ɢ ɩɪɢ ɤɨɞɢɪɨɜɚɧɢɢ. ɉɨɫɥɟ ɩɨɥɭɱɟɧɢɹ ɫɦɟɳɟɧɢɹ match_pos ɞɟɤɨɞɟɪ ɩɪɨɢɡɜɨɞɢɬ ɫɪɚɜɧɟɧɢɟ ɮɪɚɡɵ, ɧɚɱɢɧɚɸɳɟɣɫɹ ɫ ɧɚɣɞɟɧɧɨɣ ɩɨɡɢɰɢɢ t–(match_pos–1) (t+1 — ɩɨɡɢɰɢɹ ɧɚɱɚɥɚ ɛɭɮɟɪɚ), ɫɨ ɜɫɟɦɢ ɛɨɥɟɟ «ɧɨɜɵɦɢ» ɮɪɚɡɚɦɢ ɫɥɨɜɚɪɹ, ɬ.ɟ. ɥɟɠɚɳɢɦɢ ɜ ɨɛɥɚɫɬɢ t–(match_pos–1), …, t. Ⱦɥɢɧɚ ɮɪɚɡɵ ɜɨɫɫɬɚɧɚɜɥɢɜɚɟɬɫɹ ɤɚɤ ɫɭɦɦɚ ɦɚɤɫɢɦɚɥɶɧɨɝɨ ɫɨɜɩɚɞɟɧɢɹ ɢ ɩɨɥɭɱɟɧɧɨɣ ɨɬ ɤɨɞɟɪɚ ɪɚɡɧɨɫɬɧɨɣ ɞɥɢɧɵ j. Ɍɚɤ, ɧɚɩɪɢɦɟɪ, ɩɪɨɰɟɞɭɪɚ ɞɟɤɨɞɢɪɨɜɚɧɢɹ ɞɥɹ ɲɚɝɚ k+3 ɛɭɞɟɬ ɜɵɝɥɹɞɟɬɶ ɫɥɟɞɭɸɳɢɦ ɨɛɪɚɡɨɦ. Ⱦɟɤɨɞɟɪ ɱɢɬɚɟɬ ɫɦɟɳɟɧɢɟ i = 16, ɪɚɡɧɨɫɬɧɭɸ ɞɥɢɧɭ j = 1 ɢ ɧɚɱɢɧɚɟɬ ɫɪɚɜɧɢɜɚɬɶ ɮɪɚɡɭ “ɤɨɥɨɥ_…”, ɧɚɱɚɥɨ ɤɨɬɨɪɨɣ ɨɩɪɟɞɟɥɹɟɬɫɹ ɞɚɧɧɵɦ ɫɦɟɳɟɧɢɟɦ i, ɫɨ ɜɫɟɦɢ ɮɪɚɡɚɦɢ ɫɥɨɜɚɪɹ, ɧɚɱɚɥɨ ɤɨɬɨɪɵɯ ɢɦɟɟɬ ɫɦɟɳɟɧɢɟ ɨɬ 15 ɞɨ 1. Ɇɚɤɫɢɦɚɥɶɧɨɟ ɫɨɜɩɚɞɟɧɢɟ ɢɦɟɟɬ ɮɪɚɡɚ “ɤɨ”, ɪɚɫɩɨɥɨɠɟɧɧɚɹ ɩɨ ɫɦɟɳɟɧɢɸ 10. ɉɨɷɬɨɦɭ ɞɥɢɧɚ ɡɚɤɨɞɢɪɨɜɚɧɧɨɣ ɮɪɚɡɵ ɪɚɜɧɚ 2 + j = 2 + 1 = 3, ɬ.ɟ. ɤɨɞɟɪ ɩɟɪɟɞɚɥ ɭɤɚɡɚɬɟɥɶ ɧɚ ɮɪɚɡɭ “ɤɨɥ”. ɂɫɩɨɥɶɡɨɜɚɧɢɟ ɬɟɯɧɢɤɢ Ȼɟɧɞɟɪɚ-ȼɭɥɮɚ ɩɨɡɜɨɥɹɟɬ ɭɥɭɱɲɢɬɶ ɫɠɚɬɢɟ ɞɥɹ ɚɥɝɨɪɢɬɦɨɜ ɬɢɩɚ LZH ɩɪɢɦɟɪɧɨ ɧɚ 1%. ɉɪɢ ɷɬɨɦ ɞɟɤɨɞɢɪɨɜɚɧɢɟ ɫɢɥɶɧɨ ɡɚɦɟɞɥɹɟɬɫɹ (ɜ ɪɚɡɵ!), ɩɨɫɤɨɥɶɤɭ ɦɵ ɜɵɧɭɠɞɟɧɵ ɜɵɩɨɥɧɹɬɶ ɬɚɤɨɣ ɠɟ ɞɨɩɨɥɧɢɬɟɥɶɧɵɣ ɩɨɢɫɤ ɞɥɹ ɨɩɪɟɞɟɥɟɧɢɹ ɞɥɢɧɵ, ɱɬɨ ɢ ɩɪɢ ɫɠɚɬɢɢ. ȺɅȽɈɊɂɌɆ ɎȺɃɗɅɗ-ȽɊɂɇɂ
ȿɳɟ ɨɞɢɧ ɫɩɨɫɨɛ ɛɨɪɶɛɵ ɫ ɢɡɛɵɬɨɱɧɨɫɬɶɸ ɫɥɨɜɚɪɹ LZ77 ɩɪɟɞɥɨɠɟɧ Ɏɚɣɷɥɷ (Fiala) ɢ Ƚɪɢɧɢ (Greene) [4]. ȼ ɪɚɡɪɚɛɨɬɚɧɧɨɦ ɢɦɢ ɚɥɝɨɪɢɬɦɟ LZFG ɞɥɹ ɩɪɨɫɦɨɬɪɚ ɫɥɨɜɚɪɹ ɢɫɩɨɥɶɡɭɟɬɫɹ ɞɟɪɟɜɨ ɰɢɮɪɨɜɨɝɨ ɩɨɢɫɤɚ, ɢ ɥɸɛɚɹ ɮɪɚɡɚ ɤɨɞɢɪɭɟɬɫɹ ɧɟ ɩɚɪɨɣ <ɞɥɢɧɚ, ɫɦɟɳɟɧɢɟ>, ɚ ɢɧɞɟɤɫɨɦ ɭɡɥɚ, ɫɨɨɬɜɟɬɫɬɜɭɸɳɟɝɨ ɷɬɨɣ ɮɪɚɡɟ. ɂɧɚɱɟ ɝɨɜɨɪɹ, ɜɫɟɦ ɨɞɢɧɚɤɨɜɵɦ ɮɪɚɡɚɦ ɫɨɨɬɜɟɬɫɬɜɭɟɬ ɨɞɢɧ ɢ ɬɨɬ ɠɟ ɢɧɞɟɤɫ. ɍɫɬɪɚɧɟɧɢɟ ɩɨɜɬɨɪɹɸɳɢɯɫɹ ɮɪɚɡ ɢɡ ɫɥɨɜɚɪɹ ɩɨɡɜɨɥɹɟɬ ɭɦɟɧɶɲɢɬɶ ɫɪɟɞɧɸɸ ɞɥɢɧɭ ɤɨɞɨɜ ɮɪɚɡ. Ɉɛɵɱɧɨ ɤɨɷɮɮɢɰɢɟɧɬ ɫɠɚɬɢɹ LZFG ɥɭɱɲɟ ɤɨɷɮɮɢɰɢɟɧɬɚ ɫɠɚɬɢɹ LZSS ɩɪɢɦɟɪɧɨ ɧɚ 10%.
104 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɄɈɇɌȿɄɋɌɇɈ-ɁȺȼɂɋɂɆɕȿ ɋɅɈȼȺɊɂ
Ɉɛɴɟɦ ɫɥɨɜɚɪɹ ɢ, ɫɨɨɬɜɟɬɫɬɜɟɧɧɨ, ɫɪɟɞɧɹɹ ɞɥɢɧɚ ɡɚɤɨɞɢɪɨɜɚɧɧɨɝɨ ɢɧɞɟɤɫɚ ɦɨɝɭɬ ɛɵɬɶ ɭɦɟɧɶɲɟɧɵ ɡɚ ɫɱɟɬ ɢɫɩɨɥɶɡɨɜɚɧɢɹ ɩɪɢɟɦɨɜ ɤɨɧɬɟɤɫɬɧɨɝɨ ɦɨɞɟɥɢɪɨɜɚɧɢɹ. Ȼɵɥɨ ɭɫɬɚɧɨɜɥɟɧɨ, ɱɬɨ ɩɪɢɦɟɧɟɧɢɟ ɤɨɧɬɟɤɫɬɧɨ-ɡɚɜɢɫɢɦɵɯ ɫɥɨɜɚɪɟɣ ɭɥɭɱɲɚɟɬ ɫɠɚɬɢɟ ɞɥɹ ɚɥɝɨɪɢɬɦɨɜ ɫɟɦɟɣɫɬɜɚ LZ77 ɢ, ɜ ɨɫɨɛɟɧɧɨɫɬɢ, ɫɟɦɟɣɫɬɜɚ LZ78 [5]. ɂɞɟɹ ɩɨɞɯɨɞɚ ɫɨɫɬɨɢɬ ɜ ɫɥɟɞɭɸɳɟɦ. ɉɭɫɬɶ ɦɵ ɬɨɥɶɤɨ ɱɬɨ ɡɚɤɨɞɢɪɨɜɚɥɢ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɶ ɫɢɦɜɨɥɨɜ S ɧɟɛɨɥɶɲɨɣ ɞɥɢɧɵ L, ɬɨɝɞɚ ɧɚ ɬɟɤɭɳɟɦ ɲɚɝɟ ɜ ɤɚɱɟɫɬɜɟ ɫɥɨɜɚɪɹ ɢɫɩɨɥɶɡɭɸɬɫɹ ɬɨɥɶɤɨ ɫɬɪɨɤɢ, ɜɫɬɪɟɱɟɧɧɵɟ ɜ ɭɠɟ ɨɛɪɚɛɨɬɚɧɧɨɣ ɱɚɫɬɢ ɩɨɬɨɤɚ ɧɟɩɨɫɪɟɞɫɬɜɟɧɧɨ ɩɨɫɥɟ ɫɬɪɨɤ, ɪɚɜɧɵɯ S. ɗɬɢ ɫɬɪɨɤɢ ɨɛɪɚɡɭɸɬ ɤɨɧɬɟɤɫɬɧɨ-ɡɚɜɢɫɢɦɵɣ ɫɥɨɜɚɪɶ ɩɨɪɹɞɤɚ L ɞɥɹ S. ȿɫɥɢ ɜ ɫɥɨɜɚɪɟ ɩɨɪɹɞɤɚ L ɫɨɜɩɚɞɟɧɢɟ ɨɛɧɚɪɭɠɢɬɶ ɧɟ ɭɞɚɥɨɫɶ, ɬɨ ɩɪɨɢɫɯɨɞɢɬ ɭɯɨɞ ɤ ɫɥɨɜɚɪɸ ɩɨɪɹɞɤɚ L–1. ȼ ɤɨɧɟɱɧɨɦ ɢɬɨɝɟ, ɟɫɥɢ ɧɟ ɛɵɥɨ ɧɚɣɞɟɧɨ ɫɨɜɩɚɞɚɸɳɢɯ ɮɪɚɡ ɧɢ ɜ ɨɞɧɨɦ ɢɡ ɞɨɫɬɭɩɧɵɯ ɫɥɨɜɚɪɟɣ, ɬɨ ɬɟɤɭɳɢɣ ɫɢɦɜɨɥ ɩɟɪɟɞɚɟɬɫɹ ɜ ɹɜɧɨɦ ɜɢɞɟ. ɇɚɩɪɢɦɟɪ, ɩɪɢ ɢɫɩɨɥɶɡɨɜɚɧɢɢ ɬɟɯɧɢɤɢ ɤɨɧɬɟɤɫɬɧɨɡɚɜɢɫɢɦɵɯ ɫɥɨɜɚɪɟɣ ɩɨɪɹɞɤɚ ɜ ɫɨɱɟɬɚɧɢɢ ɫ LZ77, ɩɨɫɥɟ ɨɛɪɚɛɨɬɤɢ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ “ɚɛɪɚɤɚɞɚɛɪɚ” ɩɨɥɭɱɚɟɦ ɫɥɟɞɭɸɳɢɣ ɫɨɫɬɚɜ ɫɥɨɜɚɪɟɣ ɩɨɪɹɞɤɨɜ 2, 1 ɢ 0 ɞɥɹ ɬɟɤɭɳɟɝɨ ɤɨɧɬɟɤɫɬɚ: ɉɨɪɹɞɨɤ L ɋɨɫɬɚɜ ɤɨɧɬɟɤɫɬɧɨ-ɡɚɜɢɫɢɦɨɝɨ ɫɥɨɜɚɪɹ ɩɨɪɹɞɤɚ L (ɮɪɚɡɵ ɫɥɨɜɚɪɹ ɦɨɝɭɬ ɧɚɱɢɧɚɬɶɫɹ ɬɨɥɶɤɨ ɜ ɩɟɪɜɨɣ ɩɨɡɢɰɢɢ ɭɤɚɡɚɧɧɵɯ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɟɣ) 2 ɤɚɞɚɛɪɚ (ɤɨɧɬɟɤɫɬ “ɪɚ”) 1 ɛɪɚɤɚɞɚɛɪɚ (ɤɨɧɬɟɤɫɬ “ɚ”) ɤɚɞɚɛɪɚ ɞɚɛɪɚ ɛɪɚ
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X 105 http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɉɨɪɹɞɨɤ L
ɋɨɫɬɚɜ ɤɨɧɬɟɤɫɬɧɨ-ɡɚɜɢɫɢɦɨɝɨ ɫɥɨɜɚɪɹ ɩɨɪɹɞɤɚ L (ɮɪɚɡɵ ɫɥɨɜɚɪɹ ɦɨɝɭɬ ɧɚɱɢɧɚɬɶɫɹ ɬɨɥɶɤɨ ɜ ɩɟɪɜɨɣ ɩɨɡɢɰɢɢ ɭɤɚɡɚɧɧɵɯ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɟɣ) 0 ɚɛɪɚɤɚɞɚɛɪɚ (ɩɭɫɬɨɣ ɤɨɧɬɟɤɫɬ) ɛɪɚɤɚɞɚɛɪɚ ɪɚɤɚɞɚɛɪɚ ɚɤɚɞɚɛɪɚ ɤɚɞɚɛɪɚ ɚɞɚɛɪɚ ɞɚɛɪɚ ɚɛɪɚ ɛɪɚ ɪɚ a (ɨɛɵɱɧɵɣ ɫɥɨɜɚɪɶ LZ77) ɗɤɫɩɟɪɢɦɟɧɬɵ ɩɨɤɚɡɚɥɢ, ɱɬɨ ɧɚɢɥɭɱɲɢɟ ɪɟɡɭɥɶɬɚɬɵ ɞɨɫɬɢɝɚɸɬɫɹ ɩɪɢ L = 1 ɢɥɢ 2, ɬ.ɟ. ɜ ɤɚɱɟɫɬɜɟ ɤɨɧɬɟɤɫɬɚ ɞɨɫɬɚɬɨɱɧɨ ɢɫɩɨɥɶɡɨɜɚɬɶ ɨɞɢɧ ɢɥɢ ɞɜɚ ɩɪɟɞɵɞɭɳɢɯ ɫɢɦɜɨɥɚ. ɉɪɢɦɟɧɟɧɢɟ ɤɨɧɬɟɤɫɬɧɨ-ɡɚɜɢɫɢɦɵɯ ɫɥɨɜɚɪɟɣ ɩɨɡɜɨɥɹɟɬ ɭɥɭɱɲɢɬɶ ɫɠɚɬɢɟ LZSS ɧɚ 1–2%, LZFG — ɧɚ 5%, LZW — ɩɪɢɦɟɪɧɨ ɧɚ 10%. ɉɨɬɟɪɢ ɜ ɫɤɨɪɨɫɬɢ ɜ ɫɥɭɱɚɟ ɦɨɞɢɮɢɤɚɰɢɢ LZFG ɫɨɫɬɚɜɥɹɸɬ ɩɨɪɹɞɤɚ 20–30%. ɋɨɨɬɜɟɬɫɬɜɭɸɳɢɟ ɜɟɪɫɢɢ ɚɥɝɨɪɢɬɦɨɜ ɢɡɜɟɫɬɧɵ ɤɚɤ LZ77-PM, LZFG-PM, LZW-PM [5]. ɇɟɞɨɫɬɚɬɤɨɦ ɬɟɯɧɢɤɢ ɹɜɥɹɟɬɫɹ ɧɟɨɛɯɨɞɢɦɨɫɬɶ ɩɨɞɞɟɪɠɢɜɚɬɶ ɞɨɫɬɚɬɨɱɧɨ ɫɥɨɠɧɭɸ ɫɬɪɭɤɬɭɪɭ ɤɨɧɬɟɤɫɬɧɨ-ɡɚɜɢɫɢɦɵɯ ɫɥɨɜɚɪɟɣ ɧɟ ɬɨɥɶɤɨ ɩɪɢ ɤɨɞɢɪɨɜɚɧɢɢ, ɧɨ ɢ ɩɪɢ ɞɟɤɨɞɢɪɨɜɚɧɢɢ. ȻɍɎȿɊɂɁȺɐɂə ɋɆȿɓȿɇɂɃ
ȿɫɥɢ ɛɵɥɚ ɡɚɤɨɞɢɪɨɜɚɧɚ ɮɪɚɡɚ ɫɨ ɫɦɟɳɟɧɢɟɦ i, ɬɨ ɭɜɟɥɢɱɢɜɚɟɬɫɹ ɜɟɪɨɹɬɧɨɫɬɶ ɬɨɝɨ, ɱɬɨ ɜɫɤɨɪɟ ɧɚɦ ɦɨɠɟɬ ɩɨɬɪɟɛɨɜɚɬɶɫɹ ɡɚɤɨɞɢɪɨɜɚɬɶ ɮɪɚɡɵ ɫ ɩɪɢɛɥɢɡɢɬɟɥɶɧɨ ɬɚɤɢɦ ɠɟ ɫɦɟɳɟɧɢɟɦ i ± į, ɝɞɟ į — ɧɟɛɨɥɶɲɨɟ ɱɢɫɥɨ. ɗɬɨ ɨɫɨɛɟɧɧɨ ɱɚɫɬɨ ɩɪɨɹɜɥɹɟɬɫɹ ɩɪɢ ɨɛɪɚɛɨɬɤɟ ɞɜɨɢɱɧɵɯ ɞɚɧɧɵɯ (ɢɫɩɨɥɧɢɦɵɯ ɮɚɣɥɨɜ, ɮɚɣɥɨɜ ɪɟɫɭɪɫɨɜ), ɩɨɫɤɨɥɶɤɭ ɞɥɹ ɧɢɯ ɯɚɪɚɤɬɟɪɧɨ ɧɚɥɢɱɢɟ ɫɪɚɜɧɢɬɟɥɶɧɨ 106 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɞɥɢɧɧɵɯ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɟɣ, ɨɬɥɢɱɚɸɳɢɯɫɹ ɥɢɲɶ ɜ ɧɟɫɤɨɥɶɤɢɯ ɩɨɡɢɰɢɹɯ. ɋɦɟɳɟɧɢɟ ɨɛɵɱɧɨ ɩɪɟɞɫɬɚɜɥɹɟɬɫɹ ɩɨɫɪɟɞɫɬɜɨɦ ɞɜɭɯ (ɢɧɨɝɞɚ ɛɨɥɟɟ) ɩɨɥɟɣ: ɛɚɡɵ (ɫɟɝɦɟɧɬɚ) ɢ ɩɨɥɹ ɞɨɩɨɥɧɢɬɟɥɶɧɵɯ ɛɢɬɨɜ, ɭɬɨɱɧɹɸɳɟɝɨ ɡɧɚɱɟɧɢɟ ɫɦɟɳɟɧɢɹ ɨɬɧɨɫɢɬɟɥɶɧɨ ɛɚɡɵ. ɉɨɷɬɨɦɭ ɜ ɩɨɬɨɤɟ ɡɚɤɨɞɢɪɨɜɚɧɧɵɯ ɞɚɧɧɵɯ, ɩɨɪɨɠɞɚɟɦɨɦ ɚɥɝɨɪɢɬɦɚɦɢ ɫɟɦɟɣɫɬɜɚ LZ77, ɤɨɞɵ ɮɪɚɡ ɫ ɨɞɧɢɦ ɢ ɬɟɦ ɠɟ ɡɧɚɱɟɧɢɟɦ ɛɚɡɵ ɫɦɟɳɟɧɢɹ ɱɚɫɬɨ ɪɚɫɩɨɥɚɝɚɸɬɫɹ ɧɟɞɚɥɟɤɨ ɞɪɭɝ ɨɬ ɞɪɭɝɚ. ɗɬɨ ɫɜɨɣɫɬɜɨ ɦɨɠɧɨ ɢɫɩɨɥɶɡɨɜɚɬɶ ɞɥɹ ɭɥɭɱɲɟɧɢɹ ɫɠɚɬɢɹ, ɩɪɢɦɟɧɢɜ ɬɟɯɧɢɤɭ ɛɭɮɟɪɢɡɚɰɢɢ ɛɚɡ ɫɦɟɳɟɧɢɣ. ȼ ɛɭɮɟɪɟ ɡɚɩɨɦɢɧɚɟɬɫɹ m ɩɨɫɥɟɞɧɢɯ ɢɫɩɨɥɶɡɨɜɚɧɧɵɯ ɛɚɡ ɫɦɟɳɟɧɢɣ, ɪɚɡɥɢɱɚɸɳɢɯɫɹ ɦɟɠɞɭ ɫɨɛɨɣ. Ȼɭɮɟɪ ɨɛɧɨɜɥɹɟɬɫɹ ɩɨ ɩɪɢɧɰɢɩɭ ɫɩɢɫɤɚ LRU, ɬ.ɟ. ɫɚɦɚɹ ɩɨɫɥɟɞɧɹɹ ɢɫɩɨɥɶɡɨɜɚɧɧɚɹ ɛɚɡɚ ɢɦɟɟɬ ɢɧɞɟɤɫ 0, ɫɚɦɚɹ «ɫɬɚɪɚɹ» — ɢɧɞɟɤɫ m–1. ȿɫɥɢ ɛɚɡɚ B ɫɦɟɳɟɧɢɹ ɬɟɤɭɳɟɣ ɮɪɚɡɵ ɫɨɜɩɚɞɚɟɬ ɫ ɨɞɧɨɣ ɢɡ ɫɨɞɟɪɠɚɳɢɯɫɹ ɜ ɛɭɮɟɪɟ ɛɚɡ Bi, ɬɨ ɜɦɟɫɬɨ B ɤɨɞɢɪɭɟɬɫɹ ɢɧɞɟɤɫ i ɛɭɮɟɪɚ. Ɂɚɬɟɦ Bi ɩɟɪɟɦɟɳɚɟɬɫɹ ɜ ɧɚɱɚɥɨ ɫɩɢɫɤɚ LRU, ɬ.ɟ. ɩɨɥɭɱɚɟɬ ɢɧɞɟɤɫ 0, ɚ ɜɫɟ B0, B1, …, Bi-1 ɫɞɜɢɝɚɸɬɫɹ ɧɚ ɨɞɧɭ ɩɨɡɢɰɢɸ ɤ ɤɨɧɰɭ ɫɩɢɫɤɚ. ɂɧɚɱɟ ɤɨɞɢɪɭɟɬɫɹ ɫɨɛɫɬɜɟɧɧɨ ɛɚɡɚ B, ɩɨɫɥɟ ɱɟɝɨ ɨɧɚ ɞɨɛɚɜɥɹɟɬɫɹ ɜ ɧɚɱɚɥɨ ɛɭɮɟɪ ɤɚɤ B0, ɚ ɜɫɟ ɛɭɮɟɪɢɡɨɜɚɧɧɵɟ ɛɚɡɵ ɫɦɟɳɚɸɬɫɹ ɧɚ ɨɞɧɭ ɩɨɡɢɰɢɸ ɤ ɤɨɧɰɭ ɫɩɢɫɤɚ LRU, ɩɪɢ ɷɬɨɦ Bm-1 ɭɞɚɥɹɟɬɫɹ ɢɡ ɛɭɮɟɪɚ. ɉɪɢɦɟɪ ɉɪɢɦɟɦ m ɪɚɜɧɵɦ 2. ȿɫɥɢ ɛɚɡɚ ɧɟ ɫɨɜɩɚɞɚɟɬ ɧɢ ɫ ɨɞɧɨɣ ɫɨɞɟɪɠɚɳɟɣɫɹ ɜ ɛɭɮɟɪɟ, ɬɨ ɤɨɞɢɪɭɟɦɨɟ ɡɧɚɱɟɧɢɟ ɛɚɡɵ ɪɚɜɧɨ ɚɛɫɨɥɸɬɧɨɦɭ ɡɧɚɱɟɧɢɸ ɩɥɸɫ m. ɉɭɫɬɶ ɬɚɤɠɟ ɫɨɞɟɪɠɢɦɨɟ ɛɭɮɟɪɚ ɪɚɜɧɨ {0, 1}, ɬɨɝɞɚ ɩɨɲɚɝɨɜɨɟ ɩɪɟɨɛɪɚɡɨɜɚɧɢɟ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ ɛɚɡ ɫɦɟɳɟɧɢɣ 15, 14, 14, 2, 3, 2,… ɛɭɞɟɬ ɜɵɝɥɹɞɟɬɶ ɫɥɟɞɭɸɳɢɦ ɨɛɪɚɡɨɦ. ɋɨɞɟɪɠɢɦɨɟ ɛɭɮɟ- Ʉɨɞɢɪɭɟɦɨɟ ɇɨɦɟɪ Ⱥɛɫɨɥɸɬɧɨɟ ɲɚɝɚ ɡɧɚɱɟɧɢɟ ɛɚ- ɪɚ ɜ ɧɚɱɚɥɟ ɲɚɝɚ ɡɧɚɱɟɧɢɟ ɛɚɡɵ ɡɵ B0 B1 1 15 0 1 17 2 14 15 0 16 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X 107 http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɋɨɞɟɪɠɢɦɨɟ ɛɭɮɟɪɚ ɜ ɧɚɱɚɥɟ ɲɚɝɚ 3 14 14 15 0 4 2 14 15 4 5 3 2 14 5 6 2 3 2 1 7 ? 2 3 ? Ɉɛɪɚɬɢɬɟ ɜɧɢɦɚɧɢɟ ɧɚ ɫɨɫɬɨɹɧɢɟ ɛɭɮɟɪɚ ɩɨɫɥɟ ɲɚɝɚ 3. Ɉɧɨ ɧɟ ɢɡɦɟɧɢɥɨɫɶ, ɩɨɫɤɨɥɶɤɭ ɜɫɟ ɷɥɟɦɟɧɬɵ ɛɭɮɟɪɚ ɞɨɥɠɧɵ ɛɵɬɶ ɪɚɡɥɢɱɧɵ. ɂɧɚɱɟ ɦɵ ɭɯɭɞɲɢɦ ɫɠɚɬɢɟ ɢɡ-ɡɚ ɜɧɟɫɟɧɢɹ ɢɡɛɵɬɨɱɧɨɫɬɢ ɜ ɨɩɢɫɚɧɢɟ ɛɚɡ ɫɦɟɳɟɧɢɣ, ɩɨɫɤɨɥɶɤɭ ɜ ɷɬɨɦ ɫɥɭɱɚɟ ɨɞɧɚ ɢ ɬɚ ɠɟ ɛɚɡɚ ɦɨɠɟɬ ɡɚɞɚɜɚɬɶɫɹ ɧɟɫɤɨɥɶɤɢɦɢ ɱɢɫɥɚɦɢ. Ʉɚɤ ɩɨɤɚɡɵɜɚɸɬ ɷɤɫɩɟɪɢɦɟɧɬɵ, ɨɩɬɢɦɚɥɶɧɨɟ ɡɧɚɱɟɧɢɟ m ɥɟɠɢɬ ɜ ɩɪɟɞɟɥɚɯ 4…8. ɋɬɨɢɦɨɫɬɶ ɤɨɞɢɪɨɜɚɧɢɹ ɢɧɞɟɤɫɚ ɛɭɮɟɪɚ ɨɛɵɱɧɨ ɧɢɠɟ ɫɬɨɢɦɨɫɬɢ ɤɨɞɢɪɨɜɚɧɢɹ ɛɚɡɵ ɫɦɟɳɟɧɢɹ ɧɟɩɨɫɪɟɞɫɬɜɟɧɧɨ. ɉɨɷɬɨɦɭ ɢɦɟɟɬ ɫɦɵɫɥ ɩɪɢɧɭɞɢɬɟɥɶɧɨ ɭɜɟɥɢɱɢɜɚɬɶ ɱɚɫɬɨɬɭ ɢɫɩɨɥɶɡɨɜɚɧɢɹ ɛɭɮɟɪɢɡɨɜɚɧɧɵɯ ɫɦɟɳɟɧɢɣ ɡɚ ɫɱɟɬ ɩɨɞɛɨɪɚ ɮɪɚɡ ɫ «ɧɭɠɧɵɦ» ɪɚɫɩɨɥɨɠɟɧɢɟɦ ɜ ɫɥɨɜɚɪɟ. ɉɪɢɦɟɧɟɧɢɟ ɪɚɫɫɦɨɬɪɟɧɧɨɣ ɬɟɯɧɢɤɢ ɡɚɦɟɬɧɨ ɭɥɭɱɲɚɟɬ ɫɠɚɬɢɟ ɞɜɨɢɱɧɵɯ ɮɚɣɥɨɜ — ɞɨ ɧɟɫɤɨɥɶɤɢɯ ɩɪɨɰɟɧɬɨɜ, ɧɨ ɫɥɚɛɨ ɜɥɢɹɟɬ ɜ ɫɥɭɱɚɟ ɨɛɪɚɛɨɬɤɢ ɬɟɤɫɬɨɜ. Ȼɭɮɟɪɢɡɚɰɢɹ ɫɦɟɳɟɧɢɣ ɢɫɩɨɥɶɡɭɟɬɫɹ ɩɪɚɤɬɢɱɟɫɤɢ ɜɨ ɜɫɟɯ ɫɨɜɪɟɦɟɧɧɵɯ ɚɪɯɢɜɚɬɨɪɚɯ, ɪɟɚɥɢɡɭɸɳɢɯ ɚɥɝɨɪɢɬɦɵ ɫɟɦɟɣɫɬɜɚ LZ77, ɧɚɩɪɢɦɟɪ: 7-Zip, CABARC, WinRAR. ɋɈȼɆȿɋɌɇɈȿ ɄɈȾɂɊɈȼȺɇɂȿ ȾɅɂɇ ɂ ɋɆȿɓȿɇɂɃ
Ɇɟɠɞɭ ɜɟɥɢɱɢɧɨɣ ɫɦɟɳɟɧɢɹ ɢ ɞɥɢɧɨɣ ɫɨɜɩɚɞɟɧɢɹ ɢɦɟɟɬɫɹ ɧɟɡɧɚɱɢɬɟɥɶɧɚɹ ɤɨɪɪɟɥɹɰɢɹ, ɜɟɥɢɱɢɧɚ ɤɨɬɨɪɨɣ ɜɨɡɪɚɫɬɚɟɬ ɜ ɫɥɭɱɚɟ ɩɪɢɦɟɧɟɧɢɹ ɛɭɮɟɪɢɡɚɰɢɢ ɫɦɟɳɟɧɢɣ. ɗɬɨ ɫɜɨɣɫɬɜɨ ɦɨɠɧɨ ɢɫɩɨɥɶɡɨɜɚɬɶ, ɨɛɴɟɞɢɧɢɜ ɜ ɨɞɢɧ ɦɟɬɚɫɢɦɜɨɥ ɞɥɢɧɭ ɫɨɜɩɚɞɟɧɢɹ match_len ɢ ɛɚɡɭ ɫɦɟɳɟɧɢɹ offset_base, ɢ, ɬɚɤɢɦ ɨɛɪɚɡɨɦ, ɤɨɞɢɪɨɜɚɬɶ ɦɟɬɚɫɢɦɜɨɥ ɧɚ ɨɫɧɨɜɚɧɢɢ ɫɬɚɬɢɫɬɢɤɢ ɫɨɜɦɟɫɬɧɨɝɨ ɩɨɹɜɥɟɧɢɹ ɨɩɪɟɞɟɥɟɧɧɵɯ ɞɥɢɧɵ ɢ ɫɦɟɳɟɧɢɹ. Ʉɚɤ ɢ ɜ ɫɥɭɱɚɟ ɫɦɟ108 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɳɟɧɢɹ, ɜ ɦɟɬɚɫɢɦɜɨɥ ɥɭɱɲɟ ɜɤɥɸɱɚɬɶ ɧɟ ɩɨɥɧɨɫɬɶɸ ɞɥɢɧɭ, ɚ ɟɟ ɤɜɚɧɬɨɜɚɧɧɨɟ ɡɧɚɱɟɧɢɟ. Ɍɚɤ, ɧɚɩɪɢɦɟɪ, ɜ ɮɨɪɦɚɬɟ LZX (ɢɫɩɨɥɶɡɭɟɬɫɹ ɜ ɤɨɦɩɪɟɫɫɨɪɟ CABARC) ɞɥɢɧɵ ɫɨɜɩɚɞɟɧɢɹ ɨɬ 2 ɞɨ 8 ɜɯɨɞɹɬ ɜ ɫɨɫɬɚɜ ɦɟɬɚɫɢɦɜɨɥɚ ɧɟɩɨɫɪɟɞɫɬɜɟɧɧɨ, ɚ ɜɫɟ ɞɥɢɧɵ match_len > 8 ɨɬɨɛɪɚɠɚɸɬɫɹ ɜ ɨɞɧɨ ɡɧɚɱɟɧɢɟ. ȼ ɩɨɫɥɟɞɧɟɦ ɫɥɭɱɚɟ ɞɥɢɧɚ ɫɨɜɩɚɞɟɧɢɹ ɞɨɨɩɪɟɞɟɥɹɟɬɫɹ ɩɭɬɟɦ ɨɬɞɟɥɶɧɨɣ ɩɟɪɟɞɚɱɢ ɜɟɥɢɱɢɧɵ match_len – 9. Ɇɟɬɚɫɢɦɜɨɥɵ ɞɥɢɧɚ/ɫɦɟɳɟɧɢɟ ɢ ɥɢɬɟɪɚɥɵ ɜɯɨɞɹɬ ɜ ɨɞɢɧ ɚɥɮɚɜɢɬ, ɩɨɷɬɨɦɭ ɜ ɭɩɪɨɳɟɧɧɨɦ ɜɢɞɟ ɚɥɝɨɪɢɬɦ ɤɨɞɢɪɨɜɚɧɢɹ ɬɚɤɨɜ: if (match_len >= 2) { // ɡɚɤɨɞɢɪɭɟɦ ɮɪɚɡɭ if ( match_len <= 8 ) metasymbol = (offset_base<<3) || (match_len–2); else metasymbol = (offset_base<<3) || 7; /*ɡɚɤɨɞɢɪɭɟɦ ɦɟɬɚɫɢɦɜɨɥ, ɭɤɚɡɚɜ, ɱɬɨ ɷɬɨ ɧɟ ɥɢɬɟɪɚɥ, ɞɥɹ ɩɪɚɜɢɥɶɧɨɝɨ ɨɬɨɛɪɚɠɟɧɢɹ ɡɧɚɱɟɧɢɹ ɦɟɬɚɫɢɦɜɨɥɚ ɜ ɚɥɮɚɜɢɬ ɞɥɢɧ/ɫɦɟɳɟɧɢɣ ɢ ɥɢɬɟɪɚɥɨɜ */ encode_symbol (metasymbol, NON_LITERAL); if (match_len > 8) // ɞɨɨɩɪɟɞɟɥɢɦ ɞɥɢɧɭ ɫɨɜɩɚɞɟɧɢɹ encode_length_footer (match_len – 9); // ɡɚɤɨɞɢɪɭɟɦ ɦɥɚɞɲɢɟ ɛɢɬɵ ɫɦɟɳɟɧɢɹ encode_offset_footer (...); ... }else{ // ɡɚɤɨɞɢɪɭɟɦ ɥɢɬɟɪɚɥ ɜ ɬɟɤɭɳɟɣ ɩɨɡɢɰɢɢ t+1 encode_symbol (window[t+1], LITERAL) ... }
ɍɩɪɚɠɧɟɧɢɟ: ɇɚɩɢɲɢɬɟ ɭɩɪɨɳɟɧɧɵɣ ɚɥɝɨɪɢɬɦ ɞɟɤɨɞɢɪɨɜɚɧɢɹ.
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X 109 http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
Ⱥɪɯɢɜɚɬɨɪɵ ɢ ɤɨɦɩɪɟɫɫɨɪɵ, ɢɫɩɨɥɶɡɭɸɳɢɟ ɚɥɝɨɪɢɬɦɵ LZ ɋɪɟɞɢ ɨɝɪɨɦɧɨɝɨ ɤɨɥɢɱɟɫɬɜɚ LZ-ɚɪɯɢɜɚɬɨɪɨɜ ɨɬɦɟɬɢɦ ɫɥɟɞɭɸɳɢɟ: 1) 7-Zip, ɚɜɬɨɪ ɂɝɨɪɶ ɉɚɜɥɨɜ (Pavlov); 2) ACE, ɚɜɬɨɪ Ɇɚɪɤɟɥ Ʌɟɦɤɟ (Lemke); 3) ARJ, ɚɜɬɨɪ Ɋɨɛɟɪɬ Ⱦɠɚɧɝ (Jung); 4) ARJZ, ɚɜɬɨɪ Ȼɭɥɚɬ Ɂɢɝɚɧɲɢɧ (Ziganshin); 5) CABARC, ɤɨɪɩɨɪɚɰɢɹ Microsoft; 6) Imp, ɮɢɪɦɚ Technelysium Pty Ltd; 7) JAR, ɚɜɬɨɪ Ɋɨɛɟɪɬ Ⱦɠɚɧɝ (Jung); 8) PKZIP, ɮɢɪɦɚ PKWARE Inc.; 9) RAR, ɚɜɬɨɪ ȿɜɝɟɧɢɣ Ɋɨɲɚɥ (Roshal); 10) WinZip, ɮɢɪɦɚ Nico Mak Computing; 11) Zip, Info-ZIP group. ɗɬɢ ɚɪɯɢɜɚɬɨɪɵ ɹɜɥɹɸɬɫɹ ɢɥɢ ɨɞɧɢɦɢ ɢɡ ɫɚɦɵɯ ɷɮɮɟɤɬɢɜɧɵɯ ɜ ɤɥɚɫɫɟ ɩɪɢɦɟɧɹɸɳɢɯ ɦɟɬɨɞɵ Ɂɢɜɚ-Ʌɟɦɩɟɥɚ, ɢɥɢ ɩɨɥɶɡɭɸɬɫɹ ɩɨɩɭɥɹɪɧɨɫɬɶɸ, ɢɥɢ ɨɤɚɡɚɥɢ ɫɭɳɟɫɬɜɟɧɧɨɟ ɜɥɢɹɧɢɟ ɧɚ ɪɚɡɜɢɬɢɟ ɫɥɨɜɚɪɧɵɯ ɚɥɝɨɪɢɬɦɨɜ, ɢɥɢ ɢɧɬɟɪɟɫɧɵ ɫ ɬɨɱɤɢ ɡɪɟɧɢɹ ɧɟɫɤɨɥɶɤɢɯ ɭɤɚɡɚɧɧɵɯ ɤɪɢɬɟɪɢɟɜ. Ɂɚ ɢɫɤɥɸɱɟɧɢɟɦ 7-Zip, ɫɥɨɜɚɪɧɵɟ ɚɥɝɨɪɢɬɦɵ ɜɫɟɯ ɭɤɚɡɚɧɧɵɯ ɚɪɯɢɜɚɬɨɪɨɜ ɦɨɠɧɨ ɪɚɫɫɦɚɬɪɢɜɚɬɶ ɤɚɤ ɦɨɞɢɮɢɤɚɰɢɢ LZH. ȼ ɚɥɝɨɪɢɬɦɟ LZMA, ɪɟɚɥɢɡɨɜɚɧɧɨɦ ɜ 7-Zip, ɫɨɜɦɟɫɬɧɨ ɫɨ ɫɥɨɜɚɪɧɵɦɢ ɡɚɦɟɧɚɦɢ ɢɫɩɨɥɶɡɭɟɬɫɹ ɤɨɧɬɟɤɫɬɧɨɟ ɦɨɞɟɥɢɪɨɜɚɧɢɟ ɢ ɚɪɢɮɦɟɬɢɱɟɫɤɨɟ ɤɨɞɢɪɨɜɚɧɢɟ. ȼ ɬɚɛɥ. 3.12 ɩɪɟɞɫɬɚɜɥɟɧɵ ɪɟɡɭɥɶɬɚɬɵ ɫɪɚɜɧɟɧɢɹ ɧɟɤɨɬɨɪɵɯ ɚɪɯɢɜɚɬɨɪɨɜ ɩɨ ɫɬɟɩɟɧɢ ɫɠɚɬɢɹ ɮɚɣɥɨɜ ɧɚɛɨɪɚ CalgCC. Ɍɚɛɥɢɰɚ 3.12 Bib Book1 Book2 Geo News Obj1 Obj2
ARJ
PKZIP
ACE
RAR
CABARC
7-Zip
3.08 2.41 2.90 1.48 2.56 2.06 3.01
3.16 2.46 2.95 1.49 2.61 2.07 3.04
3.38 2.78 3.36 1.56 3.00 2.19 3.39
3.39 2.80 3.39 1.53 3.00 2.18 3.38
3.45 2.91 3.51 1.70 3.07 2.20 3.54
3.62 2.94 3.59 1.89 3.16 2.26 3.96
110 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
Paper1 Paper2 Pic Progc Progl Progp Trans ɂɬɨɝɨ
ARJ
PKZIP
ACE
RAR
CABARC
7-Zip
2.84 2.74 9.30 2.93 4.35 4.32 4.65
2.85 2.77 9.76 2.94 4.42 4.37 4.79
2.91 2.86 10.53 3.00 4.49 4.55 5.19
2.93 2.88 10.39 3.01 4.55 4.57 5.23
2.99 2.95 10.67 3.04 4.62 4.62 5.30
3.07 3.01 11.76 3.15 4.76 4.73 5.56
3.47
3.55
3.80
3.80
3.90
4.10
ɂɫɩɨɥɶɡɨɜɚɧɧɵɟ ɜɟɪɫɢɢ ɚɪɯɢɜɚɬɨɪɨɜ: ARJ 2.50a, PKZIP 2.04g, WinRAR 2.71, ACE 2.04, 7-Zip 2.30 beta 7. ȼɨ ɜɫɟɯ ɫɥɭɱɚɹɯ ɩɪɢɦɟɧɹɥɫɹ ɬɨɬ ɚɥɝɨɪɢɬɦ LZ, ɤɨɬɨɪɵɣ ɨɛɟɫɩɟɱɢɜɚɥ ɧɚɢɥɭɱɲɟɟ ɫɠɚɬɢɟ. Ɂɚɦɟɬɢɦ, ɱɬɨ 7-Zip ɢɫɩɨɥɶɡɭɟɬ ɫɩɟɰɢɚɥɶɧɵɟ ɦɟɬɨɞɵ ɩɪɟɩɪɨɰɟɫɫɢɧɝɚ ɧɟɬɟɤɫɬɨɜɵɯ ɞɚɧɧɵɯ, «ɨɬɤɥɸɱɢɬɶ» ɤɨɬɨɪɵɟ ɧɟ ɭɞɚɥɨɫɶ, ɱɬɨ ɞɨ ɧɟɤɨɬɨɪɨɣ ɫɬɟɩɟɧɢ ɢɫɤɚɡɢɥɨ ɤɚɪɬɢɧɭ. Ɍɟɦ ɧɟ ɦɟɧɟɟ, ɩɪɟɢɦɭɳɟɫɬɜɨ ɷɬɨɝɨ ɚɪɯɢɜɚɬɨɪɚ ɧɚ ɞɚɧɧɨɦ ɬɟɫɬɨɜɨɦ ɧɚɛɨɪɟ ɧɟɫɨɦɧɟɧɧɨ. ȼ ɫɥɭɱɚɟ WinRAR ɢ ACE ɪɟɠɢɦ ɦɭɥɶɬɢɦɟɞɢɣɧɨɣ ɤɨɦɩɪɟɫɫɢɢ ɧɚɦɟɪɟɧɧɨ ɧɟ ɜɤɥɸɱɚɥɫɹ. ɉɪɢ ɫɪɚɜɧɟɧɢɢ ɩɪɨɝɪɚɦɦ 7-Zip ɜɟɪɫɢɢ 2.3 ɢ RAR ɜɟɪɫɢɢ 3 ɫ ɞɪɭɝɢɦɢ LZɚɪɯɢɜɚɬɨɪɚɦɢ ɧɟɨɛɯɨɞɢɦɨ ɫɥɟɞɢɬɶ, ɱɬɨɛɵ 7-Zip ɢ RAR ɢɫɩɨɥɶɡɨɜɚɥɢ ɚɥɝɨɪɢɬɦ ɬɢɩɚ LZ, ɩɨɫɤɨɥɶɤɭ ɨɧɢ ɢɦɟɸɬ ɜ ɫɜɨɟɦ ɚɪɫɟɧɚɥɟ ɚɥɝɨɪɢɬɦ PPMII, ɨɛɟɫɩɟɱɢɜɚɸɳɢɣ ɜɵɫɨɤɭɸ ɫɬɟɩɟɧɶ ɫɠɚɬɢɹ ɬɟɤɫɬɨɜ.
ɉɪɢ ɫɪɚɜɧɟɧɢɢ ɫɥɟɞɭɟɬ ɭɱɢɬɵɜɚɬɶ, ɱɬɨ ɫɤɨɪɨɫɬɶ ɫɠɚɬɢɹ ARJ ɢ PKZIP ɛɵɥɚ ɩɪɢɦɟɪɧɨ ɜ 4.5 ɪɚɡɚ ɜɵɲɟ, ɱɟɦ ɭ RAR ɢ ACE, ɤɨɬɨɪɵɟ, ɜ ɫɜɨɸ ɨɱɟɪɟɞɶ, ɛɵɥɢ ɛɵɫɬɪɟɟ CABARC ɢ 7-Zip ɩɪɢɛɥɢɡɢɬɟɥɶɧɨ ɧɚ 30% . Ɋɚɡɦɟɪ ɫɥɨɜɚɪɹ ɜ ARJ ɢ PKZIP ɜ ɞɟɫɹɬɤɢ ɪɚɡ ɦɟɧɶɲɟ, ɱɟɦ ɜ ɨɫɬɚɥɶɧɵɯ ɩɪɨɝɪɚɦɦɚɯ.
ȼɨɩɪɨɫɵ ɞɥɹ ɫɚɦɨɤɨɧɬɪɨɥɹ5 1. Ʉɚɤɢɟ ɫɜɨɣɫɬɜɚ ɞɚɧɧɵɯ ɨɩɪɟɞɟɥɹɸɬ ɩɪɢɧɰɢɩɢɚɥɶɧɭɸ ɜɨɡɦɨɠɧɨɫɬɶ ɢɯ ɫɠɚɬɢɹ ɫ ɩɨɦɨɳɶɸ LZ-ɦɟɬɨɞɨɜ?
5
Ɉɬɜɟɬɵ ɤ ɜɨɩɪɨɫɚɦ ɢ ɭɩɪɚɠɧɟɧɢɹɦ ɢ ɢɫɯɨɞɧɵɟ ɬɟɤɫɬɵ ɩɪɨɝɪɚɦɦ ɜɵ ɦɨɠɟɬɟ ɧɚɣɬɢ ɧɚ http://www.compression.ru/
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X 111 http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
2. ȼ ɱɟɦ ɨɫɧɨɜɧɚɹ ɪɚɡɧɢɰɚ ɦɟɠɞɭ ɚɥɝɨɪɢɬɦɚɦɢ ɫɟɦɟɣɫɬɜɚ LZ77 ɢ ɫɟɦɟɣɫɬɜɚ LZ78? 3. Ʉɚɤɢɟ ɨɫɨɛɟɧɧɨɫɬɢ ɫɬɪɨɟɧɢɹ ɫɥɨɜɚɪɹ LZ77 ɩɨɡɜɨɥɹɸɬ ɫɨɡɞɚɜɚɬɶ ɞɥɹ ɨɞɧɨɝɨ ɢ ɬɨɝɨ ɠɟ ɜɯɨɞɧɨɝɨ ɮɚɣɥɚ ɧɟɫɤɨɥɶɤɨ ɪɚɡɥɢɱɧɵɯ ɚɪɯɢɜɧɵɯ, ɤɨɬɨɪɵɟ ɡɚɬɟɦ ɦɨɠɧɨ ɪɚɡɠɚɬɶ ɛɟɡ ɩɨɬɟɪɶ ɢɧɮɨɪɦɚɰɢɢ ɫ ɩɨɦɨɳɶɸ ɨɞɧɨɝɨ ɢ ɬɨɝɨ ɠɟ ɞɟɤɨɞɟɪɚ LZ77? ȼɨɡɦɨɠɧɨ ɥɢ ɷɬɨ ɜ ɫɥɭɱɚɟ ɚɥɝɨɪɢɬɦɚ LZ78? 4. ɉɨɱɟɦɭ ɜ ɚɥɝɨɪɢɬɦɚɯ ɫɟɦɟɣɫɬɜɚ LZ77 ɤɨɪɨɬɤɢɟ ɫɬɪɨɤɢ ɱɚɫɬɨ ɜɵɝɨɞɧɟɟ ɫɠɢɦɚɬɶ ɧɟ ɫ ɩɨɦɨɳɶɸ ɫɥɨɜɚɪɧɨɣ ɡɚɦɟɧɵ, ɚ ɱɟɪɟɡ ɤɨɞɢɪɨɜɚɧɢɟ ɤɚɤ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ ɥɢɬɟɪɚɥɨɜ? Ʉɚɤɢɦ ɨɛɪɚɡɨɦ ɷɬɨ ɫɜɹɡɚɧɨ ɫ ɜɟɥɢɱɢɧɨɣ ɫɦɟɳɟɧɢɹ ɮɪɚɡɵ, ɫɨɜɩɚɞɚɸɳɟɣ ɫɨ ɫɬɪɨɤɨɣ? 5. ɉɪɢɜɟɞɢɬɟ ɩɪɢɦɟɪ ɛɥɨɤɚ ɞɚɧɧɵɯ, ɤɨɬɨɪɵɟ ɜ ɨɛɳɟɦ ɫɥɭɱɚɟ ɜɵɝɨɞɧɟɟ ɫɠɢɦɚɬɶ ɚɥɝɨɪɢɬɦɨɦ ɫɟɦɟɣɫɬɜɚ LZ77, ɧɟɠɟɥɢ ɫɟɦɟɣɫɬɜɚ LZ78, ɚ ɬɚɤɠɟ ɨɛɪɚɬɧɵɣ ɩɪɢɦɟɪ. ɇɚ ɨɫɧɨɜɚɧɢɢ ɤɚɤɢɯ ɤɪɢɬɟɪɢɟɜ ɦɨɠɧɨ ɫɞɟɥɚɬɶ ɩɪɟɞɜɚɪɢɬɟɥɶɧɵɣ ɜɵɛɨɪ ɦɟɠɞɭ ɚɥɝɨɪɢɬɦɚɦɢ ɫɟɦɟɣɫɬɜɚ LZ77 ɢɥɢ ɫɟɦɟɣɫɬɜɚ LZ78, ɟɫɥɢ ɡɚɞɚɜɚɬɶɫɹ ɬɨɥɶɤɨ ɰɟɥɶɸ ɦɚɤɫɢɦɢɡɚɰɢɢ ɫɬɟɩɟɧɢ ɫɠɚɬɢɹ? 6. ɉɨɱɟɦɭ ɞɢɫɬɪɢɛɭɬɢɜɵ ɩɪɨɝɪɚɦɦɧɨɝɨ ɨɛɟɫɩɟɱɟɧɢɹ ɰɟɥɟɫɨɨɛɪɚɡɧɨ ɚɪɯɢɜɢɪɨɜɚɬɶ ɫ ɩɨɦɨɳɶɸ ɚɥɝɨɪɢɬɦɨɜ ɫɟɦɟɣɫɬɜɚ LZ77? 7. ȼ ɤɚɤɢɯ ɫɥɭɱɚɹɯ ɢɦɟɟɬ ɫɦɵɫɥ ɢɫɩɨɥɶɡɨɜɚɬɶ ɦɟɬɨɞɵ ɤɨɞɢɪɨɜɚɧɢɹ ɰɟɥɵɯ ɱɢɫɟɥ — ɤɨɞɵ ɗɥɢɚɫɚ, Ƚɨɥɨɦɛɚ ɢ ɬ.ɩ. — ɞɥɹ ɫɠɚɬɢɹ ɩɨɬɨɤɨɜ ɫɦɟɳɟɧɢɣ ɢ ɞɥɢɧ ɫɨɜɩɚɞɟɧɢɹ? 8. ɉɪɢɦɟɧɢɦ ɥɢ ɚɥɝɨɪɢɬɦ «ɩɨɱɬɢ ɨɩɬɢɦɚɥɶɧɨɝɨ» ɪɚɡɛɨɪɚ ɞɥɹ ɦɟɬɨɞɨɜ LZ77, ɪɚɫɫɦɨɬɪɟɧɧɵɣ ɜ ɩɭɧɤɬɟ «ɉɭɬɢ ɭɥɭɱɲɟɧɢɹ ɫɠɚɬɢɹ ɞɥɹ ɦɟɬɨɞɨɜ LZ», ɞɥɹ ɨɛɪɚɛɨɬɤɢ ɩɨɬɨɤɨɜ? Ɇɨɠɧɨ ɥɢ ɨɞɧɨɡɧɚɱɧɨ ɫɤɚɡɚɬɶ, ɱɬɨ ɥɸɛɚɹ ɫɬɪɚɬɟɝɢɹ ɩɨɥɭɱɟɧɢɹ ɨɩɬɢɦɚɥɶɧɨɝɨ ɪɚɡɛɨɪɚ ɬɪɟɛɭɟɬ ɩɨɛɥɨɱɧɨɣ ɨɛɪɚɛɨɬɤɢ ɞɚɧɧɵɯ? 9. ɉɨɱɟɦɭ ɩɪɢɦɟɧɟɧɢɟ ɤɨɧɬɟɤɫɬɧɨ-ɡɚɜɢɫɢɦɵɯ ɫɥɨɜɚɪɟɣ ɭɥɭɱɲɚɟɬ ɫɬɟɩɟɧɶ ɫɠɚɬɢɹ ɞɥɹ ɚɥɝɨɪɢɬɦɨɜ ɫɟɦɟɣɫɬɜɚ LZ78 ɡɧɚɱɢɬɟɥɶɧɨ ɛɨɥɶɲɟ, ɱɟɦ ɞɥɹ ɚɥɝɨɪɢɬɦɨɜ ɫɟɦɟɣɫɬɜɚ LZ77? 112 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
Ʌɢɬɟɪɚɬɭɪɚ 1. Ʉɚɞɚɱ Ⱥ.ȼ. ɗɮɮɟɤɬɢɜɧɵɟ ɚɥɝɨɪɢɬɦɵ ɧɟɢɫɤɚɠɚɸɳɟɝɨ ɫɠɚɬɢɹ ɬɟɤɫɬɨɜɨɣ ɢɧɮɨɪɦɚɰɢɢ. — Ⱦɢɫɫɟɪɬɚɰɢɹ ɧɚ ɫɨɢɫɤɚɧɢɟ ɭɱɟɧɨɣ ɫɬɟɩɟɧɢ ɤ.ɮ-ɦ.ɧ. — ɂɧɫɬɢɬɭɬ ɫɢɫɬɟɦ ɢɧɮɨɪɦɚɬɢɤɢ ɢɦ. Ⱥ.ɉ.ȿɪɲɨɜɚ, 1997. 2. Bender P.E., Wolf J.K. New asymptotic bounds and improvements on the Lempel-Ziv data compression algorithm // IEEE Transactions on Information Theory. Vol. 37(3), pp. 721727. May 1991. 3. Deutsch L.P. (1996) DEFLATE Compressed Data Format Specification v.1.3 (RFC1951) http://www.compression.ru/download/articles/lz/rfc1951_pdf.rar 4. Fiala E.R., Greene D.H. Data compression with finite windows. Commun // ACM Vol. 32(4), pp.490-505. Apr. 1989. 5. Hoang D.T., Long P.M., Vitter J.S. Multiple-dictionary compression using partial matching // Proceedings of Data Compression Conference, pp.272-281, Snowbird, Utah, March 1995. 6. Langdon G.G. A note on the Ziv-Lempel model for compressing individual sequences // IEEE Transactions on Information Theory, Vol. 29(2), pp.284-287. March 1983. 7. Larsson J., Moffat A. Offline dictionary-based compression // Proceedings IEEE, Vol. 88(11), pp.1722-1732, Nov. 2000. 8. Matias Y., Rajpoot N., Sahinalp S.C. Implementation and experimental evaluation of flexible parsing for dynamic dictionary based data compression // Proceedings WAE'98, 1998. 9. Rissanen J.J., Langdon G.G. Universal modeling and coding // IEEE Transactions on Information Theory, Vol. 27(1), pp.12-23, Jan. 1981. 10. Storer J.A., Szymanski T.G. Data compression via textual substitution // Journal of ACM, Vol. 29(4), pp.928-951, Oct. 1982. Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X 113 http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
11. Welch T.A. A technique for high-performance data compression // IEEE Computer, Vol. 17(6), pp.8-19, June 1984. 12. Ziv J., Lempel A. A universal algorithm for sequential data compression // IEEE Transactions on Information Theory, Vol. 23(3), pp.337-343, May 1977. 13. Ziv J. and Lempel A. Compression of individual sequences via variable-rate coding // IEEE Transactions on Information Theory, Vol. 24(5), pp.530-536, Sept. 1978.
ɋɩɢɫɨɤ ɚɪɯɢɜɚɬɨɪɨɜ ɢ ɤɨɦɩɪɟɫɫɨɪɨɜ 1. Info-ZIP group. Info-ZIP's portable Zip — C sources. http://www.infozip.org 2. Jung R. ARJ archiver. http://www.arjsoftware.com 3. Jung R. JAR archiver. ftp://ftp.elf.stuba.sk/pub/pc/pack/jar102x.exe 4. Lemke M. ACE archiver. http://www.winace.com 5. Microlog Cabinet Manager 2001 for Win9x/NT — Compression tool for .cab files. ftp://ftp.elf.stuba.sk/pub/pc/pack/cab2001.zip 6. Microsoft Corporation. Cabinet Software Development Tool. http://msdn.microsoft.com/library/en-us/dnsamples/cab-sdk.exe 7. Nico Mak Computing. WinZip archiver. http://www.winzip.com 8. Pavlov I. 7-Zip archiver. http://www.7-zip.org 9. PKWARE Inc. PKZIP archiver. ftp://ftp.elf.stuba.sk/pub/pc/pack/pk250dos.exe 10. Roshal E. RAR for Windows. http://www.rarsoft.com 11. Technelysium Pty Ltd. IMP archiver. ftp://ftp.elf.stuba.sk/pub/pc/pack/imp112.exe 12. Ziganshin B. ARJZ archiver. ftp://ftp.elf.stuba.sk/pub/pc/pack/arjz015.zip
Ƚɥɚɜɚ 4. Ɇɟɬɨɞɵ ɤɨɧɬɟɤɫɬɧɨɝɨ ɦɨɞɟɥɢɪɨɜɚɧɢɹ ɉɪɢɦɟɧɟɧɢɟ ɦɟɬɨɞɨɜ ɤɨɧɬɟɤɫɬɧɨɝɨ ɦɨɞɟɥɢɪɨɜɚɧɢɹ ɞɥɹ ɫɠɚɬɢɹ ɞɚɧɧɵɯ ɨɩɢɪɚɟɬɫɹ ɧɚ ɩɚɪɚɞɢɝɦɭ ɫɠɚɬɢɹ ɫ ɩɨɦɨɳɶɸ «ɭɧɢ114 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɜɟɪɫɚɥɶɧɵɯ ɦɨɞɟɥɢɪɨɜɚɧɢɹ ɢ ɤɨɞɢɪɨɜɚɧɢɹ» (universal modelling and coding), ɩɪɟɞɥɨɠɟɧɧɭɸ Ɋɢɫɫɚɧɟɧɨɦ (Rissanen) ɢ Ʌɷɧɝɞɨɧɨɦ (Langdon) ɜ 1981 ɝɨɞɭ [12]. ȼ ɫɨɨɬɜɟɬɫɬɜɢɢ ɫ ɞɚɧɧɨɣ ɢɞɟɟɣ ɩɪɨɰɟɫɫ ɫɠɚɬɢɹ ɫɨɫɬɨɢɬ ɢɡ ɞɜɭɯ ɫɚɦɨɫɬɨɹɬɟɥɶɧɵɯ ɱɚɫɬɟɣ: • ɦɨɞɟɥɢɪɨɜɚɧɢɟ; • ɤɨɞɢɪɨɜɚɧɢɟ. ɉɨɞ ɦɨɞɟɥɢɪɨɜɚɧɢɟɦ ɩɨɧɢɦɚɟɬɫɹ ɩɨɫɬɪɨɟɧɢɟ ɦɨɞɟɥɢ ɢɧɮɨɪɦɚɰɢɨɧɧɨɝɨ ɢɫɬɨɱɧɢɤɚ, ɩɨɪɨɞɢɜɲɟɝɨ ɫɠɢɦɚɟɦɵɟ ɞɚɧɧɵɟ, ɚ ɩɨɞ ɤɨɞɢɪɨɜɚɧɢɟɦ — ɨɬɨɛɪɚɠɟɧɢɟ ɨɛɪɚɛɚɬɵɜɚɟɦɵɯ ɞɚɧɧɵɯ ɜ ɫɠɚɬɭɸ ɮɨɪɦɭ ɩɪɟɞɫɬɚɜɥɟɧɢɹ ɧɚ ɨɫɧɨɜɚɧɢɢ ɪɟɡɭɥɶɬɚɬɨɜ ɦɨɞɟɥɢɪɨɜɚɧɢɹ (ɪɢɫ. 4.1). «Ʉɨɞɢɪɨɜɳɢɤ» ɫɨɡɞɚɟɬ ɜɵɯɨɞɧɨɣ ɩɨɬɨɤ, ɹɜɥɹɸɳɢɣɫɹ ɤɨɦɩɚɤɬɧɨɣ ɮɨɪɦɨɣ ɩɪɟɞɫɬɚɜɥɟɧɢɹ ɨɛɪɚɛɚɬɵɜɚɟɦɨɣ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ, ɧɚ ɨɫɧɨɜɚɧɢɢ ɢɧɮɨɪɦɚɰɢɢ, ɩɨɫɬɚɜɥɹɟɦɨɣ ɟɦɭ «ɦɨɞɟɥɢɪɨɜɳɢɤɨɦ». Ʉɨɞɟɪ ɢɫɬɨɱɧɢɤɚ (ɤɨɦɩɪɟɫɫɨɪ) ɂɫɬɨɱɧɢɤ ɞɚɧɧɵɯ
ɋɠɢɦɚɟɦɵɟ ɞɚɧɧɵɟ
Ɇɨɞɟɥɢɪɨɜɳɢɤ
ɨɛɧɨɜɢɬɶ ɦɨɞɟɥɶ
ɤɨɞɢɪɨɜɚɬɶ ɫɢɦɜɨɥ ɧɚ ɨɫɧɨɜɚɧɢɢ ɟɝɨ ɜɟɪɨɹɬɧɨɫɬɢ
Ⱦɚɧɧɵɟ ɜ ɤɨɦɩɚɤɬɧɨɦ ɩɪɟɞɫɬɚɜɥɟɧɢɢ
Ʉɨɞɢɪɨɜɳɢɤ
Ɋɢɫ. 4.1. ɋɯɟɦɚ ɩɪɨɰɟɫɫɚ ɫɠɚɬɢɹ ɞɚɧɧɵɯ ɜ ɫɨɨɬɜɟɬɫɬɜɢɢ ɫ ɤɨɧɰɟɩɰɢɟɣ ɭɧɢɜɟɪɫɚɥɶɧɵɯ ɦɨɞɟɥɢɪɨɜɚɧɢɹ ɢ ɤɨɞɢɪɨɜɚɧɢɹ ɋɥɟɞɭɟɬ ɡɚɦɟɬɢɬɶ, ɱɬɨ ɩɨɧɹɬɢɟ «ɤɨɞɢɪɨɜɚɧɢɟ» ɱɚɫɬɨ ɢɫɩɨɥɶɡɭɸɬ ɜ ɲɢɪɨɤɨɦ ɫɦɵɫɥɟ ɞɥɹ ɨɛɨɡɧɚɱɟɧɢɹ ɜɫɟɝɨ ɩɪɨɰɟɫɫɚ ɫɠɚɬɢɹ, ɬ.ɟ. ɜɤɥɸɱɚɹ ɦɨɞɟɥɢɪɨɜɚɧɢɟ ɜ ɞɚɧɧɨɦ ɧɚɦɢ ɨɩɪɟɞɟɥɟɧɢɢ. Ɍɚɤɢɦ ɨɛɪɚɡɨɦ, ɧɟɨɛɯɨɞɢɦɨ ɪɚɡɥɢɱɚɬɶ ɩɨɧɹɬɢɹ ɤɨɞɢɪɨɜɚɧɢɹ ɜ ɲɢɪɨɤɨɦ ɫɦɵɫɥɟ (ɜɟɫɶ ɩɪɨɰɟɫɫ) ɢ ɜ ɭɡɤɨɦ (ɝɟɧɟɪɚɰɢɹ ɩɨɬɨɤɚ ɤɨɞɨɜ ɧɚ ɨɫɧɨɜɚɧɢɢ ɢɧɮɨɪɦɚɰɢɢ ɦɨɞɟɥɢ). ɉɨɧɹɬɢɟ «ɫɬɚɬɢɫɬɢɱɟɫɤɨɟ ɤɨɞɢɪɨɜɚɧɢɟ» ɬɚɤɠɟ ɢɫɩɨɥɶɡɭɟɬɫɹ, ɡɚɱɚɫɬɭɸ ɫ ɫɨɦɧɢɬɟɥɶɄɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X 115 http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɧɨɣ ɤɨɪɪɟɤɬɧɨɫɬɶɸ, ɞɥɹ ɨɛɨɡɧɚɱɟɧɢɹ ɬɨɝɨ ɢɥɢ ɢɧɨɝɨ ɭɪɨɜɧɹ ɤɨɞɢɪɨɜɚɧɢɹ. ȼɨ ɢɡɛɟɠɚɧɢɟ ɩɭɬɚɧɢɰɵ ɪɹɞ ɚɜɬɨɪɨɜ ɩɪɢɦɟɧɹɟɬ ɬɟɪɦɢɧ «ɷɧɬɪɨɩɢɣɧɨɟ ɤɨɞɢɪɨɜɚɧɢɟ» ɞɥɹ ɤɨɞɢɪɨɜɚɧɢɹ ɜ ɭɡɤɨɦ ɫɦɵɫɥɟ. ɗɬɨ ɧɚɢɦɟɧɨɜɚɧɢɟ ɞɚɥɟɤɨ ɨɬ ɫɨɜɟɪɲɟɧɫɬɜɚ ɢ ɜɫɬɪɟɱɚɟɬ ɜɩɨɥɧɟ ɨɛɨɫɧɨɜɚɧɧɭɸ ɤɪɢɬɢɤɭ. Ⱦɚɥɟɟ ɜ ɷɬɨɣ ɝɥɚɜɟ ɩɪɨɰɟɫɫ ɤɨɞɢɪɨɜɚɧɢɹ ɜ ɲɢɪɨɤɨɦ ɫɦɵɫɥɟ ɛɭɞɟɦ ɢɦɟɧɨɜɚɬɶ «ɤɨɞɢɪɨɜɚɧɢɟɦ», ɚ ɜ ɭɡɤɨɦ ɫɦɵɫɥɟ — «ɫɬɚɬɢɫɬɢɱɟɫɤɢɦ ɤɨɞɢɪɨɜɚɧɢɟɦ», ɢɥɢ «ɫɨɛɫɬɜɟɧɧɨ ɤɨɞɢɪɨɜɚɧɢɟɦ». ɂɡ ɬɟɨɪɟɦɵ ɒɟɧɧɨɧɚ ɨ ɤɨɞɢɪɨɜɚɧɢɢ ɢɫɬɨɱɧɢɤɚ [13] ɢɡɜɟɫɬɧɨ, ɱɬɨ ɫɢɦɜɨɥ si, ɜɟɪɨɹɬɧɨɫɬɶ ɩɨɹɜɥɟɧɢɹ ɤɨɬɨɪɨɝɨ ɪɚɜɧɹɟɬɫɹ p(si), ɜɵɝɨɞɧɟɟ ɜɫɟɝɨ ɩɪɟɞɫɬɚɜɥɹɬɶ –log2 p(si) ɛɢɬɚɦɢ, ɩɪɢ ɷɬɨɦ ɫɪɟɞɧɹɹ ɞɥɢɧɚ ɤɨɞɨɜ ɦɨɠɟɬ ɛɵɬɶ ɜɵɱɢɫɥɟɧɚ ɩɨ ɩɪɢɜɨɞɢɜɲɟɣɫɹ ɪɚɧɟɟ ɮɨɪɦɭɥɟ (1). ɉɪɚɤɬɢɱɟɫɤɢ ɜɫɟɝɞɚ ɢɫɬɢɧɧɚɹ ɫɬɪɭɤɬɭɪɚ ɢɫɬɨɱɧɢɤɚ ɫɤɪɵɬɚ, ɩɨɷɬɨɦɭ ɧɟɨɛɯɨɞɢɦɨ ɫɬɪɨɢɬɶ ɦɨɞɟɥɶ ɢɫɬɨɱɧɢɤɚ, ɤɨɬɨɪɚɹ ɩɨɡɜɨɥɢɥɚ ɛɵ ɧɚɦ ɜ ɤɚɠɞɨɣ ɩɨɡɢɰɢɢ ɜɯɨɞɧɨɣ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ ɧɚɣɬɢ ɨɰɟɧɤɭ q(si) ɜɟɪɨɹɬɧɨɫɬɢ ɩɨɹɜɥɟɧɢɹ ɤɚɠɞɨɝɨ ɫɢɦɜɨɥɚ si ɚɥɮɚɜɢɬɚ ɜɯɨɞɧɨɣ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ. Ɉɰɟɧɤɚ ɜɟɪɨɹɬɧɨɫɬɟɣ ɫɢɦɜɨɥɨɜ ɩɪɢ ɦɨɞɟɥɢɪɨɜɚɧɢɢ ɩɪɨɢɡɜɨɞɢɬɫɹ ɧɚ ɨɫɧɨɜɚɧɢɢ ɢɡɜɟɫɬɧɨɣ ɫɬɚɬɢɫɬɢɤɢ ɢ, ɜɨɡɦɨɠɧɨ, ɚɩɪɢɨɪɧɵɯ ɩɪɟɞɩɨɥɨɠɟɧɢɣ, ɩɨɷɬɨɦɭ ɱɚɫɬɨ ɝɨɜɨɪɹɬ ɨ ɡɚɞɚɱɟ ɫɬɚɬɢɫɬɢɱɟɫɤɨɝɨ ɦɨɞɟɥɢɪɨɜɚɧɢɹ. Ɇɨɠɧɨ ɫɤɚɡɚɬɶ, ɱɬɨ ɦɨɞɟɥɢɪɨɜɳɢɤ ɩɪɟɞɫɤɚɡɵɜɚɟɬ ɜɟɪɨɹɬɧɨɫɬɶ ɩɨɹɜɥɟɧɢɹ ɤɚɠɞɨɝɨ ɫɢɦɜɨɥɚ ɜ ɤɚɠɞɨɣ ɩɨɡɢɰɢɢ ɜɯɨɞɧɨɣ ɫɬɪɨɤɢ, ɨɬɫɸɞɚ ɟɳɟ ɨɞɧɨ ɧɚɢɦɟɧɨɜɚɧɢɟ ɷɬɨɝɨ ɤɨɦɩɨɧɟɧɬɚ — «ɩɪɟɞɫɤɚɡɚɬɟɥɶ», ɢɥɢ «ɩɪɟɞɢɤɬɨɪ» (ɨɬ “predictor”). ɇɚ ɷɬɚɩɟ ɫɬɚɬɢɫɬɢɱɟɫɤɨɝɨ ɤɨɞɢɪɨɜɚɧɢɹ ɜɵɩɨɥɧɹɟɬɫɹ ɡɚɦɟɳɟɧɢɟ ɫɢɦɜɨɥɚ si ɫ ɨɰɟɧɤɨɣ ɜɟɪɨɹɬɧɨɫɬɢ ɩɨɹɜɥɟɧɢɹ q(si) ɤɨɞɨɦ ɞɥɢɧɨɣ –log2 q(si) ɛɢɬɨɜ. Ɋɚɫɫɦɨɬɪɢɦ ɩɪɢɦɟɪ. ɉɪɟɞɩɨɥɨɠɢɦ, ɱɬɨ ɦɵ ɫɠɢɦɚɟɦ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɶ ɫɢɦɜɨɥɨɜ ɚɥɮɚɜɢɬɚ {‘0’,’1’}, ɩɨɪɨɠɞɟɧɧɭɸ ɢɫɬɨɱɧɢɤɨɦ ɛɟɡ ɩɚɦɹɬɢ, ɢ ɜɟɪɨɹɬɧɨɫɬɢ ɝɟɧɟɪɚɰɢɢ ɫɢɦɜɨɥɨɜ ɫɥɟɞɭɸɳɢɟ: p(‘0’) = 0.4, p(‘1’) = 0.6. ɉɭɫɬɶ ɧɚɲɚ ɦɨɞɟɥɶ ɞɚɟɬ ɬɚɤɢɟ ɨɰɟɧɤɢ ɜɟɪɨɹɬɧɨɫɬɟɣ: q(‘0’) = 0.35, q(‘1’) = 0.65. ɗɧɬɪɨɩɢɹ H ɢɫɬɨɱɧɢɤɚ ɪɚɜɧɚ
116 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
− p('0' ) log 2 p('0' ) − p('1' ) log 2 p('1' ) = = −0.4 log 2 0.4 − 0.6 log 2 0.6 ≈ 0.971 ɛɢɬɚ. ȿɫɥɢ ɩɨɞɯɨɞɢɬɶ ɮɨɪɦɚɥɶɧɨ, ɬɨ «ɷɧɬɪɨɩɢɹ» ɦɨɞɟɥɢ ɩɨɥɭɱɚɟɬɫɹ ɪɚɜɧɨɣ
− q('0' ) log 2 q('0' ) − q('1' ) log 2 q('1' ) = = −0.35 log 2 0.35 − 0.65 log 2 0.65 ≈ 0.934 ɛɢɬɚ. Ʉɚɡɚɥɨɫɶ ɛɵ, ɱɬɨ ɦɨɞɟɥɶ ɨɛɟɫɩɟɱɢɜɚɟɬ ɥɭɱɲɟɟ ɫɠɚɬɢɟ, ɱɟɦ ɷɬɨ ɩɨɡɜɨɥɹɟɬ ɮɨɪɦɭɥɚ ɒɟɧɧɨɧɚ. ɇɨ ɢɫɬɢɧɧɵɟ ɜɟɪɨɹɬɧɨɫɬɢ ɩɨɹɜɥɟɧɢɹ ɫɢɦɜɨɥɨɜ ɧɟ ɢɡɦɟɧɢɥɢɫɶ! ȿɫɥɢ ɢɫɯɨɞɢɬɶ ɢɡ ɜɟɪɨɹɬɧɨɫɬɟɣ p, ɬɨ ‘0’ ɫɥɟɞɭɟɬ ɤɨɞɢɪɨɜɚɬɶ –log20.4 § 1.322 ɛɢɬɚ, ɚ ɞɥɹ ‘1’ ɧɭɠɧɨ ɨɬɜɨɞɢɬɶ –log20.6 § 0.737 ɛɢɬɚ. Ⱦɥɹ ɨɰɟɧɨɤ ɜɟɪɨɹɬɧɨɫɬɟɣ q ɦɵ ɢɦɟɟɦ –log20.35 § 1.515 ɛɢɬɚ ɢ –log20.65 § 0.621 ɛɢɬɚ ɫɨɨɬɜɟɬɫɬɜɟɧɧɨ. ɉɪɢ ɤɚɠɞɨɦ ɤɨɞɢɪɨɜɚɧɢɢ ɧɚ ɨɫɧɨɜɚɧɢɢ ɢɧɮɨɪɦɚɰɢɢ ɦɨɞɟɥɢ ɜ ɫɥɭɱɚɟ ‘0’ ɦɵ ɛɭɞɟɦ ɬɟɪɹɬɶ 1.515 – 1.322 = 0.193 ɛɢɬɚ, ɚ ɜ ɫɥɭɱɚɟ ‘1’ ɜɵɢɝɪɵɜɚɬɶ 0.737 – 0.621 = 0.116 ɛɢɬɚ. ɋ ɭɱɟɬɨɦ ɜɟɪɨɹɬɧɨɫɬɟɣ ɩɨɹɜɥɟɧɢɹ ɫɢɦɜɨɥɨɜ ɫɪɟɞɧɢɣ ɩɪɨɢɝɪɵɲ ɩɪɢ ɤɚɠɞɨɦ ɤɨɞɢɪɨɜɚɧɢɢ ɫɨɫɬɚɜɢɬ 0.4·0.193 – 0.6·0.116 = 0.008 ɛɢɬɚ. ȼɵɜɨɞ: ɑɟɦ ɬɨɱɧɟɟ ɨɰɟɧɤɚ ɜɟɪɨɹɬɧɨɫɬɟɣ ɩɨɹɜɥɟɧɢɹ ɫɢɦɜɨɥɨɜ, ɬɟɦ ɛɨɥɶɲɟ ɤɨɞɵ ɫɨɨɬɜɟɬɫɬɜɭɸɬ ɨɩɬɢɦɚɥɶɧɵɦ, ɬɟɦ ɥɭɱɲɟ ɫɠɚɬɢɟ. ɉɪɚɜɢɥɶɧɨɫɬɶ ɞɟɤɨɞɢɪɨɜɚɧɢɹ ɨɛɟɫɩɟɱɢɜɚɟɬɫɹ ɢɫɩɨɥɶɡɨɜɚɧɢɟɦ ɬɨɱɧɨ ɬɚɤɨɣ ɠɟ ɦɨɞɟɥɢ, ɱɬɨ ɛɵɥɚ ɩɪɢɦɟɧɟɧɚ ɩɪɢ ɤɨɞɢɪɨɜɚɧɢɢ. ɋɥɟɞɨɜɚɬɟɥɶɧɨ, ɩɪɢ ɦɨɞɟɥɢɪɨɜɚɧɢɢ ɞɥɹ ɫɠɚɬɢɹ ɞɚɧɧɵɯ ɧɟɥɶɡɹ ɩɨɥɶɡɨɜɚɬɶɫɹ ɢɧɮɨɪɦɚɰɢɟɣ, ɤɨɬɨɪɚɹ ɧɟɢɡɜɟɫɬɧɚ ɞɟɤɨɞɟɪɭ. Ɉɫɨɡɧɚɧɢɟ ɞɜɨɣɫɬɜɟɧɧɨɣ ɩɪɢɪɨɞɵ ɩɪɨɰɟɫɫɚ ɫɠɚɬɢɹ ɩɨɡɜɨɥɹɟɬ ɨɫɭɳɟɫɬɜɥɹɬɶ ɞɟɤɨɦɩɨɡɢɰɢɸ ɡɚɞɚɱ ɤɨɦɩɪɟɫɫɢɢ ɞɚɧɧɵɯ ɫɨ ɫɥɨɠɧɨɣ ɫɬɪɭɤɬɭɪɨɣ ɢ ɧɟɬɪɢɜɢɚɥɶɧɵɦɢ ɜɡɚɢɦɨɡɚɜɢɫɢɦɨɫɬɹɦɢ, ɨɛɟɫɩɟɱɢɜɚɬɶ ɨɩɪɟɞɟɥɟɧɧɭɸ ɫɚɦɨɫɬɨɹɬɟɥɶɧɨɫɬɶ ɩɪɨɰɟɞɭɪ, ɪɟɄɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X 117 http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɲɚɸɳɢɯ ɱɚɫɬɧɵɟ ɩɪɨɛɥɟɦɵ, ɫɨɫɪɟɞɨɬɚɱɢɜɚɬɶ ɛɨɥɶɲɟ ɜɧɢɦɚɧɢɹ ɧɚ ɞɟɬɚɥɹɯ ɪɟɚɥɢɡɚɰɢɢ ɤɨɧɤɪɟɬɧɨɝɨ ɷɥɟɦɟɧɬɚ. Ɂɚɞɚɱɚ ɫɬɚɬɢɫɬɢɱɟɫɤɨɝɨ ɤɨɞɢɪɨɜɚɧɢɹ ɛɵɥɚ ɜ ɰɟɥɨɦ ɭɫɩɟɲɧɨ ɪɟɲɟɧɚ ɤ ɧɚɱɚɥɭ 1980-ɯ ɝɨɞɨɜ. Ⱥɪɢɮɦɟɬɢɱɟɫɤɢɣ ɤɨɞɟɪ ɩɨɡɜɨɥɹɟɬ ɫɝɟɧɟɪɢɪɨɜɚɬɶ ɫɠɚɬɭɸ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɶ, ɞɥɢɧɚ ɤɨɬɨɪɨɣ ɨɛɵɱɧɨ ɜɫɟɝɨ ɥɢɲɶ ɧɚ ɞɟɫɹɬɵɟ ɞɨɥɢ ɩɪɨɰɟɧɬɚ ɩɪɟɜɵɲɚɟɬ ɬɟɨɪɟɬɢɱɟɫɤɭɸ ɞɥɢɧɭ, ɪɚɫɫɱɢɬɚɧɧɭɸ ɫ ɩɨɦɨɳɶɸ ɮɨɪɦɭɥɵ (1) (ɫɦ. ɩɭɧɤɬ «Ⱥɪɢɮɦɟɬɢɱɟɫɤɨɟ ɫɠɚɬɢɟ» ɝɥɚɜɵ 1). Ȼɨɥɟɟ ɬɨɝɨ, ɩɪɢɦɟɧɟɧɢɟ ɫɨɜɪɟɦɟɧɧɨɣ ɦɨɞɢɮɢɤɚɰɢɢ ɚɪɢɮɦɟɬɢɱɟɫɤɨɝɨ ɤɨɞɟɪɚ — ɢɧɬɟɪɜɚɥɶɧɨɝɨ ɤɨɞɟɪɚ — ɩɨɡɜɨɥɹɟɬ ɨɫɭɳɟɫɬɜɥɹɬɶ ɫɨɛɫɬɜɟɧɧɨ ɤɨɞɢɪɨɜɚɧɢɟ ɨɱɟɧɶ ɛɵɫɬɪɨ. ɋɤɨɪɨɫɬɶ ɫɬɚɬɢɫɬɢɱɟɫɤɨɝɨ ɤɨɞɢɪɨɜɚɧɢɹ ɫɨɫɬɚɜɥɹɟɬ ɦɢɥɥɢɨɧɵ ɫɢɦɜɨɥɨɜ ɜ ɫɟɤɭɧɞɭ ɧɚ ɫɨɜɪɟɦɟɧɧɵɯ ɉɄ. ȼ ɫɜɟɬɟ ɜɵɲɟɫɤɚɡɚɧɧɨɝɨ, ɩɨɜɵɲɟɧɢɟ ɬɨɱɧɨɫɬɢ ɦɨɞɟɥɟɣ ɹɜɥɹɟɬɫɹ, ɮɚɤɬɢɱɟɫɤɢ, ɟɞɢɧɫɬɜɟɧɧɵɦ ɫɩɨɫɨɛɨɦ ɫɭɳɟɫɬɜɟɧɧɨɝɨ ɭɥɭɱɲɟɧɢɹ ɫɠɚɬɢɹ.
Ʉɥɚɫɫɢɮɢɤɚɰɢɹ ɫɬɪɚɬɟɝɢɣ ɦɨɞɟɥɢɪɨɜɚɧɢɹ ɉɟɪɟɞ ɪɚɫɫɦɨɬɪɟɧɢɟɦ ɤɨɧɬɟɤɫɬɧɵɯ ɦɟɬɨɞɨɜ ɦɨɞɟɥɢɪɨɜɚɧɢɹ ɫɥɟɞɭɟɬ ɫɤɚɡɚɬɶ ɨ ɤɥɚɫɫɢɮɢɤɚɰɢɢ ɫɬɪɚɬɟɝɢɣ ɦɨɞɟɥɢɪɨɜɚɧɢɹ ɢɫɬɨɱɧɢɤɚ ɞɚɧɧɵɯ ɩɨ ɫɩɨɫɨɛɭ ɩɨɫɬɪɨɟɧɢɹ ɢ ɨɛɧɨɜɥɟɧɢɹ ɦɨɞɟɥɢ. ȼɵɞɟɥɹɸɬ ɱɟɬɵɪɟ ɜɚɪɢɚɧɬɚ ɦɨɞɟɥɢɪɨɜɚɧɢɹ: • ɫɬɚɬɢɱɟɫɤɨɟ; • ɩɨɥɭɚɞɚɩɬɢɜɧɨɟ; • ɚɞɚɩɬɢɜɧɨɟ (ɞɢɧɚɦɢɱɟɫɤɨɟ); • ɛɥɨɱɧɨ-ɚɞɚɩɬɢɜɧɨɟ. ɉɪɢ ɫɬɚɬɢɱɟɫɤɨɦ ɦɨɞɟɥɢɪɨɜɚɧɢɢ ɞɥɹ ɥɸɛɵɯ ɨɛɪɚɛɚɬɵɜɚɟɦɵɯ ɞɚɧɧɵɯ ɢɫɩɨɥɶɡɭɟɬɫɹ ɨɞɧɚ ɢ ɬɚ ɠɟ ɦɨɞɟɥɶ. ɂɧɚɱɟ ɝɨɜɨɪɹ, ɧɟ ɩɪɨɢɡɜɨɞɢɬɫɹ ɚɞɚɩɬɚɰɢɹ ɦɨɞɟɥɢ ɤ ɨɫɨɛɟɧɧɨɫɬɹɦ ɫɠɢɦɚɟɦɵɯ ɞɚɧɧɵɯ. Ɉɩɢɫɚɧɢɟ ɡɚɪɚɧɟɟ ɩɨɫɬɪɨɟɧɧɨɣ ɦɨɞɟɥɢ ɯɪɚɧɢɬɫɹ ɜ ɫɬɪɭɤɬɭɪɚɯ ɞɚɧɧɵɯ ɤɨɞɟɪɚ ɢ ɞɟɤɨɞɟɪɚ; ɬɚɤɢɦ ɨɛɪɚɡɨɦ ɞɨɫɬɢɝɚɟɬɫɹ ɨɞɧɨɡɧɚɱɧɨɫɬɶ ɤɨɞɢɪɨɜɚɧɢɹ, ɫ ɨɞɧɨɣ ɫɬɨɪɨɧɵ, ɢ ɨɬɫɭɬɫɬɜɢɟ ɧɟɨɛɯɨɞɢɦɨɫɬɢ ɜ ɹɜɧɨɣ ɩɟɪɟɞɚɱɢ ɦɨɞɟɥɢ, ɫ ɞɪɭɝɨɣ. ɇɟɞɨɫɬɚɬɨɤ ɩɨɞɯɨɞɚ ɬɚɤɠɟ ɨɱɟɜɢɞɟɧ: ɦɵ ɦɨɠɟɦ ɩɨɥɭɱɚɬɶ ɩɥɨɯɨɟ ɫɠɚɬɢɟ ɢ ɞɚɠɟ ɭɜɟɥɢɱɢɜɚɬɶ ɪɚɡɦɟɪ ɩɪɟɞɫɬɚɜɥɟɧɢɹ, ɟɫɥɢ ɨɛɪɚɛɚɬɵɜɚɟɦɵɟ 118 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɞɚɧɧɵɟ ɧɟ ɫɨɨɬɜɟɬɫɬɜɭɸɬ ɜɵɛɪɚɧɧɨɣ ɦɨɞɟɥɢ. ɉɨɷɬɨɦɭ ɬɚɤɚɹ ɫɬɪɚɬɟɝɢɹ ɢɫɩɨɥɶɡɭɟɬɫɹ ɬɨɥɶɤɨ ɜ ɫɩɟɰɢɚɥɢɡɢɪɨɜɚɧɧɵɯ ɩɪɢɥɨɠɟɧɢɹɯ, ɤɨɝɞɚ ɬɢɩ ɫɠɢɦɚɟɦɵɯ ɞɚɧɧɵɯ ɧɟɢɡɦɟɧɟɧ ɢ ɡɚɪɚɧɟɟ ɢɡɜɟɫɬɟɧ. ɉɨɥɭɚɞɚɩɬɢɜɧɨɟ ɫɠɚɬɢɟ ɹɜɥɹɟɬɫɹ ɪɚɡɜɢɬɢɟɦ ɫɬɪɚɬɟɝɢɢ ɫɬɚɬɢɱɟɫɤɨɝɨ ɦɨɞɟɥɢɪɨɜɚɧɢɹ. ȼ ɷɬɨɦ ɫɥɭɱɚɟ ɞɥɹ ɫɠɚɬɢɹ ɡɚɞɚɧɧɨɣ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ ɜɵɛɢɪɚɟɬɫɹ ɢɥɢ ɫɬɪɨɢɬɫɹ ɦɨɞɟɥɶ ɧɚ ɨɫɧɨɜɚɧɢɢ ɚɧɚɥɢɡɚ ɢɦɟɧɧɨ ɨɛɪɚɛɚɬɵɜɚɟɦɵɯ ɞɚɧɧɵɯ. ɉɨɧɹɬɧɨ, ɱɬɨ ɤɨɞɟɪ ɞɨɥɠɟɧ ɩɟɪɟɞɚɜɚɬɶ ɞɟɤɨɞɟɪɭ ɧɟ ɬɨɥɶɤɨ ɡɚɤɨɞɢɪɨɜɚɧɧɵɟ ɞɚɧɧɵɟ, ɧɨ ɢ ɨɩɢɫɚɧɢɟ ɢɫɩɨɥɶɡɨɜɚɧɧɨɣ ɦɨɞɟɥɢ. ȿɫɥɢ ɦɨɞɟɥɶ ɜɵɛɢɪɚɟɬɫɹ ɢɡ ɡɚɪɚɧɟɟ ɫɨɡɞɚɧɧɵɯ ɢ ɢɡɜɟɫɬɧɵɯ ɤɚɤ ɤɨɞɟɪɭ, ɬɚɤ ɢ ɞɟɤɨɞɟɪɭ, ɬɨ ɷɬɨ ɩɪɨɫɬɨ ɩɨɪɹɞɤɨɜɵɣ ɧɨɦɟɪ ɦɨɞɟɥɢ. ɂɧɚɱɟ, ɟɫɥɢ ɦɨɞɟɥɶ ɛɵɥɚ ɧɚɫɬɪɨɟɧɚ ɢɥɢ ɩɨɫɬɪɨɟɧɚ ɩɪɢ ɤɨɞɢɪɨɜɚɧɢɢ, ɬɨ ɧɟɨɛɯɨɞɢɦɨ ɩɟɪɟɞɚɜɚɬɶ ɥɢɛɨ ɡɧɚɱɟɧɢɹ ɩɚɪɚɦɟɬɪɨɜ ɧɚɫɬɪɨɣɤɢ, ɥɢɛɨ ɦɨɞɟɥɶ ɩɨɥɧɨɫɬɶɸ. ȼ ɨɛɳɟɦ ɫɥɭɱɚɟ ɩɨɥɭɚɞɚɩɬɢɜɧɵɣ ɩɨɞɯɨɞ ɞɚɟɬ ɥɭɱɲɟɟ ɫɠɚɬɢɟ, ɱɟɦ ɫɬɚɬɢɱɟɫɤɢɣ, ɬ.ɤ. ɨɛɟɫɩɟɱɢɜɚɟɬ ɩɪɢɫɩɨɫɨɛɥɟɧɢɟ ɤ ɩɪɢɪɨɞɟ ɨɛɪɚɛɚɬɵɜɚɟɦɵɯ ɞɚɧɧɵɯ, ɭɦɟɧɶɲɚɹ ɜɟɪɨɹɬɧɨɫɬɶ ɡɧɚɱɢɬɟɥɶɧɨɣ ɪɚɡɧɢɰɵ ɦɟɠɞɭ ɩɪɟɞɫɤɚɡɚɧɢɹɦɢ ɦɨɞɟɥɢ ɢ ɪɟɚɥɶɧɵɦ ɩɨɜɟɞɟɧɢɟɦ ɩɨɬɨɤɚ ɞɚɧɧɵɯ. Ⱥɞɚɩɬɢɜɧɨɟ ɦɨɞɟɥɢɪɨɜɚɧɢɟ ɹɜɥɹɟɬɫɹ ɟɫɬɟɫɬɜɟɧɧɨɣ ɩɪɨɬɢɜɨɩɨɥɨɠɧɨɫɬɶɸ ɫɬɚɬɢɱɟɫɤɨɣ ɫɬɪɚɬɟɝɢɢ. ɉɨ ɦɟɪɟ ɤɨɞɢɪɨɜɚɧɢɹ ɦɨɞɟɥɶ ɢɡɦɟɧɹɟɬɫɹ ɩɨ ɡɚɞɚɧɧɨɦɭ ɚɥɝɨɪɢɬɦɭ ɩɨɫɥɟ ɫɠɚɬɢɹ ɤɚɠɞɨɝɨ ɫɢɦɜɨɥɚ. Ɉɞɧɨɡɧɚɱɧɨɫɬɶ ɞɟɤɨɞɢɪɨɜɚɧɢɹ ɞɨɫɬɢɝɚɟɬɫɹ ɬɟɦ, ɱɬɨ, ɜɨ-ɩɟɪɜɵɯ, ɢɡɧɚɱɚɥɶɧɨ ɤɨɞɟɪ ɢ ɞɟɤɨɞɟɪ ɢɦɟɸɬ ɢɞɟɧɬɢɱɧɭɸ ɢ ɨɛɵɱɧɨ ɨɱɟɧɶ ɩɪɨɫɬɭɸ ɦɨɞɟɥɶ ɢ, ɜɨ-ɜɬɨɪɵɯ, ɦɨɞɢɮɢɤɚɰɢɹ ɦɨɞɟɥɢ ɩɪɢ ɫɠɚɬɢɢ ɢ ɪɚɡɠɚɬɢɢ ɨɫɭɳɟɫɬɜɥɹɟɬɫɹ ɨɞɢɧɚɤɨɜɵɦ ɨɛɪɚɡɨɦ. Ɉɩɵɬ ɢɫɩɨɥɶɡɨɜɚɧɢɹ ɦɨɞɟɥɟɣ ɪɚɡɥɢɱɧɵɯ ɬɢɩɨɜ ɩɨɤɚɡɵɜɚɟɬ, ɱɬɨ ɚɞɚɩɬɢɜɧɨɟ ɦɨɞɟɥɢɪɨɜɚɧɢɟ ɹɜɥɹɟɬɫɹ ɧɟ ɬɨɥɶɤɨ ɷɥɟɝɚɧɬɧɨɣ ɬɟɯɧɢɤɨɣ, ɧɨ ɢ ɨɛɟɫɩɟɱɢɜɚɟɬ, ɩɨ ɤɪɚɣɧɟɣ ɦɟɪɟ, ɧɟ ɯɭɞɲɟɟ ɫɠɚɬɢɟ, ɱɟɦ ɩɨɥɭɚɞɚɩɬɢɜɧɨɟ ɦɨɞɟɥɢɪɨɜɚɧɢɟ. ɉɨɧɹɬɧɨ, ɱɬɨ ɟɫɥɢ ɫɬɨɢɬ ɡɚɞɚɱɚ ɫɨɡɞɚɧɢɹ «ɭɧɢɜɟɪɫɚɥɶɧɨɝɨ» ɤɨɦɩɪɟɫɫɨɪɚ ɞɥɹ ɫɠɚɬɢɹ ɞɚɧɧɵɯ ɧɟɫɯɨɞɧɵɯ ɬɢɩɨɜ, ɬɨ ɚɞɚɩɬɢɜɧɵɣ ɩɨɞɯɨɞ ɹɜɥɹɟɬɫɹ ɟɫɬɟɫɬɜɟɧɧɵɦ ɜɵɛɨɪɨɦ ɪɚɡɪɚɛɨɬɱɢɤɚ. Ȼɥɨɱɧɨ-ɚɞɚɩɬɢɜɧɨɟ ɦɨɞɟɥɢɪɨɜɚɧɢɟ ɦɨɠɧɨ ɪɚɫɫɦɚɬɪɢɜɚɬɶ ɤɚɤ ɱɚɫɬɧɵɣ ɫɥɭɱɚɣ ɚɞɚɩɬɢɜɧɨɣ ɫɬɪɚɬɟɝɢɢ (ɢɥɢ ɧɚɨɛɨɪɨɬ, ɱɬɨ ɫɭɬɢ Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X 119 http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɞɟɥɚ ɧɟ ɦɟɧɹɟɬ). ȼ ɡɚɜɢɫɢɦɨɫɬɢ ɨɬ ɤɨɧɤɪɟɬɧɨɝɨ ɚɥɝɨɪɢɬɦɚ ɨɛɧɨɜɥɟɧɢɹ ɦɨɞɟɥɢ, ɨɰɟɧɤɢ ɜɟɪɨɹɬɧɨɫɬɟɣ ɫɢɦɜɨɥɨɜ, ɦɟɬɨɞɚ ɫɬɚɬɢɫɬɢɱɟɫɤɨɝɨ ɤɨɞɢɪɨɜɚɧɢɹ ɢ ɫɚɦɢɯ ɞɚɧɧɵɯ ɢɡɦɟɧɟɧɢɟ ɦɨɞɟɥɢ ɩɨɫɥɟ ɨɛɪɚɛɨɬɤɢ ɤɚɠɞɨɝɨ ɫɢɦɜɨɥɚ ɦɨɠɟɬ ɛɵɬɶ ɫɨɩɪɹɠɟɧɨ ɫɨ ɫɥɟɞɭɸɳɢɦɢ ɧɟɩɪɢɹɬɧɨɫɬɹɦɢ: • ɩɨɬɟɪɹ ɭɫɬɨɣɱɢɜɨɫɬɢ (ɪɨɛɚɫɬɧɨɫɬɢ) ɨɰɟɧɨɤ, ɟɫɥɢ ɞɚɧɧɵɟ «ɡɚɲɭɦɥɟɧɵ», ɢɥɢ ɢɦɟɸɬɫɹ ɡɧɚɱɢɬɟɥɶɧɵɟ ɥɨɤɚɥɶɧɵɟ ɢɡɦɟɧɟɧɢɹ ɫɬɚɬɢɫɬɢɱɟɫɤɢɯ ɜɡɚɢɦɨɫɜɹɡɟɣ ɦɟɠɞɭ ɫɢɦɜɨɥɚɦɢ ɨɛɪɚɛɚɬɵɜɚɟɦɨɝɨ ɩɨɬɨɤɚ; ɢɧɚɱɟ ɝɨɜɨɪɹ, ɱɟɪɟɫɱɭɪ ɛɵɫɬɪɚɹ, «ɚɝɪɟɫɫɢɜɧɚɹ» ɚɞɚɩɬɚɰɢɹ ɦɨɞɟɥɢ ɦɨɠɟɬ ɩɪɢɜɨɞɢɬɶ ɤ ɭɯɭɞɲɟɧɢɸ ɬɨɱɧɨɫɬɢ ɨɰɟɧɨɤ; • ɛɨɥɶɲɢɟ ɜɵɱɢɫɥɢɬɟɥɶɧɵɟ ɪɚɫɯɨɞɵ ɧɚ ɨɛɧɨɜɥɟɧɢɟ ɦɨɞɟɥɢ (ɤɚɤ ɩɪɢɦɟɪ — ɜ ɫɥɭɱɚɟ ɚɞɚɩɬɢɜɧɨɝɨ ɤɨɞɢɪɨɜɚɧɢɹ ɩɨ ɚɥɝɨɪɢɬɦɭ ɏɚɮɮɦɚɧɚ); • ɛɨɥɶɲɢɟ ɪɚɫɯɨɞɵ ɩɚɦɹɬɢ ɞɥɹ ɯɪɚɧɟɧɢɹ ɫɬɪɭɤɬɭɪ ɞɚɧɧɵɯ, ɨɛɟɫɩɟɱɢɜɚɸɳɢɯ ɛɵɫɬɪɭɸ ɦɨɞɢɮɢɤɚɰɢɸ ɦɨɞɟɥɢ. ɉɨɷɬɨɦɭ ɨɛɧɨɜɥɟɧɢɟ ɦɨɞɟɥɢ ɦɨɠɟɬ ɜɵɩɨɥɧɹɬɶɫɹ ɩɨɫɥɟ ɨɛɪɚɛɨɬɤɢ ɰɟɥɨɝɨ ɛɥɨɤɚ ɫɢɦɜɨɥɨɜ, ɜ ɨɛɳɟɦ ɫɥɭɱɚɟ ɩɟɪɟɦɟɧɧɨɣ ɞɥɢɧɵ. Ⱦɥɹ ɨɛɟɫɩɟɱɟɧɢɹ ɩɪɚɜɢɥɶɧɨɫɬɢ ɪɚɡɠɚɬɢɹ ɞɟɤɨɞɟɪ ɞɨɥɠɟɧ ɜɵɩɨɥɧɹɬɶ ɬɚɤɭɸ ɠɟ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɶ ɞɟɣɫɬɜɢɣ ɩɨ ɨɛɧɨɜɥɟɧɢɸ ɦɨɞɟɥɢ, ɱɬɨ ɢ ɤɨɞɟɪ, ɥɢɛɨ ɤɨɞɟɪɭ ɧɟɨɛɯɨɞɢɦɨ ɩɟɪɟɞɚɜɚɬɶ ɜɦɟɫɬɟ ɫɨ ɫɠɚɬɵɦɢ ɞɚɧɧɵɦɢ ɢɧɫɬɪɭɤɰɢɢ ɩɨ ɦɨɞɢɮɢɤɚɰɢɢ ɦɨɞɟɥɢ. ɉɨɫɥɟɞɧɢɣ ɜɚɪɢɚɧɬ ɞɨɫɬɚɬɨɱɧɨ ɱɚɫɬɨ ɢɫɩɨɥɶɡɭɟɬɫɹ ɩɪɢ ɛɥɨɱɧɨ-ɚɞɚɩɬɢɜɧɨɦ ɦɨɞɟɥɢɪɨɜɚɧɢɢ ɞɥɹ ɭɫɤɨɪɟɧɢɹ ɩɪɨɰɟɫɫɚ ɞɟɤɨɞɢɪɨɜɚɧɢɹ ɜ ɭɳɟɪɛ ɤɨɷɮɮɢɰɢɟɧɬɭ ɫɠɚɬɢɹ. ɉɨɧɹɬɧɨ, ɱɬɨ ɩɪɢɜɟɞɟɧɧɚɹ ɤɥɚɫɫɢɮɢɤɚɰɢɹ ɹɜɥɹɟɬɫɹ ɞɨ ɧɟɤɨɬɨɪɨɣ ɫɬɟɩɟɧɢ ɚɛɫɬɪɚɤɬɧɨɣ, ɢ ɧɚ ɩɪɚɤɬɢɤɟ ɱɚɫɬɨ ɢɫɩɨɥɶɡɭɸɬ ɝɢɛɪɢɞɧɵɟ ɫɯɟɦɵ.
Ʉɨɧɬɟɤɫɬɧɨɟ ɦɨɞɟɥɢɪɨɜɚɧɢɟ ɂɬɚɤ, ɧɚɦ ɧɟɨɛɯɨɞɢɦɨ ɪɟɲɢɬɶ ɡɚɞɚɱɭ ɨɰɟɧɤɢ ɜɟɪɨɹɬɧɨɫɬɟɣ ɩɨɹɜɥɟɧɢɹ ɫɢɦɜɨɥɨɜ ɜ ɤɚɠɞɨɣ ɩɨɡɢɰɢɢ ɨɛɪɚɛɚɬɵɜɚɟɦɨɣ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ. Ⱦɥɹ ɬɨɝɨ ɱɬɨɛɵ ɪɚɡɠɚɬɢɟ ɩɪɨɢɡɨɲɥɨ ɛɟɡ ɩɨɬɟɪɶ, ɦɵ ɦɨɠɟɦ ɩɨɥɶɡɨɜɚɬɶɫɹ ɬɨɥɶɤɨ ɬɨɣ ɢɧɮɨɪɦɚɰɢɟɣ, ɤɨɬɨɪɚɹ ɜ ɩɨɥɧɨɣ ɦɟɪɟ ɢɡɜɟɫɬɧɚ ɤɚɤ ɤɨɞɟɪɭ, ɬɚɤ ɢ ɞɟɤɨɞɟɪɭ. Ɉɛɵɱɧɨ ɷɬɨ 120 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɨɡɧɚɱɚɟɬ, ɱɬɨ ɨɰɟɧɤɚ ɜɟɪɨɹɬɧɨɫɬɢ ɨɱɟɪɟɞɧɨɝɨ ɫɢɦɜɨɥɚ ɞɨɥɠɧɚ ɡɚɜɢɫɟɬɶ ɬɨɥɶɤɨ ɨɬ ɫɜɨɣɫɬɜ ɭɠɟ ɨɛɪɚɛɨɬɚɧɧɨɝɨ ɛɥɨɤɚ ɞɚɧɧɵɯ. ɉɨɠɚɥɭɣ, ɧɚɢɛɨɥɟɟ ɩɪɨɫɬɨɣ ɫɩɨɫɨɛ ɨɰɟɧɤɢ ɪɟɚɥɢɡɭɟɬɫɹ ɫ ɩɨɦɨɳɶɸ ɩɨɥɭɚɞɚɩɬɢɜɧɨɝɨ ɦɨɞɟɥɢɪɨɜɚɧɢɹ ɢ ɡɚɤɥɸɱɚɟɬɫɹ ɜ ɩɪɟɞɜɚɪɢɬɟɥɶɧɨɦ ɩɨɞɫɱɟɬɟ ɛɟɡɭɫɥɨɜɧɨɣ ɱɚɫɬɨɬɵ ɩɨɹɜɥɟɧɢɹ ɫɢɦɜɨɥɨɜ ɜ ɫɠɢɦɚɟɦɨɦ ɛɥɨɤɟ. ɉɨɥɭɱɟɧɧɨɟ ɪɚɫɩɪɟɞɟɥɟɧɢɟ ɜɟɪɨɹɬɧɨɫɬɟɣ ɢɫɩɨɥɶɡɭɟɬɫɹ ɞɥɹ ɫɬɚɬɢɫɬɢɱɟɫɤɨɝɨ ɤɨɞɢɪɨɜɚɧɢɹ ɜɫɟɯ ɫɢɦɜɨɥɨɜ ɛɥɨɤɚ. ȿɫɥɢ, ɧɚɩɪɢɦɟɪ, ɬɚɤɭɸ ɦɨɞɟɥɶ ɩɪɢɦɟɧɢɬɶ ɞɥɹ ɫɠɚɬɢɹ ɬɟɤɫɬɚ ɧɚ ɪɭɫɫɤɨɦ ɹɡɵɤɟ, ɬɨ ɜ ɫɪɟɞɧɟɦ ɧɚ ɤɨɞɢɪɨɜɚɧɢɟ ɤɚɠɞɨɝɨ ɫɢɦɜɨɥɚ ɛɭɞɟɬ ɩɨɬɪɚɱɟɧɨ ɩɪɢɦɟɪɧɨ 4.5 ɛɢɬɚ. ɗɬɨ ɡɧɚɱɟɧɢɟ ɹɜɥɹɟɬɫɹ ɫɪɟɞɧɟɣ ɞɥɢɧɨɣ ɤɨɞɨɜ ɞɥɹ ɦɨɞɟɥɢ, ɛɚɡɢɪɭɸɳɟɣɫɹ ɧɚ ɢɫɩɨɥɶɡɨɜɚɧɢɢ ɛɟɡɭɫɥɨɜɧɨɝɨ ɪɚɫɩɪɟɞɟɥɟɧɢɹ ɜɟɪɨɹɬɧɨɫɬɟɣ ɛɭɤɜ ɜ ɬɟɤɫɬɟ. Ɂɚɦɟɬɢɦ, ɱɬɨ ɭɠɟ ɜ ɷɬɨɦ ɩɪɨɫɬɨɦ ɫɥɭɱɚɟ ɞɨɫɬɢɝɚɟɬɫɹ ɫɬɟɩɟɧɶ ɫɠɚɬɢɹ 1.5 ɩɨ ɨɬɧɨɲɟɧɢɸ ɤ ɬɪɢɜɢɚɥɶɧɨɦɭ ɤɨɞɢɪɨɜɚɧɢɸ, ɤɨɝɞɚ ɜɫɟɦ ɫɢɦɜɨɥɚɦ ɧɚɡɧɚɱɚɸɬɫɹ ɤɨɞɵ ɨɞɢɧɚɤɨɜɨɣ ɞɥɢɧɵ. Ⱦɟɣɫɬɜɢɬɟɥɶɧɨ, ɪɚɡɦɟɪ ɚɥɮɚɜɢɬɚ ɪɭɫɫɤɨɝɨ ɬɟɤɫɬɚ ɩɪɟɜɵɲɚɟɬ 64, ɧɨ ɦɟɧɶɲɟ 128 ɡɧɚɤɨɜ (ɫɬɪɨɱɧɵɟ ɢ ɡɚɝɥɚɜɧɵɟ ɛɭɤɜɵ, ɡɧɚɤɢ ɩɪɟɩɢɧɚɧɢɹ, ɩɪɨɛɟɥ), ɱɬɨ ɬɪɟɛɭɟɬ 7-ɛɢɬɨɜɵɯ ɤɨɞɨɜ. Ⱥɧɚɥɢɡ ɪɚɫɩɪɨɫɬɪɚɧɟɧɧɵɯ ɬɢɩɨɜ ɞɚɧɧɵɯ — ɧɚɩɪɢɦɟɪ, ɬɟɯ ɠɟ ɬɟɤɫɬɨɜ ɧɚ ɟɫɬɟɫɬɜɟɧɧɵɯ ɹɡɵɤɚɯ, — ɜɵɹɜɥɹɟɬ ɫɢɥɶɧɭɸ ɡɚɜɢɫɢɦɨɫɬɶ ɜɟɪɨɹɬɧɨɫɬɢ ɩɨɹɜɥɟɧɢɹ ɫɢɦɜɨɥɨɜ ɨɬ ɧɟɩɨɫɪɟɞɫɬɜɟɧɧɨ ɢɦ ɩɪɟɞɲɟɫɬɜɭɸɳɢɯ. ɂɧɚɱɟ ɝɨɜɨɪɹ, ɛɨɥɶɲɚɹ ɱɚɫɬɶ ɞɚɧɧɵɯ, ɫ ɤɨɬɨɪɵɦɢ ɦɵ ɫɬɚɥɤɢɜɚɟɦɫɹ, ɩɨɪɨɠɞɚɟɬɫɹ ɢɫɬɨɱɧɢɤɚɦɢ ɫ ɩɚɦɹɬɶɸ. Ⱦɨɩɭɫɬɢɦ, ɧɚɦ ɢɡɜɟɫɬɧɨ, ɱɬɨ ɫɠɢɦɚɟɦɵɣ ɛɥɨɤ ɹɜɥɹɟɬɫɹ ɬɟɤɫɬɨɦ ɧɚ ɪɭɫɫɤɨɦ ɹɡɵɤɟ. ȿɫɥɢ, ɧɚɩɪɢɦɟɪ, ɫɬɪɨɤɚ ɢɡ ɬɪɟɯ ɬɨɥɶɤɨ ɱɬɨ ɨɛɪɚɛɨɬɚɧɧɵɯ ɫɢɦɜɨɥɨɜ ɪɚɜɧɚ “_ɰɵ” (ɩɨɞɱɟɪɤɢɜɚɧɢɟɦ ɡɞɟɫɶ ɢ ɞɚɥɟɟ ɨɛɨɡɧɚɱɚɟɬɫɹ ɩɪɨɛɟɥ), ɬɨ ɬɟɤɭɳɢɣ ɫɢɦɜɨɥ ɫɤɨɪɟɟ ɜɫɟɝɨ ɜɯɨɞɢɬ ɜ ɫɥɟɞɭɸɳɭɸ ɝɪɭɩɩɭ: ‘ɝ’ («ɰɵɝɚɧ»), ‘ɤ’ («ɰɵɤɚɬɶ»), ‘ɩ’ («ɰɵɩɨɱɤɢ»), ‘ɰ’ («ɰɵɰ»). ɂɥɢ, ɜ ɫɥɭɱɚɟ ɚɧɚɥɢɡɚ ɫɪɚɡɭ ɧɟɫɤɨɥɶɤɢɯ ɫɥɨɜ, ɟɫɥɢ ɩɪɟɞɵɞɭɳɚɹ ɫɬɪɨɤɚ ɪɚɜɧɚ “ȼɫɬɚɜɚɣ,_ɩɪɨɤɥɹɬɶɟɦ_ɡɚɤɥɟɣɦɟɧɧɵɣ,”, ɬɨ ɩɪɨɞɨɥɠɟɧɢɟɦ ɹɜɧɨ ɛɭɞɟɬ “ɜɟɫɶ_ɦɢɪ_”. ɋɥɟɞɨɜɚɬɟɥɶɧɨ, ɭɱɟɬ ɡɚɜɢɫɢɦɨɫɬɢ ɱɚɫɬɨɬɵ ɩɨɹɜɥɟɧɢɹ ɫɢɦɜɨɥɚ (ɜ ɨɛɳɟɦ ɫɥɭɱɚɟ — ɛɥɨɤɚ ɫɢɦɜɨɥɨɜ) ɨɬ ɩɪɟɞɵɞɭɳɢɯ ɞɨɥɠɟɧ ɞɚɜɚɬɶ ɛɨɥɟɟ ɬɨɱɧɵɟ ɨɰɟɧɤɢ ɢ, ɜ ɤɨɧɟɱɧɨɦ ɫɱɟɬɟ, ɥɭɱɲɟɟ ɫɠɚɬɢɟ. Ⱦɟɣɫɬɜɢɬɟɥɶɧɨ, ɜ ɫɥɭɱɚɟ ɩɨɫɢɦɜɨɥɶɧɨɝɨ Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X 121 http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɤɨɞɢɪɨɜɚɧɢɹ ɩɪɢ ɢɫɩɨɥɶɡɨɜɚɧɢɢ ɢɧɮɨɪɦɚɰɢɢ ɨɛ ɨɞɧɨɦ ɧɟɩɨɫɪɟɞɫɬɜɟɧɧɨ ɩɪɟɞɲɟɫɬɜɭɸɳɟɦ ɫɢɦɜɨɥɟ ɞɨɫɬɢɝɚɟɬɫɹ ɫɪɟɞɧɹɹ ɞɥɢɧɚ ɤɨɞɨɜ ɜ 3.6 ɛɢɬɚ ɞɥɹ ɪɭɫɫɤɢɯ ɬɟɤɫɬɨɜ, ɩɪɢ ɭɱɟɬɟ ɞɜɭɯ ɩɨɫɥɟɞɧɢɯ — ɭɠɟ ɩɨɪɹɞɤɚ 3.2 ɛɢɬɚ. ȼ ɩɟɪɜɨɦ ɫɥɭɱɚɟ ɦɨɞɟɥɢɪɭɸɬɫɹ ɭɫɥɨɜɧɵɟ ɪɚɫɩɪɟɞɟɥɟɧɢɹ ɜɟɪɨɹɬɧɨɫɬɟɣ ɫɢɦɜɨɥɨɜ, ɡɚɜɢɫɹɳɢɟ ɨɬ ɡɧɚɱɟɧɢɹ ɫɬɪɨɤɢ ɢɡ ɨɞɧɨɝɨ ɧɟɩɨɫɪɟɞɫɬɜɟɧɧɨ ɩɪɟɞɲɟɫɬɜɭɸɳɟɝɨ ɫɢɦɜɨɥɚ, ɜɨ ɜɬɨɪɨɦ — ɡɚɜɢɫɹɳɢɟ ɨɬ ɫɬɪɨɤɢ ɢɡ ɞɜɭɯ ɩɪɟɞɲɟɫɬɜɭɸɳɢɯ ɫɢɦɜɨɥɨɜ. Ʌɸɛɨɩɵɬɧɨ, ɱɬɨ ɦɨɞɟɥɢ, ɨɩɟɪɢɪɭɸɳɢɟ ɛɟɡɭɫɥɨɜɧɵɦɢ ɱɚɫɬɨɬɚɦɢ ɢ ɱɚɫɬɨɬɚɦɢ ɜ ɡɚɜɢɫɢɦɨɫɬɢ ɨɬ ɨɞɧɨɝɨ ɩɪɟɞɲɟɫɬɜɭɸɳɟɝɨ ɫɢɦɜɨɥɚ, ɞɚɸɬ ɩɪɢɦɟɪɧɨ ɨɞɢɧɚɤɨɜɵɟ ɪɟɡɭɥɶɬɚɬɵ ɞɥɹ ɜɫɟɯ ɟɜɪɨɩɟɣɫɤɢɯ ɹɡɵɤɨɜ (ɡɚ ɢɫɤɥɸɱɟɧɢɟɦ, ɛɵɬɶ ɦɨɠɟɬ, ɫɚɦɵɯ ɷɤɡɨɬɢɱɟɫɤɢɯ) — 4.5 ɢ 3.6 ɛɢɬɚ ɫɨɨɬɜɟɬɫɬɜɟɧɧɨ.
ɍɥɭɱɲɟɧɢɟ ɫɠɚɬɢɹ ɩɪɢ ɭɱɟɬɟ ɩɪɟɞɵɞɭɳɢɯ ɷɥɟɦɟɧɬɨɜ (ɩɢɤɫɟɥɨɜ, ɫɷɦɩɥɨɜ, ɨɬɫɱɟɬɨɜ, ɱɢɫɟɥ) ɨɬɦɟɱɚɟɬɫɹ ɢ ɩɪɢ ɨɛɪɚɛɨɬɤɟ ɞɚɧɧɵɯ ɞɪɭɝɢɯ ɪɚɫɩɪɨɫɬɪɚɧɟɧɧɵɯ ɬɢɩɨɜ: ɨɛɴɟɤɬɧɵɯ ɮɚɣɥɨɜ, ɢɡɨɛɪɚɠɟɧɢɣ, ɚɭɞɢɨɡɚɩɢɫɟɣ, ɬɚɛɥɢɰ ɱɢɫɟɥ. ɌȿɊɆɂɇɈɅɈȽɂə
ɉɨɞ ɤɨɧɬɟɤɫɬɧɵɦ ɦɨɞɟɥɢɪɨɜɚɧɢɟɦ ɛɭɞɟɦ ɩɨɧɢɦɚɬɶ ɨɰɟɧɤɭ ɜɟɪɨɹɬɧɨɫɬɢ ɩɨɹɜɥɟɧɢɹ ɫɢɦɜɨɥɚ (ɷɥɟɦɟɧɬɚ, ɩɢɤɫɟɥɚ, ɫɷɦɩɥɚ, ɨɬɫɱɟɬɚ ɢ ɞɚɠɟ ɧɚɛɨɪɚ ɤɚɱɟɫɬɜɟɧɧɨ ɪɚɡɧɵɯ ɨɛɴɟɤɬɨɜ) ɜ ɡɚɜɢɫɢɦɨɫɬɢ ɨɬ ɧɟɩɨɫɪɟɞɫɬɜɟɧɧɨ ɟɦɭ ɩɪɟɞɲɟɫɬɜɭɸɳɢɯ, ɢɥɢ ɤɨɧɬɟɤɫɬɚ. Ɂɚɦɟɬɢɦ, ɱɬɨ ɜ ɛɵɬɭ ɩɨɧɹɬɢɟ «ɤɨɧɬɟɤɫɬ» ɨɛɵɱɧɨ ɢɫɩɨɥɶɡɭɟɬɫɹ ɜ ɝɥɨɛɚɥɶɧɨɦ ɡɧɚɱɟɧɢɢ — ɤɚɤ ɫɨɜɨɤɭɩɧɨɫɬɶ ɫɢɦɜɨɥɨɜ (ɷɥɟɦɟɧɬɨɜ), ɨɤɪɭɠɚɸɳɢɯ ɬɟɤɭɳɢɣ ɨɛɪɚɛɚɬɵɜɚɟɦɵɣ. ɗɬɨ ɤɨɧɬɟɤɫɬ ɜ ɲɢɪɨɤɨɦ ɫɦɵɫɥɟ. ȼɵɞɟɥɹɸɬ ɬɚɤɠɟ «ɥɟɜɨɫɬɨɪɨɧɧɢɟ» ɢ «ɩɪɚɜɨɫɬɨɪɨɧɧɢɟ» ɤɨɧɬɟɤɫɬɵ, ɬ.ɟ. ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ ɫɢɦɜɨɥɨɜ, ɧɟɩɨɫɪɟɞɫɬɜɟɧɧɨ ɩɪɢɦɵɤɚɸɳɢɟ ɤ ɬɟɤɭɳɟɦɭ ɫɢɦɜɨɥɭ ɫɥɟɜɚ ɢ ɫɩɪɚɜɚ ɫɨɨɬɜɟɬɫɬɜɟɧɧɨ. Ɂɞɟɫɶ ɢ ɞɚɥɟɟ ɩɨɞ ɤɨɧɬɟɤɫɬɨɦ ɛɭɞɟɦ ɩɨɧɢɦɚɬɶ ɢɦɟɧɧɨ ɤɥɚɫɫɢɱɟɫɤɢɣ ɥɟɜɨɫɬɨɪɨɧɧɢɣ: ɬɚɤ, ɧɚɩɪɢɦɟɪ, ɞɥɹ ɩɨɫɥɟɞɧɟɝɨ ɫɢɦɜɨɥɚ ‘ɨ’ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ “…ɦɨɥɨɤɨ…” ɤɨɧɬɟɤɫɬɨɦ ɹɜɥɹɟɬɫɹ “…ɦɨɥɨɤ”. ȿɫɥɢ ɞɥɢɧɚ ɤɨɧɬɟɤɫɬɚ ɨɝɪɚɧɢɱɟɧɚ, ɬɨ ɬɚɤɨɣ ɩɨɞɯɨɞ ɛɭɞɟɦ ɧɚɡɵɜɚɬɶ ɤɨɧɬɟɤɫɬɧɵɦ ɦɨɞɟɥɢɪɨɜɚɧɢɟɦ ɨɝɪɚɧɢɱɟɧɧɨɝɨ ɩɨɪɹɞɤɚ 122 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
(finite-context modeling), ɩɪɢ ɷɬɨɦ ɩɨɞ ɩɨɪɹɞɤɨɦ ɩɨɧɢɦɚɟɬɫɹ ɦɚɤɫɢɦɚɥɶɧɚɹ ɞɥɢɧɚ ɢɫɩɨɥɶɡɭɟɦɵɯ ɤɨɧɬɟɤɫɬɨɜ N. ɇɚɩɪɢɦɟɪ, ɩɪɢ ɦɨɞɟɥɢɪɨɜɚɧɢɢ ɩɨɪɹɞɤɚ 3 ɞɥɹ ɩɨɫɥɟɞɧɟɝɨ ɫɢɦɜɨɥɚ ‘ɨ’ ɜ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ “…ɦɨɥɨɤɨ…” ɤɨɧɬɟɤɫɬɨɦ ɦɚɤɫɢɦɚɥɶɧɨɣ ɞɥɢɧɵ 3 ɹɜɥɹɟɬɫɹ ɫɬɪɨɤɚ “ɥɨɤ”. ɉɪɢ ɫɠɚɬɢɢ ɷɬɨɝɨ ɫɢɦɜɨɥɚ ɩɨɞ «ɬɟɤɭɳɢɦɢ ɤɨɧɬɟɤɫɬɚɦɢ» ɦɨɝɭɬ ɩɨɧɢɦɚɬɶɫɹ “ɥɨɤ”, “ɨɤ”, “ɤ”, ɚ ɬɚɤɠɟ ɩɭɫɬɚɹ ɫɬɪɨɤɚ “”. ȼɫɟ ɷɬɢ ɤɨɧɬɟɤɫɬɵ ɞɥɢɧɵ ɨɬ N ɞɨ 0 ɧɚɡɨɜɟɦ ɚɤɬɢɜɧɵɦɢ ɤɨɧɬɟɤɫɬɚɦɢ ɜ ɬɨɦ ɫɦɵɫɥɟ, ɱɬɨ ɩɪɢ ɨɰɟɧɤɟ ɫɢɦɜɨɥɚ ɦɨɠɟɬ ɛɵɬɶ ɢɫɩɨɥɶɡɨɜɚɧɚ ɧɚɤɨɩɥɟɧɧɚɹ ɞɥɹ ɧɢɯ ɫɬɚɬɢɫɬɢɤɚ. Ⱦɚɥɟɟ ɜɦɟɫɬɨ «ɤɨɧɬɟɤɫɬ ɞɥɢɧɵ o, o N» ɦɵ ɛɭɞɟɦ ɨɛɵɱɧɨ ɝɨɜɨɪɢɬɶ «ɤɨɧɬɟɤɫɬ ɩɨɪɹɞɤɚ o». ȼ ɫɢɥɭ ɨɛɴɟɤɬɢɜɧɵɯ ɩɪɢɱɢɧ — ɨɝɪɚɧɢɱɟɧɧɨɫɬɶ ɜɵɱɢɫɥɢɬɟɥɶɧɵɯ ɪɟɫɭɪɫɨɜ — ɬɟɯɧɢɤɚ ɤɨɧɬɟɤɫɬɧɨɝɨ ɦɨɞɟɥɢɪɨɜɚɧɢɹ ɢɦɟɧɧɨ ɨɝɪɚɧɢɱɟɧɧɨɝɨ ɩɨɪɹɞɤɚ ɩɨɥɭɱɢɥɚ ɧɚɢɛɨɥɶɲɟɟ ɪɚɡɜɢɬɢɟ ɢ ɪɚɫɩɪɨɫɬɪɚɧɟɧɢɟ, ɩɨɷɬɨɦɭ ɞɚɥɟɟ ɩɨɞ ɤɨɧɬɟɤɫɬɧɵɦ ɦɨɞɟɥɢɪɨɜɚɧɢɟɦ ɛɭɞɟɦ ɩɨɧɢɦɚɬɶ ɢɦɟɧɧɨ ɟɟ. Ⱦɚɥɶɧɟɣɲɟɟ ɢɡɥɨɠɟɧɢɟ ɬɚɤɠɟ ɭɱɢɬɵɜɚɟɬ ɫɩɟɰɢɮɢɤɭ ɬɨɝɨ, ɱɬɨ ɤɨɧɬɟɤɫɬɧɨɟ ɦɨɞɟɥɢɪɨɜɚɧɢɟ ɩɪɚɤɬɢɱɟɫɤɢ ɜɫɟɝɞɚ ɩɪɢɦɟɧɹɟɬɫɹ ɤɚɤ ɚɞɚɩɬɢɜɧɨɟ. Ɉɰɟɧɤɢ ɜɟɪɨɹɬɧɨɫɬɟɣ ɩɪɢ ɤɨɧɬɟɤɫɬɧɨɦ ɦɨɞɟɥɢɪɨɜɚɧɢɢ ɫɬɪɨɹɬɫɹ ɧɚ ɨɫɧɨɜɚɧɢɢ ɨɛɵɱɧɵɯ ɫɱɟɬɱɢɤɨɜ ɱɚɫɬɨɬ, ɫɜɹɡɚɧɧɵɯ ɫ ɬɟɤɭɳɢɦ ɤɨɧɬɟɤɫɬɨɦ. ȿɫɥɢ ɦɵ ɨɛɪɚɛɨɬɚɥɢ ɫɬɪɨɤɭ “ɚɛɫɚɛɜɛɚɛɫ”, ɬɨ ɞɥɹ ɤɨɧɬɟɤɫɬɚ “ɚɛ” ɫɱɟɬɱɢɤ ɫɢɦɜɨɥɚ ‘c’ ɪɚɜɟɧ ɞɜɭɦ (ɝɨɜɨɪɹɬ, ɱɬɨ ɫɢɦɜɨɥ ‘c’ ɩɨɹɜɢɥɫɹ ɜ ɤɨɧɬɟɤɫɬɟ “ɚɛ” ɞɜɚ ɪɚɡɚ), ɫɢɦɜɨɥɚ ‘ɜ’ — ɟɞɢɧɢɰɟ. ɇɚ ɨɫɧɨɜɚɧɢɢ ɷɬɨɣ ɫɬɚɬɢɫɬɢɤɢ ɦɨɠɧɨ ɭɬɜɟɪɠɞɚɬɶ, ɱɬɨ ɜɟɪɨɹɬɧɨɫɬɶ ɩɨɹɜɥɟɧɢɹ ‘c’ ɩɨɫɥɟ “ɚɛ” ɪɚɜɧɚ 2/3, ɚ ɜɟɪɨɹɬɧɨɫɬɶ ɩɨɹɜɥɟɧɢɹ ‘ɜ’ — 1/3, ɬ.ɟ. ɨɰɟɧɤɢ ɮɨɪɦɢɪɭɸɬɫɹ ɧɚ ɨɫɧɨɜɟ ɭɠɟ ɩɪɨɫɦɨɬɪɟɧɧɨɣ ɱɚɫɬɢ ɩɨɬɨɤɚ. ȼ ɨɛɳɟɦ ɫɥɭɱɚɟ ɞɥɹ ɤɚɠɞɨɝɨ ɤɨɧɬɟɤɫɬɚ ɤɨɧɟɱɧɨɣ ɞɥɢɧɵ o N, ɜɫɬɪɟɱɚɟɦɨɝɨ ɜ ɨɛɪɚɛɚɬɵɜɚɟɦɨɣ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ, ɫɨɡɞɚɟɬɫɹ ɤɨɧɬɟɤɫɬɧɚɹ ɦɨɞɟɥɶ ɄɆ. Ʌɸɛɚɹ ɄɆ ɜɤɥɸɱɚɟɬ ɜ ɫɟɛɹ ɫɱɟɬɱɢɤɢ ɜɫɟɯ ɫɢɦɜɨɥɨɜ, ɜɫɬɪɟɱɟɧɧɵɯ ɜ ɫɨɨɬɜɟɬɫɬɜɭɸɳɟɦ ɟɣ ɤɨɧɬɟɤɫɬɟ, ɬ.ɟ. ɫɪɚɡɭ ɩɨɫɥɟ ɫɬɪɨɤɢ ɤɨɧɬɟɤɫɬɚ. ɉɨɫɥɟ ɤɚɠɞɨɝɨ ɩɨɹɜɥɟɧɢɹ ɤɚɤɨɝɨ-ɬɨ ɫɢɦɜɨɥɚ s ɜ ɪɚɫɫɦɚɬɪɢɜɚɟɦɨɦ ɤɨɧɬɟɤɫɬɟ ɩɪɨɢɡɜɨɞɢɬɫɹ ɭɜɟɥɢɱɟɧɢɟ ɡɧɚɱɟɧɢɹ ɫɱɟɬɱɢɤɚ ɫɢɦɜɨɥɚ s ɜ ɫɨɨɬɜɟɬɫɬɜɭɸɳɟɣ ɤɨɧɬɟɤɫɬɭ ɄɆ. Ɉɛɵɱɧɨ ɫɱɟɬɱɢɤɢ ɢɧɢɰɢɚɥɢɡɢɪɭɸɬɫɹ Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X 123 http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɧɭɥɹɦɢ. ɇɚ ɩɪɚɤɬɢɤɟ ɫɱɟɬɱɢɤɢ ɨɛɵɱɧɨ ɫɨɡɞɚɸɬɫɹ ɩɨ ɦɟɪɟ ɩɨɹɜɥɟɧɢɹ ɜ ɡɚɞɚɧɧɨɦ ɤɨɧɬɟɤɫɬɟ ɧɨɜɵɯ ɫɢɦɜɨɥɨɜ, ɬ.ɟ. ɫɱɟɬɱɢɤɨɜ ɧɢ ɪɚɡɭ ɧɟ ɜɢɞɟɧɧɵɯ ɜ ɡɚɞɚɧɧɨɦ ɤɨɧɬɟɤɫɬɟ ɫɢɦɜɨɥɨɜ ɩɪɨɫɬɨ ɧɟ ɫɭɳɟɫɬɜɭɟɬ. ɉɨɞ ɩɨɪɹɞɤɨɦ ɄɆ ɛɭɞɟɦ ɩɨɧɢɦɚɬɶ ɞɥɢɧɭ ɫɨɨɬɜɟɬɫɬɜɭɸɳɟɝɨ ɟɣ ɤɨɧɬɟɤɫɬɚ. ȿɫɥɢ ɩɨɪɹɞɨɤ ɄɆ ɪɚɜɟɧ o, ɬɨ ɛɭɞɟɦ ɨɛɨɡɧɚɱɚɬɶ ɬɚɤɭɸ ɄɆ ɤɚɤ «ɄɆ(o)». Ʉɪɨɦɟ ɨɛɵɱɧɵɯ ɄɆ, ɱɚɫɬɨ ɢɫɩɨɥɶɡɭɸɬ ɤɨɧɬɟɤɫɬɧɭɸ ɦɨɞɟɥɶ ɦɢɧɭɫ ɩɟɪɜɨɝɨ ɩɨɪɹɞɤɚ ɄɆ(–1), ɩɪɢɫɜɚɢɜɚɸɳɭɸ ɨɞɢɧɚɤɨɜɭɸ ɜɟɪɨɹɬɧɨɫɬɶ ɜɫɟɦ ɫɢɦɜɨɥɚɦ ɚɥɮɚɜɢɬɚ ɫɠɢɦɚɟɦɨɝɨ ɩɨɬɨɤɚ. ɉɨɧɹɬɧɨ, ɱɬɨ ɞɥɹ ɧɭɥɟɜɨɝɨ ɢ ɦɢɧɭɫ ɩɟɪɜɨɝɨ ɩɨɪɹɞɤɚ ɤɨɧɬɟɤɫɬɧɚɹ ɦɨɞɟɥɶ ɨɞɧɚ, ɚ ɄɆ ɛɨɥɶɲɟɝɨ ɩɨɪɹɞɤɚ ɦɨɠɟɬ ɛɵɬɶ ɧɟɫɤɨɥɶɤɨ, ɜɩɥɨɬɶ ɞɨ qN, ɝɞɟ q — ɪɚɡɦɟɪ ɚɥɮɚɜɢɬɚ ɨɛɪɚɛɚɬɵɜɚɟɦɨɣ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ. ɄɆ(0) ɢ ɄɆ(–1) ɜɫɟɝɞɚ ɚɤɬɢɜɧɵ. Ɂɚɦɟɬɢɦ, ɱɬɨ ɱɚɫɬɨ ɧɟ ɞɟɥɚɟɬɫɹ ɪɚɡɥɢɱɢɣ ɦɟɠɞɭ ɩɨɧɹɬɢɟɦ «ɤɨɧɬɟɤɫɬ» ɢ «ɤɨɧɬɟɤɫɬɧɚɹ ɦɨɞɟɥɶ». Ⱥɜɬɨɪɵ ɷɬɨɣ ɤɧɢɝɢ ɬɚɤɨɟ ɫɨɝɥɚɲɟɧɢɟ ɧɟ ɩɨɞɞɟɪɠɢɜɚɸɬ. ɑɚɫɬɨ ɝɨɜɨɪɹɬ ɨ «ɪɨɞɢɬɟɥɶɫɤɢɯ» ɢ «ɞɨɱɟɪɧɢɯ» ɤɨɧɬɟɤɫɬɚɯ. Ⱦɥɹ ɤɨɧɬɟɤɫɬɚ “ɤ” ɞɨɱɟɪɧɢɦɢ ɹɜɥɹɸɬɫɹ “ɨɤ” ɢ “ɥɤ”, ɩɨɫɤɨɥɶɤɭ ɨɧɢ ɨɛɪɚɡɨɜɚɧɵ ɫɰɟɩɥɟɧɢɟɦ (ɤɨɧɤɚɬɟɧɚɰɢɟɣ) ɨɞɧɨɝɨ ɫɢɦɜɨɥɚ ɢ ɤɨɧɬɟɤɫɬɚ “ɤ”. Ⱥɧɚɥɨɝɢɱɧɨ, ɞɥɹ ɤɨɧɬɟɤɫɬɚ “ɥɨɤ” ɪɨɞɢɬɟɥɶɫɤɢɦ ɹɜɥɹɟɬɫɹ ɤɨɧɬɟɤɫɬ “ɨɤ”, ɚ ɤɨɧɬɟɤɫɬɚɦɢ-ɩɪɟɞɤɚɦɢ — “ɨɤ”, “ɤ”, “”. Ɉɱɟɜɢɞɧɨ, ɱɬɨ «ɩɭɫɬɨɣ» ɤɨɧɬɟɤɫɬ “” ɹɜɥɹɟɬɫɹ ɩɪɟɞɤɨɦ ɞɥɹ ɜɫɟɯ. Ⱥɧɚɥɨɝɢɱɧɵɟ ɬɟɪɦɢɧɵ ɩɪɢɦɟɧɹɸɬɫɹ ɞɥɹ ɄɆ, ɫɨɨɬɜɟɬɫɬɜɭɸɳɢɯ ɤɨɧɬɟɤɫɬɚɦ. ɋɨɜɨɤɭɩɧɨɫɬɶ ɄɆ ɨɛɪɚɡɭɟɬ ɦɨɞɟɥɶ ɢɫɬɨɱɧɢɤɚ ɞɚɧɧɵɯ. ɉɨɞ ɩɨɪɹɞɤɨɦ ɦɨɞɟɥɢ ɩɨɧɢɦɚɟɬɫɹ ɦɚɤɫɢɦɚɥɶɧɵɣ ɩɨɪɹɞɨɤ ɢɫɩɨɥɶɡɭɟɦɵɯ ɄɆ. ȼɂȾɕ ɄɈɇɌȿɄɋɌɇɈȽɈ ɆɈȾȿɅɂɊɈȼȺɇɂə
ɉɪɢɦɟɪ ɨɛɪɚɛɨɬɤɢ ɫɬɪɨɤɢ “ɚɛɫɚɛɜɛɚɛɫ” ɢɥɥɸɫɬɪɢɪɭɟɬ ɫɪɚɡɭ ɞɜɟ ɩɪɨɛɥɟɦɵ ɤɨɧɬɟɤɫɬɧɨɝɨ ɦɨɞɟɥɢɪɨɜɚɧɢɹ: • ɤɚɤ ɜɵɛɢɪɚɬɶ ɩɨɞɯɨɞɹɳɢɣ ɤɨɧɬɟɤɫɬ (ɢɥɢ ɤɨɧɬɟɤɫɬɵ) ɫɪɟɞɢ ɚɤɬɢɜɧɵɯ ɫ ɰɟɥɶɸ ɩɨɥɭɱɟɧɢɹ ɛɨɥɟɟ ɬɨɱɧɨɣ ɨɰɟɧɤɢ, ɜɟɞɶ ɬɟɤɭɳɢɣ ɫɢɦɜɨɥ ɦɨɠɟɬ ɥɭɱɲɟ ɩɪɟɞɫɤɚɡɵɜɚɬɶɫɹ ɧɟ 124 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɤɨɧɬɟɤɫɬɨɦ ɜɬɨɪɨɝɨ ɩɨɪɹɞɤɚ “ɚɛ”, ɚ ɤɨɧɬɟɤɫɬɨɦ ɩɟɪɜɨɝɨ ɩɨɪɹɞɤɚ “ɛ”; • ɤɚɤ ɨɰɟɧɢɜɚɬɶ ɜɟɪɨɹɬɧɨɫɬɶ ɫɢɦɜɨɥɨɜ, ɢɦɟɸɳɢɯ ɧɭɥɟɜɭɸ ɱɚɫɬɨɬɭ (ɧɚɩɪɢɦɟɪ, ‘ɝ’). ȼɵɲɟ ɛɵɥɢ ɩɪɢɜɟɞɟɧɵ ɰɢɮɪɵ, ɜ ɫɨɨɬɜɟɬɫɬɜɢɢ ɫ ɤɨɬɨɪɵɦɢ ɩɪɢ ɭɜɟɥɢɱɟɧɢɢ ɞɥɢɧɵ ɢɫɩɨɥɶɡɭɟɦɨɝɨ ɤɨɧɬɟɤɫɬɚ ɫɠɚɬɢɟ ɞɚɧɧɵɯ ɭɥɭɱɲɚɟɬɫɹ. Ʉ ɫɨɠɚɥɟɧɢɸ, ɩɪɢ ɤɨɞɢɪɨɜɚɧɢɢ ɛɥɨɤɨɜ ɬɢɩɢɱɧɨɣ ɞɥɢɧɵ — ɟɞɢɧɢɰɵ ɦɟɝɚɛɚɣɬɨɜ ɢ ɦɟɧɶɲɟ — ɷɬɨ ɫɩɪɚɜɟɞɥɢɜɨ ɬɨɥɶɤɨ ɞɥɹ ɧɟɛɨɥɶɲɢɯ ɩɨɪɹɞɤɨɜ ɦɨɞɟɥɢ, ɬ.ɤ. ɫɬɚɬɢɫɬɢɤɚ ɞɥɹ ɞɥɢɧɧɵɯ ɤɨɧɬɟɤɫɬɨɜ ɦɟɞɥɟɧɧɨ ɧɚɤɚɩɥɢɜɚɟɬɫɹ. ɉɪɢ ɷɬɨɦ ɬɚɤɠɟ ɫɥɟɞɭɟɬ ɭɱɢɬɵɜɚɬɶ, ɱɬɨ ɛɨɥɶɲɢɧɫɬɜɨ ɪɟɚɥɶɧɵɯ ɞɚɧɧɵɯ ɯɚɪɚɤɬɟɪɢɡɭɟɬɫɹ ɧɟɨɞɧɨɪɨɞɧɨɫɬɶɸ, ɧɟɫɬɚɛɢɥɶɧɨɫɬɶɸ ɫɢɥɵ ɢ ɜɢɞɚ ɫɬɚɬɢɫɬɢɱɟɫɤɢɯ ɜɡɚɢɦɨɫɜɹɡɟɣ, ɩɨɷɬɨɦɭ «ɫɬɚɪɚɹ» ɫɬɚɬɢɫɬɢɤɚ ɤɨɧɬɟɤɫɬɧɨ-ɡɚɜɢɫɢɦɵɯ ɱɚɫɬɨɬ ɩɨɹɜɥɟɧɢɹ ɫɢɦɜɨɥɨɜ ɦɚɥɨɩɨɥɟɡɧɚ ɢɥɢ ɞɚɠɟ ɜɪɟɞɧɚ. ɉɨɷɬɨɦɭ ɦɨɞɟɥɢ, ɫɬɪɨɹɳɢɟ ɨɰɟɧɤɭ ɬɨɥɶɤɨ ɧɚ ɨɫɧɨɜɚɧɢɢ ɢɧɮɨɪɦɚɰɢɢ ɄɆ ɦɚɤɫɢɦɚɥɶɧɨɝɨ ɩɨɪɹɞɤɚ N, ɨɛɟɫɩɟɱɢɜɚɸɬ ɫɪɚɜɧɢɬɟɥɶɧɨ ɧɢɡɤɭɸ ɬɨɱɧɨɫɬɶ ɩɪɟɞɫɤɚɡɚɧɢɹ. Ʉɪɨɦɟ ɬɨɝɨ, ɯɪɚɧɟɧɢɟ ɦɨɞɟɥɢ ɛɨɥɶɲɨɝɨ ɩɨɪɹɞɤɚ ɬɪɟɛɭɟɬ ɦɧɨɝɨ ɩɚɦɹɬɢ. ȿɫɥɢ ɜ ɦɨɞɟɥɢ ɢɫɩɨɥɶɡɭɸɬɫɹ ɞɥɹ ɨɰɟɧɤɢ ɬɨɥɶɤɨ ɄɆ(N), ɬɨ ɢɧɨɝɞɚ ɬɚɤɨɣ ɩɨɞɯɨɞ ɧɚɡɵɜɚɸɬ «ɱɢɫɬɵɦ» (pure) ɤɨɧɬɟɤɫɬɧɵɦ ɦɨɞɟɥɢɪɨɜɚɧɢɟɦ ɩɨɪɹɞɤɚ N. ɂɡ-ɡɚ ɜɵɲɟɭɤɚɡɚɧɧɨɝɨ ɧɟɞɨɫɬɚɬɤɚ «ɱɢɫɬɵɟ» ɦɨɞɟɥɢ ɩɪɟɞɫɬɚɜɥɹɸɬ ɨɛɵɱɧɨ ɬɨɥɶɤɨ ɧɚɭɱɧɵɣ ɢɧɬɟɪɟɫ. Ⱦɟɣɫɬɜɢɬɟɥɶɧɨ, ɪɟɚɥɶɧɨ ɢɫɩɨɥɶɡɭɟɦɵɟ ɮɚɣɥɵ ɨɛɵɱɧɨ ɢɦɟɸɬ ɫɪɚɜɧɢɬɟɥɶɧɨ ɧɟɛɨɥɶɲɨɣ ɪɚɡɦɟɪ, ɩɨɷɬɨɦɭ ɞɥɹ ɭɥɭɱɲɟɧɢɹ ɢɯ ɫɠɚɬɢɹ ɧɟɨɛɯɨɞɢɦɨ ɭɱɢɬɵɜɚɬɶ ɨɰɟɧɤɢ ɜɟɪɨɹɬɧɨɫɬɟɣ, ɩɨɥɭɱɚɟɦɵɟ ɧɚ ɨɫɧɨɜɚɧɢɢ ɫɬɚɬɢɫɬɢɤɢ ɤɨɧɬɟɤɫɬɨɜ ɪɚɡɧɵɯ ɞɥɢɧ. Ɍɟɯɧɢɤɚ ɨɛɴɟɞɢɧɟɧɢɹ ɨɰɟɧɨɤ ɜɟɪɨɹɬɧɨɫɬɟɣ, ɫɨɨɬɜɟɬɫɬɜɭɸɳɢɯ ɨɬɞɟɥɶɧɵɦ ɚɤɬɢɜɧɵɦ ɤɨɧɬɟɤɫɬɚɦ, ɜ ɨɞɧɭ ɨɰɟɧɤɭ ɧɚɡɵɜɚɟɬɫɹ ɫɦɟɲɢɜɚɧɢɟɦ (blending). ɂɡɜɟɫɬɧɨ ɧɟɫɤɨɥɶɤɨ ɫɩɨɫɨɛɨɜ ɜɵɩɨɥɧɟɧɢɹ ɫɦɟɲɢɜɚɧɢɹ. Ɋɚɫɫɦɨɬɪɢɦ ɦɨɞɟɥɶ ɩɪɨɢɡɜɨɥɶɧɨɝɨ ɩɨɪɹɞɤɚ N. ȿɫɥɢ q(si|o) ɟɫɬɶ ɜɟɪɨɹɬɧɨɫɬɶ, ɩɪɢɫɜɚɢɜɚɟɦɚɹ ɜ ɚɤɬɢɜɧɨɣ ɄɆ(o) ɫɢɦɜɨɥɭ si ɚɥɮɚɜɢɬɚ ɫɠɢɦɚɟɦɨɝɨ ɩɨɬɨɤɚ, ɬɨ ɫɦɟɲɚɧɧɚɹ ɜɟɪɨɹɬɧɨɫɬɶ q(si) ɜɵɱɢɫɥɹɟɬɫɹ ɜ ɨɛɳɟɦ ɫɥɭɱɚɟ ɤɚɤ Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X 125 http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
q ( si ) =
N
ƒw(o)q(s | o) , i
o = −1
ɝɞɟ w(o) — ɜɟɫ ɨɰɟɧɤɢ ɄɆ(o) . Ɉɰɟɧɤɚ q(si|o) ɨɛɵɱɧɨ ɨɩɪɟɞɟɥɹɟɬɫɹ ɱɟɪɟɡ ɱɚɫɬɨɬɭ ɫɢɦɜɨɥɚ si ɩɨ ɬɪɢɜɢɚɥɶɧɨɣ ɮɨɪɦɭɥɟ
q( si | o) =
f ( si | o) , f (o)
ɝɞɟ
f(si|o) — ɱɚɫɬɨɬɚ ɩɨɹɜɥɟɧɢɹ ɫɢɦɜɨɥɚ si ɜ ɫɨɨɬɜɟɬɫɬɜɭɸɳɟɦ ɤɨɧɬɟɤɫɬɟ ɩɨɪɹɞɤɚ o; f(o) — ɨɛɳɚɹ ɱɚɫɬɨɬɚ ɩɨɹɜɥɟɧɢɹ ɫɨɨɬɜɟɬɫɬɜɭɸɳɟɝɨ ɤɨɧɬɟɤɫɬɚ ɩɨɪɹɞɤɚ o ɜ ɨɛɪɚɛɨɬɚɧɧɨɣ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ. Ɂɚɦɟɬɢɦ, ɱɬɨ ɩɪɚɜɢɥɶɧɟɟ ɛɵɥɨ ɛɵ ɩɢɫɚɬɶ ɧɟ, ɫɤɚɠɟɦ, f(si|o), ɚ f(si|ɋj(o)), ɬ.ɟ. «ɱɚɫɬɨɬɚ ɩɨɹɜɥɟɧɢɹ ɫɢɦɜɨɥɚ si ɜ ɄɆ ɩɨɪɹɞɤɚ o ɫ ɧɨɦɟɪɨɦ j(o)», ɩɨɫɤɨɥɶɤɭ ɤɨɧɬɟɤɫɬɧɵɯ ɦɨɞɟɥɟɣ ɩɨɪɹɞɤɚ o ɦɨɠɟɬ ɛɵɬɶ ɨɝɪɨɦɧɨɟ ɤɨɥɢɱɟɫɬɜɨ. ɇɨ ɩɪɢ ɫɠɚɬɢɢ ɤɚɠɞɨɝɨ ɬɟɤɭɳɟɝɨ ɫɢɦɜɨɥɚ ɦɵ ɪɚɫɫɦɚɬɪɢɜɚɟɦ ɬɨɥɶɤɨ ɨɞɧɭ ɄɆ ɞɥɹ ɤɚɠɞɨɝɨ ɩɨɪɹɞɤɚ, ɬ.ɤ. ɤɨɧɬɟɤɫɬ ɨɩɪɟɞɟɥɹɟɬɫɹ ɧɟɩɨɫɪɟɞɫɬɜɟɧɧɨ ɩɪɢɦɵɤɚɸɳɟɣ ɫɥɟɜɚ ɤ ɫɢɦɜɨɥɭ ɫɬɪɨɤɨɣ ɨɩɪɟɞɟɥɟɧɧɨɣ ɞɥɢɧɵ. ɂɧɚɱɟ ɝɨɜɨɪɹ, ɞɥɹ ɤɚɠɞɨɝɨ ɫɢɦɜɨɥɚ ɦɵ ɢɦɟɟɦ ɧɚɛɨɪ ɢɡ N+1 ɚɤɬɢɜɧɵɯ ɤɨɧɬɟɤɫɬɨɜ ɞɥɢɧɵ ɨɬ N ɞɨ 0, ɤɚɠɞɨɦɭ ɢɡ ɤɨɬɨɪɵɯ ɨɞɧɨɡɧɚɱɧɨ ɫɨɨɬɜɟɬɫɬɜɭɟɬ ɬɨɥɶɤɨ ɨɞɧɚ ɄɆ, ɟɫɥɢ ɨɧɚ ɜɨɨɛɳɟ ɟɫɬɶ. ɉɨɷɬɨɦɭ ɡɞɟɫɶ ɢ ɞɚɥɟɟ ɢɫɩɨɥɶɡɭɟɬɫɹ ɫɨɤɪɚɳɟɧɧɚɹ ɡɚɩɢɫɶ. ȿɫɥɢ ɜɟɫ w(–1) > 0, ɬɨ ɷɬɨ ɝɚɪɚɧɬɢɪɭɟɬ ɭɫɩɟɲɧɨɫɬɶ ɤɨɞɢɪɨɜɚɧɢɹ ɥɸɛɨɝɨ ɫɢɦɜɨɥɚ ɜɯɨɞɧɨɝɨ ɩɨɬɨɤɚ, ɬ.ɤ. ɧɚɥɢɱɢɟ ɄɆ(–1) ɩɨɡɜɨɥɹɟɬ ɜɫɟɝɞɚ ɩɨɥɭɱɚɬɶ ɧɟɧɭɥɟɜɭɸ ɨɰɟɧɤɭ ɜɟɪɨɹɬɧɨɫɬɢ ɢ, ɫɨɨɬɜɟɬɫɬɜɟɧɧɨ, ɤɨɞ ɤɨɧɟɱɧɨɣ ɞɥɢɧɵ. Ɋɚɡɥɢɱɚɸɬ ɦɨɞɟɥɢ ɫ ɩɨɥɧɵɦ ɫɦɟɲɢɜɚɧɢɟɦ (fully blended), ɤɨɝɞɚ ɩɪɟɞɫɤɚɡɚɧɢɟ ɨɩɪɟɞɟɥɹɟɬɫɹ ɫɬɚɬɢɫɬɢɤɨɣ ɄɆ ɜɫɟɯ ɢɫɩɨɥɶɡɭɟɦɵɯ ɩɨɪɹɞɤɨɜ, ɢ ɫ ɱɚɫɬɢɱɧɵɦ ɫɦɟɲɢɜɚɧɢɟɦ (partially blended) — ɜ ɩɪɨɬɢɜɧɨɦ ɫɥɭɱɚɟ.
126 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɉɪɢɦɟɪ 1 Ɋɚɫɫɦɨɬɪɢɦ ɩɪɨɰɟɫɫ ɨɰɟɧɤɢ ɨɬɦɟɱɟɧɧɨɝɨ ɧɚ ɪɢɫɭɧɤɟ ɫɬɪɟɥɤɨɣ ɫɢɦɜɨɥɚ ‘ɥ’, ɜɫɬɪɟɬɢɜɲɟɝɨɫɹ ɜ ɛɥɨɤɟ “ɦɨɥɨɱɧɨɟ_ɦɨɥɨɤɨ”. ɋɱɢɬɚɟɦ, ɱɬɨ ɦɨɞɟɥɶ ɪɚɛɨɬɚɟɬ ɧɚ ɭɪɨɜɧɟ ɫɢɦɜɨɥɨɜ. ɦ
ɨ
ɥ
ɨ
ɱ
ɧ
ɨ
ɟ
ɦ ɨ
ɥ
ɨ
ɤ
ɨ
ɉɭɫɬɶ ɦɵ ɢɫɩɨɥɶɡɭɟɦ ɤɨɧɬɟɤɫɬɧɨɟ ɦɨɞɟɥɢɪɨɜɚɧɢɟ ɩɨɪɹɞɤɚ 2 ɢ ɞɟɥɚɟɦ ɩɨɥɧɨɟ ɫɦɟɲɢɜɚɧɢɟ ɨɰɟɧɨɤ ɪɚɫɩɪɟɞɟɥɟɧɢɣ ɜɟɪɨɹɬɧɨɫɬɟɣ ɜ ɄɆ ɜɬɨɪɨɝɨ, ɩɟɪɜɨɝɨ ɢ ɧɭɥɟɜɨɝɨ ɩɨɪɹɞɤɨɜ ɫ ɜɟɫɚɦɢ 0.6, 0.3 ɢ 0.1. ɋɱɢɬɚɟɦ, ɱɬɨ ɜ ɧɚɱɚɥɟ ɤɨɞɢɪɨɜɚɧɢɹ ɜ ɄɆ(0) ɫɨɡɞɚɸɬɫɹ ɫɱɟɬɱɢɤɢ ɞɥɹ ɜɫɟɯ ɫɢɦɜɨɥɨɜ ɚɥɮɚɜɢɬɚ {‘ɦ’, ‘ɨ’, ‘ɥ’, ‘ɱ’, ‘ɧ’, ‘ɟ’, ‘_’, ‘ɤ’} ɢ ɢɧɢɰɢɚɥɢɡɢɪɭɸɬɫɹ ɟɞɢɧɢɰɟɣ; ɫɱɟɬɱɢɤ ɫɢɦɜɨɥɚ ɩɨɫɥɟ ɟɝɨ ɨɛɪɚɛɨɬɤɢ ɭɜɟɥɢɱɢɜɚɟɬɫɹ ɧɚ 1. Ⱦɥɹ ɬɟɤɭɳɟɝɨ ɫɢɦɜɨɥɚ ‘ɥ’ ɢɦɟɸɬɫɹ ɤɨɧɬɟɤɫɬɵ “ɦɨ”, “ɨ” ɢ ɩɭɫɬɨɣ (ɧɭɥɟɜɨɝɨ ɩɨɪɹɞɤɚ). Ʉ ɞɚɧɧɨɦɭ ɦɨɦɟɧɬɭ ɞɥɹ ɧɢɯ ɧɚɤɨɩɥɟɧɚ ɫɬɚɬɢɫɬɢɤɚ, ɩɨɤɚɡɚɧɧɚɹ ɜ ɬɚɛɥ. 4.1. Ɍɚɛɥɢɰɚ 4.1 ɋɢɦɜɨɥɵ ‘ɦ’ ‘ɨ’ ‘ɥ’ ‘ɱ’ ‘ɧ’ ‘ɟ’ ‘_’ ɄɆ ɑɚɫɬɨɬɵ 3 5 2 2 2 2 2 ɩɨɪɹɞɤɚ 0 ɇɚɤɨɩ3 8 10 12 14 16 18 (ɤɨɧɬɟɤɫɬ ɥɟɧɧɵɟ “”) ɱɚɫɬɨɬɵ ɄɆ ɑɚɫɬɨɬɵ 1 1 1 ɩɨɪɹɞɤɚ 1 1 2 3 ɇɚɤɨɩ(ɤɨɧɬɟɤɫɬ ɥɟɧɧɵɟ “ɨ”) ɱɚɫɬɨɬɵ ɄɆ ɑɚɫɬɨɬɵ 1 ɩɨɪɹɞɤɚ 2 ɇɚɤɨɩ1 (“ɦɨ”) ɥɟɧɧɵɟ ɱɚɫɬɨɬɵ Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X 127 http://www.compression.ru/
‘ɤ’ 1 19
-
-
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
Ɍɨɝɞɚ ɨɰɟɧɤɚ ɜɟɪɨɹɬɧɨɫɬɢ ɞɥɹ ɫɢɦɜɨɥɚ ‘ɥ’ ɛɭɞɟɬ ɪɚɜɧɚ
q (' ɥ' ) = 0.1 ⋅
2 1 1 + 0.3 ⋅ + 0.6 ⋅ = 0,71 . 19 3 1
ȼ ɨɛɳɟɦ ɫɥɭɱɚɟ, ɞɥɹ ɨɞɧɨɡɧɚɱɧɨɝɨ ɤɨɞɢɪɨɜɚɧɢɹ ɫɢɦɜɨɥɚ ‘ɥ’ ɬɚɤɭɸ ɨɰɟɧɤɭ ɧɟɨɛɯɨɞɢɦɨ ɩɪɨɞɟɥɚɬɶ ɞɥɹ ɜɫɟɯ ɫɢɦɜɨɥɨɜ ɚɥɮɚɜɢɬɚ. Ⱦɟɣɫɬɜɢɬɟɥɶɧɨ, ɫ ɨɞɧɨɣ ɫɬɨɪɨɧɵ, ɞɟɤɨɞɟɪ ɧɟ ɡɧɚɟɬ, ɱɟɦɭ ɪɚɜɟɧ ɬɟɤɭɳɢɣ ɫɢɦɜɨɥ, ɫ ɞɪɭɝɨɣ ɫɬɨɪɨɧɵ, ɨɰɟɧɤɚ ɜɟɪɨɹɬɧɨɫɬɢ ɧɟ ɝɚɪɚɧɬɢɪɭɟɬ ɭɧɢɤɚɥɶɧɨɫɬɶ ɤɨɞɚ, ɚ ɥɢɲɶ ɡɚɞɚɟɬ ɟɝɨ ɞɥɢɧɭ. ɉɨɷɬɨɦɭ ɫɬɚɬɢɫɬɢɱɟɫɤɨɟ ɤɨɞɢɪɨɜɚɧɢɟ ɜɵɩɨɥɧɹɟɬɫɹ ɧɚ ɨɫɧɨɜɚɧɢɢ ɧɚɤɨɩɥɟɧɧɨɣ ɱɚɫɬɨɬɵ (ɫɦ. ɩɨɞɪɨɛɧɨɫɬɢ ɜ ɩɪɢɦɟɪɟ 2 ɢ ɜ ɩɭɧɤɬɟ «Ⱥɪɢɮɦɟɬɢɱɟɫɤɨɟ ɫɠɚɬɢɟ» ɝɥɚɜɵ 1). ɇɚɩɪɢɦɟɪ, ɟɫɥɢ ɤɨɞɢɪɨɜɚɬɶ ɧɚ ɨɫɧɨɜɚɧɢɢ ɫɬɚɬɢɫɬɢɤɢ ɬɨɥɶɤɨ ɧɭɥɟɜɨɝɨ ɩɨɪɹɞɤɚ, ɬɨ ɫɭɳɟɫɬɜɭɟɬ ɜɡɚɢɦɧɨ ɨɞɧɨɡɧɚɱɧɨɟ ɫɨɨɬɜɟɬɫɬɜɢɟ ɦɟɠɞɭ ɧɚɤɨɩɥɟɧɧɵɦɢ ɱɚɫɬɨɬɚɦɢ ɢɡ ɞɢɚɩɚɡɨɧɚ (8,10] ɢ ɫɢɦɜɨɥɨɦ ‘ɥ’, ɱɬɨ ɧɟ ɢɦɟɟɬ ɦɟɫɬɚ ɜ ɫɥɭɱɚɟ ɩɪɨɫɬɨ ɱɚɫɬɨɬɵ (ɱɚɫɬɨɬɭ 2 ɢɦɟɸɬ ɟɳɟ 4 ɫɢɦɜɨɥɚ). ɉɨɧɹɬɧɨ, ɱɬɨ ɚɧɚɥɨɝɢɱɧɵɟ ɫɜɨɣɫɬɜɚ ɨɫɬɚɸɬɫɹ ɜ ɫɢɥɟ ɢ ɜ ɫɥɭɱɚɟ ɨɰɟɧɨɤ, ɩɨɥɭɱɚɟɦɵɯ ɱɚɫɬɢɱɧɵɦ ɫɦɟɲɢɜɚɧɢɟɦ. ɍɩɪɚɠɧɟɧɢɟ: ɉɪɟɞɥɨɠɢɬɟ ɫɩɨɫɨɛɵ ɭɜɟɥɢɱɟɧɢɹ ɫɪɟɞɧɟɣ ɫɤɨɪɨɫɬɢ ɜɵɱɢɫɥɟɧɢɹ ɨɰɟɧɨɤ ɞɥɹ ɦɟɬɨɞɨɜ ɤɨɧɬɟɤɫɬɧɨɝɨ ɦɨɞɟɥɢɪɨɜɚɧɢɹ ɫɨ ɫɦɟɲɢɜɚɧɢɟɦ, ɤɚɤ ɩɨɥɧɵɦ, ɬɚɤ ɢ ɱɚɫɬɢɱɧɵɦ. Ɉɱɟɜɢɞɧɨ, ɱɬɨ ɭɫɩɟɯ ɩɪɢɦɟɧɟɧɢɹ ɫɦɟɲɢɜɚɧɢɹ ɡɚɜɢɫɢɬ ɨɬ ɫɩɨɫɨɛɚ ɜɵɛɨɪɚ ɜɟɫɨɜ w(o). ɉɪɨɫɬɨɣ ɩɭɬɶ ɫɨɫɬɨɢɬ ɜ ɢɫɩɨɥɶɡɨɜɚɧɢɢ ɡɚɞɚɧɧɨɝɨ ɧɚɛɨɪɚ ɮɢɤɫɢɪɨɜɚɧɧɵɯ ɜɟɫɨɜ ɄɆ ɪɚɡɧɵɯ ɩɨɪɹɞɤɨɜ ɩɪɢ ɤɚɠɞɨɣ ɨɰɟɧɤɟ; ɷɬɨɬ ɫɩɨɫɨɛ ɛɵɥ ɩɪɢɦɟɧɟɧ ɜ ɩɪɢɦɟɪɟ 2. ȿɫɬɟɫɬɜɟɧɧɨ, ɚɥɶɬɟɪɧɚɬɢɜɨɣ ɹɜɥɹɟɬɫɹ ɚɞɚɩɬɚɰɢɹ ɜɟɫɨɜ ɩɨ ɦɟɪɟ ɤɨɞɢɪɨɜɚɧɢɹ. ɉɪɢɫɩɨɫɨɛɥɟɧɢɟ ɦɨɠɟɬ ɡɚɤɥɸɱɚɬɶɫɹ ɜ ɩɪɢɞɚɧɢɢ ɜɫɟ ɛɨɥɶɲɟɣ ɡɧɚɱɢɦɨɫɬɢ ɄɆ ɜɫɟ ɛɨɥɶɲɢɯ ɩɨɪɹɞɤɨɜ ɢɥɢ, ɫɤɚɠɟɦ, ɩɨɩɵɬɤɟ ɜɵɛɪɚɬɶ ɧɚɢɥɭɱɲɢɟ ɜɟɫɚ ɧɚ ɨɫɧɨɜɚɧɢɢ ɨɩɪɟɞɟɥɟɧɧɵɯ ɫɬɚɬɢɫɬɢɱɟɫɤɢɯ ɯɚɪɚɤɬɟɪɢɫɬɢɤ ɩɨɫɥɟɞɧɟɝɨ ɨɛɪɚɛɨɬɚɧɧɨɝɨ ɛɥɨɤɚ ɞɚɧɧɵɯ. ɇɨ ɬɚɤ ɢɫɬɨɪɢɱɟɫɤɢ ɫɥɨɠɢɥɨɫɶ, ɱɬɨ ɪɟɚɥɶɧɨɟ 128 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɪɚɡɜɢɬɢɟ ɩɨɥɭɱɢɥɢ ɦɟɬɨɞɵ ɧɟɹɜɧɨɝɨ ɜɡɜɟɲɢɜɚɧɢɹ. ɗɬɨ ɨɛɴɹɫɧɹɟɬɫɹ ɜ ɩɟɪɜɭɸ ɨɱɟɪɟɞɶ ɢɯ ɦɟɧɶɲɟɣ ɜɵɱɢɫɥɢɬɟɥɶɧɨɣ ɫɥɨɠɧɨɫɬɶɸ. Ɍɟɯɧɢɤɚ ɧɟɹɜɧɨɝɨ ɜɡɜɟɲɢɜɚɧɢɹ ɫɜɹɡɚɧɚ ɫ ɜɜɟɞɟɧɢɟɦ ɜɫɩɨɦɨɝɚɬɟɥɶɧɨɝɨ ɫɢɦɜɨɥɚ ɭɯɨɞɚ (escape). ɋɢɦɜɨɥ ɭɯɨɞɚ ɹɜɥɹɟɬɫɹ ɤɜɚɡɢɫɢɦɜɨɥɨɦ ɢ ɧɟ ɞɨɥɠɟɧ ɩɪɢɧɚɞɥɟɠɚɬɶ ɚɥɮɚɜɢɬɭ ɫɠɢɦɚɟɦɨɣ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ. Ɏɚɤɬɢɱɟɫɤɢ, ɨɧ ɢɫɩɨɥɶɡɭɟɬɫɹ ɞɥɹ ɩɟɪɟɞɚɱɢ ɞɟɤɨɞɟɪɭ ɭɤɚɡɚɧɢɣ ɤɨɞɟɪɚ. ɂɞɟɹ ɡɚɤɥɸɱɚɟɬɫɹ ɜ ɬɨɦ, ɱɬɨ ɟɫɥɢ ɢɫɩɨɥɶɡɭɟɦɚɹ ɄɆ ɧɟ ɩɨɡɜɨɥɹɟɬ ɨɰɟɧɢɬɶ ɬɟɤɭɳɢɣ ɫɢɦɜɨɥ (ɟɝɨ ɫɱɟɬɱɢɤ ɪɚɜɟɧ 0 ɜ ɷɬɨɣ ɄɆ), ɬɨ ɧɚ ɜɵɯɨɞ ɩɨɫɵɥɚɟɬɫɹ ɡɚɤɨɞɢɪɨɜɚɧɧɵɣ ɫɢɦɜɨɥ ɭɯɨɞɚ ɢ ɩɪɨɢɡɜɨɞɢɬɫɹ ɩɨɩɵɬɤɚ ɨɰɟɧɢɬɶ ɬɟɤɭɳɢɣ ɫɢɦɜɨɥ ɜ ɞɪɭɝɨɣ ɄɆ, ɤɨɬɨɪɨɣ ɫɨɨɬɜɟɬɫɬɜɭɟɬ ɤɨɧɬɟɤɫɬ ɢɧɨɣ ɞɥɢɧɵ. Ɉɛɵɱɧɨ ɩɨɩɵɬɤɚ ɨɰɟɧɤɢ ɧɚɱɢɧɚɟɬɫɹ ɫ ɄɆ ɧɚɢɛɨɥɶɲɟɝɨ ɩɨɪɹɞɤɚ N, ɡɚɬɟɦ ɜ ɨɩɪɟɞɟɥɟɧɧɨɣ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ ɨɫɭɳɟɫɬɜɥɹɟɬɫɹ ɩɟɪɟɯɨɞ ɤ ɤɨɧɬɟɤɫɬɧɵɦ ɦɨɞɟɥɹɦ ɦɟɧɶɲɢɯ ɩɨɪɹɞɤɨɜ. ȿɫɬɟɫɬɜɟɧɧɨ, ɫɬɚɬɢɫɬɢɱɟɫɤɨɟ ɤɨɞɢɪɨɜɚɧɢɟ ɫɢɦɜɨɥɚ ɭɯɨɞɚ ɜɵɩɨɥɧɹɟɬɫɹ ɧɚ ɨɫɧɨɜɚɧɢɢ ɟɝɨ ɜɟɪɨɹɬɧɨɫɬɢ, ɬɚɤ ɧɚɡɵɜɚɟɦɨɣ ɜɟɪɨɹɬɧɨɫɬɢ ɭɯɨɞɚ. Ɉɱɟɜɢɞɧɨ, ɱɬɨ ɫɢɦɜɨɥɵ ɭɯɨɞɚ ɩɨɪɨɠɞɚɸɬɫɹ ɧɟ ɢɫɬɨɱɧɢɤɨɦ ɞɚɧɧɵɯ, ɚ ɦɨɞɟɥɶɸ. ɋɥɟɞɨɜɚɬɟɥɶɧɨ, ɢɯ ɜɟɪɨɹɬɧɨɫɬɶ ɦɨɠɟɬ ɡɚɜɢɫɟɬɶ ɨɬ ɯɚɪɚɤɬɟɪɢɫɬɢɤ ɫɠɢɦɚɟɦɵɯ ɞɚɧɧɵɯ, ɫɜɨɣɫɬɜ ɄɆ, ɫ ɤɨɬɨɪɨɣ ɩɪɨɢɡɜɨɞɢɬɫɹ ɭɯɨɞ, ɫɜɨɣɫɬɜ ɄɆ, ɧɚ ɤɨɬɨɪɭɸ ɩɪɨɢɫɯɨɞɢɬ ɭɯɨɞ, ɢ ɬ.ɞ. Ʉɚɤ ɦɨɠɧɨ ɨɰɟɧɢɬɶ ɷɬɭ ɜɟɪɨɹɬɧɨɫɬɶ, ɢɦɟɹ ɜ ɜɢɞɭ, ɱɬɨ ɤɨɧɟɱɧɵɣ ɤɪɢɬɟɪɢɣ ɤɚɱɟɫɬɜɚ — ɭɥɭɱɲɟɧɢɟ ɫɠɚɬɢɹ? ȼɟɪɨɹɬɧɨɫɬɶ ɭɯɨɞɚ — ɷɬɨ ɜɟɪɨɹɬɧɨɫɬɶ ɩɨɹɜɥɟɧɢɹ ɜ ɤɨɧɬɟɤɫɬɟ ɧɨɜɨɝɨ ɫɢɦɜɨɥɚ. Ɍɨɝɞɚ, ɮɚɤɬɢɱɟɫɤɢ, ɧɟɨɛɯɨɞɢɦɨ ɨɰɟɧɢɬɶ ɩɪɚɜɞɨɩɨɞɨɛɧɨɫɬɶ ɧɚɫɬɭɩɥɟɧɢɹ ɧɢ ɪɚɡɭ ɧɟ ɩɪɨɢɫɯɨɞɢɜɲɟɝɨ ɫɨɛɵɬɢɹ. Ɍɟɨɪɟɬɢɱɟɫɤɨɝɨ ɮɭɧɞɚɦɟɧɬɚ ɞɥɹ ɪɟɲɟɧɢɹ ɷɬɨɣ ɩɪɨɛɥɟɦɵ, ɜɢɞɢɦɨ, ɧɟ ɫɭɳɟɫɬɜɭɟɬ, ɧɨ ɡɚ ɜɪɟɦɹ ɪɚɡɜɢɬɢɹ ɬɟɯɧɢɤ ɤɨɧɬɟɤɫɬɧɨɝɨ ɦɨɞɟɥɢɪɨɜɚɧɢɹ ɛɵɥɨ ɩɪɟɞɥɨɠɟɧɨ ɧɟɫɤɨɥɶɤɨ ɩɨɞɯɨɞɨɜ, ɯɨɪɨɲɨ ɪɚɛɨɬɚɸɳɢɯ ɜ ɛɨɥɶɲɢɧɫɬɜɟ ɪɟɚɥɶɧɵɯ ɫɢɬɭɚɰɢɣ. Ʉɪɨɦɟ ɬɨɝɨ, ɷɤɫɩɟɪɢɦɟɧɬɵ ɩɨɤɚɡɵɜɚɸɬ, ɱɬɨ ɦɨɞɟɥɢ ɫ ɧɟɹɜɧɵɦ ɜɡɜɟɲɢɜɚɧɢɟɦ ɭɫɬɨɣɱɢɜɵ ɨɬɧɨɫɢɬɟɥɶɧɨ ɢɫɩɨɥɶɡɭɟɦɨɝɨ ɦɟɬɨɞɚ ɨɰɟɧɤɢ ɜɟɪɨɹɬɧɨɫɬɢ ɭɯɨɞɚ, ɬ.ɟ. ɜɵɛɨɪ ɤɚɤɨɝɨ-ɬɨ ɫɩɨɫɨɛɚ ɜɵɱɢɫɥɟɧɢɹ ɷɬɨɣ ɜɟɥɢɱɢɧɵ ɧɟ ɜɥɢɹɟɬ ɧɚ ɤɨɷɮɮɢɰɢɟɧɬ ɫɠɚɬɢɹ ɤɚɪɞɢɧɚɥɶɧɵɦ ɨɛɪɚɡɨɦ. Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X 129 http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
Ⱥɥɝɨɪɢɬɦɵ PPM Ɍɟɯɧɢɤɚ ɤɨɧɬɟɤɫɬɧɨɝɨ ɦɨɞɟɥɢɪɨɜɚɧɢɹ Prediction by Partial Matching (ɩɪɟɞɫɤɚɡɚɧɢɟ ɩɨ ɱɚɫɬɢɱɧɨɦɭ ɫɨɜɩɚɞɟɧɢɸ), ɩɪɟɞɥɨɠɟɧɧɚɹ ɜ 1984 ɝɨɞɭ Ʉɥɢɪɢ (Cleary) ɢ ɍɢɬɬɟɧɨɦ (Witten) [5], ɹɜɥɹɟɬɫɹ ɨɞɧɢɦ ɢɡ ɫɚɦɵɯ ɢɡɜɟɫɬɧɵɯ ɩɨɞɯɨɞɨɜ ɤ ɫɠɚɬɢɸ ɤɚɱɟɫɬɜɟɧɧɵɯ ɞɚɧɧɵɯ ɢ ɭɠ ɬɨɱɧɨ ɫɚɦɵɦ ɩɨɩɭɥɹɪɧɵɦ ɫɪɟɞɢ ɤɨɧɬɟɤɫɬɧɵɯ ɦɟɬɨɞɨɜ. Ɂɧɚɱɢɦɨɫɬɶ ɩɨɞɯɨɞɚ ɨɛɭɫɥɨɜɥɟɧɚ ɢ ɬɟɦ ɮɚɤɬɨɦ, ɱɬɨ ɚɥɝɨɪɢɬɦɵ, ɩɪɢɱɢɫɥɹɟɦɵɟ ɤ PPM, ɧɟɢɡɦɟɧɧɨ ɨɛɟɫɩɟɱɢɜɚɸɬ ɜ ɫɪɟɞɧɟɦ ɧɚɢɥɭɱɲɟɟ ɫɠɚɬɢɟ ɩɪɢ ɤɨɞɢɪɨɜɚɧɢɢ ɞɚɧɧɵɯ ɪɚɡɥɢɱɧɵɯ ɬɢɩɨɜ ɢ ɫɥɭɠɚɬ ɫɬɚɧɞɚɪɬɨɦ, «ɬɨɱɤɨɣ ɨɬɫɱɟɬɚ» ɩɪɢ ɫɪɚɜɧɟɧɢɢ ɭɧɢɜɟɪɫɚɥɶɧɵɯ ɚɥɝɨɪɢɬɦɨɜ ɫɠɚɬɢɹ. ɉɟɪɟɞ ɫɨɛɫɬɜɟɧɧɨ ɪɚɫɫɦɨɬɪɟɧɢɟɦ ɚɥɝɨɪɢɬɦɨɜ PPM ɧɟɨɛɯɨɞɢɦɨ ɫɞɟɥɚɬɶ ɡɚɦɟɱɚɧɢɟ ɨ ɤɨɪɪɟɤɬɧɨɫɬɢ ɢɫɩɨɥɶɡɭɟɦɨɣ ɬɟɪɦɢɧɨɥɨɝɢɢ. ɇɚ ɩɪɨɬɹɠɟɧɢɢ ɩɪɢɦɟɪɧɨ 10 ɥɟɬ — ɫ ɫɟɪɟɞɢɧɵ 1980-ɯ ɝɨɞɨɜ ɞɨ ɫɟɪɟɞɢɧɵ 1990-ɯ — ɩɨɞ PPM ɩɨɧɢɦɚɥɚɫɶ ɝɪɭɩɩɚ ɦɟɬɨɞɨɜ ɫ ɜɩɨɥɧɟ ɨɩɪɟɞɟɥɟɧɧɵɦɢ ɯɚɪɚɤɬɟɪɢɫɬɢɤɚɦɢ. ȼ ɩɨɫɥɟɞɧɢɟ ɝɨɞɵ, ɜɟɪɨɹɬɧɨ ɢɡ-ɡɚ ɪɟɡɤɨɝɨ ɭɜɟɥɢɱɟɧɢɹ ɱɢɫɥɚ ɜɫɟɜɨɡɦɨɠɧɵɯ ɝɢɛɪɢɞɧɵɯ ɫɯɟɦ ɢ ɚɤɬɢɜɧɨɝɨ ɩɪɚɤɬɢɱɟɫɤɨɝɨ ɢɫɩɨɥɶɡɨɜɚɧɢɹ ɫɬɚɬɢɫɬɢɱɟɫɤɢɯ ɦɨɞɟɥɟɣ ɞɥɹ ɫɠɚɬɢɹ, ɩɪɨɢɡɨɲɥɨ ɫɦɟɲɟɧɢɟ ɩɨɧɹɬɢɣ, ɢ ɬɟɪɦɢɧ «PPM» ɱɚɫɬɨ ɢɫɩɨɥɶɡɭɟɬɫɹ ɞɥɹ ɨɛɨɡɧɚɱɟɧɢɹ ɤɨɧɬɟɤɫɬɧɵɯ ɦɟɬɨɞɨɜ ɜɨɨɛɳɟ. ɇɢɠɟ ɛɭɞɟɬ ɨɩɢɫɚɧ ɧɟɤɢɣ ɨɛɨɛɳɟɧɧɵɣ ɚɥɝɨɪɢɬɦ PPM, ɚ ɡɚɬɟɦ ɨɫɨɛɟɧɧɨɫɬɢ ɤɨɧɤɪɟɬɧɵɯ ɪɚɫɩɪɨɫɬɪɚɧɟɧɧɵɯ ɫɯɟɦ. Ʉɚɤ ɢ ɜ ɫɥɭɱɚɟ ɦɧɨɝɢɯ ɞɪɭɝɢɯ ɤɨɧɬɟɤɫɬɧɵɯ ɦɟɬɨɞɨɜ, ɞɥɹ ɤɚɠɞɨɝɨ ɤɨɧɬɟɤɫɬɚ, ɜɫɬɪɟɱɚɟɦɨɝɨ ɜ ɨɛɪɚɛɚɬɵɜɚɟɦɨɣ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ, ɫɨɡɞɚɟɬɫɹ ɫɜɨɹ ɤɨɧɬɟɤɫɬɧɚɹ ɦɨɞɟɥɶ ɄɆ. ɉɪɢ ɷɬɨɦ ɩɨɞ ɤɨɧɬɟɤɫɬɨɦ ɩɨɧɢɦɚɟɬɫɹ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɶ ɷɥɟɦɟɧɬɨɜ ɨɞɧɨɝɨ ɬɢɩɚ — ɫɢɦɜɨɥɨɜ, ɩɢɤɫɟɥɨɜ, ɱɢɫɟɥ, ɧɨ ɧɟ ɧɚɛɨɪ ɪɚɡɧɨɪɨɞɧɵɯ ɨɛɴɟɤɬɨɜ. Ⱦɚɥɟɟ ɜɦɟɫɬɨ ɫɥɨɜɚ «ɷɥɟɦɟɧɬ» ɦɵ ɛɭɞɟɦ ɢɫɩɨɥɶɡɨɜɚɬɶ «ɫɢɦɜɨɥ». Ʉɚɠɞɚɹ ɄɆ ɜɤɥɸɱɚɟɬ ɜ ɫɟɛɹ ɫɱɟɬɱɢɤɢ ɜɫɟɯ ɫɢɦɜɨɥɨɜ, ɜɫɬɪɟɱɟɧɧɵɯ ɜ ɫɨɨɬɜɟɬɫɬɜɭɸɳɟɦ ɤɨɧɬɟɤɫɬɟ. PPM ɨɬɧɨɫɢɬɫɹ ɤ ɚɞɚɩɬɢɜɧɵɦ ɦɟɬɨɞɚɦ ɦɨɞɟɥɢɪɨɜɚɧɢɹ. ɂɫɯɨɞɧɨ ɤɨɞɟɪɭ ɢ ɞɟɤɨɞɟɪɭ ɩɨɫɬɚɜɥɟɧɚ ɜ ɫɨɨɬɜɟɬɫɬɜɢɟ ɧɚɱɚɥɶɧɚɹ ɦɨɞɟɥɶ ɢɫɬɨɱɧɢɤɚ ɞɚɧɧɵɯ. Ȼɭɞɟɦ ɫɱɢɬɚɬɶ, ɱɬɨ ɨɧɚ ɫɨɫɬɨɢɬ ɢɡ 130 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɄɆ(–1), ɩɪɢɫɜɚɢɜɚɸɳɟɣ ɨɞɢɧɚɤɨɜɭɸ ɜɟɪɨɹɬɧɨɫɬɶ ɜɫɟɦ ɫɢɦɜɨɥɚɦ ɚɥɮɚɜɢɬɚ ɜɯɨɞɧɨɣ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ. ɉɨɫɥɟ ɨɛɪɚɛɨɬɤɢ ɬɟɤɭɳɟɝɨ ɫɢɦɜɨɥɚ ɤɨɞɟɪ ɢ ɞɟɤɨɞɟɪ ɢɡɦɟɧɹɸɬ ɫɜɨɢ ɦɨɞɟɥɢ ɨɞɢɧɚɤɨɜɵɦ ɨɛɪɚɡɨɦ, ɜ ɱɚɫɬɧɨɫɬɢ, ɧɚɪɚɳɢɜɚɹ ɜɟɥɢɱɢɧɭ ɨɰɟɧɤɢ ɜɟɪɨɹɬɧɨɫɬɢ ɪɚɫɫɦɚɬɪɢɜɚɟɦɨɝɨ ɫɢɦɜɨɥɚ. ɋɥɟɞɭɸɳɢɣ ɫɢɦɜɨɥ ɤɨɞɢɪɭɟɬɫɹ (ɞɟɤɨɞɢɪɭɟɬɫɹ) ɧɚ ɨɫɧɨɜɚɧɢɢ ɧɨɜɨɣ, ɢɡɦɟɧɟɧɧɨɣ ɦɨɞɟɥɢ, ɩɨɫɥɟ ɱɟɝɨ ɦɨɞɟɥɶ ɫɧɨɜɚ ɦɨɞɢɮɢɰɢɪɭɟɬɫɹ ɢ ɬ.ɞ. ɇɚ ɤɚɠɞɨɦ ɲɚɝɟ ɨɛɟɫɩɟɱɢɜɚɟɬɫɹ ɢɞɟɧɬɢɱɧɨɫɬɶ ɦɨɞɟɥɢ ɤɨɞɟɪɚ ɢ ɞɟɤɨɞɟɪɚ ɡɚ ɫɱɟɬ ɩɪɢɦɟɧɟɧɢɹ ɨɞɢɧɚɤɨɜɨɝɨ ɦɟɯɚɧɢɡɦɚ ɟɟ ɨɛɧɨɜɥɟɧɢɹ. ȼ PPM ɢɫɩɨɥɶɡɭɟɬɫɹ ɧɟɹɜɧɨɟ ɜɡɜɟɲɢɜɚɧɢɟ ɨɰɟɧɨɤ. ɉɨɩɵɬɤɚ ɨɰɟɧɤɢ ɫɢɦɜɨɥɚ ɧɚɱɢɧɚɟɬɫɹ ɫ ɄɆ(N), ɝɞɟ N ɹɜɥɹɟɬɫɹ ɩɚɪɚɦɟɬɪɨɦ ɚɥɝɨɪɢɬɦɚ ɢ ɧɚɡɵɜɚɟɬɫɹ ɩɨɪɹɞɤɨɦ PPM-ɦɨɞɟɥɢ. ȼ ɫɥɭɱɚɟ ɧɭɥɟɜɨɣ ɱɚɫɬɨɬɵ ɫɢɦɜɨɥɚ ɜ ɄɆ ɬɟɤɭɳɟɝɨ ɩɨɪɹɞɤɚ ɨɫɭɳɟɫɬɜɥɹɟɬɫɹ ɩɟɪɟɯɨɞ ɤ ɄɆ ɦɟɧɶɲɟɝɨ ɩɨɪɹɞɤɚ ɡɚ ɫɱɟɬ ɢɫɩɨɥɶɡɨɜɚɧɢɹ ɦɟɯɚɧɢɡɦɚ ɭɯɨɞɨɜ (escape strategy), ɪɚɫɫɦɨɬɪɟɧɧɨɝɨ ɜ ɩɪɟɞɵɞɭɳɟɦ ɩɭɧɤɬɟ. Ɏɚɤɬɢɱɟɫɤɢ, ɜɟɪɨɹɬɧɨɫɬɶ ɭɯɨɞɚ — ɷɬɨ ɫɭɦɦɚɪɧɚɹ ɜɟɪɨɹɬɧɨɫɬɶ ɜɫɟɯ ɫɢɦɜɨɥɨɜ ɚɥɮɚɜɢɬɚ ɜɯɨɞɧɨɝɨ ɩɨɬɨɤɚ, ɟɳɟ ɧɢ ɪɚɡɭ ɧɟ ɩɨɹɜɥɹɜɲɢɯɫɹ ɜ ɤɨɧɬɟɤɫɬɟ. Ʌɸɛɚɹ ɄɆ ɞɨɥɠɧɚ ɞɚɜɚɬɶ ɨɬɥɢɱɧɭɸ ɨɬ ɧɭɥɹ ɨɰɟɧɤɭ ɜɟɪɨɹɬɧɨɫɬɢ ɭɯɨɞɚ. ɂɫɤɥɸɱɟɧɢɹ ɢɡ ɷɬɨɝɨ ɩɪɚɜɢɥɚ ɜɨɡɦɨɠɧɵ ɬɨɥɶɤɨ ɜ ɬɟɯ ɫɥɭɱɚɹɯ, ɤɨɝɞɚ ɡɧɚɱɟɧɢɹ ɜɫɟɯ ɫɱɟɬɱɢɤɨɜ ɄɆ ɞɥɹ ɜɫɟɯ ɫɢɦɜɨɥɨɜ ɚɥɮɚɜɢɬɚ ɨɬɥɢɱɧɵ ɨɬ ɧɭɥɹ, ɬɨ ɟɫɬɶ ɥɸɛɨɣ ɫɢɦɜɨɥ ɦɨɠɟɬ ɛɵɬɶ ɨɰɟɧɟɧ ɜ ɪɚɫɫɦɚɬɪɢɜɚɟɦɨɦ ɤɨɧɬɟɤɫɬɟ. Ɉɰɟɧɤɚ ɜɟɪɨɹɬɧɨɫɬɢ ɭɯɨɞɚ ɬɪɚɞɢɰɢɨɧɧɨ ɹɜɥɹɟɬɫɹ ɨɞɧɨɣ ɢɡ ɨɫɧɨɜɧɵɯ ɩɪɨɛɥɟɦ ɚɥɝɨɪɢɬɦɨɜ ɫ ɧɟɹɜɧɵɦ ɜɡɜɟɲɢɜɚɧɢɟɦ, ɢ ɨɧɚ ɛɭɞɟɬ ɫɩɟɰɢɚɥɶɧɨ ɪɚɫɫɦɨɬɪɟɧɚ ɧɢɠɟ ɜ ɩɭɧɤɬɟ «Ɉɰɟɧɤɚ ɜɟɪɨɹɬɧɨɫɬɢ ɭɯɨɞɚ». ȼɨɨɛɳɟ ɝɨɜɨɪɹ, ɫɩɨɫɨɛ ɦɨɞɟɥɢɪɨɜɚɧɢɹ ɢɫɬɨɱɧɢɤɚ ɫ ɩɨɦɨɳɶɸ ɤɥɚɫɫɢɱɟɫɤɢɯ ɚɥɝɨɪɢɬɦɨɜ PPM ɨɩɢɪɚɟɬɫɹ ɧɚ ɫɥɟɞɭɸɳɢɟ ɩɪɟɞɩɨɥɨɠɟɧɢɹ ɨ ɩɪɢɪɨɞɟ ɢɫɬɨɱɧɢɤɚ: 1. ɢɫɬɨɱɧɢɤ ɹɜɥɹɟɬɫɹ ɦɚɪɤɨɜɫɤɢɦ ɫ ɩɨɪɹɞɤɨɦ N, ɬ.ɟ. ɜɟɪɨɹɬɧɨɫɬɶ ɝɟɧɟɪɚɰɢɢ ɫɢɦɜɨɥɚ ɡɚɜɢɫɢɬ ɨɬ N ɩɪɟɞɵɞɭɳɢɯ ɫɢɦɜɨɥɨɜ ɢ ɬɨɥɶɤɨ ɨɬ ɧɢɯ; 2. ɢɫɬɨɱɧɢɤ ɢɦɟɟɬ ɬɚɤɭɸ ɞɨɩɨɥɧɢɬɟɥɶɧɭɸ ɨɫɨɛɟɧɧɨɫɬɶ, ɱɬɨ ɱɟɦ ɛɥɢɠɟ ɪɚɫɩɨɥɚɝɚɟɬɫɹ ɨɞɢɧ ɢɡ ɫɢɦɜɨɥɨɜ ɤɨɧɬɟɤɫɬɚ ɤ ɬɟɤɭɳɟɦɭ ɫɢɦɜɨɥɭ, ɬɟɦ ɛɨɥɶɲɟ ɤɨɪɪɟɥɹɰɢɹ ɦɟɠɞɭ ɧɢɦɢ.
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X 131 http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
Ɍɚɤɢɦ ɨɛɪɚɡɨɦ, ɦɟɯɚɧɢɡɦ ɭɯɨɞɨɜ ɩɟɪɜɨɧɚɱɚɥɶɧɨ ɪɚɫɫɦɚɬɪɢɜɚɥɫɹ ɥɢɲɶ ɤɚɤ ɜɫɩɨɦɨɝɚɬɟɥɶɧɵɣ ɩɪɢɟɦ, ɩɨɡɜɨɥɹɸɳɢɣ ɪɟɲɢɬɶ ɩɪɨɛɥɟɦɭ ɤɨɞɢɪɨɜɚɧɢɹ ɫɢɦɜɨɥɨɜ, ɧɢ ɪɚɡɭ ɧɟ ɜɫɬɪɟɱɚɜɲɢɯɫɹ ɜ ɤɨɧɬɟɤɫɬɟ ɩɨɪɹɞɤɚ N. ȼ ɢɞɟɚɥɟ, ɞɨɫɬɢɝɚɟɦɨɦ ɩɨɫɥɟ ɨɛɪɚɛɨɬɤɢ ɞɨɫɬɚɬɨɱɧɨ ɞɥɢɧɧɨɝɨ ɛɥɨɤɚ, ɧɢɤɚɤɨɝɨ ɨɛɪɚɳɟɧɢɹ ɤ ɄɆ ɩɨɪɹɞɤɚ ɦɟɧɶɲɟ N ɩɪɨɢɫɯɨɞɢɬɶ ɧɟ ɞɨɥɠɧɨ. ɂɧɚɱɟ ɝɨɜɨɪɹ, ɩɪɢɱɢɫɥɟɧɢɟ ɤɥɚɫɫɢɱɟɫɤɢɯ ɚɥɝɨɪɢɬɦɨɜ PPM ɤ ɦɟɬɨɞɚɦ, ɩɪɨɢɡɜɨɞɹɳɢɦ ɜɡɜɟɲɢɜɚɧɢɟ, ɩɭɫɬɶ ɢ ɧɟɹɜɧɵɦ ɨɛɪɚɡɨɦ, ɹɜɥɹɟɬɫɹ ɧɟ ɜɩɨɥɧɟ ɤɨɪɪɟɤɬɧɵɦ.
ɉɪɢ ɫɠɚɬɢɢ ɨɱɟɪɟɞɧɨɝɨ ɫɢɦɜɨɥɚ ɜɵɩɨɥɧɹɸɬɫɹ ɫɥɟɞɭɸɳɢɟ ɞɟɣɫɬɜɢɹ. ȿɫɥɢ ɫɢɦɜɨɥ s ɨɛɪɚɛɚɬɵɜɚɟɬɫɹ ɫ ɢɫɩɨɥɶɡɨɜɚɧɢɟɦ PPMɦɨɞɟɥɢ ɩɨɪɹɞɤɚ N, ɬɨ, ɤɚɤ ɦɵ ɭɠɟ ɨɬɦɟɱɚɥɢ, ɜ ɩɟɪɜɭɸ ɨɱɟɪɟɞɶ ɪɚɫɫɦɚɬɪɢɜɚɟɬɫɹ ɄɆ(N). ȿɫɥɢ ɨɧɚ ɨɰɟɧɢɜɚɟɬ ɜɟɪɨɹɬɧɨɫɬɶ s ɱɢɫɥɨɦ, ɧɟ ɪɚɜɧɵɦ ɧɭɥɸ, ɬɨ ɫɚɦɚ ɢ ɢɫɩɨɥɶɡɭɟɬɫɹ ɞɥɹ ɤɨɞɢɪɨɜɚɧɢɹ s. ɂɧɚɱɟ ɜɵɞɚɟɬɫɹ ɫɢɝɧɚɥ ɜ ɜɢɞɟ ɫɢɦɜɨɥɚ ɭɯɨɞɚ, ɢ ɧɚ ɨɫɧɨɜɟ ɦɟɧɶɲɟɣ ɩɨ ɩɨɪɹɞɤɭ ɄɆ(N–1) ɩɪɨɢɡɜɨɞɢɬɫɹ ɨɱɟɪɟɞɧɚɹ ɩɨɩɵɬɤɚ ɨɰɟɧɢɬɶ ɜɟɪɨɹɬɧɨɫɬɶ s. Ʉɨɞɢɪɨɜɚɧɢɟ ɩɪɨɢɫɯɨɞɢɬ ɱɟɪɟɡ ɭɯɨɞ ɤ ɄɆ ɦɟɧɶɲɢɯ ɩɨɪɹɞɤɨɜ ɞɨ ɬɟɯ ɩɨɪ, ɩɨɤɚ s ɧɟ ɛɭɞɟɬ ɨɰɟɧɟɧ. ɄɆ(– 1) ɝɚɪɚɧɬɢɪɭɟɬ, ɱɬɨ ɷɬɨ ɜ ɤɨɧɰɟ ɤɨɧɰɨɜ ɩɪɨɢɡɨɣɞɟɬ. Ɍɚɤɢɦ ɨɛɪɚɡɨɦ, ɤɚɠɞɵɣ ɫɢɦɜɨɥ ɤɨɞɢɪɭɟɬɫɹ ɫɟɪɢɟɣ ɤɨɞɨɜ ɫɢɦɜɨɥɚ ɭɯɨɞɚ, ɡɚ ɤɨɬɨɪɨɣ ɫɥɟɞɭɟɬ ɤɨɞ ɫɚɦɨɝɨ ɫɢɦɜɨɥɚ. ɂɡ ɷɬɨɝɨ ɫɥɟɞɭɟɬ, ɱɬɨ ɜɟɪɨɹɬɧɨɫɬɶ ɭɯɨɞɚ ɬɚɤɠɟ ɦɨɠɧɨ ɪɚɫɫɦɚɬɪɢɜɚɬɶ ɤɚɤ ɜɟɪɨɹɬɧɨɫɬɶ ɩɟɪɟɯɨɞɚ ɤ ɤɨɧɬɟɤɫɬɧɨɣ ɦɨɞɟɥɢ ɦɟɧɶɲɟɝɨ ɩɨɪɹɞɤɚ. ȿɫɥɢ ɜ ɩɪɨɰɟɫɫɟ ɨɰɟɧɤɢ ɨɛɧɚɪɭɠɢɜɚɟɬɫɹ, ɱɬɨ ɬɟɤɭɳɢɣ ɪɚɫɫɦɚɬɪɢɜɚɟɦɵɣ ɤɨɧɬɟɤɫɬ ɜɫɬɪɟɱɚɟɬɫɹ ɜ ɩɟɪɜɵɣ ɪɚɡ, ɬɨ ɞɥɹ ɧɟɝɨ ɫɨɡɞɚɟɬɫɹ ɄɆ. ɉɪɢ ɨɰɟɧɤɟ ɜɟɪɨɹɬɧɨɫɬɢ ɫɢɦɜɨɥɚ ɜ ɄɆ ɩɨɪɹɞɤɚ o < N ɦɨɠɧɨ ɢɫɤɥɸɱɢɬɶ ɢɡ ɪɚɫɫɦɨɬɪɟɧɢɹ ɜɫɟ ɫɢɦɜɨɥɵ, ɤɨɬɨɪɵɟ ɫɨɞɟɪɠɚɬɫɹ ɜ ɄɆ(o+1), ɩɨɫɤɨɥɶɤɭ ɧɢ ɨɞɢɧ ɢɡ ɧɢɯ ɬɨɱɧɨ ɧɟ ɹɜɥɹɟɬɫɹ ɫɢɦɜɨɥɨɦ s. Ⱦɥɹ ɷɬɨɝɨ ɜ ɬɟɤɭɳɟɣ ɄɆ(o) ɧɭɠɧɨ ɡɚɦɚɫɤɢɪɨɜɚɬɶ, ɬ.ɟ. ɜɪɟɦɟɧɧɨ ɭɫɬɚɧɨɜɢɬɶ ɜ ɧɨɥɶ, ɡɧɚɱɟɧɢɹ ɫɱɟɬɱɢɤɨɜ ɜɫɟɯ ɫɢɦɜɨɥɨɜ, ɢɦɟɸɳɢɯɫɹ ɜ ɄɆ(o+1). Ɍɚɤɚɹ ɬɟɯɧɢɤɚ ɧɚɡɵɜɚɟɬɫɹ ɦɟɬɨɞɨɦ ɢɫɤɥɸɱɟɧɢɹ (exclusion). ɉɨɫɥɟ ɫɨɛɫɬɜɟɧɧɨ ɤɨɞɢɪɨɜɚɧɢɹ ɫɢɦɜɨɥɚ ɨɛɵɱɧɨ ɨɫɭɳɟɫɬɜɥɹɟɬɫɹ ɨɛɧɨɜɥɟɧɢɟ ɫɬɚɬɢɫɬɢɤɢ ɜɫɟɯ ɄɆ, ɢɫɩɨɥɶɡɨɜɚɧɧɵɯ ɩɪɢ ɨɰɟɧɤɟ ɟɝɨ ɜɟɪɨɹɬɧɨɫɬɢ, ɡɚ ɢɫɤɥɸɱɟɧɢɟɦ ɫɬɚɬɢɱɟɫɤɨɣ ɄɆ(–1). 132 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
Ɍɚɤɨɣ ɩɨɞɯɨɞ ɧɚɡɵɜɚɟɬɫɹ ɦɟɬɨɞɨɦ ɢɫɤɥɸɱɟɧɢɹ ɩɪɢ ɨɛɧɨɜɥɟɧɢɢ. ɉɪɨɫɬɟɣɲɢɦ ɫɩɨɫɨɛɨɦ ɦɨɞɢɮɢɤɚɰɢɢ ɹɜɥɹɟɬɫɹ ɢɧɤɪɟɦɟɧɬ ɫɱɟɬɱɢɤɨɜ ɫɢɦɜɨɥɚ ɜ ɷɬɢɯ ɄɆ. ɉɨɞɪɨɛɧɟɟ ɨ ɫɬɪɚɬɟɝɢɹɯ ɨɛɧɨɜɥɟɧɢɹ ɛɭɞɟɬ ɫɤɚɡɚɧɨ ɜ ɩɭɧɤɬɟ «Ɉɛɧɨɜɥɟɧɢɟ ɫɱɟɬɱɢɤɨɜ ɫɢɦɜɨɥɨɜ». ɉɊɂɆȿɊ ɊȺȻɈɌɕ ȺɅȽɈɊɂɌɆȺ PPM
Ɋɚɫɫɦɨɬɪɢɦ ɩɨɞɪɨɛɧɟɟ ɪɚɛɨɬɭ ɚɥɝɨɪɢɬɦɚ PPM ɫ ɩɨɦɨɳɶɸ ɩɪɢɦɟɪɚ. ɉɪɢɦɟɪ 2 ɂɦɟɟɬɫɹ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɶ ɫɢɦɜɨɥɨɜ "ɚɛɜɚɜɚɛɜɜɛɛɛɜ" ɚɥɮɚɜɢɬɚ {‘ɚ’, ‘ɛ’, ‘ɜ’, ‘ɝ’}, ɤɨɬɨɪɚɹ ɭɠɟ ɛɵɥɚ ɡɚɤɨɞɢɪɨɜɚɧɚ. ɚ ɛ ɜ ɚ ɜ ɚ ɛ ɜ ɜ ɛ ɛ ɛ ɜ ?
ɉɭɫɬɶ ɫɱɟɬɱɢɤ ɫɢɦɜɨɥɚ ɭɯɨɞɚ ɪɚɜɟɧ 1 ɞɥɹ ɜɫɟɯ ɄɆ, ɩɪɢ ɨɛɧɨɜɥɟɧɢɢ ɦɨɞɟɥɢ ɫɱɟɬɱɢɤɢ ɫɢɦɜɨɥɨɜ ɭɜɟɥɢɱɢɜɚɸɬɫɹ ɧɚ 1 ɜɨ ɜɫɟɯ ɚɤɬɢɜɧɵɯ ɄɆ, ɩɪɢɦɟɧɹɟɬɫɹ ɦɟɬɨɞ ɢɫɤɥɸɱɟɧɢɹ, ɢ ɦɚɤɫɢɦɚɥɶɧɚɹ ɞɥɢɧɚ ɤɨɧɬɟɤɫɬɚ ɪɚɜɧɚ 3, ɬ.ɟ. N = 3. ɉɟɪɜɨɧɚɱɚɥɶɧɨ ɦɨɞɟɥɶ ɫɨɫɬɨɢɬ ɢɡ ɄɆ(–1), ɜ ɤɨɬɨɪɨɣ ɫɱɟɬɱɢɤɢ ɜɫɟɯ ɱɟɬɵɪɟɯ ɫɢɦɜɨɥɨɜ ɚɥɮɚɜɢɬɚ ɢɦɟɸɬ ɡɧɚɱɟɧɢɟ 1. ɋɨɫɬɨɹɧɢɟ ɦɨɞɟɥɢ ɨɛɪɚɛɨɬɤɢ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ "ɚɛɜɚɜɚɛɜɜɛɛɛɜ" ɩɪɟɞɫɬɚɜɥɟɧɨ ɧɚ ɪɢɫ. 4.2, ɝɞɟ ɩɪɹɦɨɭɝɨɥɶɧɢɤɚɦɢ ɨɛɨɡɧɚɱɟɧɵ ɤɨɧɬɟɤɫɬɧɵɟ ɦɨɞɟɥɢ, ɩɪɢ ɷɬɨɦ ɞɥɹ ɤɚɠɞɨɣ ɄɆ ɭɤɚɡɚɧ ɤɭɪɫɢɜɨɦ ɤɨɧɬɟɤɫɬ, ɚ ɬɚɤɠɟ ɜɫɬɪɟɱɚɜɲɢɟɫɹ ɜ ɤɨɧɬɟɤɫɬɟ ɫɢɦɜɨɥɵ ɢ ɢɯ ɱɚɫɬɨɬɵ.
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X 133 http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɜ: ɚ ɜ ɛ 211
ɜɜ: ɛ 1
ɛɜɜ: ɛ 1
ɚɜ: ɚ 1
ɜɚɜ: ɚ 1
ɛɜ: ɚ ɜ 11
ɚɛɜɝ 1111
ɚɛɜ 355
ɚ: ɛ ɜ 21
ɜɚ: ɜ ɛ 11
ɚɜɚ: ɛ 1
ɜɛ: ɛ 1
ɜɜɛ: ɛ 1
ɉɨɪɹɞɨɤ:
1
ɛɜɚ: ɜ 1
ɜɚɛ: ɜ 1
ɛɛ: ɛ ɜ 11
0
ɚɛɜ: ɚ ɜ 11
ɚɛ: ɜ 2
ɛ: ɜ ɛ 32
-1
ɛɛɜ: ? 1
ɜɛɛ: ɛ 1 ɛɛɛ: ɜ 1
2
3
Ɋɢɫ. 4.2. ɋɨɫɬɨɹɧɢɟ ɦɨɞɟɥɢ ɩɨɫɥɟ ɨɛɪɚɛɨɬɤɢ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ "ɚɛɜɚɜɚɛɜɜɛɛɛɜ"
134 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɉɭɫɬɶ ɬɟɤɭɳɢɣ ɫɢɦɜɨɥ ɪɚɜɟɧ ‘ɝ’, ɬ.ɟ. ‘?’ = ‘ɝ’, ɬɨɝɞɚ ɩɪɨɰɟɫɫ ɟɝɨ ɤɨɞɢɪɨɜɚɧɢɹ ɛɭɞɟɬ ɜɵɝɥɹɞɟɬɶ ɫɥɟɞɭɸɳɢɦ ɨɛɪɚɡɨɦ. ɋɧɚɱɚɥɚ ɪɚɫɫɦɚɬɪɢɜɚɟɬɫɹ ɤɨɧɬɟɤɫɬ 3-ɝɨ ɩɨɪɹɞɤɚ “ɛɛɜ”. Ɋɚɧɟɟ ɨɧ ɧɟ ɜɫɬɪɟɱɚɥɫɹ, ɩɨɷɬɨɦɭ ɤɨɞɟɪ, ɧɢɱɟɝɨ ɧɟ ɩɨɫɥɚɜ ɧɚ ɜɵɯɨɞ, ɩɟɪɟɯɨɞɢɬ ɤ ɚɧɚɥɢɡɭ ɫɬɚɬɢɫɬɢɤɢ ɞɥɹ ɤɨɧɬɟɤɫɬɚ 2-ɝɨ ɩɨɪɹɞɤɚ. ȼ ɷɬɨɦ ɤɨɧɬɟɤɫɬɟ (“ɛɜ”) ɜɫɬɪɟɱɚɥɢɫɶ ɫɢɦɜɨɥ ‘ɚ’ ɢ ɫɢɦɜɨɥ ‘ɜ’, ɫɱɟɬɱɢɤɢ ɤɨɬɨɪɵɯ ɜ ɫɨɨɬɜɟɬɫɬɜɭɸɳɟɣ ɄɆ ɪɚɜɧɵ 1 ɤɚɠɞɵɣ, ɩɨɷɬɨɦɭ ɫɢɦɜɨɥ ɭɯɨɞɚ ɤɨɞɢɪɭɟɬɫɹ ɫ ɜɟɪɨɹɬɧɨɫɬɶɸ 1/(2+1), ɝɞɟ ɜ ɡɧɚɦɟɧɚɬɟɥɟ ɱɢɫɥɨ 2 — ɷɬɨ ɧɚɛɥɸɞɚɜɲɚɹɫɹ ɱɚɫɬɨɬɚ ɩɨɹɜɥɟɧɢɹ ɤɨɧɬɟɤɫɬɚ “ɛɜ”, 1 — ɷɬɨ ɡɧɚɱɟɧɢɟ ɫɱɟɬɱɢɤɚ ɫɢɦɜɨɥɚ ɭɯɨɞɚ. ȼ ɤɨɧɬɟɤɫɬɟ 1-ɝɨ ɩɨɪɹɞɤɚ “ɜ” ɞɜɚɠɞɵ ɜɫɬɪɟɱɚɥɫɹ ɫɢɦɜɨɥ ‘ɚ’, ɤɨɬɨɪɵɣ ɢɫɤɥɸɱɚɟɬɫɹ (ɦɚɫɤɢɪɭɟɬɫɹ), ɨɞɢɧ ɪɚɡ ɬɚɤɠɟ ɢɫɤɥɸɱɚɟɦɵɣ ‘ɜ’ ɢ ɨɞɢɧ ɪɚɡ ‘ɛ’, ɩɨɷɬɨɦɭ ɨɰɟɧɤɚ ɜɟɪɨɹɬɧɨɫɬɢ ɭɯɨɞɚ ɛɭɞɟɬ ɪɚɜɧɚ 1/(1+1). ȼ ɄɆ(0) ɫɢɦɜɨɥ ‘ɝ’ ɬɚɤɠɟ ɨɰɟɧɢɬɶ ɧɟɥɶɡɹ, ɩɪɢɱɟɦ ɜɫɟ ɢɦɟɸɳɢɟɫɹ ɜ ɷɬɨɣ ɄɆ ɫɢɦɜɨɥɵ ‘ɚ’, ’ɛ’, ‘ɜ’ ɢɫɤɥɸɱɚɸɬɫɹ, ɬɚɤ ɤɚɤ ɭɠɟ ɜɫɬɪɟɱɚɥɢɫɶ ɧɚɦ ɜ ɄɆ ɛɨɥɟɟ ɜɵɫɨɤɨɝɨ ɩɨɪɹɞɤɚ. ɉɨɷɬɨɦɭ ɜɟɪɨɹɬɧɨɫɬɶ ɭɯɨɞɚ ɩɨɥɭɱɚɟɬɫɹ ɪɚɜɧɨɣ 1. ɐɢɤɥ ɨɰɟɧɢɜɚɧɢɹ ɡɚɜɟɪɲɚɟɬɫɹ ɧɚ ɭɪɨɜɧɟ ɄɆ(–1), ɝɞɟ ‘ɝ’ ɤ ɷɬɨɦɭ ɜɪɟɦɟɧɢ ɨɫɬɚɟɬɫɹ ɟɞɢɧɫɬɜɟɧɧɵɦ ɞɨ ɫɢɯ ɩɨɪ ɧɟ ɩɨɩɚɞɚɜɲɢɦɫɹ ɫɢɦɜɨɥɨɦ, ɩɨɷɬɨɦɭ ɨɧ ɩɨɥɭɱɚɟɬ ɜɟɪɨɹɬɧɨɫɬɶ 1 ɢ ɤɨɞɢɪɭɟɬɫɹ ɩɨɫɪɟɞɫɬɜɨɦ 0 ɛɢɬɨɜ. Ɍɚɤɢɦ ɨɛɪɚɡɨɦ, ɩɪɢ ɢɫɩɨɥɶɡɨɜɚɧɢɢ ɯɨɪɨɲɟɝɨ ɫɬɚɬɢɫɬɢɱɟɫɤɨɝɨ ɤɨɞɢɪɨɜɳɢɤɚ ɞɥɹ ɩɪɟɞɫɬɚɜɥɟɧɢɹ ‘ɝ’ ɩɨɬɪɟɛɭɟɬɫɹ ɜ ɰɟɥɨɦ ɩɪɢɦɟɪɧɨ 2.6 ɛɢɬɚ. ɉɟɪɟɞ ɨɛɪɚɛɨɬɤɨɣ ɫɥɟɞɭɸɳɟɝɨ ɫɢɦɜɨɥɚ ɫɨɡɞɚɟɬɫɹ ɄɆ ɞɥɹ ɫɬɪɨɤɢ “ɛɛɜ” ɢ ɩɪɨɢɡɜɨɞɢɬɫɹ ɦɨɞɢɮɢɤɚɰɢɹ ɫɱɟɬɱɢɤɨɜ ɫɢɦɜɨɥɚ ‘ɝ’ ɜ ɫɨɡɞɚɧɧɨɣ ɢ ɜɨ ɜɫɟɯ ɩɪɨɫɦɨɬɪɟɧɧɵɯ ɄɆ. ȼ ɞɚɧɧɨɦ ɫɥɭɱɚɟ ɬɪɟɛɭɟɬɫɹ ɢɡɦɟɧɟɧɢɟ ɄɆ ɜɫɟɯ ɩɨɪɹɞɤɨɜ ɨɬ 0 ɞɨ N. Ɍɚɛɥ. 4.2 ɞɟɦɨɧɫɬɪɢɪɭɟɬ ɨɰɟɧɤɢ ɜɟɪɨɹɬɧɨɫɬɟɣ, ɤɨɬɨɪɵɟ ɞɨɥɠɧɵ ɛɵɥɢ ɛɵɬɶ ɢɫɩɨɥɶɡɨɜɚɧɵ ɩɪɢ ɤɨɞɢɪɨɜɚɧɢɢ ɫɢɦɜɨɥɨɜ ɚɥɮɚɜɢɬɚ {‘ɚ’, ‘ɛ’, ‘ɜ’, ‘ɝ’} ɜ ɬɟɤɭɳɟɣ ɩɨɡɢɰɢɢ.
Ɍɚɛɥɢɰɚ 4.2 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X 135 http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɋɢɦɜɨɥ s
‘ɚ’
ɉɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɶ ɨɰɟɧɨɤ Ɉɛɳɚɹ ɨɰɟɧ- ɉɪɟɞɫɬɚɜɞɥɹ ɄɆ ɤɚɠɞɨɝɨ ɩɨɪɹɞɤɚ ɨɬ ɤɚ ɜɟɪɨɹɬɧɨ- ɥɟɧɢɟ ɬɪɟɫɬɢ q(s) ɛɭɟɬ ɛɢɬɨɜ 3 ɞɨ –1 3 2 1 0 – 1 “ɛɛɜ” “ɛɜ” “ɜ” “” 1 1 1.6
‘ɛ’
-
‘ɜ’
-
‘ɝ’
-
2 +1 1 2 +1 1 2 +1 1 2 +1
1 1+1
-
-
-
-
-
1 1+1
1
1
3 1 6 1 3 1 6
2.6 1.6 2.6
Ⱥɥɝɨɪɢɬɦ ɞɟɤɨɞɢɪɨɜɚɧɢɹ ɚɛɫɨɥɸɬɧɨ ɫɢɦɦɟɬɪɢɱɟɧ ɚɥɝɨɪɢɬɦɭ ɤɨɞɢɪɨɜɚɧɢɹ. ɉɨɫɥɟ ɞɟɤɨɞɢɪɨɜɚɧɢɹ ɫɢɦɜɨɥɚ ɜ ɬɟɤɭɳɟɣ ɄɆ ɩɪɨɜɟɪɹɟɬɫɹ, ɧɟ ɹɜɥɹɟɬɫɹ ɥɢ ɨɧ ɫɢɦɜɨɥɨɦ ɭɯɨɞɚ, ɟɫɥɢ ɷɬɨ ɬɚɤ, ɬɨ ɜɵɩɨɥɧɹɟɬɫɹ ɩɟɪɟɯɨɞ ɤ ɄɆ ɩɨɪɹɞɤɨɦ ɧɢɠɟ. ɂɧɚɱɟ ɫɱɢɬɚɟɬɫɹ, ɱɬɨ ɢɫɯɨɞɧɵɣ ɫɢɦɜɨɥ ɜɨɫɫɬɚɧɨɜɥɟɧ, ɨɧ ɡɚɩɢɫɵɜɚɟɬɫɹ ɜ ɞɟɤɨɞɢɪɨɜɚɧɧɵɣ ɩɨɬɨɤ ɢ ɨɫɭɳɟɫɬɜɥɹɟɬɫɹ ɩɟɪɟɯɨɞ ɤ ɫɥɟɞɭɸɳɟɦɭ ɲɚɝɭ. ɋɨɞɟɪɠɚɧɢɟ ɩɪɨɰɟɞɭɪ ɨɛɧɨɜɥɟɧɢɹ ɫɱɟɬɱɢɤɨɜ, ɫɨɡɞɚɧɢɹ ɧɨɜɵɯ ɤɨɧɬɟɤɫɬɧɵɯ ɦɨɞɟɥɟɣ, ɩɪɨɱɢɯ ɜɫɩɨɦɨɝɚɬɟɥɶɧɵɯ ɞɟɣɫɬɜɢɣ ɢ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɶ ɢɯ ɩɪɢɦɟɧɟɧɢɹ ɞɨɥɠɧɵ ɛɵɬɶ ɫɬɪɨɝɨ ɨɞɢɧɚɤɨɜɵɦɢ ɩɪɢ ɤɨɞɢɪɨɜɚɧɢɢ ɢ ɞɟɤɨɞɢɪɨɜɚɧɢɢ. ɂɧɚɱɟ ɜɨɡɦɨɠɧɚ ɪɚɫɫɢɧɯɪɨɧɢɡɚɰɢɹ ɤɨɩɢɣ ɦɨɞɟɥɢ ɤɨɞɟɪɚ ɢ ɞɟɤɨɞɟɪɚ, ɱɬɨ ɪɚɧɨ ɢɥɢ ɩɨɡɞɧɨ ɩɪɢɜɟɞɟɬ ɤ ɨɲɢɛɨɱɧɨɦɭ ɞɟɤɨɞɢɪɨɜɚɧɢɸ ɤɚɤɨɝɨ-ɬɨ ɫɢɦɜɨɥɚ. ɇɚɱɢɧɚɹ ɫ ɷɬɨɣ ɩɨɡɢɰɢɢ, ɜɫɹ ɨɫɬɚɜɲɚɹɫɹ ɱɚɫɬɶ ɫɠɚɬɨɣ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ ɛɭɞɟɬ ɪɚɡɠɚɬɚ ɧɟɩɪɚɜɢɥɶɧɨ. Ɋɚɡɧɢɰɚ ɦɟɠɞɭ ɤɨɞɚɦɢ ɫɢɦɜɨɥɨɜ, ɨɰɟɧɤɢ ɜɟɪɨɹɬɧɨɫɬɢ ɤɨɬɨɪɵɯ ɨɞɢɧɚɤɨɜɵ, ɞɨɫɬɢɝɚɟɬɫɹ ɡɚ ɫɱɟɬ ɬɨɝɨ, ɱɬɨ PPMɩɪɟɞɫɤɚɡɚɬɟɥɶ ɩɟɪɟɞɚɟɬ ɤɨɞɢɪɨɜɳɢɤɭ ɬɚɤ ɧɚɡɵɜɚɟɦɵɟ ɧɚɤɨɩɥɟɧɧɵɟ ɱɚɫɬɨɬɵ (ɢɥɢ ɧɚɤɨɩɥɟɧɧɵɟ ɜɟɪɨɹɬɧɨɫɬɢ) ɨɰɟɧɢɜɚɟɦɨɝɨ ɫɢɦɜɨɥɚ ɢ ɟɝɨ ɫɨɫɟɞɟɣ ɢɥɢ ɤɨɞɨɜɵɟ ɩɪɨɫɬɪɚɧɫɬɜɚ ɫɢɦɜɨɥɨɜ. Ɍɚɤ, 136 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɧɚɩɪɢɦɟɪ, ɞɥɹ ɤɨɧɬɟɤɫɬɚ “ɛɜ” ɢɡ ɩɪɢɦɟɪɚ 2 ɦɨɠɧɨ ɫɨɫɬɚɜɢɬɶ ɬɚɛɥ. 4.3. Ɍɚɛɥɢɰɚ 4.3 ɋɢɦɜɨɥ ɑɚɫɬɨɬɚ Ɉɰɟɧɤɚ ɇɚɤɨɩɥɟɧɧɚɹ Ʉɨɞɨɜɨɟ ɩɪɨɜɟɪɨɹɬɜɟɪɨɹɬɧɨɫɬɶ ɫɬɪɚɧɫɬɜɨ ɧɨɫɬɢ (ɨɰɟɧɤɚ) 1 1 ‘ɚ’ 1 [0 … 0.33) 3
3
‘ɛ’ ‘ɜ’
0 1
-
-
1 3
2 3
‘ɝ’ ɍɯɨɞ
0 1
-
1
1 3
[0.33 … 0.66) [0.66 … 1)
ɏɨɪɨɲɢɣ ɤɨɞɢɪɨɜɳɢɤ ɞɨɥɠɟɧ ɨɬɨɛɪɚɡɢɬɶ ɫɢɦɜɨɥ s ɫ ɨɰɟɧɤɨɣ ɜɟɪɨɹɬɧɨɫɬɢ q(s) ɜ ɤɨɞ ɞɥɢɧɵ log2q(s), ɱɬɨ ɢ ɨɛɟɫɩɟɱɢɬ ɫɠɚɬɢɟ ɜɫɟɣ ɨɛɪɚɛɚɬɵɜɚɟɦɨɣ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ ɜ ɰɟɥɨɦ. ȼ ɨɛɨɛɳɟɧɧɨɦ ɜɢɞɟ ɚɥɝɨɪɢɬɦ ɤɨɞɢɪɨɜɚɧɢɹ ɦɨɠɧɨ ɡɚɩɢɫɚɬɶ ɬɚɤ. /*ɢɧɢɰɢɚɥɢɡɚɰɢɹ ɤɨɧɬɟɤɫɬɚ ɞɥɢɧɵ N (ɜ ɫɦɵɫɥɟ ɫɬɪɨɤɢ ɩɪɟɞɵɞɭɳɢɯ ɫɢɦɜɨɥɨɜ), ɷɬɚ ɫɬɪɨɤɚ ɞɨɥɠɧɚ ɫɨɞɟɪɠɚɬɶ N ɩɪɟɞɵɞɭɳɢɯ ɫɢɦɜɨɥɨɜ, ɨɩɪɟɞɟɥɹɹ ɧɚɛɨɪ ɚɤɬɢɜɧɵɯ ɤɨɧɬɟɤɫɬɨɜ ɞɥɢɧɵ o N */ context = ""; while ( ! DataFile.EOF() ){ c = DataFile.ReadSymbol(); // ɬɟɤɭɳɢɣ ɫɢɦɜɨɥ order = N; // ɬɟɤɭɳɢɣ ɩɨɪɹɞɨɤ ɄɆ success = 0; // ɭɫɩɟɲɧɨɫɬɶ ɨɰɟɧɤɢ ɜ ɬɟɤɭɳɟɣ ɄɆ do{ // ɧɚɣɞɟɦ ɄɆ ɞɥɹ ɤɨɧɬɟɤɫɬɚ ɬɟɤɭɳɟɣ ɞɥɢɧɵ CM = ContextModel.FindModel (context, order); /*ɩɨɩɪɨɛɭɟɦ ɧɚɣɬɢ ɬɟɤɭɳɢɣ ɫɢɦɜɨɥ c ɜ ɷɬɨɣ ɄɆ, ɜ CumFreq ɩɨɥɭɱɢɦ ɟɝɨ ɧɚɤɨɩɥɟɧɧɭɸ ɱɚɫɬɨɬɭ (ɢɥɢ ɧɚɤɨɩɥɟɧɧɭɸ ɱɚɫɬɨɬɭ ɫɢɦɜɨɥɚ ɭɯɨɞɚ), ɜ counter —
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X 137 http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɫɫɵɥɤɭ ɧɚ ɫɱɟɬɱɢɤ ɫɢɦɜɨɥɚ; ɮɥɚɝ success ɭɤɚɡɵɜɚɟɬ ɧɚ ɨɬɫɭɬɫɬɜɢɟ ɭɯɨɞɚ */ success = CM.EvaluateSymbol (c, &CumFreq, counter); /*ɡɚɩɨɦɧɢɦ ɜ ɫɬɟɤɟ ɄɆ ɢ ɭɤɚɡɚɬɟɥɶ ɧɚ ɫɱɟɬɱɢɤ ɞɥɹ ɩɨɫɥɟɞɭɸɳɟɝɨ ɨɛɧɨɜɥɟɧɢɹ ɦɨɞɟɥɢ */ Stack.Push (CM, counter); // ɡɚɤɨɞɢɪɭɟɦ c ɢɥɢ ɫɢɦɜɨɥ ɭɯɨɞɚ StatCoder.Encode (CM, CumFreq, counter); order--; }while ( ! success ); /*ɨɛɧɨɜɢɦ ɦɨɞɟɥɶ: ɞɨɛɚɜɢɦ ɄɆ ɜ ɫɥɭɱɚɟ ɧɟɨɛɯɨɞɢɦɨɫɬɢ, ɢɡɦɟɧɢɦ ɡɧɚɱɟɧɢɹ ɫɱɟɬɱɢɤɨɜ ɢ ɬ.ɞ. */ UpdateModel (Stack); // ɨɛɧɨɜɢɦ ɤɨɧɬɟɤɫɬ: ɫɞɜɢɧɟɦ ɜɥɟɜɨ, ɫɩɪɚɜɚ ɞɨɛɚɜɢɦ c MoveContext (c); }
ɉɊɂɆȿɊ ɊȿȺɅɂɁȺɐɂɂ PPM-ɄɈɆɉɊȿɋɋɈɊȺ
Ɋɚɫɫɦɨɬɪɢɦ ɨɫɧɨɜɧɵɟ ɦɨɦɟɧɬɵ ɪɟɚɥɢɡɚɰɢɢ ɤɨɦɩɪɟɫɫɨɪɚ PPM ɞɥɹ ɩɪɨɫɬɟɣɲɟɝɨ ɫɥɭɱɚɹ ɫ ɩɨɪɹɞɤɨɦ ɦɨɞɟɥɢ N = 1 ɛɟɡ ɢɫɤɥɸɱɟɧɢɹ ɫɢɦɜɨɥɨɜ. Ȼɭɞɟɦ ɬɚɤɠɟ ɢɫɯɨɞɢɬɶ ɢɡ ɬɨɝɨ, ɱɬɨ ɫɬɚɬɢɫɬɢɱɟɫɤɨɟ ɤɨɞɢɪɨɜɚɧɢɟ ɜɵɩɨɥɧɹɟɬɫɹ ɚɪɢɮɦɟɬɢɱɟɫɤɢɦ ɤɨɞɟɪɨɦ. ɉɪɢ ɤɨɧɬɟɤɫɬɧɨɦ ɦɨɞɟɥɢɪɨɜɚɧɢɢ 1-ɝɨ ɩɨɪɹɞɤɚ ɧɚɦ ɧɟ ɬɪɟɛɭɸɬɫɹ ɫɥɨɠɧɵɟ ɫɬɪɭɤɬɭɪɵ ɞɚɧɧɵɯ, ɨɛɟɫɩɟɱɢɜɚɸɳɢɟ ɷɮɮɟɤɬɢɜɧɨɟ ɯɪɚɧɟɧɢɟ ɢ ɞɨɫɬɭɩ ɤ ɢɧɮɨɪɦɚɰɢɢ ɨɬɞɟɥɶɧɵɯ ɄɆ. Ɇɨɠɧɨ ɩɪɨɫɬɨ ɯɪɚɧɢɬɶ ɨɩɢɫɚɧɢɹ ɄɆ ɜ ɨɞɧɨɦɟɪɧɨɦ ɦɚɫɫɢɜɟ, ɪɚɡɦɟɪ ɤɨɬɨɪɨɝɨ ɪɚɜɟɧ ɤɨɥɢɱɟɫɬɜɭ ɫɢɦɜɨɥɨɜ ɜ ɚɥɮɚɜɢɬɟ ɜɯɨɞɧɨɣ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ, ɢ ɧɚɯɨɞɢɬɶ ɧɭɠɧɭɸ ɄɆ, ɢɫɩɨɥɶɡɭɹ ɫɢɦɜɨɥ ɟɟ ɤɨɧɬɟɤɫɬɚ ɤɚɤ ɢɧɞɟɤɫ. Ɇɵ ɢɫɩɨɥɶɡɭɟɦ ɛɚɣɬ-ɨɪɢɟɧɬɢɪɨɜɚɧɧɨɟ ɦɨɞɟɥɢɪɨɜɚɧɢɟ, ɩɨɷɬɨɦɭ ɪɚɡɦɟɪ ɦɚɫɫɢɜɚ ɞɥɹ ɤɨɧɬɟɤɫɬɧɵɯ ɦɨɞɟɥɟɣ ɩɨɪɹɞɤɚ 1 ɛɭɞɟɬ ɪɚɜɟɧ 256. ɑɬɨɛɵ ɧɟ ɩɥɨɞɢɬɶ ɥɢɲɧɢɯ ɫɭɳɧɨɫɬɟɣ, ɦɵ, ɜɨ-ɩɟɪɜɵɯ, ɨɬɤɚɠɟɦɫɹ ɨɬ ɄɆ(–1) ɡɚ ɫɱɟɬ ɫɨɨɬɜɟɬɫɬɜɭɸɳɟɣ ɢɧɢɰɢɚɥɢɡɚɰɢɢ ɄɆ(0), ɢ, ɜɨ-ɜɬɨɪɵɯ, ɛɭɞɟɦ ɯɪɚɧɢɬɶ ɄɆ(0) ɜ ɬɨɦ ɠɟ ɦɚɫɫɢɜɟ, ɱɬɨ ɢ ɄɆ(1). ɋɱɢɬɚɟɦ, ɱɬɨ ɄɆ(0) ɫɨɨɬɜɟɬɫɬɜɭɟɬ ɢɧɞɟɤɫ 256. ȼ ɫɬɪɭɤɬɭɪɭ ɤɨɧɬɟɤɫɬɧɨɣ ɦɨɞɟɥɢ ContextModel ɜɤɥɸɱɢɦ ɦɚɫɫɢɜ ɫɱɟɬɱɢɤɨɜ count ɞɥɹ ɜɫɟɯ ɜɨɡɦɨɠɧɵɯ 256 ɫɢɦɜɨɥɨɜ. Ⱦɥɹ 138 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɫɢɦɜɨɥɚ ɭɯɨɞɚ ɜɜɟɞɟɦ ɜ ɫɬɪɭɤɬɭɪɭ ɄɆ ɫɩɟɰɢɚɥɶɧɵɣ ɫɱɟɬɱɢɤ esc, ɚ ɬɚɤɠɟ ɞɨɛɚɜɢɦ ɩɨɥɟ TotFr, ɜ ɤɨɬɨɪɨɦ ɛɭɞɟɬ ɫɨɞɟɪɠɚɬɶɫɹ ɫɭɦɦɚ ɡɧɚɱɟɧɢɣ ɫɱɟɬɱɢɤɨɜ ɜɫɟɯ ɨɛɵɱɧɵɯ ɫɢɦɜɨɥɨɜ. ɂɫɩɨɥɶɡɨɜɚɧɢɟ ɩɨɥɹ TotFr ɧɟ ɨɛɹɡɚɬɟɥɶɧɨ, ɧɨ ɩɨɡɜɨɥɢɬ ɭɫɤɨɪɢɬɶ ɨɛɪɚɛɨɬɤɭ ɞɚɧɧɵɯ. ɋ ɭɱɟɬɨɦ ɫɤɚɡɚɧɧɨɝɨ ɫɬɪɭɤɬɭɪɵ ɞɚɧɧɵɯ ɤɨɦɩɪɟɫɫɨɪɚ ɛɭɞɭɬ ɬɚɤɢɦɢ. struct ContextModel{ int esc, TotFr; int count[256]; }; ContextModel cm[257];
ȿɫɥɢ ɪɚɡɦɟɪ ɬɢɩɚ int ɪɚɜɟɧ 4 ɛɚɣɬɚɦ, ɬɨ ɧɚɦ ɩɨɬɪɟɛɭɟɬɫɹ ɧɟ ɦɟɧɟɟ 257 ɤɛɚɣɬ ɩɚɦɹɬɢ ɞɥɹ ɯɪɚɧɟɧɢɹ ɦɨɞɟɥɢ. Ɉɩɢɲɟɦ ɫɬɟɤ, ɜ ɤɨɬɨɪɨɦ ɛɭɞɭɬ ɯɪɚɧɢɬɶɫɹ ɭɤɚɡɚɬɟɥɢ ɧɚ ɬɪɟɛɭɸɳɢɟ ɦɨɞɢɮɢɤɚɰɢɢ ɄɆ, ɚ ɬɚɤɠɟ ɭɤɚɡɚɬɟɥɶ ɫɬɟɤɚ SP ɢ ɤɨɧɬɟɤɫɬ context. ContextModel *stack[2]; int SP, context [1]; //ɤɨɧɬɟɤɫɬ ɜɵɪɨɠɞɚɟɬɫɹ ɜ 1 ɫɢɦɜɨɥ
Ȼɨɥɶɲɟ ɧɢɤɚɤɢɯ ɝɥɨɛɚɥɶɧɵɯ ɩɟɪɟɦɟɧɧɵɯ ɢ ɫɬɪɭɤɬɭɪ ɞɚɧɧɵɯ ɧɚɦ ɧɟ ɧɭɠɧɨ. ɂɧɢɰɢɚɥɢɡɚɰɢɸ ɦɨɞɟɥɢ ɛɭɞɟɦ ɜɵɩɨɥɧɹɬɶ ɜ ɨɛɳɟɣ ɞɥɹ ɤɨɞɟɪɚ ɢ ɞɟɤɨɞɟɪɚ ɮɭɧɤɰɢɢ init_model. void init_model (void){ /*Ɍɚɤ ɤɚɤ cm ɹɜɥɹɟɬɫɹ ɝɥɨɛɚɥɶɧɨɣ ɩɟɪɟɦɟɧɧɨɣ, ɬɨ ɡɧɚɱɟɧɢɹ ɜɫɟɯ ɩɨɥɟɣ ɪɚɜɧɵ 0. ɇɚɦ ɬɪɟɛɭɟɬɫɹ ɬɨɥɶɤɨ ɪɚɫɩɪɟɞɟɥɢɬɶ ɤɨɞɨɜɨɟ ɩɪɨɫɬɪɚɧɫɬɜɨ ɜ ɄɆ(0) ɬɚɤ, ɱɬɨɛɵ ɜɫɟ ɫɢɦɜɨɥɵ, ɜɤɥɸɱɚɹ ɫɢɦɜɨɥ ɭɯɨɞɚ, ɜɫɟɝɞɚ ɛɵ ɢɦɟɥɢ ɧɟɧɭɥɟɜɵɟ ɨɰɟɧɤɢ. ɉɭɫɬɶ ɬɚɤɠɟ ɫɢɦɜɨɥɵ ɛɭɞɭɬ ɪɚɜɧɨɜɟɪɨɹɬɧɵɦɢ. */ for ( int j = 0; j < 256; j++ )
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X 139 http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
cm[256].count[j] = 1 ; cm[256].TotFr = 256; /*əɜɧɨ ɡɚɩɢɲɟɦ, ɱɬɨ ɜ ɧɚɱɚɥɟ ɦɨɞɟɥɢɪɨɜɚɧɢɹ ɦɵ ɫɱɢɬɚɟɦ ɤɨɧɬɟɤɫɬ ɪɚɜɧɵɦ 0. ɑɢɫɥɨ ɧɟ ɢɦɟɟɬ ɡɧɚɱɟɧɢɹ, ɥɢɲɶ ɛɵ ɤɨɞɟɪ ɢ ɞɟɤɨɞɟɪ ɬɨɱɧɨ ɫɥɟɞɨɜɚɥɢ ɩɪɢɧɹɬɵɦ ɫɨɝɥɚɲɟɧɢɹɦ. Ɉɛɪɚɬɢɬɟ ɧɚ ɷɬɨ ɜɧɢɦɚɧɢɟ. */ context [0] = 0; SP = 0; }
Ɏɭɧɤɰɢɢ ɨɛɧɨɜɥɟɧɢɹ ɦɨɞɟɥɢ ɬɚɤɠɟ ɛɭɞɭɬ ɨɛɳɢɦɢ ɞɥɹ ɤɨɞɟɪɚ ɢ ɞɟɤɨɞɟɪɚ. ȼ update_model ɩɪɨɢɡɜɨɞɢɬɫɹ ɢɧɤɪɟɦɟɧɬ ɫɱɟɬɱɢɤɨɜ ɩɪɨɫɦɨɬɪɟɧɧɵɯ ɄɆ, ɚ ɜ rescale ɨɫɭɳɟɫɬɜɥɹɟɬɫɹ ɦɚɫɲɬɚɛɢɪɨɜɚɧɢɟ ɫɱɟɬɱɢɤɨɜ. ɇɟɨɛɯɨɞɢɦɨɫɬɶ ɦɚɫɲɬɚɛɢɪɨɜɚɧɢɹ ɨɛɭɫɥɨɜɥɟɧɚ ɨɫɨɛɟɧɧɨɫɬɹɦɢ ɬɢɩɢɱɧɵɯ ɪɟɚɥɢɡɚɰɢɣ ɚɪɢɮɦɟɬɢɱɟɫɤɨɝɨ ɤɨɞɢɪɨɜɚɧɢɹ ɢ ɡɚɤɥɸɱɚɟɬɫɹ ɜ ɞɟɥɟɧɢɢ ɡɧɚɱɟɧɢɣ ɫɱɟɬɱɢɤɨɜ ɩɨɩɨɥɚɦ ɩɪɢ ɞɨɫɬɢɠɟɧɢɢ ɫɭɦɦɵ ɡɧɚɱɟɧɢɣ ɜɫɟɯ ɫɱɟɬɱɢɤɨɜ TotFr+esc ɧɟɤɨɬɨɪɨɝɨ ɩɨɪɨɝɚ. ɉɨɞɪɨɛɧɟɟ ɨɛ ɷɬɨɦ ɪɚɫɫɤɚɡɚɧɨ ɜ ɩɭɧɤɬɟ «Ɉɛɧɨɜɥɟɧɢɟ ɫɱɟɬɱɢɤɨɜ ɫɢɦɜɨɥɨɜ». const int MAX_TotFr = 0x3fff; void rescale (ContextModel *CM){ CM->TotFr = 0; for (int i = 0; i < 256; i++){ /*ɨɛɟɫɩɟɱɢɦ ɨɬɥɢɱɢɟ ɨɬ ɧɭɥɹ ɡɧɚɱɟɧɢɹ ɫɱɟɬɱɢɤɚ ɩɨɫɥɟ ɦɚɫɲɬɚɛɢɪɨɜɚɧɢɹ */ CM->count[i] -= CM->count[i] >> 1; CM->TotFr += CM->count[i]; } } void update_model (int c){ while (SP) { SP--; if ((stack[SP]->TotFr + stack[SP]->esc) >= MAX_TotFr) rescale (stack[SP]); if (!stack[SP]->count[c]) /*ɜ ɷɬɨɦ ɤɨɧɬɟɤɫɬɟ ɷɬɨ ɧɨɜɵɣ ɫɢɦɜɨɥ, ɭɜɟɥɢɱɢɦ ɫɱɟɬɱɢɤ ɭɯɨɞɨɜ */ stack[SP]->esc += 1;
140 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
stack[SP]->count[c] += 1; stack[SP]->TotFr += 1; } }
ɋɨɛɫɬɜɟɧɧɨ ɤɨɞɟɪ ɪɟɚɥɢɡɭɟɦ ɮɭɧɤɰɢɟɣ encode. ɗɬɚ ɮɭɧɤɰɢɹ ɭɩɪɚɜɥɹɟɬ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɶɸ ɞɟɣɫɬɜɢɣ ɩɪɢ ɫɠɚɬɢɢ ɞɚɧɧɵɯ, ɜɵɡɵɜɚɹ ɜɫɩɨɦɨɝɚɬɟɥɶɧɵɟ ɩɪɨɰɟɞɭɪɵ ɜ ɬɪɟɛɭɟɦɨɦ ɩɨɪɹɞɤɟ, ɚ ɬɚɤɠɟ ɧɚɯɨɞɢɬ ɧɭɠɧɭɸ ɄɆ. Ɉɰɟɧɤɚ ɬɟɤɭɳɟɝɨ ɫɢɦɜɨɥɚ ɩɪɨɢɡɜɨɞɢɬɫɹ ɜ ɮɭɧɤɰɢɢ encode_sym, ɤɨɬɨɪɚɹ ɩɟɪɟɞɚɟɬ ɪɟɡɭɥɶɬɚɬɵ ɫɜɨɟɣ ɪɚɛɨɬɵ ɚɪɢɮɦɟɬɢɱɟɫɤɨɦɭ ɤɨɞɟɪɭ. int encode_sym (ContextModel *CM, int c){ // ɄɆ ɩɨɬɪɟɛɭɟɬ ɢɧɤɪɟɦɟɧɬɚ ɫɱɟɬɱɢɤɨɜ, ɡɚɩɨɦɧɢɦ ɟɟ stack [SP++] = CM; if (CM->count[c]){ /*ɫɱɟɬɱɢɤ ɫɠɢɦɚɟɦɨɝɨ ɫɢɦɜɨɥɚ ɧɟ ɪɚɜɟɧ ɧɭɥɸ, ɬɨɝɞɚ ɟɝɨ ɦɨɠɧɨ ɨɰɟɧɢɬɶ ɜ ɬɟɤɭɳɟɣ ɄɆ; ɧɚɣɞɟɦ ɧɚɤɨɩɥɟɧɧɭɸ ɱɚɫɬɨɬɭ ɩɪɟɞɵɞɭɳɟɝɨ ɜ ɦɚɫɫɢɜɟ count ɫɢɦɜɨɥɚ */ int CumFreqUnder = 0; for (int i = 0; i < c; i++) CumFreqUnder += CM->count[i]; /*ɩɟɪɟɞɚɞɢɦ ɨɩɢɫɚɧɢɟ ɤɨɞɨɜɨɝɨ ɩɪɨɫɬɪɚɧɫɬɜɚ, ɡɚɧɢɦɚɟɦɨɝɨ ɫɢɦɜɨɥɨɦ c, ɚɪɢɮɦɟɬɢɱɟɫɤɨɦɭ ɤɨɞɟɪɭ */ AC.encode (CumFreqUnder, CM->count[c], CM->TotFr + CM->esc); return 1; // ɜɨɡɜɪɚɳɚɟɦɫɹ ɜ encode ɫ ɩɨɛɟɞɨɣ }else{ /*ɧɭɠɧɨ ɭɯɨɞɢɬɶ ɧɚ ɄɆ(0); ɟɫɥɢ ɬɟɤɭɳɢɣ ɤɨɧɬɟɤɫɬ 1-ɝɨ ɩɨɪɹɞɤɚ ɜɫɬɪɟɬɢɥɫɹ ɩɟɪɜɵɣ ɪɚɡ, ɬɨ ɡɚɪɚɧɟɟ ɢɡɜɟɫɬɧɨ, ɱɬɨ ɟɝɨ ɄɆ ɩɭɫɬɚ (ɜɫɟ ɫɱɟɬɱɢɤɢ ɪɚɜɧɵ ɧɭɥɸ), ɢ ɤɨɞɢɪɨɜɚɬɶ ɭɯɨɞ ɧɟ ɬɨɥɶɤɨ ɧɟ ɢɦɟɟɬ ɫɦɵɫɥɚ, ɧɨ ɢ ɧɟɥɶɡɹ, ɬ.ɤ. TotFr+esc = 0 */ if (CM->esc) AC.encode (CM->TotFr, CM->esc, CM->TotFr + CM->esc) ; return 0; // ɡɚɤɨɞɢɪɨɜɚɬɶ ɫɢɦɜɨɥ ɧɟ ɭɞɚɥɨɫɶ
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X 141 http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
} } void encode (void){ int c, // ɬɟɤɭɳɢɣ ɫɢɦɜɨɥ success; // ɭɫɩɟɲɧɨɫɬɶ ɤɨɞɢɪɨɜɚɧɢɹ ɫɢɦɜɨɥɚ ɜ ɄɆ init_model (); AC.StartEncode (); // ɩɪɨɢɧɢɰɢɚɥɢɡɢɪɭɟɦ ɚɪɢɮɦ. ɤɨɞɟɪ while (( c = DataFile.ReadSymbol() ) != EOF) { // ɩɨɩɪɨɛɭɟɦ ɡɚɤɨɞɢɪɨɜɚɬɶ ɜ ɄɆ(1) success = encode_sym (&cm[context[0]], c); if (!success) /*ɭɯɨɞɢɦ ɧɚ ɄɆ(0), ɝɞɟ ɥɸɛɨɣ ɫɢɦɜɨɥ ɩɨɥɭɱɢɬ ɧɟɧɭɥɟɜɭɸ ɨɰɟɧɤɭ ɢ ɛɭɞɟɬ ɡɚɤɨɞɢɪɨɜɚɧ */ encode_sym (&cm[256], c); update_model (c); context [0] = c; // ɫɞɜɢɧɟɦ ɤɨɧɬɟɤɫɬ } // ɡɚɤɨɞɢɪɭɟɦ ɡɧɚɤ ɤɨɧɰɚ ɮɚɣɥɚ ɫɢɦɜɨɥɨɦ ɭɯɨɞɚ ɫ ɄɆ(0) AC.encode (cm[context[0]].TotFr, cm[context[0]].esc, cm[context[0]].TotFr + cm[context[0]].esc); AC.encode (cm[256].TotFr, cm[256].esc, cm[256].TotFr + cm[256].esc); // ɡɚɜɟɪɲɢɦ ɪɚɛɨɬɭ ɚɪɢɮɦɟɬɢɱɟɫɤɨɝɨ ɤɨɞɟɪɚ AC.FinishEncode(); }
Ɋɟɚɥɢɡɚɰɢɹ ɞɟɤɨɞɟɪɚ ɜɵɝɥɹɞɢɬ ɚɧɚɥɨɝɢɱɧɨ. ȼɧɢɦɚɧɢɹ ɡɚɫɥɭɠɢɜɚɟɬ ɪɚɡɜɟ ɱɬɨ ɬɨɥɶɤɨ ɩɪɨɰɟɞɭɪɚ ɩɨɢɫɤɚ ɫɢɦɜɨɥɚ ɩɨ ɨɩɢɫɚɧɢɸ ɟɝɨ ɤɨɞɨɜɨɝɨ ɩɪɨɫɬɪɚɧɫɬɜɚ. Ɇɟɬɨɞ get_freq ɚɪɢɮɦɟɬɢɱɟɫɤɨɝɨ ɤɨɞɟɪɚ ɜɨɡɜɪɚɳɚɟɬ ɱɢɫɥɨ x, ɥɟɠɚɳɟɟ ɜ ɞɢɚɩɚɡɨɧɟ [CumFreqUnder, CumFreqUnder+CM->count[i]), ɬ.ɟ. CumFreqUnder x < CumFreqUnder+CM->count[i]. ɉɨɷɬɨɦɭ ɢɫɤɨɦɵɦ ɫɢɦɜɨɥɨɦ ɹɜɥɹɟɬɫɹ i, ɞɥɹ ɤɨɬɨɪɨɝɨ ɜɵɩɨɥɧɢɬɫɹ ɷɬɨ ɭɫɥɨɜɢɟ. int decode_sym (ContextModel *CM, int *c){ stack [SP++] = CM; if (!CM->esc) return 0; int cum_freq = AC.get_freq (CM->TotFr + CM->esc); if (cum_freq < CM->TotFr){ /*ɫɢɦɜɨɥ ɛɵɥ ɡɚɤɨɞɢɪɨɜɚɧ ɜ ɷɬɨɣ ɄɆ; ɧɚɣɞɟɦ ɫɢɦɜɨɥ ɢ
142 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɟɝɨ ɬɨɱɧɨɟ ɤɨɞɨɜɨɟ ɩɪɨɫɬɪɚɧɫɬɜɨ */ int CumFreqUnder = 0; int i = 0; for (;;){ if ( (CumFreqUnder + CM->count[i]) <= cum_freq) CumFreqUnder += CM->count[i]; else break; i++; } /*ɨɛɧɨɜɢɦ ɫɨɫɬɨɹɧɢɟ ɚɪɢɮɦɟɬɢɱɟɫɤɨɝɨ ɤɨɞɟɪɚ ɧɚ ɨɫɧɨɜɚɧɢɢ ɬɨɱɧɨɣ ɧɚɤɨɩɥɟɧɧɨɣ ɱɚɫɬɨɬɵ ɫɢɦɜɨɥɚ */ AC.decode_update (CumFreqUnder, CM->count[i], CM->TotFr + CM->esc); *c = i; return 1; }else{ /*ɨɛɧɨɜɢɦ ɫɨɫɬɨɹɧɢɟ ɚɪɢɮɦɟɬɢɱɟɫɤɨɝɨ ɤɨɞɟɪɚ ɧɚ ɨɫɧɨɜɚɧɢɢ ɬɨɱɧɨɣ ɧɚɤɨɩɥɟɧɧɨɣ ɱɚɫɬɨɬɵ ɫɢɦɜɨɥɚ, ɨɤɚɡɚɜɲɟɝɨɫɹ ɫɢɦɜɨɥɨɦ ɭɯɨɞɚ */ AC.decode_update (CM->TotFr, CM->esc, CM->TotFr + CM->esc); return 0; } } void decode (void){ int c, success; init_model (); AC.StartDecode (); for (;;){ success = decode_sym (&cm[context[0]], &c); if (!success){ success = decode_sym (&cm[256], &c); if (!success) break; //ɩɪɢɡɧɚɤ ɤɨɧɰɚ ɮɚɣɥɚ } update_model (c); context [0] = c; DataFile.WriteSymbol (c); } }
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X 143 http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɏɚɪɚɤɬɟɪɢɫɬɢɤɢ ɫɨɡɞɚɧɧɨɝɨ ɤɨɦɩɪɟɫɫɨɪɚ, ɧɚɡɜɚɧɧɨɝɨ Dummy, ɩɪɢɜɟɞɟɧɵ ɜ ɩɭɧɤɬɟ «ɉɪɨɢɡɜɨɞɢɬɟɥɶɧɨɫɬɶ ɧɚ ɬɟɫɬɨɜɨɦ ɧɚɛɨɪɟ Calgary Compression Corpus». ɉɨɥɧɵɣ ɬɟɤɫɬ ɪɟɚɥɢɡɚɰɢɢ Dummy ɨɮɨɪɦɥɟɧ ɜ ɜɢɞɟ ɩɪɢɥɨɠɟɧɢɹ 1.
Ɉɰɟɧɤɚ ɜɟɪɨɹɬɧɨɫɬɢ ɭɯɨɞɚ ɇɚ ɞɨɥɸ ɫɢɦɜɨɥɨɜ ɭɯɨɞɚ ɨɛɵɱɧɨ ɩɪɢɯɨɞɢɬɫɹ ɩɨɪɹɞɤɚ 30% ɢ ɛɨɥɟɟ ɨɬ ɜɫɟɯ ɨɰɟɧɨɤ, ɜɵɱɢɫɥɹɟɦɵɯ ɦɨɞɟɥɢɪɨɜɳɢɤɨɦ PPM. ɗɬɨ ɨɩɪɟɞɟɥɢɥɨ ɩɪɢɫɬɚɥɶɧɨɟ ɜɧɢɦɚɧɢɟ ɤ ɩɪɨɛɥɟɦɟ ɨɰɟɧɤɢ ɜɟɪɨɹɬɧɨɫɬɢ ɫɢɦɜɨɥɨɜ ɫ ɧɭɥɟɜɨɣ ɱɚɫɬɨɬɨɣ. Ʌɶɜɢɧɚɹ ɞɨɥɹ ɩɭɛɥɢɤɚɰɢɣ, ɩɨɫɜɹɳɟɧɧɵɯ PPM, ɩɪɹɦɨ ɤɚɫɚɸɬɫɹ ɨɰɟɧɤɢ ɜɟɪɨɹɬɧɨɫɬɢ ɭɯɨɞɚ (Ɉȼɍ). Ɇɨɠɧɨ ɜɵɞɟɥɢɬɶ ɞɜɚ ɩɨɞɯɨɞɚ ɤ ɪɟɲɟɧɢɸ ɩɪɨɛɥɟɦɵ Ɉȼɍ: ɚɩɪɢɨɪɧɵɟ ɦɟɬɨɞɵ, ɨɫɧɨɜɚɧɧɵɟ ɧɚ ɩɪɟɞɩɨɥɨɠɟɧɢɹɯ ɨ ɩɪɢɪɨɞɟ ɫɠɢɦɚɟɦɵɯ ɞɚɧɧɵɯ, ɢ ɚɞɚɩɬɢɜɧɵɟ ɦɟɬɨɞɵ, ɤɨɬɨɪɵɟ ɩɵɬɚɸɬɫɹ ɩɪɢɫɩɨɫɨɛɢɬɶ ɨɰɟɧɤɭ ɤ ɞɚɧɧɵɦ. ɉɨɧɹɬɧɨ, ɱɬɨ ɩɟɪɜɵɟ ɩɪɢɡɜɚɧɵ ɨɛɟɫɩɟɱɢɬɶ ɯɨɪɨɲɢɣ ɤɨɷɮɮɢɰɢɟɧɬ ɫɠɚɬɢɹ ɩɪɢ ɨɛɪɚɛɨɬɤɟ ɬɢɩɢɱɧɵɯ ɞɚɧɧɵɯ ɜ ɫɨɱɟɬɚɧɢɢ ɫ ɜɵɫɨɤɨɣ ɫɤɨɪɨɫɬɶɸ ɜɵɱɢɫɥɟɧɢɣ, ɚ ɜɬɨɪɵɟ ɨɪɢɟɧɬɢɪɨɜɚɧɵ ɧɚ ɨɛɟɫɩɟɱɟɧɢɟ ɦɚɤɫɢɦɚɥɶɧɨ ɜɨɡɦɨɠɧɨɣ ɫɬɟɩɟɧɢ ɫɠɚɬɢɹ. ȺɉɊɂɈɊɇɕȿ ɆȿɌɈȾɕ
ȼɜɟɞɟɦ ɨɛɨɡɧɚɱɟɧɢɹ: C — ɨɛɳɟɟ ɱɢɫɥɨ ɩɪɨɫɦɨɬɪɨɜ ɤɨɧɬɟɤɫɬɚ, ɬ.ɟ. ɫɤɨɥɶɤɨ ɪɚɡ ɨɧ ɜɫɬɪɟɬɢɥɫɹ ɜ ɨɛɪɚɛɨɬɚɧɧɨɦ ɛɥɨɤɟ ɞɚɧɧɵɯ; S — ɤɨɥɢɱɟɫɬɜɨ ɪɚɡɧɵɯ ɫɢɦɜɨɥɨɜ ɜ ɤɨɧɬɟɤɫɬɟ; S(i) — ɤɨɥɢɱɟɫɬɜɨ ɬɚɤɢɯ ɪɚɡɧɵɯ ɫɢɦɜɨɥɨɜ, ɱɬɨ ɨɧɢ ɜɫɬɪɟɱɚɥɢɫɶ ɜ ɤɨɧɬɟɤɫɬɟ ɪɨɜɧɨ i ɪɚɡ; E(x) — ɡɧɚɱɟɧɢɟ Ɉȼɍ ɩɨ ɦɟɬɨɞɭ x. ɂɡɨɛɪɟɬɚɬɟɥɢ ɚɥɝɨɪɢɬɦɚ PPM ɩɪɟɞɥɨɠɢɥɢ ɞɜɚ ɦɟɬɨɞɚ Ɉȼɍ: ɬɚɤ ɧɚɡɵɜɚɟɦɵɟ ɦɟɬɨɞ A ɢ ɦɟɬɨɞ B. ɂɫɩɨɥɶɡɭɸɳɢɟ ɢɯ ɚɥɝɨɪɢɬɦɵ PPM ɛɵɥɢ ɧɚɡɜɚɧɵ PPMA ɢ PPMB ɫɨɨɬɜɟɬɫɬɜɟɧɧɨ. ȼ ɞɚɥɶɧɟɣɲɟɦ ɛɵɥɨ ɨɩɢɫɚɧɨ ɟɳɟ 5 ɚɩɪɢɨɪɧɵɯ ɩɨɞɯɨɞɨɜ ɤ Ɉȼɍ: ɦɟɬɨɞɵ C, D, P, X ɢ XC [8, 10, 17]. ɉɨ ɚɧɚɥɨɝɢɢ ɫ PPMA ɢ 144 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
PPMB, ɚɥɝɨɪɢɬɦɵ PPM, ɩɪɢɦɟɧɹɸɳɢɟ ɦɟɬɨɞɵ C ɢ D, ɩɨɥɭɱɢɥɢ ɧɚɡɜɚɧɢɹ PPMC ɢ PPMD ɫɨɨɬɜɟɬɫɬɜɟɧɧɨ. ɂɞɟɹ ɦɟɬɨɞɨɜ ɢ ɢɯ ɫɪɚɜɧɟɧɢɟ ɩɪɟɞɫɬɚɜɥɟɧɵ ɜ ɬɚɛɥ. 4.4 ɢ ɬɚɛɥ. 4.5. Ɍɚɛɥɢɰɚ 4.4 ( x) Ɇɟɬɨɞ E = A 1 B C D P X XC
C +1 S − S (1) C S C+S S 2C (1) (2) S S S ( 3) − 2 + 3 − C C C (1) S C (1) ›S , ɩɪɢ 0 < S (1) < C fiC (C ) E fl , ɜ ɩɪɨɬɢɜɧɨɦ ɫɥɭɱɚɟ
Ʉɫɬɚɬɢ, ɜ ɩɪɢɦɟɪɟ 2 ɛɵɥ ɢɫɩɨɥɶɡɨɜɚɧ ɦɟɬɨɞ A, ɚ ɜ ɤɨɦɩɪɟɫɫɨɪɟ Dummy — ɦɟɬɨɞ ɋ. ɉɪɢ ɪɟɚɥɢɡɚɰɢɢ ɦɟɬɨɞɚ B ɜɨɡɞɟɪɠɢɜɚɸɬɫɹ ɨɬ ɨɰɟɧɤɢ ɫɢɦɜɨɥɨɜ ɞɨ ɬɟɯ ɩɨɪ, ɩɨɤɚ ɨɧɢ ɧɟ ɩɨɹɜɹɬɫɹ ɜ ɬɟɤɭɳɟɦ ɤɨɧɬɟɤɫɬɟ ɛɨɥɟɟ ɨɞɧɨɝɨ ɪɚɡɚ. ɗɬɨ ɞɨɫɬɢɝɚɟɬɫɹ ɡɚ ɫɱɟɬ ɜɵɱɢɬɚɧɢɹ ɟɞɢɧɢɰɵ ɢɡ ɫɱɟɬɱɢɤɨɜ. Ɇɟɬɨɞɵ P, X, XC ɛɚɡɢɪɭɸɬɫɹ ɧɚ ɩɪɟɞɩɨɥɨɠɟɧɢɢ ɨ ɬɨɦ, ɱɬɨ ɜɟɪɨɹɬɧɨɫɬɶ ɩɨɹɜɥɟɧɢɹ ɜ ɨɛɪɚɛɚɬɵɜɚɟɦɵɯ ɞɚɧɧɵɯ ɫɢɦɜɨɥɚ si ɩɨɞɱɢɧɹɟɬɫɹ ɡɚɤɨɧɭ ɉɭɚɫɫɨɧɚ ɫ ɩɚɪɚɦɟɬɪɨɦ Ȝi.
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X 145 http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
Ɍɚɛɥɢɰɚ 4.5 Ɍɢɩ ɮɚɣɥɨɜ
Ɍɨɱɧɨɫɬɶ ɩɪɟɞɫɤɚɡɚɧɢɹ Æ Ʌɭɱɲɟ XC D P X C X P XC
ɯɭɠɟ Ɍɟɤɫɬɵ C B A Ⱦɜɨɢɱɧɵɟ D B A ɮɚɣɥɵ Ɇɟɫɬɚ ɜ ɬɚɛɥ. 4.5 ɨɱɟɧɶ ɭɫɥɨɜɧɵ. Ɍɚɤ, ɧɚɩɪɢɦɟɪ, ɩɪɢ ɫɠɚɬɢɢ ɬɟɤɫɬɨɜ ɦɟɬɨɞɵ XC, D, P, X ɩɨɤɚɡɵɜɚɸɬ ɜɟɫɶɦɚ ɛɥɢɡɤɢɟ ɪɟɡɭɥɶɬɚɬɵ, ɢ ɦɧɨɝɨɟ ɡɚɜɢɫɢɬ ɨɬ ɩɨɪɹɞɤɚ ɦɨɞɟɥɢ ɢ ɢɫɩɨɥɶɡɭɟɦɵɯ ɞɥɹ ɫɪɚɜɧɟɧɢɹ ɮɚɣɥɨɜ. ȼ ɛɨɥɶɲɢɧɫɬɜɟ ɫɥɭɱɚɟɜ ɫɭɳɟɫɬɜɟɧɧɵɦ ɹɜɥɹɟɬɫɹ ɬɨɥɶɤɨ ɨɬɫɬɚɜɚɧɢɟ ɬɨɱɧɨɫɬɢ Ɉȼɍ ɩɨ ɫɩɨɫɨɛɚɦ A ɢ B ɨɬ ɞɪɭɝɢɯ ɦɟɬɨɞɨɜ. ɍɩɪɚɠɧɟɧɢɟ: ȼɵɩɨɥɧɢɬɟ ɞɟɣɫɬɜɢɹ, ɨɩɢɫɚɧɧɵɟ ɜ ɩɪɢɦɟɪɟ 2, ɢɫɩɨɥɶɡɭɹ Ɉȼɍ ɩɨ ɦɟɬɨɞɭ C. ȿɫɥɢ ɬɟɤɭɳɢɣ ɫɢɦɜɨɥ ‘ɛ’, ɬɨ ɬɨɱɧɨɫɬɶ ɟɝɨ ɩɪɟɞɫɤɚɡɚɧɢɹ ɭɥɭɱɲɢɬɫɹ, ɨɫɬɚɧɟɬɫɹ ɧɟɢɡɦɟɧɧɨɣ ɢɥɢ ɭɯɭɞɲɢɬɫɹ? ȺȾȺɉɌɂȼɇɕȿ ɆȿɌɈȾɕ
ɑɬɨɛɵ ɭɥɭɱɲɢɬɶ ɨɰɟɧɤɭ ɜɟɪɨɹɬɧɨɫɬɢ ɭɯɨɞɚ, ɧɟɨɛɯɨɞɢɦɨ ɢɦɟɬɶ ɬɚɤɭɸ ɦɨɞɟɥɶ ɨɰɟɧɤɢ, ɤɨɬɨɪɚɹ ɛɵ ɚɞɚɩɬɢɪɨɜɚɥɚɫɶ ɤ ɨɛɪɚɛɚɬɵɜɚɟɦɵɦ ɞɚɧɧɵɦ. ɉɨɞɨɛɧɵɣ ɚɞɚɩɬɢɜɧɵɣ ɦɟɯɚɧɢɡɦ ɩɨɥɭɱɢɥ ɧɚɡɜɚɧɢɟ Secondary Escape Estimation (SEE), ɬ.ɟ. «ɞɨɩɨɥɧɢɬɟɥɶɧɨɣ ɨɰɟɧɤɢ ɭɯɨɞɚ», ɢɥɢ «ɜɬɨɪɢɱɧɨɣ ɨɰɟɧɤɢ ɭɯɨɞɚ». Ɇɟɬɨɞ ɡɚɤɥɸɱɚɟɬɫɹ ɜ ɬɪɢɜɢɚɥɶɧɨɦ ɜɵɱɢɫɥɟɧɢɢ ɜɟɪɨɹɬɧɨɫɬɢ ɭɯɨɞɚ ɢɡ ɬɟɤɭɳɟɣ ɄɆ ɱɟɪɟɡ ɱɚɫɬɨɬɭ ɩɨɹɜɥɟɧɢɹ ɧɨɜɵɯ ɫɢɦɜɨɥɨɜ (ɢɥɢ, ɱɬɨ ɬɨ ɠɟ, ɫɢɦɜɨɥɨɜ ɭɯɨɞɚ) ɜ ɤɨɧɬɟɤɫɬɧɵɯ ɦɨɞɟɥɹɯ ɫɨ ɫɯɨɠɢɦɢ ɯɚɪɚɤɬɟɪɢɫɬɢɤɚɦɢ:
E ( SEE ) (i ) = ɝɞɟ
f i ( esc ) , ni
fi(esc) — ɱɢɫɥɨ ɧɚɛɥɸɞɚɜɲɢɯɫɹ ɭɯɨɞɨɜ ɢɡ ɤɨɧɬɟɤɫɬɧɵɯ ɦɨɞɟɥɟɣ ɬɢɩɚ i; ni — ɱɢɫɥɨ ɩɪɨɫɦɨɬɪɨɜ ɤɨɧɬɟɤɫɬɧɵɯ ɦɨɞɟɥɟɣ ɬɢɩɚ i.
146 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ȼɪɚɡɭɦɢɬɟɥɶɧɵɟ ɨɛɨɫɧɨɜɚɧɢɹ ɜɵɛɨɪɚ ɷɬɢɯ ɯɚɪɚɤɬɟɪɢɫɬɢɤ ɢ ɤɪɢɬɟɪɢɟɜ «ɫɯɨɠɟɫɬɢ» ɩɪɢ ɨɬɫɭɬɫɬɜɢɢ ɚɩɪɢɨɪɧɵɯ ɡɧɚɧɢɣ ɨ ɯɚɪɚɤɬɟɪɟ ɫɠɢɦɚɟɦɨɣ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ ɞɚɬɶ ɫɥɨɠɧɨ, ɩɨɷɬɨɦɭ ɢɡɜɟɫɬɧɵɟ ɚɥɝɨɪɢɬɦɵ ɚɞɚɩɬɢɜɧɨɣ ɨɰɟɧɤɢ ɛɚɡɢɪɭɸɬɫɹ ɧɚ ɷɦɩɢɪɢɱɟɫɤɨɦ ɚɧɚɥɢɡɟ ɬɢɩɨɜɵɯ ɞɚɧɧɵɯ. ɆȿɌɈȾ Z
Ɉɞɧɚ ɢɡ ɫɚɦɵɯ ɪɚɧɧɢɯ ɩɨɩɵɬɨɤ ɪɟɚɥɢɡɚɰɢɢ SEE ɢɡɜɟɫɬɧɚ ɤɚɤ ɦɟɬɨɞ Z, ɚ ɢɫɩɨɥɶɡɭɸɳɚɹ ɟɝɨ ɪɚɡɧɨɜɢɞɧɨɫɬɶ ɚɥɝɨɪɢɬɦɚ PPM — PPMZ [3]. Ⱦɥɹ ɬɨɱɧɨɫɬɢ ɨɩɢɫɚɧɢɹ ɷɬɨɣ ɬɟɯɧɢɤɢ SEE ɨɛɴɟɤɬ «ɤɨɧɬɟɤɫɬ» ɧɢɠɟ ɛɭɞɟɬ ɬɚɤɠɟ ɢɦɟɧɨɜɚɬɶɫɹ «PPM-ɤɨɧɬɟɤɫɬɨɦ». Ⱦɥɹ ɧɚɯɨɠɞɟɧɢɹ Ɉȼɍ ɫɬɪɨɹɬɫɹ ɬɚɤ ɧɚɡɵɜɚɟɦɵɟ ɤɨɧɬɟɤɫɬɵ ɭɯɨɞɚ (escape contexts) Ʉɍ, ɮɨɪɦɢɪɭɟɦɵɟ ɢɡ ɱɟɬɵɪɟɯ ɩɨɥɟɣ. ȼ ɩɨɥɹɯ Ʉɍ ɫɨɞɟɪɠɢɬɫɹ ɢɧɮɨɪɦɚɰɢɹ ɨ ɡɧɚɱɟɧɢɹɯ ɫɥɟɞɭɸɳɢɯ ɜɟɥɢɱɢɧ: ɩɨɫɥɟɞɧɢɟ ɱɟɬɵɪɟ ɫɢɦɜɨɥɚ PPM-ɤɨɧɬɟɤɫɬɚ, ɩɨɪɹɞɨɤ PPM-ɤɨɧɬɟɤɫɬɚ, ɤɨɥɢɱɟɫɬɜɨ ɭɯɨɞɨɜ ɢ ɤɨɥɢɱɟɫɬɜɨ ɭɫɩɟɲɧɵɯ ɨɰɟɧɨɤ ɜ ɫɨɨɬɜɟɬɫɬɜɭɸɳɟɣ ɄɆ. ɇɟɫɤɨɥɶɤɢɦ ɄɆ ɦɨɠɟɬ ɫɨɨɬɜɟɬɫɬɜɨɜɚɬɶ ɨɞɢɧ Ʉɍ. ɂɧɮɨɪɦɚɰɢɹ ɨ ɮɚɤɬɢɱɟɫɤɨɦ ɤɨɥɢɱɟɫɬɜɟ ɭɯɨɞɨɜ ɢ ɭɫɩɟɲɧɵɯ ɤɨɞɢɪɨɜɚɧɢɣ ɜɨ ɜɫɟɯ ɤɨɧɬɟɤɫɬɧɵɯ ɦɨɞɟɥɹɯ, ɢɦɟɸɳɢɯ ɨɛɳɢɣ Ʉɍ, ɡɚɩɨɦɢɧɚɟɬɫɹ ɜ ɫɱɟɬɱɢɤɚɯ ɤɨɧɬɟɤɫɬɧɨɣ ɦɨɞɟɥɢ ɭɯɨɞɨɜ ɄɆɍ, ɩɨɫɬɪɨɟɧɧɨɣ ɞɥɹ ɞɚɧɧɨɝɨ Ʉɍ. ɗɬɚ ɢɧɮɨɪɦɚɰɢɹ ɨɩɪɟɞɟɥɹɟɬ Ɉȼɍ ɞɥɹ ɬɟɤɭɳɟɣ ɄɆ. Ɉȼɍ ɧɚɯɨɞɢɬɫɹ ɩɭɬɟɦ ɜɡɜɟɲɢɜɚɧɢɹ ɨɰɟɧɨɤ, ɤɨɬɨɪɵɟ ɞɚɸɬ ɬɪɢ ɄɆɍ (ɄɆɍ ɩɨɪɹɞɤɚ 2, 1 ɢ 0), ɨɬɜɟɱɚɸɳɢɟ ɯɚɪɚɤɬɟɪɢɫɬɢɤɚɦ ɬɟɤɭɳɟɣ ɄɆ. Ʉɍ ɩɨɪɹɞɤɚ 2 ɧɚɢɛɨɥɟɟ ɬɨɱɧɨ ɫɨɨɬɜɟɬɫɬɜɭɟɬ ɬɟɤɭɳɟɣ ɄɆ, ɤɨɧɬɟɤɫɬɵ ɭɯɨɞɚ ɩɨɪɹɞɤɨɦ ɧɢɠɟ ɮɨɪɦɢɪɭɸɬɫɹ ɝɥɚɜɧɵɦ ɨɛɪɚɡɨɦ ɩɭɬɟɦ ɜɵɛɪɚɫɵɜɚɧɢɹ ɱɚɫɬɢ ɢɧɮɨɪɦɚɰɢɢ ɢɡ ɩɨɥɟɣ Ʉɍ ɩɨɪɹɞɤɚ 2. Ʉɨɦɩɨɧɟɧɬɵ Ʉɍ ɩɨɪɹɞɤɚ 2 ɨɩɪɟɞɟɥɹɸɬɫɹ ɜ ɫɨɨɬɜɟɬɫɬɜɢɢ ɫ ɬɚɛɥ. 4.6 [3].
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X 147 http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɇɨɦɟɪ ɩɨɥɹ 1
Ɋɚɡɦɟɪ ɜ ɛɢɬɚɯ 2
2
2
3
3
4
9
Ɍɚɛɥɢɰɚ 4.6 ɋɩɨɫɨɛ ɮɨɪɦɢɪɨɜɚɧɢɹ ɡɧɚɱɟɧɢɹ ɩɨɥɹ ɉɚɪɚɦɟɬɪ ɢ ɟɝɨ ɡɧɚɱɟɧɢɹ Ɂɧɚɱɟɧɢɟ ɩɨɥɹ ɉɨɪɹɞɨɤ ɄɆ ɩɨɪɹɞɨɤ ɄɆ / 2 (ɫ ɨɤɪɭɝɥɟɧɢɟɦ ɞɨ ɦɥɚɞɲɟɝɨ); Ʉɨɥɢɱɟɫɬɜɨ ɭɯɨɞɨɜ ɢɡ ɄɆ 1 0 2 1 3 2 >3 3 Ʉɨɥɢɱɟɫɬɜɨ ɭɫɩɟɲɧɵɯ ɨɰɟɧɨɤ ɜ ɄɆ 0 0 1 1 2 2 3, 4 3 5, 6 4 7, 8, 9 5 10, 11, 12 6 > 12 7 X1 = ɫɟɦɶ ɦɥɚɞɲɢɯ ɛɢɬɨɜ ((X2&0x60) << 2) ɩɨɫɥɟɞɧɟɝɨ (ɬɨɥɶɤɨ ɱɬɨ ɨɛ- | X1 ɪɚɛɨɬɚɧɧɨɝɨ) ɫɢɦɜɨɥɚ PPMɤɨɧɬɟɤɫɬɚ; X2 = ɲɟɫɬɨɣ ɢ ɩɹɬɵɣ ɛɢɬɵ ɩɪɟɞɩɨɫɥɟɞɧɟɝɨ ɫɢɦɜɨɥɚ; ɬ.ɟ., ɟɫɥɢ ɪɚɫɩɢɫɚɬɶ ɛɚɣɬ ɤɚɤ ɫɨɜɨɤɭɩɧɨɫɬɶ 8 ɛɢɬɨɜ xXXxxxxx, ɬɨ ɷɬɨ ɛɢɬɵ XX
ȼ ɫɨɫɬɚɜ Ʉɍ ɜɫɟɯ ɩɨɪɹɞɤɨɜ ɜɯɨɞɹɬ ɩɨɥɹ 1, 2, 3. Ⱦɥɹ Ʉɍ ɩɨɪɹɞɤɚ 1 ɩɨɥɟ 4 ɫɨɫɬɨɢɬ ɢɡ 8 ɛɢɬɨɜ ɢ ɫɬɪɨɢɬɫɹ ɢɡ ɲɟɫɬɵɯ ɢ ɩɹɬɵɯ ɛɢɬɨɜ ɩɨɫɥɟɞɧɢɯ ɱɟɬɵɪɟɯ ɨɛɪɚɛɨɬɚɧɧɵɯ ɫɢɦɜɨɥɨɜ. ɍ Ʉɍ ɩɨɪɹɞɤɚ 0 ɱɟɬɜɟɪɬɨɟ ɩɨɥɟ ɨɬɫɭɬɫɬɜɭɟɬ. Ɉɱɟɜɢɞɧɨ, ɱɬɨ ɚɥɝɨɪɢɬɦ ɩɨ148 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɫɬɪɨɟɧɢɹ ɩɨɥɹ 4 ɞɥɹ Ʉɍ ɩɨɪɹɞɤɨɜ 1 ɢ 2 ɩɪɢɡɜɚɧ ɭɥɭɱɲɢɬɶ ɩɪɟɞɫɤɚɡɚɧɢɟ ɭɯɨɞɚ ɞɥɹ ɬɟɤɫɬɨɜ ɧɚ ɚɧɝɥɢɣɫɤɨɦ ɹɡɵɤɟ ɜ ɤɨɞɢɪɨɜɤɟ ASCII. Ⱥɧɚɥɨɝɢɱɧɵɣ ɩɪɢɟɦ, ɯɨɬɹ ɢ ɜ ɧɟ ɫɬɨɥɶ ɹɜɧɨɦ ɜɢɞɟ, ɢɫɩɨɥɶɡɭɟɬɫɹ ɜ ɚɞɚɩɬɢɜɧɵɯ ɦɟɬɨɞɚɯ Ɉȼɍ SEE-d1 ɢ SEE-d2, ɪɚɫɫɦɨɬɪɟɧɧɵɯ ɧɢɠɟ. ɉɪɢ ɜɡɜɟɲɢɜɚɧɢɢ ɫɬɚɬɢɫɬɢɤɢ ɄɆɍ(n) ɢɫɩɨɥɶɡɭɸɬɫɹ ɫɥɟɞɭɸɳɢɟ ɜɟɫɚ wn
1 = e ⋅ log 2 wn
1§ ¤ e'
• (1 − e) ⋅ log + 2 ‚ „
§1 ¤ 1'− e
,• ‚ „
ɝɞɟ
e — Ɉȼɍ, ɤɨɬɨɪɭɸ ɞɚɟɬ ɞɚɧɧɚɹ ɜɡɜɟɲɢɜɚɟɦɚɹ ɄɆɍ(n); ɮɨɪɦɢɪɭɟɬɫɹ ɢɡ ɮɚɤɬɢɱɟɫɤɨɝɨ ɤɨɥɢɱɟɫɬɜɚ ɭɯɨɞɨɜ ɢ ɭɫɩɟɲɧɵɯ ɤɨɞɢɪɨɜɚɧɢɣ ɜ ɤɨɧɬɟɤɫɬɧɵɯ ɦɨɞɟɥɹɯ, ɫɨɨɬɜɟɬɫɬɜɭɸɳɢɯ ɷɬɨɣ ɄɆɍ, ɢɥɢ, ɢɧɚɱɟ, ɨɩɪɟɞɟɥɹɟɬɫɹ ɧɚɛɥɸɞɚɜɲɟɣɫɹ ɱɚɫɬɨɬɨɣ ɭɯɨɞɚ ɢɡ ɬɚɤɢɯ ɄɆ. Ɉɤɨɧɱɚɬɟɥɶɧɚɹ ɨɰɟɧɤɚ: 2
E
(Z )
=
ƒen wn
n =0 2
ƒwn
.
n =0
ɉɨɫɥɟ Ɉȼɍ ɜɵɩɨɥɧɹɟɬɫɹ ɩɨɢɫɤ ɬɟɤɭɳɟɝɨ ɫɢɦɜɨɥɚ ɫɪɟɞɢ ɢɦɟɸɳɢɯɫɹ ɜ ɄɆ. ɉɨ ɪɟɡɭɥɶɬɚɬɚɦ ɩɨɢɫɤɚ (ɫɢɦɜɨɥ ɧɚɣɞɟɧ ɢɥɢ ɧɟɬ) ɨɛɧɨɜɥɹɸɬɫɹ ɫɱɟɬɱɢɤɢ ɫɨɨɬɜɟɬɫɬɜɭɸɳɢɯ ɬɪɟɯ ɄɆɍ ɩɨɪɹɞɤɚ 0, 1 ɢ 2. ɆȿɌɈȾɕ SEE-D1 ɂ SEE-D2
ɋɨɜɪɟɦɟɧɧɵɦ ɚɞɚɩɬɢɜɧɵɦ ɦɟɬɨɞɨɦ ɹɜɥɹɟɬɫɹ ɩɨɞɯɨɞ, ɩɪɟɞɥɨɠɟɧɧɵɣ ɒɤɚɪɢɧɵɦ ɢ ɭɫɩɟɲɧɨ ɩɪɢɦɟɧɹɟɦɵɣ ɜ ɤɨɦɩɪɟɫɫɨɪɚɯ PPMd ɢ PPMonstr [1]. ɉɪɢ ɤɚɠɞɨɣ ɨɰɟɧɤɟ ɢɫɩɨɥɶɡɭɟɬɫɹ Ʉɍ ɬɨɥɶɤɨ ɤɚɤɨɝɨ-ɬɨ ɨɞɧɨɝɨ ɬɢɩɚ (ɜ ɦɟɬɨɞɟ Z ɢɯ ɬɪɢ), ɧɨ, ɜ ɡɚɜɢɫɢɦɨɫɬɢ ɨɬ ɬɪɟɛɨɜɚɧɢɣ, ɩɪɟɞɴɹɜɥɹɟɦɵɯ ɤ ɤɨɦɩɪɟɫɫɨɪɭ, ɚɜɬɨɪ ɩɪɟɞɥɚɝɚɟɬ ɩɪɢɦɟɧɹɬɶ ɨɞɢɧ ɢɡ ɞɜɭɯ ɦɟɬɨɞɨɜ. ɇɚɡɨɜɟɦ ɩɟɪɜɵɣ ɦɟɬɨɞ SEE-d1, ɚ ɜɬɨɪɨɣ — SEE-d2. Ɇɟɬɨɞ SEE-d1 ɢɫɩɨɥɶɡɭɟɬɫɹ ɜ ɤɨɦɩɪɟɫɫɨɪɟ PPMd ɢ ɨɪɢɟɧɬɢɪɨɜɚɧ ɧɚ ɯɨɪɨɲɭɸ ɬɨɱɧɨɫɬɶ ɨɰɟɧɤɢ ɩɪɢ ɧɟɛɨɥɶɲɢɯ ɜɵɱɢɫɥɢɬɟɥɶɧɵɯ ɡɚɬɪɚɬɚɯ. Ɋɚɫɫɦɨɬɪɢɦ ɟɝɨ ɩɨɞɪɨɛɧɨ. Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X 149 http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ȼɫɟ ɄɆ ɪɚɡɨɛɶɟɦ ɧɚ ɬɪɢ ɬɢɩɚ: • ɞɟɬɟɪɦɢɧɢɪɨɜɚɧɧɵɟ (ɢɥɢ ɛɢɧɚɪɧɵɟ), ɫɨɞɟɪɠɚɳɢɟ ɬɨɥɶɤɨ ɨɞɢɧ ɫɢɦɜɨɥ; ɧɚɡɨɜɟɦ ɢɯ ɤɨɧɬɟɤɫɬɧɵɦɢ ɦɨɞɟɥɹɦɢ ɬɢɩɚ d; • ɫ ɧɟɡɚɦɚɫɤɢɪɨɜɚɧɧɵɦɢ ɫɢɦɜɨɥɚɦɢ, ɬ.ɟ. ɧɢ ɨɞɢɧ ɢɡ ɫɢɦɜɨɥɨɜ, ɢɦɟɸɳɢɯɫɹ ɜ ɞɚɧɧɨɣ ɄɆ, ɧɟ ɜɫɬɪɟɱɚɥɫɹ ɜ ɄɆ ɛɨɥɶɲɢɯ ɩɨɪɹɞɤɨɜ; ɨɛɵɱɧɨ ɷɬɨ ɄɆ ɦɚɤɫɢɦɚɥɶɧɨɝɨ ɩɨɪɹɞɤɚ ɢɥɢ ɄɆ, ɫ ɤɨɬɨɪɨɣ ɧɚɱɚɥɚɫɶ ɨɰɟɧɤɚ; ɧɚɡɨɜɟɦ ɢɯ ɤɨɧɬɟɤɫɬɧɵɦɢ ɦɨɞɟɥɹɦɢ ɬɢɩɚ nm; • ɫ ɡɚɦɚɫɤɢɪɨɜɚɧɧɵɦɢ ɫɢɦɜɨɥɚɦɢ; ɧɚɡɨɜɟɦ ɢɯ ɤɨɧɬɟɤɫɬɧɵɦɢ ɦɨɞɟɥɹɦɢ ɬɢɩɚ m. Ʉɚɤ ɩɨɤɚɡɚɥɢ ɷɤɫɩɟɪɢɦɟɧɬɵ, ɜɟɪɨɹɬɧɨɫɬɶ ɭɯɨɞɚ ɢɡ ɄɆ ɪɚɡɧɵɯ ɬɢɩɨɜ ɤɨɪɪɟɥɢɪɭɟɬ ɫ ɪɚɡɧɵɦɢ ɯɚɪɚɤɬɟɪɢɫɬɢɤɚɦɢ. ɋɥɭɱɚɣ ɄɆ ɬɢɩɚ d ɹɜɥɹɟɬɫɹ ɧɚɢɛɨɥɟɟ ɩɪɨɫɬɵɦ, ɬɚɤ ɤɚɤ ɭ ɬɚɤɨɣ ɦɨɞɟɥɢ ɦɚɥɨɟ ɱɢɫɥɨ ɫɬɟɩɟɧɟɣ ɫɜɨɛɨɞɵ. ȿɫɬɟɫɬɜɟɧɧɨ, ɧɚɢɛɨɥɶɲɟɟ ɜɥɢɹɧɢɟ ɧɚ ɜɟɪɨɹɬɧɨɫɬɶ ɭɯɨɞɚ ɨɤɚɡɵɜɚɟɬ ɫɱɟɬɱɢɤ ɱɚɫɬɨɬɵ ɟɞɢɧɫɬɜɟɧɧɨɝɨ ɫɢɦɜɨɥɚ. ɇɢɠɟ ɢɡɥɨɠɟɧ ɫɩɨɫɨɛ ɮɨɪɦɢɪɨɜɚɧɢɹ Ʉɍ, ɩɪɢ ɷɬɨɦ ɨɩɢɫɚɧɢɟ ɩɨɥɟɣ ɨɬɫɨɪɬɢɪɨɜɚɧɨ ɜ ɩɨɪɹɞɤɟ ɭɛɵɜɚɧɢɹ ɫɬɟɩɟɧɢ ɢɯ ɜɥɢɹɧɢɹ ɧɚ ɬɨɱɧɨɫɬɶ ɨɰɟɧɤɢ ɭɯɨɞɚ. 1) ɋɱɟɬɱɢɤ ɱɚɫɬɨɬɵ ɫɢɦɜɨɥɚ ɤɜɚɧɬɭɟɬɫɹ ɞɨ 128 ɡɧɚɱɟɧɢɣ. 2) ɋɭɳɟɫɬɜɭɟɬ ɫɢɥɶɧɚɹ ɜɡɚɢɦɨɫɜɹɡɶ ɦɟɠɞɭ ɪɨɞɢɬɟɥɶɫɤɢɦɢ ɢ ɞɨɱɟɪɧɢɦɢ ɄɆ, ɩɨɷɬɨɦɭ ɱɢɫɥɨ ɫɢɦɜɨɥɨɜ ɜ ɪɨɞɢɬɟɥɶɫɤɨɣ ɄɆ ɤɜɚɧɬɭɟɬɫɹ ɞɨ 4 ɡɧɚɱɟɧɢɣ; 3) ɉɪɢ ɫɠɚɬɢɢ ɪɟɚɥɶɧɵɯ ɞɚɧɧɵɯ ɯɚɪɚɤɬɟɪɧɨ ɱɟɪɟɞɨɜɚɧɢɟ ɛɥɨɤɨɜ ɯɨɪɨɲɨ ɩɪɟɞɫɤɚɡɭɟɦɵɯ ɫɢɦɜɨɥɨɜ ɫ ɩɥɨɯɨ ɩɪɟɞɫɤɚɡɭɟɦɵɦɢ. ȼɤɥɸɱɢɦ ɜ Ʉɍ ɨɰɟɧɤɭ ɜɟɪɨɹɬɧɨɫɬɢ ɩɪɟɞɵɞɭɳɟɝɨ ɫɢɦɜɨɥɚ ɱɬɨɛɵ ɨɬɫɥɟɠɢɜɚɬɶ ɩɟɪɟɯɨɞɵ ɦɟɠɞɭ ɬɚɤɢɦɢ ɛɥɨɤɚɦɢ. ȼɟɥɢɱɢɧɚ ɤɜɚɧɬɭɟɬɫɹ ɞɨ 2 ɡɧɚɱɟɧɢɣ. 4) ɋɭɳɟɫɬɜɭɟɬ ɫɢɥɶɧɚɹ ɫɬɚɬɢɫɬɢɱɟɫɤɚɹ ɜɡɚɢɦɨɫɜɹɡɶ ɦɟɠɞɭ ɬɟɤɭɳɢɦ ɢ ɩɪɟɞɵɞɭɳɢɦ ɫɢɦɜɨɥɚɦɢ. ȼɜɟɞɟɦ ɨɞɧɨɛɢɬɨɜɵɣ ɮɥɚɝ, ɩɪɢɧɢɦɚɸɳɢɣ ɡɧɚɱɟɧɢɟ 0, ɟɫɥɢ ɞɜɚ ɫɬɚɪɲɢɯ ɛɢɬɚ ɩɪɟɞɵɞɭɳɟɝɨ ɫɢɦɜɨɥɚ ɧɭɥɟɜɵɟ, ɢ ɡɧɚɱɟɧɢɟ 1 ɜ ɩɪɨɱɢɯ ɫɥɭɱɚɹɯ. 5) Ʉɪɨɦɟ ɱɟɪɟɞɨɜɚɧɢɹ ɛɥɨɤɨɜ ɯɨɪɨɲɨ ɢ ɩɥɨɯɨ ɩɪɟɞɫɤɚɡɭɟɦɵɯ ɫɢɦɜɨɥɨɜ, ɱɚɫɬɨ ɜɫɬɪɟɱɚɸɬɫɹ ɞɥɢɧɧɵɟ ɛɥɨɤɢ ɨɱɟɧɶ ɯɨɪɨɲɨ 150 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɩɪɟɞɫɤɚɡɭɟɦɵɯ ɞɚɧɧɵɯ. ɗɬɨ ɨɛɵɱɧɨ ɛɵɜɚɟɬ ɜ ɫɥɭɱɚɟ ɦɧɨɠɟɫɬɜɟɧɧɵɯ ɩɨɜɬɨɪɨɜ ɞɥɢɧɧɵɯ ɫɬɪɨɤ ɜ ɫɠɢɦɚɟɦɨɦ ɩɨɬɨɤɟ. ɑɚɫɬɨ PPM-ɦɨɞɟɥɢ ɧɟɛɨɥɶɲɢɯ ɩɨɪɹɞɤɨɜ ɩɥɨɯɨ ɪɚɛɨɬɚɸɬ ɜ ɬɚɤɢɯ ɫɢɬɭɚɰɢɹɯ. ȼɜɟɞɟɦ ɨɞɧɨɛɢɬɨɜɵɣ ɮɥɚɝ, ɫɜɢɞɟɬɟɥɶɫɬɜɭɸɳɢɣ ɨ ɧɚɯɨɠɞɟɧɢɢ ɜ ɬɚɤɨɦ ɛɥɨɤɟ. Ɏɥɚɝ ɩɪɢɧɢɦɚɟɬ ɡɧɚɱɟɧɢɟ 1, ɟɫɥɢ ɩɪɢ ɨɛɪɚɛɨɬɤɟ ɩɪɟɞɵɞɭɳɢɯ ɫɢɦɜɨɥɨɜ ɧɢ ɪɚɡɭ ɧɟ ɩɪɨɢɫɯɨɞɢɥ ɭɯɨɞ, ɢ ɨɰɟɧɤɢ ɜɟɪɨɹɬɧɨɫɬɢ ɩɪɟɜɵɲɚɥɢ 0.5 ɞɥɹ L ɢɥɢ ɛɨɥɶɲɟɝɨ ɤɨɥɢɱɟɫɬɜɚ ɷɬɢɯ ɫɢɦɜɨɥɨɜ. L ɨɛɵɱɧɨ ɪɚɜɧɨ ɩɨɪɹɞɤɭ PPM-ɦɨɞɟɥɢ. 6) ȼɨɡɦɨɠɧɨɫɬɶ ɭɯɨɞɚ ɡɚɜɢɫɢɬ ɨɬ ɟɞɢɧɫɬɜɟɧɧɨɝɨ ɫɢɦɜɨɥɚ ɄɆ ɬɢɩɚ d. ɉɭɫɬɶ ɫɨɨɬɜɟɬɫɬɜɭɸɳɢɣ ɮɥɚɝ ɪɚɜɟɧ 0, ɟɫɥɢ ɞɜɚ ɫɬɚɪɲɢɯ ɛɢɬɚ ɫɢɦɜɨɥɚ ɧɭɥɟɜɵɟ, ɢ 1 ɜ ɨɫɬɚɥɶɧɵɯ ɫɥɭɱɚɹɯ. Ɍɚɤɢɦ ɨɛɪɚɡɨɦ, ɜɫɟɝɨ ɜɨɡɦɨɠɧɨ 128·4·2·2·2·2 = 8192 ɤɨɧɬɟɤɫɬɨɜ ɭɯɨɞɚ ɞɥɹ ɄɆ ɬɢɩɚ d. ȼ ɫɥɭɱɚɟ ɄɆ ɬɢɩɚ nm ɚɞɚɩɬɢɜɧɚɹ ɨɰɟɧɤɚ ɡɚɬɪɭɞɧɟɧɚ ɢɡ-ɡɚ ɧɟɛɨɥɶɲɨɣ ɱɚɫɬɨɬɵ ɢɯ ɢɫɩɨɥɶɡɨɜɚɧɢɹ, ɱɬɨ ɩɪɢɜɨɞɢɬ ɤ ɨɬɫɭɬɫɬɜɢɸ ɩɪɟɞɫɬɚɜɢɬɟɥɶɧɨɣ ɫɬɚɬɢɫɬɢɤɢ ɜ ɛɨɥɶɲɢɧɫɬɜɟ ɫɥɭɱɚɟɜ. ɉɨɷɬɨɦɭ ɩɪɢɦɟɧɢɦ ɩɨɥɭɚɞɚɩɬɢɜɧɵɣ ɦɟɬɨɞ, ɞɨɤɚɡɚɜɲɢɣ ɧɚ ɩɪɚɤɬɢɤɟ ɫɜɨɸ ɷɮɮɟɤɬɢɜɧɨɫɬɶ. Ⱦɨɩɭɫɬɢɦ, ɪɚɫɩɪɟɞɟɥɟɧɢɟ ɫɢɦɜɨɥɨɜ ɝɟɨɦɟɬɪɢɱɟɫɤɨɟ: p( sik | o) = p k (1 − p ) , ɝɞɟ
p( sik | o) — ɜɟɪɨɹɬɧɨɫɬɶ ɩɨɹɜɥɟɧɢɹ ɫɢɦɜɨɥɚ si ɜ ɡɚɞɚɧɧɨɣ ɄɆ(o) ɩɨɫɥɟ ɫɟɪɢɢ ɢɡ k ɢɧɵɯ ɫɢɦɜɨɥɨɜ.
ɂɧɚɱɟ ɝɨɜɨɪɹ,
p( sik | o)
— ɜɟɪɨɹɬɧɨɫɬɶ ɭɫɩɟɯɚ ɜ ɩɟɪɜɵɣ ɪɚɡ ɩɨɫɥɟ ɪɨɜɧɨ
k ɢɫɩɵɬɚɧɢɣ ɩɨ ɫɯɟɦɟ Ȼɟɪɧɭɥɥɢ ɩɪɢ ɜɟɪɨɹɬɧɨɫɬɢ ɭɫɩɟɯɚ (1 – p).
ɉɚɪɚɦɟɬɪ p ɝɟɨɦɟɬɪɢɱɟɫɤɨɝɨ ɪɚɫɩɪɟɞɟɥɟɧɢɹ ɦɨɠɟɬ ɛɵɬɶ ɧɚɣɞɟɧ ɱɟɪɟɡ ɨɰɟɧɤɭ ɞɥɹ ɫɨɨɬɜɟɬɫɬɜɭɸɳɟɣ ɄɆ ɬɢɩɚ d. ɉɨɥɭɱɢɜ p, ɦɨɠɧɨ ɨɰɟɧɢɬɶ ɱɚɫɬɨɬɭ ɫɱɟɬɱɢɤɚ ɱɢɫɥɚ ɭɯɨɞɨɜ. ɗɬɨ ɞɟɥɚɟɬɫɹ ɬɨɥɶɤɨ ɞɥɹ ɄɆ, ɫɨɞɟɪɠɚɳɢɯ 1 ɫɢɦɜɨɥ, ɩɪɢ ɞɨɛɚɜɥɟɧɢɢ ɧɨɜɨɝɨ ɫɢɦɜɨɥɚ, ɬ.ɟ. ɤɨɝɞɚ ɄɆ ɩɟɪɟɫɬɚɟɬ ɛɵɬɶ ɞɟɬɟɪɦɢɧɢɪɨɜɚɧɧɨɣ. Ⱦɚɥɟɟ ɡɧɚɱɟɧɢɟ ɫɱɟɬɱɢɤɚ ɫɢɦɜɨɥɚ ɭɯɨɞɚ ɢɡɦɟɧɹɟɬɫɹ ɬɨɥɶɤɨ ɩɪɢ ɞɨɛɚɜɥɟɧɢɢ ɜ ɄɆ ɧɨɜɵɯ ɫɢɦɜɨɥɨɜ. ȼɟɥɢɱɢɧɚ ɢɧɤɪɟɦɟɧɬɚ į ɫɱɟɬɱɢɤɚ ɪɚɜɧɚ Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X 151 http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
1›/ 2, ɩɪɢ 4 S (o) < S (o − k ) 1fi/ 4, ɩɪɢ 2 S (o) < S (o − k ) , 0, ɞɥɹ ɜɫɟɯ ɩɪɨɱɢɯ ɫɥɭɱɚɟɜ fl ɝɞɟ
S(o) — ɱɢɫɥɨ ɫɢɦɜɨɥɨɜ ɜ ɦɨɞɢɮɢɰɢɪɭɟɦɨɣ ɄɆ(o); S(o–k) — ɱɢɫɥɨ ɫɢɦɜɨɥɨɜ ɜ ɄɆ(o–k), ɜ ɤɨɬɨɪɨɣ ɪɟɚɥɶɧɨ ɛɵɥ ɨɰɟɧɟɧ ɬɟɤɭɳɢɣ ɫɢɦɜɨɥ. ȿɫɥɢ ɧɨɜɨɦɭ ɫɢɦɜɨɥɭ ɫɨɨɬɜɟɬɫɬɜɭɟɬ ɧɟɛɨɥɶɲɚɹ ɜɟɪɨɹɬɧɨɫɬɶ, ɬɨ į ɭɜɟɥɢɱɢɜɚɟɬɫɹ ɧɚ 1– f 0 ( s i | o ) , ɝɞɟ f 0 ( s i | o ) ɟɫɬɶ ɧɚɫɥɟɞɭɟɦɚɹ ɱɚɫɬɨɬɚ ɧɨɜɨɝɨ ɫɢɦɜɨɥɚ si (ɫɦ. ɩɨɞɩɭɧɤɬ «ɇɚɫɥɟɞɨɜɚɧɢɟ ɢɧɮɨɪɦɚɰɢɢ»). ȼɟɪɨɹɬɧɨɫɬɶ ɭɯɨɞɚ ɢɡ ɄɆ ɬɢɩɚ m ɛɨɥɶɲɟ ɜɫɟɝɨ ɡɚɜɢɫɢɬ ɨɬ ɫɭɦɦɵ ɡɧɚɱɟɧɢɣ ɜɫɟɯ ɫɱɟɬɱɢɤɨɜ. ɇɨ ɷɬɚ ɫɭɦɦɚ ɞɨɥɠɧɚ ɩɪɟɞɫɬɚɜɥɹɬɶɫɹ ɞɨɫɬɚɬɨɱɧɨ ɬɨɱɧɨ, ɱɬɨ ɩɪɢɜɟɞɟɬ ɤ ɛɨɥɶɲɨɦɭ ɤɨɥɢɱɟɫɬɜɭ ɢɫɩɨɥɶɡɭɟɦɵɯ ɄɆɍ ɢ, ɤɚɤ ɫɥɟɞɫɬɜɢɟ, ɤ ɧɟɞɨɫɬɚɬɤɭ ɫɬɚɬɢɫɬɢɤɢ ɜ ɤɚɠɞɨɣ ɄɆɍ. ɉɨɷɬɨɦɭ ɛɭɞɟɦ ɦɨɞɟɥɢɪɨɜɚɬɶ ɧɟ ɜɟɪɨɹɬɧɨɫɬɶ ɭɯɨɞɚ, ɚ ɜɟɥɢɱɢɧɭ ɫɱɟɬɱɢɤɚ ɫɢɦɜɨɥɚ ɭɯɨɞɚ, ɤɨɬɨɪɚɹ ɫɥɚɛɨ ɡɚɜɢɫɢɬ ɨɬ ɫɭɦɦɵ ɱɚɫɬɨɬ. ɉɨɥɹ Ʉɍ ɮɨɪɦɢɪɭɸɬɫɹ ɫɥɟɞɭɸɳɢɦ ɨɛɪɚɡɨɦ. 1) ɂɦɟɟɬɫɹ ɫɢɥɶɧɚɹ ɜɡɚɢɦɨɫɜɹɡɶ ɦɟɠɞɭ ɱɚɫɬɨɬɨɣ ɭɯɨɞɨɜ ɢ ɱɢɫɥɨɦ ɧɟɡɚɦɚɫɤɢɪɨɜɚɧɧɵɯ ɫɢɦɜɨɥɨɜ; ɩɪɨɢɡɜɟɞɟɦ ɤɜɚɧɬɨɜɚɧɢɟ ɷɬɨɝɨ ɱɢɫɥɚ ɞɨ 25 ɡɧɚɱɟɧɢɣ. 2) Ɋɟɡɭɥɶɬɚɬ ɫɪɚɜɧɟɧɢɹ ɱɢɫɥɚ ɧɟɡɚɦɚɫɤɢɪɨɜɚɧɧɵɯ ɫɢɦɜɨɥɨɜ S(o) –S(o+1) ɜ ɄɆ(o) ɫ ɱɢɫɥɨɦ ɫɢɦɜɨɥɨɜ S(o+1) ɜ ɞɨɱɟɪɧɟɣ ɄɆ(o+1) ɡɚɩɢɲɟɦ ɜ ɜɢɞɟ ɨɞɧɨɛɢɬɨɜɨɝɨ ɮɥɚɝɚ. 3) Ⱥɧɚɥɨɝɢɱɧɨ ɩɨɥɸ 2 ɜɜɟɞɟɦ ɮɥɚɝ ɪɟɡɭɥɶɬɚɬɚ ɫɪɚɜɧɟɧɢɹ ɱɢɫɥɚ ɧɟɡɚɦɚɫɤɢɪɨɜɚɧɧɵɯ ɫɢɦɜɨɥɨɜ S(o) – S(o+1) ɫ ɱɢɫɥɨɦ ɫɢɦɜɨɥɨɜ S(o–1) – S(o), ɤɨɬɨɪɵɟ ɨɫɬɚɧɭɬɫɹ ɧɟɡɚɦɚɫɤɢɪɨɜɚɧɧɵɦɢ ɜ ɪɨɞɢɬɟɥɶɫɤɨɣ ɄɆ(o–1), ɟɫɥɢ ɬɟɤɭɳɚɹ ɄɆ(o) ɧɟ ɫɦɨɠɟɬ ɨɰɟɧɢɬɶ ɨɛɪɚɛɚɬɵɜɚɟɦɵɣ ɫɢɦɜɨɥ. 4) ɋɭɳɟɫɬɜɭɟɬ ɫɢɥɶɧɚɹ ɫɬɚɬɢɫɬɢɱɟɫɤɚɹ ɜɡɚɢɦɨɫɜɹɡɶ ɦɟɠɞɭ ɬɟɤɭɳɢɦ ɢ ɩɪɟɞɵɞɭɳɢɦ ɫɢɦɜɨɥɚɦɢ. ȼɜɟɞɟɦ ɨɞɧɨɛɢɬɨɜɵɣ ɮɥɚɝ, ɩɪɢɧɢɦɚɸɳɢɣ ɡɧɚɱɟɧɢɟ 0, ɟɫɥɢ ɞɜɚ ɫɬɚɪɲɢɯ ɛɢɬɚ 152 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
5)
ɩɪɟɞɵɞɭɳɟɝɨ ɫɢɦɜɨɥɚ ɧɭɥɟɜɵɟ, ɢ ɡɧɚɱɟɧɢɟ 1 ɜ ɩɪɨɱɢɯ ɫɥɭɱɚɹɯ. ɋɭɳɟɫɬɜɭɟɬ ɫɬɚɬɢɫɬɢɱɟɫɤɚɹ ɜɡɚɢɦɨɫɜɹɡɶ ɦɟɠɞɭ ɱɚɫɬɨɬɨɣ ɭɯɨɞɨɜ ɢ ɫɪɟɞɧɟɣ ɱɚɫɬɨɬɨɣ ɫɢɦɜɨɥɨɜ
f (o ) ɜ ɄɆ, ɜɤɥɸS (o ) + 1
ɱɚɹ ɫɢɦɜɨɥ ɭɯɨɞɚ, ɝɞɟ f(o) ɟɫɬɶ ɫɭɦɦɚ ɡɧɚɱɟɧɢɣ ɜɫɟɯ ɫɱɟɬɱɢɤɨɜ ɬɟɤɭɳɟɣ ɄɆ(o). ȼɫɟɝɨ ɦɨɠɟɬ ɢɫɩɨɥɶɡɨɜɚɬɶɫɹ ɞɨ 25·2·2·2·2 = 400 ɤɨɧɬɟɤɫɬɨɜ ɭɯɨɞɚ ɞɥɹ ɄɆ ɬɢɩɚ m. Ɇɟɬɨɞ SEE-d2, ɢɫɩɨɥɶɡɭɟɦɵɣ ɜ ɤɨɦɩɪɟɫɫɨɪɟ PPMonstr, ɨɬɥɢɱɚɟɬɫɹ ɨɬ SEE-d1 ɫɥɟɞɭɸɳɢɦ ɨɛɪɚɡɨɦ: 1) ɞɨɛɚɜɥɟɧɨ 4 ɩɨɥɹ ɜ Ʉɍ ɞɥɹ ɄɆ ɬɢɩɚ d; 2) ɞɨɛɚɜɥɟɧɨ 2 ɩɨɥɹ ɜ Ʉɍ ɞɥɹ ɄɆ ɬɢɩɚ m; 3) ɞɥɹ KM ɬɢɩɚ nm ɢɫɩɨɥɶɡɭɟɬɫɹ ɚɞɚɩɬɢɜɧɚɹ ɨɰɟɧɤɚ. Ⱦɚɧɧɚɹ ɦɨɞɢɮɢɤɚɰɢɹ ɩɨɡɜɨɥɹɟɬ ɭɥɭɱɲɢɬɶ ɫɠɚɬɢɟ ɧɚ 0,5–1%, ɧɨ ɜɵɱɢɫɥɟɧɢɟ ɡɧɚɱɟɧɢɣ ɞɨɩɨɥɧɢɬɟɥɶɧɵɯ ɩɨɥɟɣ ɫɭɳɟɫɬɜɟɧɧɨ ɡɚɦɟɞɥɹɟɬ ɪɚɛɨɬɭ ɤɨɦɩɪɟɫɫɨɪɚ. Ʉɚɤ SEE-d2, ɬɚɤ ɢ SEE-d1 ɨɛɵɱɧɨ ɷɮɮɟɤɬɢɜɧɟɟ SEE ɩɨ ɦɟɬɨɞɭ Z ɫ ɬɨɱɤɢ ɡɪɟɧɢɹ ɬɨɱɧɨɫɬɢ ɨɰɟɧɨɤ ɢ ɜɵɱɢɫɥɢɬɟɥɶɧɨɣ ɫɥɨɠɧɨɫɬɢ. ɉɊɂɆȿɊ ɊȿȺɅɂɁȺɐɂɂ ȺȾȺɉɌɂȼɇɈɃ Ɉȼɍ
Ɂɚɦɟɧɢɦ ɜ ɧɚɲɟɦ ɤɨɦɩɪɟɫɫɨɪɟ Dummy ɚɩɪɢɨɪɧɵɣ ɦɟɬɨɞ Ɉȼɍ ɧɚ ɚɞɚɩɬɢɜɧɵɣ. ɋ ɰɟɥɶɸ ɦɚɤɫɢɦɚɥɶɧɨɝɨ ɭɩɪɨɳɟɧɢɹ ɤɨɧɬɟɤɫɬ ɭɯɨɞɚ ɛɭɞɟɦ ɮɨɪɦɢɪɨɜɚɬɶ ɧɚ ɨɫɧɨɜɚɧɢɢ ɬɨɥɶɤɨ ɱɚɫɬɨɬɵ ɩɨɹɜɥɟɧɢɹ ɤɨɧɬɟɤɫɬɚ TotFr. Ɋɚɫɫɦɨɬɪɢɦ ɤɚɤ ɢɡɦɟɧɢɬɫɹ ɩɪɨɝɪɚɦɦɚ. Ⱦɥɹ ɩɨɞɫɱɟɬɚ ɱɢɫɥɚ ɭɫɩɟɲɧɵɯ ɤɨɞɢɪɨɜɚɧɢɣ ɢ ɱɢɫɥɚ ɭɯɨɞɨɜ ɫɨɡɞɚɞɢɦ ɫɬɪɭɤɬɭɪɵ ɞɚɧɧɵɯ: struct SEE_item { //ɫɱɟɬɱɢɤɢ ɞɥɹ ɤɨɧɬɟɤɫɬɚ ɭɯɨɞɚ int e, s; }; int TF2Index [MAX_TotFr+1]; //ɬɚɛɥɢɰɚ ɤɜɚɧɬɨɜɚɧɢɹ TotFr SEE_item *SEE;
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X 153 http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
Ⱥɥɝɨɪɢɬɦ ɤɜɚɧɬɨɜɚɧɢɹ TotFr ɨɩɢɫɵɜɚɟɬɫɹ ɫɥɟɞɭɸɳɢɦ ɨɛɪɚɡɨɦ: Ɂɧɚɱɟɧɢɟ TotFr ɇɨɦɟɪ Ʉɍ 1 1 2…3 2 4…7 3 8…15 4 … … ɂɧɚɱɟ ɝɨɜɨɪɹ, ɩɨ ɦɟɪɟ ɪɨɫɬɚ TotFr ɞɢɚɩɚɡɨɧ ɜɨɡɦɨɠɧɵɯ ɡɧɚɱɟɧɢɣ TotFr ɝɪɭɩɩɵ ɄɆ, ɨɬɧɨɫɢɦɵɯ ɤ ɨɞɧɨɦɭ ɢ ɬɨɦɭ ɠɟ Ʉɍ, ɜ ɞɜɚ ɪɚɡɚ ɛɨɥɶɲɟ ɩɪɟɞɵɞɭɳɟɝɨ. ȿɫɥɢ MAX_TotFr = 0x3fff, ɬɨ ɜɫɟɝɨ ɦɨɠɟɬ ɢɫɩɨɥɶɡɨɜɚɬɶɫɹ ɞɨ 14 Ʉɍ. ɂɡɦɟɧɢɦ ɫɨɨɬɜɟɬɫɬɜɭɸɳɢɦ ɨɛɪɚɡɨɦ ɮɭɧɤɰɢɸ init_model. void init_model (void){ ... // ɪɚɧɟɟ ɨɩɢɫɚɧɧɵɟ ɞɟɣɫɬɜɢɹ ɩɨ ɢɧɢɰɢɚɥɢɡɚɰɢɢ int ind = 0, //ɧɨɦɟɪ Ʉɍ i = 1, //ɡɧɚɱɟɧɢɟ TotFr size = 1; //ɪɚɡɦɟɪ ɞɢɚɩɚɡɨɧɚ do{ int j = 0; do{ TF2Index [i+j] = ind; }while (++j < size); i += j; size <<= 1; ind++; }while ((i + size) <= MAX_TotFr); for (; i <= MAX_TotFr; i++) TF2Index [i] = ind; /*ɧɚ ɜɫɹɤɢɣ ɫɥɭɱɚɣ ɨɬɧɟɫɟɦ ɄɆ ɫ TotFr = 0 ɤ Ʉɍ ɫ ɧɨɦɟɪɨɦ 0 */ TF2Index [0] = 0; SEE = (SEE_item*) new SEE_item[ind+1]; //ɩɪɨɢɧɢɰɢɚɥɢɡɢɪɭɟɦ ɫɱɟɬɱɢɤɢ ɄɆɍ for (i = 0; i <= ind; i++) { SEE[i].e = 0; /* ɷɬɨ ɩɪɟɞɨɬɜɪɚɬɢɬ ɞɟɥɟɧɢɟ ɧɚ 0, ɯɨɬɹ ɢ ɫɦɟɫɬɢɬ ɨɰɟɧɤɭ */ SEE[i].s = 1;
154 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
} }
Ɏɭɧɤɰɢɹ encode_sym ɩɪɢɦɟɬ ɬɚɤɨɣ ɜɢɞ (ɢɡɦɟɧɟɧɢɹ ɜɵɞɟɥɟɧɵ ɠɢɪɧɵɦ ɲɪɢɮɬɨɦ): int encode_sym (ContextModel *CM, int c){ int esc; stack [SP++] = CM; SEE_item *E; E = calc_SEE (CM, &esc); //ɧɚɯɨɞɢɦ ɚɞɚɩɬɢɜɧɭɸ Ɉȼɍ if (CM->count[c]){ int CumFreqUnder = 0; for (int i = 0; i < c; i++) CumFreqUnder += CM->count[i]; AC.encode (CumFreqUnder, CM->count[c], CM->TotFr + esc); /* ɭɜɟɥɢɱɢɜɚɟɦ ɫɱɟɬɱɢɤ ɭɫɩɟɲɧɵɯ ɤɨɞɢɪɨɜɚɧɢɣ ɞɥɹ ɬɟɤɭɳɟɝɨ Ʉɍ */ E->s++; return 1; }else{ if (CM->esc){ AC.encode (CM->TotFr, esc, CM->TotFr + esc); //ɭɜɟɥɢɱɢɜɚɟɦ ɫɱɟɬɱɢɤ ɭɯɨɞɨɜ ɞɥɹ ɬɟɤɭɳɟɝɨ Ʉɍ E->e++; } return 0; } }
ȼ ɮɭɧɤɰɢɢ ɞɟɤɨɞɢɪɨɜɚɧɢɹ ɫɢɦɜɨɥɚ decode_sym ɩɪɨɢɡɜɟɞɟɦ ɚɧɚɥɨɝɢɱɧɵɟ ɢɡɦɟɧɟɧɢɹ. int decode_sym (ContextModel *CM, int *c){ stack [SP++] = CM; if (!CM->esc) return 0; int esc; SEE_item *E = calc_SEE (CM, &esc); int cum_freq = AC.get_freq (CM->TotFr + esc); if (cum_freq < CM->TotFr){ int CumFreqUnder = 0;
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X 155 http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
int i = 0; for (;;){ if ( (CumFreqUnder + CM->count[i]) <= cum_freq) CumFreqUnder += CM->count[i]; else break; i++; } AC.decode_update (CumFreqUnder, CM->count[i], CM->TotFr + esc); *c = i; E->s++; return 1; }else{ AC.decode_update (CM->TotFr, esc, CM->TotFr + esc); E->e++; return 0; } }
Ɂɚɜɢɫɢɦɨɫɬɶ ɦɟɠɞɭ ɬɪɟɛɭɟɦɵɦ ɡɧɚɱɟɧɢɟɦ ɫɱɟɬɱɢɤɚ ɭɯɨɞɨɜ, ɫ ɨɞɧɨɣ ɫɬɨɪɨɧɵ, ɢ ɤɨɥɢɱɟɫɬɜɨɦ ɭɯɨɞɨɜ ɢ ɭɫɩɟɲɧɵɯ ɤɨɞɢɪɨɜɚɧɢɣ, ɫ ɞɪɭɝɨɣ ɫɬɨɪɨɧɵ, ɢɦɟɟɬ ɜɢɞ
esc e = , TotFr + esc e + s ɨɬɤɭɞɚ
esc =
e ⋅ TotFr . s
ɉɨɷɬɨɦɭ ɮɭɧɤɰɢɸ calc_SEE, ɜ ɤɨɬɨɪɨɣ ɫɨɛɫɬɜɟɧɧɨ ɢ ɨɫɭɳɟɫɬɜɥɹɟɬɫɹ ɚɞɚɩɬɢɜɧɚɹ Ɉȼɍ, ɪɟɚɥɢɡɭɟɦ ɬɚɤ: const int SEE_THRESH1 = 10; const int SEE_THRESH2 = 0x7ff; SEE_item* calc_SEE (ContextModel* CM, int *esc){ SEE_item* E = &SEE[TF2Index[CM->TotFr]]; if ((E->e + E->s) > SEE_THRESH1){ *esc = E->e * CM->TotFr / E->s; //ɚɞɚɩɬɢɜɧɚɹ ɨɰɟɧɤɚ if (!(*esc)) *esc = 1; if ((E->e + E->s) > SEE_THRESH2){ E->e -= E->e >> 1; E->s -= E->s >> 1; }
156 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
} else *esc = CM->esc; //ɚɩɪɢɨɪɧɚɹ ɨɰɟɧɤɚ return E; }
Ʉɨɧɫɬɚɧɬɚ SEE_THRESH1 ɨɩɪɟɞɟɥɹɟɬ ɩɨɪɨɝ ɱɚɫɬɨɬɵ ɢɫɩɨɥɶɡɨɜɚɧɢɹ Ʉɍ, ɧɢɠɟ ɤɨɬɨɪɨɝɨ ɩɪɟɞɩɨɱɬɢɬɟɥɶɧɟɟ ɜɫɟ ɠɟ ɩɪɢɦɟɧɟɧɢɟ ɚɩɪɢɨɪɧɨɝɨ ɦɟɬɨɞɚ ɨɰɟɧɤɢ, ɬ.ɤ. ɧɟ ɧɚɛɪɚɥɨɫɶ ɟɳɟ ɡɧɚɱɢɬɟɥɶɧɨɝɨ ɨɛɴɟɦɚ ɫɬɚɬɢɫɬɢɤɢ ɞɥɹ ɬɟɤɭɳɟɝɨ Ʉɍ. Ʉɨɧɫɬɚɧɬɚ SEE_THRESH2 ɧɚɥɚɝɚɟɬ ɨɝɪɚɧɢɱɟɧɢɟ ɧɚ ɡɧɚɱɟɧɢɟ ɫɱɟɬɱɢɤɨɜ ɭɫɩɟɲɧɵɯ ɤɨɞɢɪɨɜɚɧɢɣ s ɢ ɭɯɨɞɚ e ɱɬɨɛɵ, ɫ ɨɞɧɨɣ ɫɬɨɪɨɧɵ, ɩɪɟɞɨɬɜɪɚɬɢɬɶ ɩɟɪɟɩɨɥɧɟɧɢɟ ɩɪɢ ɭɦɧɨɠɟɧɢɢ E->e * CM->TotFr ɢ, ɫ ɞɪɭɝɨɣ, ɭɥɭɱɲɢɬɶ ɚɞɚɩɬɚɰɢɸ ɤ ɥɨɤɚɥɶɧɵɦ ɢɡɦɟɧɟɧɢɹɦ ɯɚɪɚɤɬɟɪɢɫɬɢɤ ɫɠɢɦɚɟɦɨɝɨ ɩɨɬɨɤɚ. ɉɪɟɞɥɨɠɟɧɧɚɹ ɪɟɚɥɢɡɚɰɢɹ ɜɵɱɢɫɥɟɧɢɹ ɫɪɟɞɧɟɣ ɱɚɫɬɨɬɵ ɭɯɨɞɨɜ ɤɪɚɣɧɟ ɧɟɷɤɨɧɨɦɧɚ. Ɍɚɤ, ɧɚɩɪɢɦɟɪ, ɦɨɠɧɨ ɢɡɛɟɠɚɬɶ ɭɦɧɨɠɟɧɢɹ ɧɚ CM->TotFr, ɬ.ɤ. ɨɛɵɱɧɨ ɜ ɩɪɟɞɟɥɚɯ ɝɪɭɩɩɵ ɄɆ, ɨɬɧɨɫɢɦɵɯ ɤ ɨɞɧɨɦɭ Ʉɍ, ɷɬɚ ɜɟɥɢɱɢɧɚ ɢɡɦɟɧɹɟɬɫɹ ɧɟ ɫɢɥɶɧɨ, ɩɨɷɬɨɦɭ ɢɦɟɟɬ ɫɦɵɫɥ ɡɚɥɨɠɢɬɶ ɧɟɹɜɧɨɟ ɭɦɧɨɠɟɧɢɟ ɧɚ ɫɨɨɬɜɟɬɫɬɜɭɸɳɭɸ ɤɨɧɫɬɚɧɬɭ ɜ ɫɚɦ ɚɥɝɨɪɢɬɦ ɢɡɦɟɧɟɧɢɹ ɫɱɟɬɱɢɤɨɜ e ɢ s. ɉɪɚɤɬɢɱɧɚɹ ɪɟɚɥɢɡɚɰɢɹ ɚɞɚɩɬɢɜɧɨɣ ɨɰɟɧɤɢ ɫɪɟɞɧɟɝɨ ɢɡɥɨɠɟɧɚ ɜ [1]. Ɍɚɤɠɟ ɧɟɨɛɯɨɞɢɦɨ ɫɥɟɞɢɬɶ ɡɚ ɜɟɥɢɱɢɧɨɣ esc, ɩɨɫɤɨɥɶɤɭ ɞɨɫɬɚɬɨɱɧɨ ɛɨɥɶɲɚɹ ɫɭɦɦɚ CM->TotFr + esc ɦɨɠɟɬ ɩɪɢɜɟɫɬɢ ɤ ɩɟɪɟɩɨɥɧɟɧɢɸ ɜ ɚɪɢɮɦɟɬɢɱɟɫɤɨɦ ɤɨɞɟɪɟ. Ɇɵ ɧɟ ɞɟɥɚɥɢ ɫɨɨɬɜɟɬɫɬɜɭɸɳɢɯ ɩɪɨɜɟɪɨɤ ɥɢɲɶ ɫ ɰɟɥɶɸ ɭɩɪɨɳɟɧɢɹ ɨɩɢɫɚɧɢɹ. ɍɩɪɚɠɧɟɧɢɟ: Ⱦɨɛɚɜɥɟɧɢɟ ɚɞɚɩɬɢɜɧɨɝɨ ɦɟɬɨɞɚ Ɉȼɍ ɬɪɟɛɭɟɬ ɢɡɦɟɧɟɧɢɹ ɞɟɣɫɬɜɢɣ ɩɨ ɤɨɞɢɪɨɜɚɧɢɸ ɡɧɚɤɚ ɤɨɧɰɚ ɮɚɣɥɚ. ɉɪɟɞɥɨɠɢɬɟ ɜɚɪɢɚɧɬ ɬɚɤɨɣ ɦɨɞɢɮɢɤɚɰɢɢ. ȿɫɥɢ ɫɪɚɜɧɢɜɚɬɶ ɫ ɩɨɦɨɳɶɸ CalgCC, ɬɨ ɩɪɢɦɟɧɟɧɢɟ ɨɩɢɫɚɧɧɨɝɨ ɦɟɬɨɞɚ ɚɞɚɩɬɢɜɧɨɣ Ɉȼɍ ɭɥɭɱɲɚɟɬ ɫɠɚɬɢɟ ɜɫɟɝɨ ɥɢɲɶ ɩɪɢɛɥɢɡɢɬɟɥɶɧɨ ɧɚ 0.3%. ɇɟɛɨɥɶɲɨɣ ɷɮɮɟɤɬ ɨɛɴɹɫɧɹɟɬɫɹ ɧɟ ɬɨɥɶɤɨ Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X 157 http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɩɪɨɫɬɵɦ ɦɟɯɚɧɢɡɦɨɦ ɜɵɱɢɫɥɟɧɢɹ Ɉȼɍ, ɧɨ ɢ ɦɚɥɵɦ ɩɨɪɹɞɤɨɦ ɢɫɩɨɥɶɡɭɟɦɨɣ ɦɨɞɟɥɢ. Ɂɚɤɥɸɱɟɧɢɟ: Ⱦɚɠɟ ɫɥɨɠɧɵɟ ɚɞɚɩɬɢɜɧɵɟ ɦɟɬɨɞɵ Ɉȼɍ ɭɥɭɱɲɚɸɬ ɫɠɚɬɢɟ ɨɛɵɱɧɨ ɥɢɲɶ ɧɚ 1–2% ɩɨ ɫɪɚɜɧɟɧɢɸ ɫ ɚɩɪɢɨɪɧɵɦɢ ɦɟɬɨɞɚɦɢ, ɧɨ ɬɪɟɛɭɸɬ ɫɭɳɟɫɬɜɟɧɧɵɯ ɜɵɱɢɫɥɢɬɟɥɶɧɵɯ ɡɚɬɪɚɬ.
Ɉɛɧɨɜɥɟɧɢɟ ɫɱɟɬɱɢɤɨɜ ɫɢɦɜɨɥɨɜ Ɇɨɞɢɮɢɤɚɰɢɹ ɫɱɟɬɱɢɤɨɜ ɩɨɫɥɟ ɨɛɪɚɛɨɬɤɢ ɨɱɟɪɟɞɧɨɝɨ ɫɢɦɜɨɥɚ ɦɨɠɟɬ ɛɵɬɶ ɪɟɚɥɢɡɨɜɚɧɚ ɩɨ-ɪɚɡɧɨɦɭ. ɉɨɫɥɟ ɤɨɞɢɪɨɜɚɧɢɹ ɤɚɠɞɨɝɨ ɫɢɦɜɨɥɚ ɟɫɬɟɫɬɜɟɧɧɨ ɢɡɦɟɧɹɬɶ ɫɨɨɬɜɟɬɫɬɜɭɸɳɢɟ ɫɱɟɬɱɢɤɢ ɜɨ ɜɫɟɯ ɄɆ ɩɨɪɹɞɤɨɜ 0, 1, …, N, ɱɬɨ ɢ ɩɪɟɞɥɚɝɚɟɬɫɹ, ɜ ɱɚɫɬɧɨɫɬɢ, ɞɟɥɚɬɶ ɜ ɚɥɝɨɪɢɬɦɚɯ PPMA ɢ PPMB. Ɍɚɤɨɣ ɩɨɞɯɨɞ ɧɚɡɵɜɚɟɬɫɹ ɩɨɥɧɵɦ ɨɛɧɨɜɥɟɧɢɟɦ (full updates). ɇɨ ɜ ɫɥɭɱɚɟ ɤɥɚɫɫɢɱɟɫɤɨɝɨ, ɧɟ ɢɫɩɨɥɶɡɭɸɳɟɝɨ ɧɚɫɥɟɞɨɜɚɧɢɟ ɢɧɮɨɪɦɚɰɢɢ PPM, ɥɭɱɲɢɟ ɪɟɡɭɥɶɬɚɬɵ ɞɨɫɬɢɝɚɸɬɫɹ ɤɨɝɞɚ ɫɱɟɬɱɢɤɢ ɨɰɟɧɟɧɧɨɝɨ ɫɢɦɜɨɥɚ ɭɜɟɥɢɱɢɜɚɸɬɫɹ ɬɨɥɶɤɨ ɜ ɄɆ ɩɨɪɹɞɤɨɜ o, o+1, …, N, ɝɞɟ o — ɩɨɪɹɞɨɤ ɄɆ, ɜ ɤɨɬɨɪɨɣ ɫɢɦɜɨɥ ɛɵɥ ɡɚɤɨɞɢɪɨɜɚɧ. ɂɧɚɱɟ ɝɨɜɨɪɹ, ɫɱɟɬɱɢɤ ɨɛɪɚɛɨɬɚɧɧɨɝɨ ɫɢɦɜɨɥɚ ɧɟ ɭɜɟɥɢɱɢɜɚɟɬɫɹ ɜ ɤɚɤɨɣ-ɬɨ ɚɤɬɢɜɧɨɣ ɄɆ, ɟɫɥɢ ɨɧ ɛɵɥ ɨɰɟɧɟɧ ɜ ɄɆ ɛɨɥɟɟ ɜɵɫɨɤɨɝɨ ɩɨɪɹɞɤɚ. ɗɬɚ ɬɟɯɧɢɤɚ ɢɦɟɟɬ ɫɚɦɨɫɬɨɹɬɟɥɶɧɨɟ ɧɚɡɜɚɧɢɟ — ɢɫɤɥɸɱɟɧɢɟ ɩɪɢ ɨɛɧɨɜɥɟɧɢɢ (update exclusion). Ɍɟɪɦɢɧ «ɢɫɤɥɸɱɟɧɢɟ ɩɪɢ ɨɛɧɨɜɥɟɧɢɢ» ɧɟ ɫɥɟɞɭɟɬ ɩɭɬɚɬɶ ɫ ɢɫɤɥɸɱɟɧɢɟɦ (exclusion), ɩɨɞ ɤɨɬɨɪɵɦ ɩɨɧɢɦɚɸɬ ɫɚɦ ɦɟɯɚɧɢɡɦ ɭɯɨɞɨɜ ɫ ɦɚɫɤɢɪɨɜɚɧɢɟɦ ɫɱɟɬɱɢɤɨɜ ɬɟɯ ɫɢɦɜɨɥɨɜ, ɤɨɬɨɪɵɟ ɜɫɬɪɟɱɚɥɢɫɶ ɜ ɤɨɧɬɟɤɫɬɚɯ ɛɨɥɶɲɟɝɨ ɩɨɪɹɞɤɚ. ɉɪɢɦɟɧɟɧɢɟ ɢɫɤɥɸɱɟɧɢɹ ɩɪɢ ɨɛɧɨɜɥɟɧɢɢ ɩɨɡɜɨɥɹɟɬ ɭɥɭɱɲɢɬɶ ɫɠɚɬɢɟ ɨɛɵɱɧɨɝɨ PPM-ɤɨɦɩɪɟɫɫɨɪɚ ɩɪɢɦɟɪɧɨ ɧɚ 1–2% ɩɨ ɫɪɚɜɧɟɧɢɸ ɫ ɬɟɦ ɫɥɭɱɚɟɦ, ɤɨɝɞɚ ɩɪɨɢɡɜɨɞɢɬɫɹ ɨɛɧɨɜɥɟɧɢɟ ɫɱɟɬɱɢɤɨɜ ɫɢɦɜɨɥɚ ɜɨ ɜɫɟɯ ɄɆ. Ɉɞɧɨɜɪɟɦɟɧɧɨ ɭɫɤɨɪɹɟɬɫɹ ɪɚɛɨɬɚ ɤɨɦɩɪɟɫɫɨɪɚ. ȼ ɫɥɭɱɚɟ ɩɪɢɦɟɧɟɧɢɹ ɧɚɫɥɟɞɨɜɚɧɢɹ ɢɧɮɨɪɦɚɰɢɢ, ɚ 158 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɬɚɤɠɟ ɞɥɹ ɚɥɝɨɪɢɬɦɚ PPM* (ɨɩɢɫɚɧɢɟ PPM* ɩɪɢɜɟɞɟɧɨ ɧɢɠɟ), ɩɨɥɶɡɚ ɨɬ ɢɫɤɥɸɱɟɧɢɹ ɩɪɢ ɨɛɧɨɜɥɟɧɢɢ ɧɟ ɫɬɨɥɶ ɨɱɟɜɢɞɧɚ. Ɋɨɥɶ ɤɨɧɬɟɤɫɬɨɜ-ɩɪɟɞɤɨɜ ɫɪɚɜɧɢɬɟɥɶɧɨ ɧɟɛɨɥɶɲɢɯ ɩɨɪɹɞɤɨɜ ɡɧɚɱɢɬɟɥɶɧɨ ɜɨɡɪɚɫɬɚɟɬ ɩɪɢ ɢɫɩɨɥɶɡɨɜɚɧɢɢ ɬɟɯɧɢɤɢ ɧɚɫɥɟɞɨɜɚɧɢɹ ɢɧɮɨɪɦɚɰɢɢ, ɩɨɷɬɨɦɭ ɧɟɨɛɯɨɞɢɦɨ ɛɨɥɟɟ ɛɵɫɬɪɨɟ ɨɛɧɨɜɥɟɧɢɟ ɢɯ ɫɬɚɬɢɫɬɢɤɢ. Ʉɚɤ ɩɨɤɚɡɵɜɚɸɬ ɷɤɫɩɟɪɢɦɟɧɬɵ, ɩɨɥɧɨɟ ɨɛɧɨɜɥɟɧɢɟ ɪɚɛɨɬɚɟɬ ɜɫɟ ɠɟ ɩɥɨɯɨ ɢ ɜ ɷɬɨɦ ɫɥɭɱɚɟ. ɉɨɷɬɨɦɭ ɨɛɵɱɧɨ ɫɥɟɞɭɟɬ ɢɫɩɨɥɶɡɨɜɚɬɶ ɪɟɲɟɧɢɟ, ɩɪɨɦɟɠɭɬɨɱɧɨɟ ɦɟɠɞɭ ɢɫɤɥɸɱɟɧɢɟɦ ɩɪɢ ɨɛɧɨɜɥɟɧɢɢ ɢ ɩɨɥɧɵɦ ɨɛɧɨɜɥɟɧɢɟɦ. ɇɚɩɪɢɦɟɪ, ɩɨɦɢɦɨ ɭɜɟɥɢɱɟɧɢɹ ɫ ɜɟɫɨɦ 1 ɜ ɪɚɦɤɚɯ ɪɟɚɥɢɡɚɰɢɢ ɢɫɤɥɸɱɟɧɢɹ ɩɪɢ ɨɛɧɨɜɥɟɧɢɢ, ɢɦɟɟɬ ɫɦɵɫɥ ɢɧɤɪɟɦɟɧɬɢɪɨɜɚɬɶ ɫ ɜɟɫɨɦ 1/(o– i+1) ɫɱɟɬɱɢɤɢ ɫɢɦɜɨɥɚ ɜ ɤɨɧɬɟɤɫɬɧɵɯ ɦɨɞɟɥɹɯ ɦɟɧɶɲɢɯ ɩɨɪɹɞɤɨɜ i. ɉɨɞ ɄɆ(i) ɩɨɧɢɦɚɸɬɫɹ ɩɪɟɞɤɢ ɬɨɣ ɄɆ(o), ɜ ɤɨɬɨɪɨɣ ɫɢɦɜɨɥ ɛɵɥ ɨɰɟɧɟɧ. ɇɚɩɪɢɦɟɪ, ɜ ɤɨɦɩɪɟɫɫɨɪɟ PPMd ɞɟɥɚɟɬɫɹ ɦɨɞɢɮɢɤɚɰɢɹ ɫɱɟɬɱɢɤɚ ɫ ɜɟɫɨɦ 1/2 ɬɨɥɶɤɨ ɜ ɪɨɞɢɬɟɥɶɫɤɨɣ ɄɆ ɢ ɬɨɥɶɤɨ ɜ ɨɩɪɟɞɟɥɟɧɧɵɯ ɫɥɭɱɚɹɯ. ɉɪɢ ɷɬɨɦ ɨɫɧɨɜɧɨɟ ɭɫɥɨɜɢɟ ɜɵɩɨɥɧɟɧɢɹ ɬɚɤɨɣ ɦɨɞɢɮɢɤɚɰɢɢ ɬɪɟɛɭɟɬ, ɱɬɨɛɵ ɫɱɟɬɱɢɤ ɨɰɟɧɟɧɧɨɝɨ ɫɢɦɜɨɥɚ ɜ ɄɆ(o) ɛɵɥ ɦɟɧɶɲɟ ɧɟɤɨɬɨɪɨɝɨ ɩɨɪɨɝɚ. ȼ ɚɥɝɨɪɢɬɦɟ PPM* ɩɪɢɦɟɧɹɟɬɫɹ ɱɚɫɬɢɱɧɨɟ ɢɫɤɥɸɱɟɧɢɟ ɩɪɢ ɨɛɧɨɜɥɟɧɢɢ (partial update exclusion). ȼ ɷɬɨɦ ɫɥɭɱɚɟ ɩɪɨɢɡɜɨɞɢɬɫɹ ɭɜɟɥɢɱɟɧɢɟ ɫɱɟɬɱɢɤɨɜ ɜɨ ɜɫɟɯ ɬɚɤ ɧɚɡɵɜɚɟɦɵɯ ɞɟɬɟɪɦɢɧɢɪɨɜɚɧɧɵɯ ɄɆ, ɚ ɟɫɥɢ ɠɟ ɢɯ ɧɟɬ, ɬɨ ɬɨɥɶɤɨ ɜ ɧɟɞɟɬɟɪɦɢɧɢɪɨɜɚɧɧɨɣ ɄɆ ɫ ɫɚɦɵɦ ɛɨɥɶɲɢɦ ɩɨɪɹɞɤɨɦ. ɉɨɞ ɞɟɬɟɪɦɢɧɢɪɨɜɚɧɧɨɣ ɩɨɧɢɦɚɟɬɫɹ ɬɚɤɚɹ ɄɆ, ɱɬɨ ɜ ɫɨɨɬɜɟɬɫɬɜɭɸɳɟɦ ɟɣ ɤɨɧɬɟɤɫɬɟ ɞɨ ɞɚɧɧɨɝɨ ɦɨɦɟɧɬɚ ɜɫɬɪɟɱɚɥɫɹ ɬɨɥɶɤɨ ɨɞɢɧ ɫɢɦɜɨɥ (ɥɸɛɨɟ ɱɢɫɥɨ ɪɚɡ). Ⱥɧɚɥɨɝɢɱɧɨ, ɬɚɤɨɣ ɤɨɧɬɟɤɫɬ ɧɚɡɵɜɚɟɬɫɹ ɞɟɬɟɪɦɢɧɢɪɨɜɚɧɧɵɦ. Ⱦɥɹ ɫɨɛɫɬɜɟɧɧɨ ɫɠɚɬɢɹ ɜ ɫɜɹɡɤɟ ɫ PPM ɩɪɚɤɬɢɱɟɫɤɢ ɜɫɟɝɞɚ ɢɫɩɨɥɶɡɭɟɬɫɹ ɚɪɢɮɦɟɬɢɱɟɫɤɨɟ ɤɨɞɢɪɨɜɚɧɢɟ. ɍɜɟɥɢɱɟɧɢɟ ɡɧɚɱɟɧɢɣ ɫɱɟɬɱɢɤɨɜ ɄɆ ɦɨɠɟɬ ɩɪɢɜɟɫɬɢ ɤ ɨɲɢɛɤɟ ɩɟɪɟɩɨɥɧɟɧɢɹ ɜ ɚɪɢɮɦɟɬɢɱɟɫɤɨɦ ɤɨɞɟɪɟ. ȼɨ ɢɡɛɟɠɚɧɢɟ ɷɬɨɝɨ ɨɛɵɱɧɨ ɩɪɨɢɡɜɨɞɹɬ ɞɟɥɟɧɢɟ ɡɧɚɱɟɧɢɣ ɩɨɩɨɥɚɦ ɩɪɢ ɞɨɫɬɢɠɟɧɢɢ ɡɚɞɚɧɧɨɝɨ ɩɨɪɨɝɚ. Ɇɚɤɫɢɦɚɥɶɧɚɹ ɜɟɥɢɱɢɧɚ ɩɨɪɨɝɚ ɨɩɪɟɞɟɥɹɟɬɫɹ ɨɫɨɛɟɧɧɨɫɬɹɦɢ ɤɨɧɤɪɟɬɧɨɣ ɪɟɚɥɢɡɚɰɢɢ ɚɪɢɮɦɟɬɢɱɟɫɤɨɝɨ ɤɨɞɟɪɚ. ɋ ɞɪɭɝɨɣ ɫɬɨɪɨɧɵ, ɦɚɫɲɬɚɛɢɪɨɜɚɧɢɟ ɫɱɟɬɱɢɤɨɜ ɞɚɟɬ ɩɨɛɨɱɧɵɣ ɷɮɮɟɤɬ ɜ ɜɢɄɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X 159 http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɞɟ ɭɥɭɱɲɟɧɢɹ ɫɠɚɬɢɹ ɩɪɢ ɤɨɞɢɪɨɜɚɧɢɢ ɞɚɧɧɵɯ ɫ ɞɨɫɬɚɬɨɱɧɨ ɛɵɫɬɪɨ ɦɟɧɹɸɳɟɣɫɹ ɫɬɚɬɢɫɬɢɤɨɣ ɤɨɧɬɟɤɫɬɧɵɯ ɦɨɞɟɥɟɣ. ɑɟɦ ɧɟɫɬɚɛɢɥɶɧɟɟ ɄɆ, ɬɟɦ ɱɚɳɟ ɫɥɟɞɭɟɬ ɦɚɫɲɬɚɛɢɪɨɜɚɬɶ ɟɟ ɫɱɟɬɱɢɤɢ, ɨɬɛɪɚɫɵɜɚɹ ɬɚɤɢɦ ɨɛɪɚɡɨɦ ɱɚɫɬɶ ɢɧɮɨɪɦɚɰɢɢ ɨ ɩɨɜɟɞɟɧɢɢ ɞɚɧɧɨɣ ɄɆ ɜ ɩɪɨɲɥɨɦ. ȼ ɫɜɟɬɟ ɷɬɨɝɨ ɟɫɬɟɫɬɜɟɧɧɨɣ ɹɜɥɹɟɬɫɹ ɢɞɟɹ ɨɛ ɭɜɟɥɢɱɟɧɢɢ ɫɱɟɬɱɢɤɨɜ ɫ ɧɟɪɚɜɧɵɦ ɲɚɝɨɦ, ɬɚɤ ɱɬɨɛɵ ɧɟɞɚɜɧɨ ɜɫɬɪɟɱɟɧɧɵɟ ɫɢɦɜɨɥɵ ɩɨɥɭɱɚɥɢ ɛɨɥɶɲɢɟ ɜɟɫɚ, ɱɟɦ «ɫɬɚɪɵɟ» ɫɢɦɜɨɥɵ. ȼ ɤɚɱɟɫɬɜɟ ɩɨɥɭɦɟɪɵ ɦɨɠɧɨ ɩɪɢɦɟɧɹɬɶ ɦɚɫɲɬɚɛɢɪɨɜɚɧɢɟ ɫɱɟɬɱɢɤɚ ɩɨɫɥɟɞɧɟɝɨ ɜɫɬɪɟɱɟɧɧɨɝɨ ɫɢɦɜɨɥɚ, ɤɨɬɨɪɨɟ ɷɤɫɩɥɭɚɬɢɪɭɟɬ ɬɚɤɭɸ ɠɟ ɨɫɨɛɟɧɧɨɫɬɶ ɬɢɩɢɱɧɵɯ ɞɚɧɧɵɯ (ɫɦ. ɧɢɠɟ ɩɨɞɩɭɧɤɬ «Ɇɚɫɲɬɚɛɢɪɨɜɚɧɢɟ ɫɱɟɬɱɢɤɚ ɩɨɫɥɟɞɧɟɝɨ ɜɫɬɪɟɱɟɧɧɨɝɨ ɫɢɦɜɨɥɚ»). ɋɭɳɟɫɬɜɟɧɧɨɦɭ ɭɥɭɱɲɟɧɢɸ ɫɠɚɬɢɹ ɜ ɬɚɤɢɯ ɫɥɭɱɚɹɯ ɬɚɤɠɟ ɫɩɨɫɨɛɫɬɜɭɟɬ ɜɬɨɪɢɱɧɚɹ ɨɰɟɧɤɚ ɜɟɪɨɹɬɧɨɫɬɢ ɫɢɦɜɨɥɨɜ (ɫɦ. ɞɚɥɟɟ ɩɨ ɬɟɤɫɬɭ ɩɨɞɩɭɧɤɬ «ɍɜɟɥɢɱɟɧɢɟ ɬɨɱɧɨɫɬɢ ɩɪɟɞɫɤɚɡɚɧɢɹ ɧɚɢɛɨɥɟɟ ɜɟɪɨɹɬɧɵɯ ɫɢɦɜɨɥɨɜ»). ɂɫɩɨɥɶɡɨɜɚɧɢɟ ɜ ɤɚɱɟɫɬɜɟ ɲɚɝɚ ɩɪɢɪɨɫɬɚ ɫɱɟɬɱɢɤɨɜ ɜɟɥɢɱɢɧ, ɛɨɥɶɲɢɯ ɟɞɢɧɢɰɵ, ɧɟɨɛɯɨɞɢɦɨ ɞɥɹ ɭɫɩɟɲɧɨɣ ɪɚɛɨɬɵ ɫɥɨɠɧɵɯ ɦɟɬɨɞɨɜ ɨɛɧɨɜɥɟɧɢɹ, ɚ ɬɚɤɠɟ ɫɩɨɫɨɛɫɬɜɭɟɬ ɥɭɱɲɟɣ ɚɞɚɩɬɚɰɢɢ ɦɨɞɟɥɢ ɩɪɢ ɦɚɫɲɬɚɛɢɪɨɜɚɧɢɢ. ȼ ɤɚɱɟɫɬɜɟ ɞɨɛɚɜɤɢ ɜɟɫɚ 1 ɯɨɪɨɲɨ ɪɚɛɨɬɚɸɬ 4 ɢɥɢ 8, ɩɪɢ ɷɬɨɦ ɜɫɟ ɟɳɟ ɨɬɫɭɬɫɬɜɭɟɬ ɩɪɨɛɥɟɦɚ ɩɟɪɟɩɨɥɧɟɧɢɹ ɞɚɠɟ ɩɪɢ ɢɫɩɨɥɶɡɨɜɚɧɢɢ ɞɥɹ ɫɱɟɬɱɢɤɨɜ 16ɛɢɬɧɵɯ ɦɚɲɢɧɧɵɯ ɫɥɨɜ. ɇɚɩɪɢɦɟɪ, ɟɫɥɢ ɲɚɝ ɩɪɢɪɨɫɬɚ = 4, ɬɨ ɫɱɟɬɱɢɤ ɫɢɦɜɨɥɚ ɦɨɠɟɬ ɩɪɢɧɢɦɚɬɶ ɡɧɚɱɟɧɢɹ: 4 (ɢɧɢɰɢɚɥɢɡɚɰɢɹ ɩɪɢ ɩɟɪɜɨɦ ɩɨɹɜɥɟɧɢɢ ɫɢɦɜɨɥɚ ɜ ɤɨɧɬɟɤɫɬɟ), 8, 12, 16… ȼ ɤɨɦɩɪɟɫɫɨɪɟ Dummy ɢɫɩɨɥɶɡɭɟɬɫɹ ɟɞɢɧɢɱɧɵɣ ɲɚɝ ɩɪɢɪɨɫɬɚ.
ɉɨɜɵɲɟɧɢɟ ɬɨɱɧɨɫɬɢ ɨɰɟɧɨɤ ɜ ɤɨɧɬɟɤɫɬɧɵɯ ɦɨɞɟɥɹɯ ɜɵɫɨɤɢɯ ɩɨɪɹɞɤɨɜ ɇɚɪɹɞɭ ɫ ɡɚɞɚɱɟɣ ɨɰɟɧɤɢ ɜɟɪɨɹɬɧɨɫɬɢ ɭɯɨɞɚ ɫɟɪɶɟɡɧɨɣ ɩɪɨɛɥɟɦɨɣ PPM ɹɜɥɹɟɬɫɹ ɧɟɞɨɫɬɚɬɨɱɧɵɣ ɨɛɴɟɦ ɫɬɚɬɢɫɬɢɤɢ ɜ ɄɆ ɜɵɫɨɤɢɯ ɩɨɪɹɞɤɨɜ, ɱɬɨ ɩɪɢɜɨɞɢɬ ɤ ɛɨɥɶɲɢɦ ɩɨɝɪɟɲɧɨɫɬɹɦ ɨɰɟɧɨɤ. Ʉɚɤ ɩɨɛɨɱɧɵɣ ɪɟɡɭɥɶɬɚɬ ɢɦɟɟɬɫɹ ɧɟɩɪɢɹɬɧɚɹ ɡɚɜɢɫɢɦɨɫɬɶ ɩɨɪɹɞɤɚ ɨɛɵɱɧɨɣ PPM-ɦɨɞɟɥɢ, ɨɛɟɫɩɟɱɢɜɚɸɳɟɝɨ ɧɚɢɥɭɱɲɟɟ ɫɠɚɬɢɟ, ɨɬ ɜɢɞɚ ɞɚɧɧɵɯ. Ʉɚɤ ɩɪɚɜɢɥɨ, ɨɩɬɢɦɚɥɶɧɵɣ ɩɨɪɹɞɨɤ ɨɛɵɱɧɨɣ ɦɨɞɟɥɢ ɤɨɥɟɛɥɟɬɫɹ ɨɬ 0 ɞɨ 16 (ɞɥɹ ɬɟɤɫɬɨɜ ɜ ɪɚɣɨɧɟ 4– 6), ɤɪɨɦɟ ɬɨɝɨ, ɱɚɫɬɨ ɫɭɳɟɫɬɜɭɸɬ ɡɧɚɱɢɬɟɥɶɧɵɟ ɥɨɤɚɥɶɧɵɟ ɢɡɦɟ160 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
), ɤɪɨɦɟ ɬɨɝɨ, ɱɚɫɬɨ ɫɭɳɟɫɬɜɭɸɬ ɡɧɚɱɢɬɟɥɶɧɵɟ ɥɨɤɚɥɶɧɵɟ ɢɡɦɟɧɟɧɢɹ ɜɧɭɬɪɢ ɮɚɣɥɚ. ɇɚɩɪɢɦɟɪ, ɧɚ ɪɢɫ. 4.3. ɩɪɢɜɟɞɟɧ ɬɢɩɢɱɧɵɣ ɞɥɹ ɤɥɚɫɫɢɱɟɫɤɨɝɨ PPM-ɚɥɝɨɪɢɬɦɚ ɝɪɚɮɢɤ ɡɚɜɢɫɢɦɨɫɬɢ ɫɬɟɩɟɧɢ ɫɠɚɬɢɹ ɬɟɤɫɬɚ ɨɬ ɩɨɪɹɞɤɚ ɦɨɞɟɥɢ. ȼɢɞɧɨ, ɱɬɨ ɦɚɤɫɢɦɭɦ ɞɨɫɬɢɝɚɟɬɫɹ ɩɪɢ N = 4…5, ɩɨɫɥɟ ɱɟɝɨ ɧɚɛɥɸɞɚɟɬɫɹ ɩɥɚɜɧɨɟ ɩɚɞɟɧɢɟ ɫɬɟɩɟɧɢ ɫɠɚɬɢɹ. ɋɬɟɩɟɧɶ ɫɠɚɬɢɹ
4 3.5 3 2.5 2 1.5 1 0
1
2
3
4 5 ɉɨɪɹɞɨɤ
6
7
8
Ɋɢɫ. 4.3. Ɂɚɜɢɫɢɦɨɫɬɶ ɫɬɟɩɟɧɢ ɫɠɚɬɢɹ ɨɬ ɩɨɪɹɞɤɚ ɦɨɞɟɥɢ ɞɥɹ ɤɥɚɫɫɢɱɟɫɤɨɝɨ PPM-ɚɥɝɨɪɢɬɦɚ Ɇɨɠɧɨ ɜɵɞɟɥɢɬɶ 2 ɩɨɞɯɨɞɚ ɤ ɪɟɲɟɧɢɸ ɩɪɨɛɥɟɦɵ: • ɜɵɛɨɪ ɩɨɪɹɞɤɚ ɦɨɞɟɥɢ, ɨɛɟɫɩɟɱɢɜɚɸɳɟɝɨ ɧɚɢɥɭɱɲɟɟ ɫɠɚɬɢɟ, ɩɪɢ ɨɰɟɧɢɜɚɧɢɢ ɤɚɠɞɨɝɨ ɫɢɦɜɨɥɚ; • ɢɫɩɨɥɶɡɨɜɚɧɢɟ ɫɬɚɬɢɫɬɢɤɢ ɤɨɧɬɟɤɫɬɨɜ-ɩɪɟɞɤɨɜ. ȼɕȻɈɊ ɅɈɄȺɅɖɇɈȽɈ ɉɈɊəȾɄȺ ɆɈȾȿɅɂ
Ɇɟɯɚɧɢɡɦ ɜɵɛɨɪɚ ɩɨɪɹɞɤɚ ɦɨɞɟɥɢ ɞɥɹ ɤɨɞɢɪɨɜɚɧɢɹ ɤɚɠɞɨɝɨ ɫɢɦɜɨɥɚ ɩɨɥɭɱɢɥ ɧɚɡɜɚɧɢɟ Local Order Estimation (LOE) — «ɨɰɟɧɤɚ ɥɨɤɚɥɶɧɨɝɨ ɩɨɪɹɞɤɚ». ɋɯɟɦɵ LOE ɧɨɫɹɬ ɱɢɫɬɨ ɷɜɪɢɫɬɢɱɟɫɤɢɣ ɯɚɪɚɤɬɟɪ ɢ ɡɚɤɥɸɱɚɸɬɫɹ ɜ ɬɨɦ, ɱɬɨ ɦɵ ɡɚɞɚɟɦ ɧɟɤɭɸ ɮɭɧɤɰɢɸ «ɞɨɜɟɪɢɹ» ɢ ɩɪɨɛɭɟɦ ɩɪɟɞɫɤɚɡɚɬɶ ɫ ɟɟ ɩɨɦɨɳɶɸ ɷɮɮɟɤɬɢɜɧɨɫɬɶ ɤɨɞɢɪɨɜɚɧɢɹ ɬɟɤɭɳɟɝɨ ɫɢɦɜɨɥɚ ɜ ɬɨɣ ɢɥɢ ɢɧɨɣ ɞɨɫɬɭɩɧɨɣ — ɫɨɨɬɜɟɬɫɬɜɭɸɳɟɣ ɚɤɬɢɜɧɨɦɭ ɤɨɧɬɟɤɫɬɭ ɢ ɮɢɡɢɱɟɫɤɢ ɫɭɳɟɫɬɜɭɸɳɟɣ — ɄɆ ɩɨɪɹɞɤɚ ɨɬ 0 ɞɨ ɡɚɞɚɧɧɨɝɨ N. Ɇɨɠɧɨ ɜɵɞɟɥɢɬɶ ɬɪɢ ɬɢɩɚ ɫɯɟɦ LOE: Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X 161 http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɢɳɟɦ ɨɩɬɢɦɚɥɶɧɵɣ ɩɨɪɹɞɨɤ ɫɜɟɪɯɭ ɜɧɢɡ ɨɬ ɄɆ ɦɚɤɫɢɦɚɥɶɧɨɝɨ ɩɨɪɹɞɤɚ N ɤ ɄɆ ɦɢɧɢɦɚɥɶɧɨɝɨ ɩɨɪɹɞɤɚ; ɩɪɟɤɪɚɳɚɟɦ ɩɨɢɫɤ, ɤɚɤ ɬɨɥɶɤɨ ɄɆ ɦɟɧɶɲɟɝɨ ɩɨɪɹɞɤɚ ɤɚɠɟɬɫɹ ɧɚɦ ɛɨɥɟɟ «ɩɨɞɨɡɪɢɬɟɥɶɧɨɣ», ɱɟɦ ɬɟɤɭɳɚɹ, ɤɨɬɨɪɭɸ ɢ ɢɫɩɨɥɶɡɭɟɦ ɞɥɹ ɨɰɟɧɤɢ ɜɟɪɨɹɬɧɨɫɬɢ ɫɢɦɜɨɥɚ; 2) ɩɨɢɫɤ ɫɧɢɡɭ ɜɜɟɪɯ; 3) ɨɰɟɧɤɚ ɜɫɟɯ ɞɨɫɬɭɩɧɵɯ ɄɆ. ȿɫɥɢ ɜ ɜɵɛɪɚɧɧɨɣ ɄɆ ɡɚɤɨɞɢɪɨɜɚɬɶ ɫɢɦɜɨɥ ɧɟ ɭɞɚɥɨɫɶ, ɬɨ, ɜɨɨɛɳɟ ɝɨɜɨɪɹ, ɩɪɨɰɟɞɭɪɭ ɩɨɢɫɤɚ ɫɥɟɞɭɸɳɟɣ ɨɩɬɢɦɚɥɶɧɨɣ ɩɨ ɡɚɞɚɧɧɨɦɭ ɤɪɢɬɟɪɢɸ ɄɆ ɦɨɠɧɨ ɩɨɜɬɨɪɢɬɶ. Ɍɟɦ ɧɟ ɦɟɧɟɟ, ɨɛɵɱɧɨ ɢɳɭɬ ɬɨɥɶɤɨ ɧɚɱɚɥɶɧɵɣ ɩɨɪɹɞɨɤ, ɚ ɜ ɫɥɭɱɚɟ ɭɯɨɞɚ ɩɪɨɫɬɨ ɫɩɭɫɤɚɸɬɫɹ ɧɚ ɭɪɨɜɟɧɶ ɧɢɠɟ, ɬɨ ɟɫɬɶ ɞɚɥɶɲɟ ɢɫɩɨɥɶɡɭɸɬ ɨɛɵɱɧɵɣ ɚɥɝɨɪɢɬɦ PPM. ȼɵɛɨɪ ɬɨɣ ɢɥɢ ɢɧɨɣ ɮɭɧɤɰɢɢ ɞɨɜɟɪɢɹ ɡɚɜɢɫɢɬ ɨɬ ɨɫɨɛɟɧɧɨɫɬɟɣ ɤɨɧɤɪɟɬɧɨɣ ɪɟɚɥɢɡɚɰɢɢ PPM, ɯɚɪɚɤɬɟɪɢɫɬɢɤ ɞɚɧɧɵɯ, ɞɥɹ ɫɠɚɬɢɹ ɤɨɬɨɪɵɯ ɪɚɡɪɚɛɚɬɵɜɚɟɬɫɹ ɤɨɦɩɪɟɫɫɨɪ, ɢ, ɤɚɤ ɧɟɪɟɞɤɨ ɛɵɜɚɟɬ, ɥɢɱɧɵɯ ɩɪɢɫɬɪɚɫɬɢɣ ɪɚɡɪɚɛɨɬɱɢɤɚ. Ʉɚɤ ɩɨɤɚɡɚɥ ɨɩɵɬ, ɪɚɡɥɢɱɧɵɟ «ɧɚɢɜɧɵɟ» ɷɧɬɪɨɩɢɣɧɵɟ ɨɰɟɧɤɢ ɧɚɞɟɠɧɨɫɬɢ ɄɆ ɪɚɛɨɬɚɸɬ ɩɥɨɯɨ. ɗɬɢ ɨɰɟɧɤɢ ɨɫɧɨɜɵɜɚɸɬɫɹ ɧɚ ɫɪɚɜɧɟɧɢɢ ɫɪɟɞɧɟɣ ɞɥɢɧɵ ɤɨɞɨɜ ɞɥɹ ɬɟɤɭɳɟɣ ɄɆ(o) ɢ ɪɨɞɢɬɟɥɶɫɤɨɣ ɄɆ(o–1). ɇɟɭɞɚɱɚ ɨɛɴɹɫɧɹɟɬɫɹ, ɜɢɞɢɦɨ, ɬɟɦ, ɱɬɨ ɜ ɫɢɥɭ ɱɢɫɬɨɣ ɫɥɭɱɚɣɧɨɫɬɢ ɮɭɧɤɰɢɹ ɪɚɫɩɪɟɞɟɥɟɧɢɹ ɜ ɄɆ(o) ɦɨɠɟɬ ɛɵɬɶ ɛɨɥɟɟ ɩɥɨɫɤɨɣ, ɱɟɦ ɜ ɫɥɟɞɭɸɳɟɣ ɪɚɫɫɦɚɬɪɢɜɚɟɦɨɣ ɄɆ(o–1). ɉɨɷɬɨɦɭ ɞɥɹ ɩɨɥɭɱɟɧɢɹ ɩɪɚɜɞɨɩɨɞɨɛɧɨɣ ɨɰɟɧɤɢ ɧɚɞɨ ɫɪɚɜɧɢɜɚɬɶ ɫɪɟɞɧɸɸ ɞɥɢɧɭ ɤɨɞɨɜ ɞɥɹ ɜɫɟɯ ɞɨɱɟɪɧɢɯ ɤɨɧɬɟɤɫɬɧɵɯ ɦɨɞɟɥɟɣ ɬɟɤɭɳɟɣ ɄɆ(o) ɫɨ ɫɪɟɞɧɟɣ ɞɥɢɧɨɣ ɤɨɞɨɜ ɞɥɹ ɜɫɟɯ ɞɨɱɟɪɧɢɯ ɤɨɧɬɟɤɫɬɧɵɯ ɦɨɞɟɥɟɣ ɪɨɞɢɬɟɥɶɫɤɨɣ ɄɆ(o–1). ȼ [3] ɛɵɥ ɩɪɟɞɥɨɠɟɧ ɷɮɮɟɤɬɢɜɧɵɣ ɢ ɩɪɨɫɬɨɣ ɦɟɬɨɞ, ɞɚɸɳɢɣ ɨɰɟɧɤɭ ɧɚɞɟɠɧɨɫɬɢ ɄɆ ɢɫɯɨɞɹ ɢɡ ɨɰɟɧɤɢ ɜɟɪɨɹɬɧɨɫɬɢ Q ɧɚɢɛɨɥɟɟ ɜɟɪɨɹɬɧɨɝɨ ɜ ɄɆ ɫɢɦɜɨɥɚ (Most Probable Symbol's Probability, MPS-P) ɢ ɤɨɥɢɱɟɫɬɜɚ ɭɯɨɞɨɜ E ɢɡ ɄɆ. Ɉɛɨɛɳɟɧɧɨ ɮɨɪɦɭɥɭ ɦɨɠɧɨ ɡɚɩɢɫɚɬɶ ɬɚɤ: a ⋅ Q log 2 Q + b ⋅ E (log 2 E − c) + d ⋅ (1 − Q)(log 2 E − c) , (4.1) ɝɞɟ ɤɨɧɫɬɚɧɬɵ a, b, c, d ɩɨɞɛɢɪɚɸɬɫɹ ɷɦɩɢɪɢɱɟɫɤɢɦ ɩɭɬɟɦ. 1)
162 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
Ʉɪɢɬɟɪɢɟɦ ɜɵɛɨɪɚ ɄɆ ɹɜɥɹɟɬɫɹ ɦɢɧɢɦɚɥɶɧɨɟ ɡɧɚɱɟɧɢɟ ɜɵɪɚɠɟɧɢɹ (4.1) ɫɪɟɞɢ ɜɫɟɯ ɞɨɫɬɭɩɧɵɯ ɄɆ. Ʉ ɫɱɚɫɬɶɸ, ɨɰɟɧɤɚ ɬɨɥɶɤɨ ɩɨ Q ɞɚɟɬ ɯɨɪɨɲɢɟ ɪɟɡɭɥɶɬɚɬɵ ɭɠɟ ɜ ɬɨɦ ɫɥɭɱɚɟ, ɤɨɝɞɚ ɩɪɨɫɬɨ ɜɵɛɢɪɚɟɦ ɄɆ ɫ ɦɚɤɫɢɦɚɥɶɧɵɦ Q (ɫɨɨɬɜɟɬɫɬɜɭɟɬ ɜɚɪɢɚɧɬɭ ɨɛɨɛɳɟɧɧɨɣ ɮɨɪɦɭɥɵ ɩɪɢ b = d = 0). Ɇɨɠɧɨ ɞɚɬɶ ɫɥɟɞɭɸɳɢɣ ɩɪɢɦɟɪ, ɞɟɦɨɧɫɬɪɢɪɭɸɳɢɣ ɧɟɞɨɫɬɚɬɤɢ «ɧɚɢɜɧɨɝɨ» ɷɧɬɪɨɩɢɣɧɨɝɨ ɩɨɞɯɨɞɚ ɢ ɩɨɞɯɨɞɚ MPS-P. ɉɭɫɬɶ ɦɵ ɤɨɞɢɪɭɟɦ ɫ ɩɨɦɨɳɶɸ PPM-ɦɨɞɟɥɢɪɨɜɚɧɢɹ ɩɨɪɹɞɤɚ 2 ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɶ ɚɥɮɚɜɢɬɚ {‘0’, ‘1’}, ɩɨɪɨɠɞɟɧɧɭɸ ɢɫɬɨɱɧɢɤɨɦ ɫ ɬɚɤɢɦɢ ɜɟɪɨɹɬɧɨɫɬɹɦɢ ɝɟɧɟɪɚɰɢɢ ɫɢɦɜɨɥɨɜ: p(0|00) = 0, p(1|00) = 1, p(0|10) = p(1|10) = 0.5. ɉɭɫɬɶ ɩɨɹɜɥɟɧɢɟ ɫɬɪɨɤ “00” ɢ “10” ɪɚɜɧɨɜɟɪɨɹɬɧɨ. ȿɫɥɢ ɭɠɟ ɨɛɪɚɛɨɬɚɧ ɛɨɥɶɲɨɣ ɛɥɨɤ ɜɯɨɞɧɨɣ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ, ɢ ɤɨɧɬɟɤɫɬ ɬɟɤɭɳɟɝɨ ɫɢɦɜɨɥɚ ɪɚɜɟɧ “10”, ɬɨ, ɜ ɫɨɨɬɜɟɬɫɬɜɢɢ ɫ ɡɚɞɚɧɧɵɦ ɨɩɢɫɚɧɢɟɦ ɢɫɬɨɱɧɢɤɚ, ɜ ɄɆ(2) ɨɰɟɧɤɢ ɜɟɪɨɹɬɧɨɫɬɟɣ q(0|10) = q(1|10) = 0.5, ɚ ɜ ɄɆ(1) ɨɰɟɧɤɢ ɫɨɫɬɚɜɥɹɸɬ q(0|0) = 0.25, q(1|0) = 0.75. ɋɪɟɞɧɹɹ ɞɥɢɧɚ ɤɨɞɨɜ ɞɥɹ ɄɆ(2) ɪɚɜɧɚ − q(0 | 10) log 2 q(0 | 10) − q(1 | 10) log 2 q(1 | 10) , ɱɬɨ ɫɨɫɬɚɜɥɹɟɬ 1 ɛɢɬ. ȼ ɬɨ ɠɟ ɜɪɟɦɹ ɫɪɟɞɧɹɹ ɞɥɢɧɚ ɞɥɹ ɄɆ(1) ɪɚɜɧɚ − q(0 | 0) log 2 q(0 | 0) − q(1 | 0) log 2 q(1 | 0) , ɱɬɨ ɫɨɨɬɜɟɬɫɬɜɭɟɬ ɩɪɢɦɟɪɧɨ 0.8 ɛɢɬɚ. ɉɨɷɬɨɦɭ, ɟɫɥɢ ɩɨɥɶɡɭɟɦɫɹ «ɧɚɢɜɧɵɦ» ɷɧɬɪɨɩɢɣɧɵɦ ɤɪɢɬɟɪɢɟɦ, ɬɨ ɦɵ ɞɨɥɠɧɵ ɜɵɛɪɚɬɶ ɞɥɹ ɤɨɞɢɪɨɜɚɧɢɹ ɄɆ(1). Ʉɪɢɬɟɪɢɣ MPS-P ɬɚɤɠɟ ɭɤɚɡɵɜɚɟɬ ɧɚ ɄɆ(1). ɗɬɨɬ ɜɵɛɨɪ ɨɲɢɛɨɱɟɧ. Ⱦɟɣɫɬɜɢɬɟɥɶɧɨ, ɟɫɥɢ ɦɵ ɤɨɞɢɪɭɟɦ ɜ ɄɆ(2), ɬɨ ɫɢɦɜɨɥɵ ‘0’ ɢ ‘1’ ɬɪɟɛɭɸɬ ɩɨ –log2 0.5 = 1 ɛɢɬɭ. ȿɫɥɢ ɜ ɄɆ(1), ɬɨ ɞɥɹ ɤɨɞɢɪɨɜɚɧɢɹ ‘0’ ɧɭɠɧɨ –log2 0.25 = 2 ɛɢɬɚ, ɚ ɞɥɹ ‘1’ ɬɪɟɛɭɟɬɫɹ –log2 0.75 § 0.4 ɛɢɬɚ. ȼ ɫɨɨɬɜɟɬɫɬɜɢɢ ɫ ɩɪɢɧɹɬɵɦ ɨɩɢɫɚɧɢɟɦ ɢɫɬɨɱɧɢɤɚ ɜɟɪɨɹɬɧɨɫɬɢ ɩɨɹɜɥɟɧɢɹ ‘0’ ɢ ‘1’ ɩɨɫɥɟ ɫɬɪɨɤɢ “10” ɨɞɢɧɚɤɨɜɵ, ɩɨɷɬɨɦɭ ɩɪɢ ɤɚɠɞɨɦ ɨɰɟɧɢɜɚɧɢɢ ɧɚ ɨɫɧɨɜɚɧɢɢ ɫɬɚɬɢɫɬɢɤɢ ɞɥɹ ɤɨɧɬɟɤɫɬɚ “0” ɜɦɟɫɬɨ ɫɬɚɬɢɫɬɢɤɢ Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X 163 http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɞɥɹ ɤɨɧɬɟɤɫɬɚ “10” ɦɵ ɛɭɞɟɦ ɬɟɪɹɬɶ ɜ ɫɪɟɞɧɟɦ 0.5·(2–1) + 0.5·(0.4–1) = 0.2 ɛɢɬɚ. Ⱦɨɛɚɜɢɦ, ɱɬɨ ɢɡɜɟɫɬɧɵɟ ɜɚɪɢɚɧɬɵ ɪɟɚɥɢɡɚɰɢɢ ɩɨɞɯɨɞɚ LOE ɩɥɨɯɨ ɫɨɱɟɬɚɸɬɫɹ ɜ ɫɦɵɫɥɟ ɭɥɭɱɲɟɧɢɹ ɫɠɚɬɢɹ ɫ ɦɟɯɚɧɢɡɦɨɦ ɧɚɫɥɟɞɨɜɚɧɢɟɦ ɢɧɮɨɪɦɚɰɢɢ, ɬ.ɤ. ɷɬɢ ɬɟɯɧɢɤɢ ɷɤɫɩɥɭɚɬɢɪɭɸɬ ɩɪɢɦɟɪɧɨ ɨɞɢɧɚɤɨɜɵɟ ɧɟɞɨɫɬɚɬɤɢ ɤɥɚɫɫɢɱɟɫɤɨɝɨ ɚɥɝɨɪɢɬɦɚ PPM. ɇȺɋɅȿȾɈȼȺɇɂȿ ɂɇɎɈɊɆȺɐɂɂ
Ɇɟɬɨɞ ɧɚɫɥɟɞɨɜɚɧɢɹ ɢɧɮɨɪɦɚɰɢɢ ɩɨɡɜɨɥɹɟɬ ɫɭɳɟɫɬɜɟɧɧɨ ɭɥɭɱɲɢɬɶ ɬɨɱɧɨɫɬɶ ɨɰɟɧɨɤ. ɇɚ ɤɨɧɟɰ 2001 ɝɨɞɚ ɢɦɟɟɬɫɹ ɩɨ ɤɪɚɣɧɟɣ ɦɟɪɟ ɨɞɧɚ ɨɱɟɧɶ ɷɮɮɟɤɬɢɜɧɚɹ ɪɟɚɥɢɡɚɰɢɹ PPM, ɨɛɟɫɩɟɱɢɜɚɸɳɚɹ ɜɵɫɨɤɭɸ ɫɬɟɩɟɧɶ ɫɠɚɬɢɹ ɬɢɩɨɜɵɯ ɞɚɧɧɵɯ, ɜ ɨɫɨɛɟɧɧɨɫɬɢ ɬɟɤɫɬɨɜ, ɜ ɩɟɪɜɭɸ ɨɱɟɪɟɞɶ ɢɡ-ɡɚ ɩɪɢɦɟɧɟɧɢɹ ɧɚɫɥɟɞɨɜɚɧɢɹ ɢɧɮɨɪɦɚɰɢɢ [1]. Ɇɟɬɨɞ ɧɚɫɥɟɞɨɜɚɧɢɹ ɢɧɮɨɪɦɚɰɢɢ, ɩɪɟɞɥɨɠɟɧɧɵɣ ɒɤɚɪɢɧɵɦ ɜ [1], ɛɨɪɟɬɫɹ ɫ ɧɟɬɨɱɧɨɫɬɶɸ ɨɰɟɧɨɤ ɫɢɦɜɨɥɨɜ ɜ ɄɆ ɛɨɥɶɲɢɯ ɩɨɪɹɞɤɨɜ ɢ ɨɫɧɨɜɚɧ ɧɚ ɨɱɟɧɶ ɩɪɨɫɬɨɣ ɢɞɟɟ. Ʌɨɝɢɱɧɨ ɩɪɟɞɩɨɥɨɠɢɬɶ, ɱɬɨ ɪɚɫɩɪɟɞɟɥɟɧɢɹ ɱɚɫɬɨɬ ɫɢɦɜɨɥɨɜ ɜ ɪɨɞɢɬɟɥɶɫɤɢɯ ɢ ɞɨɱɟɪɧɢɯ ɄɆ ɩɨɯɨɠɢ. Ɍɨɝɞɚ ɩɪɢ ɩɨɹɜɥɟɧɢɢ ɜ ɞɨɱɟɪɧɟɣ ɄɆ(o) ɧɨɜɨɝɨ ɫɢɦɜɨɥɚ si ɰɟɥɟɫɨɨɛɪɚɡɧɨ ɢɧɢɰɢɚɥɢɡɢɪɨɜɚɬɶ ɟɝɨ ɫɱɟɬɱɢɤ f(si|o) ɧɟɤɨɬɨɪɨɣ ɜɟɥɢɱɢɧɨɣ f 0 ( s i | o ) , ɡɚɜɢɫɹɳɟɣ ɨɬ ɢɧɮɨɪɦɚɰɢɢ ɨ ɞɚɧɧɨɦ ɫɢɦɜɨɥɟ ɜ ɪɨɞɢɬɟɥɶɫɤɨɣ ɄɆ (ɢɥɢ ɧɟɫɤɨɥɶɤɢɯ ɤɨɧɬɟɤɫɬɧɵɯ ɦɨɞɟɥɹɯ-ɩɪɟɞɤɚɯ). ɉɭɫɬɶ ɜ ɪɟɡɭɥɶɬɚɬɟ ɫɟɪɢɢ ɭɯɨɞɨɜ ɦɵ ɫɩɭɫɬɢɥɢɫɶ ɫ ɄɆ(o) ɧɚ ɄɆ(o–k), ɝɞɟ ɫɢɦɜɨɥ ɢ ɛɵɥ ɭɫɩɟɲɧɨ ɨɰɟɧɟɧ. Ɍɨɝɞɚ ɧɚɱɚɥɶɧɨɟ ɡɧɚɱɟɧɢɟ ɫɱɟɬɱɢɤɚ ɫɢɦɜɨɥɚ ɜ ɄɆ(o) ɪɚɡɭɦɧɨ ɜɵɱɢɫɥɹɬɶ ɢɫɯɨɞɹ ɢɡ ɪɚɜɟɧɫɬɜɚ
f 0 ( si | o ) f ( si | o − k ) = , f (o) f (o − k ) + Fo−k ,o
ɝɞɟ
f 0 ( si | o) — ɧɚɫɥɟɞɭɟɦɚɹ ɱɚɫɬɨɬɚ; f(o) — ɫɭɦɦɚ ɱɚɫɬɨɬ ɜɫɟɯ ɫɢɦɜɨɥɨɜ ɄɆ(o), ɜɤɥɸɱɚɹ ɫɢɦɜɨɥ ɭɯɨɞɚ; Fo–k,o — ɫɭɦɦɚ ɱɚɫɬɨɬ ɜɫɟɯ ɫɢɦɜɨɥɨɜ, ɪɟɚɥɶɧɨ ɜɫɬɪɟɱɟɧɧɵɯ ɜ ɤɨɧɬɟɤɫɬɚɯ ɩɨɪɹɞɤɨɜ o–k+1 … o.
164 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
(4.2)
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
Fo − k ,o = ɝɞɟ
o m = o − k +1
( f (m) − f (esc | m) − ƒ
S(m) j =1
)
f 0 ( s j | m) ,
f(esc|m) — ɱɚɫɬɨɬɚ ɞɥɹ ɫɢɦɜɨɥɚ ɭɯɨɞɚ ɜ ɄɆ(m); S(m) — ɤɨɥɢɱɟɫɬɜɨ ɫɢɦɜɨɥɨɜ ɜ ɄɆ(m), ɧɟ ɜɤɥɸɱɚɹ ɫɢɦɜɨɥ ɭɯɨɞɚ. ɍɩɪɚɠɧɟɧɢɟ: Ɉɛɴɹɫɧɢɬɟ ɫɦɵɫɥ ɫɥɚɝɚɟɦɨɝɨ Fo–k,o ɜ ɜɵɪɚɠɟɧɢɢ (4.2).
ȼɵɪɚɠɟɧɢɟ (4.2) ɨɛɥɚɞɚɟɬ ɛɨɥɶɲɨɣ ɜɵɱɢɫɥɢɬɟɥɶɧɨɣ ɫɥɨɠɧɨɫɬɶɸ ɢ ɬɪɟɛɭɟɬ ɫɭɳɟɫɬɜɟɧɧɵɯ ɡɚɬɪɚɬ ɩɚɦɹɬɢ ɞɥɹ ɨɪɝɚɧɢɡɚɰɢɢ ɜɵɱɢɫɥɟɧɢɹ. Ʉɪɨɦɟ ɬɨɝɨ, ɢɦɟɟɬ ɫɦɵɫɥ ɭɱɢɬɵɜɚɬɶ ɬɨɥɶɤɨ ɫɬɚɬɢɫɬɢɤɭ ɄɆ(o–k), ɬɚɤ ɤɚɤ ɜɫɟ ɪɚɜɧɨ ɜ ɛɨɥɶɲɢɧɫɬɜɟ ɫɥɭɱɚɟɜ k ɪɚɜɧɨ 1, ɬ.ɟ. ɭɫɩɟɲɧɨɟ ɤɨɞɢɪɨɜɚɧɢɟ ɩɪɨɢɫɯɨɞɢɬ ɜ ɪɨɞɢɬɟɥɶɫɤɨɣ ɄɆ, ɟɫɥɢ ɠɟ ɷɬɨ ɧɟ ɬɚɤ, ɬɨ, ɫɤɨɪɟɟ ɜɫɟɝɨ, ɤɨɧɬɟɤɫɬɵ ɩɨɪɹɞɤɨɜ o–1 … o–k+1 ɹɜɥɹɸɬɫɹ «ɦɨɥɨɞɵɦɢ», ɢ ɞɥɹ ɧɢɯ ɟɳɟ ɧɟ ɧɚɤɨɩɥɟɧɨ ɩɨɥɟɡɧɨɣ ɫɬɚɬɢɫɬɢɤɢ. ɉɨɷɬɨɦɭ ɧɚ ɩɪɚɤɬɢɤɟ ɰɟɥɟɫɨɨɛɪɚɡɧɨ ɢɫɩɨɥɶɡɨɜɚɬɶ ɩɪɢɛɥɢɠɟɧɧɭɸ ɮɨɪɦɭɥɭ
f (o) ⋅ f ( si | o − k ) . f ( o ) − s ( o ) + f ( o − k ) − f ( si | o − k ) ɉɪɢ ɫɚɦɨɣ ɩɪɨɫɬɨɣ ɪɟɚɥɢɡɚɰɢɢ ɜɟɥɢɱɢɧɚ f 0 ( si | o ) ɜɵɱɢɫɥɹf 0 (i | o ) =
ɟɬɫɹ ɢ ɩɪɢɫɜɚɢɜɚɟɬɫɹ ɫɪɚɡɭ ɩɪɢ ɫɨɡɞɚɧɢɢ ɧɨɜɨɝɨ ɫɱɟɬɱɢɤɚ ɜ ɄɆ(o). ɇɨ ɦɨɠɧɨ ɨɬɥɨɠɢɬɶ ɧɚɫɥɟɞɨɜɚɧɢɟ ɱɚɫɬɨɬɵ ɞɨ ɫɥɟɞɭɸɳɟɝɨ ɩɨɹɜɥɟɧɢɹ ɫɢɦɜɨɥɚ si ɜ ɷɬɨɦ ɤɨɧɬɟɤɫɬɟ ɩɨɪɹɞɤɚ o. ȼɟɪɨɹɬɧɟɟ ɜɫɟɝɨ, ɤ ɬɨɦɭ ɜɪɟɦɟɧɢ ɪɨɞɢɬɟɥɶɫɤɚɹ ɄɆ ɛɭɞɟɬ ɨɛɥɚɞɚɬɶ ɛɨɥɶɲɢɦ ɨɛɴɟɦɨɦ ɫɬɚɬɢɫɬɢɤɢ, ɱɬɨ ɞɨɥɠɧɨ ɞɚɬɶ ɛɨɥɟɟ ɬɨɱɧɭɸ ɨɰɟɧɤɭ f 0 ( si | o ) ɢ, ɜ ɤɨɧɟɱɧɨɦ ɢɬɨɝɟ, ɭɥɭɱɲɢɬɶ ɫɠɚɬɢɟ. Ɍɚɤɨɟ «ɨɬɥɨɠɟɧɧɨɟ» ɧɚɫɥɟɞɨɜɚɧɢɟ ɬɪɟɛɭɟɬ ɩɨɜɬɨɪɧɨɝɨ ɩɨɢɫɤɚ ɪɨɞɢɬɟɥɶɫɤɨɣ ɄɆ ɢ ɫɢɦɜɨɥɚ si ɜ ɧɟɣ, ɱɬɨ ɦɨɠɟɬ ɫɭɳɟɫɬɜɟɧɧɨ ɡɚɦɟɞɥɢɬɶ ɨɛɪɚɛɨɬɤɭ. ȼ ɡɚɜɢɫɢɦɨɫɬɢ ɨɬ ɩɨɪɹɞɤɚ ɦɨɞɟɥɢ, ɨɫɨɛɟɧɧɨɫɬɟɣ ɪɟɚɥɢɡɚɰɢɢ ɢ ɫɨɛɫɬɜɟɧɧɨ ɫɠɢɦɚɟɦɵɯ ɞɚɧɧɵɯ ɧɚɫɥɟɞɨɜɚɧɢɟ ɢɧɮɨɪɦɚɰɢɢ Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X 165 http://www.compression.ru/
ƒ
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɩɨɡɜɨɥɹɟɬ ɭɥɭɱɲɢɬɶ ɫɠɚɬɢɟ ɩɪɢɦɟɪɧɨ ɧɚ 1…10%. Ɍɢɩɢɱɧɨɣ ɹɜɥɹɟɬɫɹ ɰɢɮɪɚ ɩɨɪɹɞɤɚ 2–4%. Ɂɚɤɥɸɱɟɧɢɟ: ɋɭɳɟɫɬɜɭɸɳɢɟ ɪɟɚɥɢɡɚɰɢɢ ɤɨɦɩɪɟɫɫɨɪɨɜ, ɢɫɩɨɥɶɡɭɸɳɢɯ ɦɟɯɚɧɢɡɦ ɧɚɫɥɟɞɨɜɚɧɢɹ ɢɧɮɨɪɦɚɰɢɢ, ɨɛɟɫɩɟɱɢɜɚɸɬ ɥɭɱɲɟɟ ɫɠɚɬɢɟ, ɱɟɦ ɤɨɦɩɪɟɫɫɨɪɵ ɫ LOE.
Ɋɚɡɥɢɱɧɵɟ ɫɩɨɫɨɛɵ ɩɨɜɵɲɟɧɢɹ ɬɨɱɧɨɫɬɢ ɩɪɟɞɫɤɚɡɚɧɢɹ ɆȺɋɒɌȺȻɂɊɈȼȺɇɂȿ ɋɑȿɌɑɂɄȺ ɉɈɋɅȿȾɇȿȽɈ ȼɋɌɊȿɑȿɇɇɈȽɈ ɋɂɆȼɈɅȺ
ȿɫɥɢ ɜ ɩɨɫɥɟɞɧɢɣ ɪɚɡ ɜ ɬɟɤɭɳɟɦ ɤɨɧɬɟɤɫɬɟ ɛɵɥ ɜɫɬɪɟɱɟɧ ɧɟɤɢɣ ɫɢɦɜɨɥ s, ɬɨ ɜɟɪɨɹɬɧɨɫɬɶ ɬɨɝɨ, ɱɬɨ ɢ ɬɟɤɭɳɢɣ ɫɢɦɜɨɥ ɬɚɤɠɟ s, ɜɵɪɚɫɬɚɟɬ, ɩɪɢɱɟɦ ɱɚɫɬɨ ɡɧɚɱɢɬɟɥɶɧɨ. ɗɬɨɬ ɮɚɤɬ ɩɨɡɜɨɥɹɟɬ ɭɥɭɱɲɢɬɶ ɩɪɟɞɫɤɚɡɚɧɢɟ ɡɚ ɫɱɟɬ ɭɦɧɨɠɟɧɢɹ ɫɱɟɬɱɢɤɚ ɩɨɫɥɟɞɧɟɝɨ ɜɫɬɪɟɱɟɧɧɨɝɨ ɫɢɦɜɨɥɚ (ɉȼɋ) ɧɚ ɧɟɤɢɣ ɤɨɷɮɮɢɰɢɟɧɬ. ɋɭɞɹ ɩɨ ɜɫɟɦɭ, ɜɩɟɪɜɵɟ ɬɚɤɚɹ ɬɟɯɧɢɤɚ ɨɩɢɫɚɧɚ ɜ [15], ɝɞɟ ɨɧɚ ɧɚɡɵɜɚɟɬɫɹ “recency scaling” — «ɦɚɫɲɬɚɛɢɪɨɜɚɧɢɟ ɧɨɜɢɡɧɵ». Ɍɟɯɧɢɤɚ ɛɵɥɚ ɢɫɫɥɟɞɨɜɚɧɚ Ɇ.Ⱥ. ɋɦɢɪɧɨɜɵɦ ɩɪɢ ɪɚɡɪɚɛɨɬɤɟ ɤɨɦɩɪɟɫɫɨɪɚ PPMN. ɉɨ ɫɨɫɬɨɹɧɢɸ ɧɚ 2001 ɝɨɞ ɧɟɢɡɜɟɫɬɧɵ ɞɪɭɝɢɟ ɩɪɨɝɪɚɦɦɵ ɫɠɚɬɢɹ, ɢɫɩɨɥɶɡɭɸɳɢɟ recency scaling. ȼ ɛɨɥɶɲɢɧɫɬɜɟ ɫɥɭɱɚɟɜ ɯɨɪɨɲɨ ɪɚɛɨɬɚɟɬ ɦɧɨɠɢɬɟɥɶ 1.1–1.2, ɬɨ ɟɫɬɶ ɩɪɢ ɬɚɤɨɦ ɡɧɚɱɟɧɢɢ ɧɚɛɥɸɞɚɟɬɫɹ ɭɥɭɱɲɟɧɢɟ ɫɠɚɬɢɹ ɛɨɥɶɲɢɧɫɬɜɚ ɮɚɣɥɨɜ, ɢ ɦɚɥɨɜɟɪɨɹɬɧɨ ɭɯɭɞɲɟɧɢɟ ɫɠɚɬɢɹ ɤɚɤɨɝɨ-ɬɨ «ɩɪɢɜɟɪɟɞɥɢɜɨɝɨ» ɮɚɣɥɚ. ɇɨ ɱɚɫɬɨ ɨɩɬɢɦɚɥɶɧɚɹ ɜɟɥɢɱɢɧɚ ɦɚɫɲɬɚɛɢɪɭɸɳɟɝɨ ɤɨɷɮɮɢɰɢɟɧɬɚ ɤɨɥɟɛɥɟɬɫɹ ɜ ɪɚɣɨɧɟ 2–2.5, ɬɚɤ ɱɬɨ ɦɨɠɧɨ ɭɥɭɱɲɢɬɶ ɨɰɟɧɤɭ ɡɚ ɫɱɟɬ ɚɞɚɩɬɢɜɧɨɝɨ ɢɡɦɟɧɟɧɢɹ ɦɧɨɠɢɬɟɥɹ. ɉɨɞɯɨɞɹɳɟɟ ɡɧɚɱɟɧɢɟ ɜɵɛɢɪɚɟɬɫɹ ɧɚ ɨɫɧɨɜɟ ɚɧɚɥɢɡɚ ɫɠɢɦɚɟɦɵɯ ɞɚɧɧɵɯ ɫ ɩɨɦɨɳɶɸ ɷɦɩɢɪɢɱɟɫɤɢ ɩɨɥɭɱɟɧɧɵɯ ɮɨɪɦɭɥ. ɂɫɫɥɟɞɨɜɚɧɢɹ ɩɨɤɚɡɚɥɢ, ɱɬɨ ɜɟɥɢɱɢɧɚ ɧɚɛɥɸɞɚɟɦɨɣ ɱɚɫɬɨɬɵ ɫɨɜɩɚɞɟɧɢɹ ɩɨɫɥɟɞɧɟɝɨ ɜɫɬɪɟɱɟɧɧɨɝɨ ɢ ɬɟɤɭɳɟɝɨ ɫɢɦɜɨɥɨɜ ɜ ɧɟɞɟɬɟɪɦɢɧɢɪɨɜɚɧɧɵɯ ɤɨɧɬɟɤɫɬɚɯ ɩɨɡɜɨɥɹɟɬ ɩɨɞɛɢɪɚɬɶ ɤɨɷɮɮɢɰɢɟɧɬ ɫ ɯɨɪɨɲɟɣ ɬɨɱɧɨɫɬɶɸ. 166 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
Ⱦɥɹ ɩɨɜɵɲɟɧɢɹ ɬɨɱɧɨɫɬɢ ɨɰɟɧɤɢ ɬɚɤɠɟ ɫɥɟɞɭɟɬ ɭɱɢɬɵɜɚɬɶ ɪɚɫɫɬɨɹɧɢɟ ɦɟɠɞɭ ɬɟɤɭɳɟɣ ɩɨɡɢɰɢɟɣ ɢ ɦɨɦɟɧɬɨɦ ɩɨɫɥɟɞɧɟɣ ɜɫɬɪɟɱɢ ɬɟɤɭɳɟɝɨ ɤɨɧɬɟɤɫɬɚ. ȿɫɥɢ ɪɚɫɫɬɨɹɧɢɟ ɛɨɥɶɲɟ 5000 ɫɢɦɜɨɥɨɜ, ɬɨ, ɫɤɨɪɟɟ ɜɫɟɝɨ, ɦɚɫɲɬɚɛɢɪɨɜɚɧɢɟ ɫɱɟɬɱɢɤɚ ɉȼɋ ɬɨɥɶɤɨ ɩɨɜɪɟɞɢɬ. ɇɨ ɫɥɟɞɭɟɬ ɩɨɧɢɦɚɬɶ, ɱɬɨ ɭɱɟɬ ɷɬɨɣ ɯɚɪɚɤɬɟɪɢɫɬɢɤɢ ɬɪɟɛɭɟɬ ɫɭɳɟɫɬɜɟɧɧɵɯ ɡɚɬɪɚɬ ɩɚɦɹɬɢ. Ɋɚɫɫɦɨɬɪɢɦ ɪɟɚɥɢɡɚɰɢɸ ɩɪɨɫɬɟɣɲɟɝɨ ɚɥɝɨɪɢɬɦɚ recency scaling ɧɚ ɩɪɢɦɟɪɟ ɧɚɲɟɝɨ ɤɨɦɩɪɟɫɫɨɪɚ Dummy. ȼ ɨɩɢɫɚɧɢɟ ɫɬɪɭɤɬɭɪɵ ɄɆ ɜɧɟɫɟɦ ɩɨɥɟ last, ɨɩɢɫɵɜɚɸɳɟɟ ɉȼɋ ɞɥɹ ɡɚɞɚɧɧɨɝɨ ɤɨɧɬɟɤɫɬɚ. struct ContextModel{ int esc, TotFr, last; int count[256];
}; Ɂɧɚɱɟɧɢɟ last ɛɭɞɟɦ ɜɵɱɢɫɥɹɬɶ ɤɚɤ ɫɭɦɦɭ ɧɨɦɟɪɚ ɫɢɦɜɨɥɚ ɢ 1, ɞɥɹ ɬɨɝɨ ɱɬɨɛɵ ɧɭɥɟɜɨɟ ɡɧɚɱɟɧɢɟ last ɭɤɚɡɵɜɚɥɨ ɧɚ ɨɬɫɭɬɫɬɜɢɟ ɧɟɨɛɯɨɞɢɦɨɫɬɢ ɜɵɩɨɥɧɹɬɶ ɦɚɫɲɬɚɛɢɪɨɜɚɧɢɟ. ȼ ɧɚɱɚɥɟ ɪɚɛɨɬɵ ɩɪɨɝɪɚɦɦɵ last ɛɭɞɟɬ ɪɚɜɧɨ 0, ɬ.ɤ. cm ɹɜɥɹɟɬɫɹ ɝɥɨɛɚɥɶɧɨɣ ɩɟɪɟɦɟɧɧɨɣ. ȼ ɧɚɱɚɥɨ ɮɭɧɤɰɢɣ encode_sym ɢ decode_sym ɞɨɛɚɜɢɦ ɞɟɣɫɬɜɢɹ ɩɨ ɭɦɧɨɠɟɧɢɸ ɫɱɟɬɱɢɤɚ ɉȼɋ ɧɚ ɩɨɫɬɨɹɧɧɵɣ ɤɨɷɮɮɢɰɢɟɧɬ 1.25. int addition; if (CM->last){ addition = CM->count[CM->last-1]>>2; CM->count[CM->last-1] += addition; CM->TotFr += addition; }
Ʉɪɨɦɟ ɬɨɝɨ, ɞɨɛɚɜɢɦ ɫɪɚɡɭ ɠɟ ɩɨɫɥɟ ɜɵɡɨɜɚ ɦɟɬɨɞɨɜ ɢ AC.decode_update ɭɫɥɨɜɧɵɟ ɨɩɟɪɚɬɨɪɵ, ɢɫɩɪɚɜɥɹɸɳɢɟ ɡɧɚɱɟɧɢɹ ɫɱɟɬɱɢɤɨɜ ɧɚ ɩɟɪɜɨɧɚɱɚɥɶɧɵɟ. AC.encode
if (CM->last){
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X 167 http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
CM->count[CM->last-1] -= addition; CM->TotFr -= addition; }
ɂ, ɧɚɤɨɧɟɰ, ɨɛɟɫɩɟɱɢɦ ɩɪɚɜɢɥɶɧɨɟ ɨɛɧɨɜɥɟɧɢɟ last ɜ ɮɭɧɤɰɢɢ update_model. if (!stack[SP]->count[c]) stack[SP]->esc += 1; else stack[SP]->last = c+1;
Ɉɛɪɚɳɚɟɦ ɜɧɢɦɚɧɢɟ, ɱɬɨ ɧɟɨɛɯɨɞɢɦɨ ɤɨɧɬɪɨɥɢɪɨɜɚɬɶ ɜɟɥɢɱɢɧɭ addition, ɬ.ɤ. ɦɚɫɲɬɚɛɢɪɨɜɚɧɢɟ ɦɨɠɟɬ ɩɪɢɜɟɫɬɢ ɤ ɩɟɪɟɩɨɥɧɟɧɢɸ ɜ ɚɪɢɮɦɟɬɢɱɟɫɤɨɦ ɤɨɞɟɪɟ. Ɇɵ ɧɟ ɪɟɚɥɢɡɨɜɚɥɢ ɷɬɭ ɩɪɨɜɟɪɤɭ ɥɢɲɶ ɫ ɰɟɥɶɸ ɭɩɪɨɳɟɧɢɹ ɨɩɢɫɚɧɢɹ. Ɉɩɢɫɚɧɧɚɹ ɦɨɞɢɮɢɤɚɰɢɹ ɤɨɦɩɪɟɫɫɨɪɚ ɩɨɡɜɨɥɹɟɬ ɭɥɭɱɲɢɬɶ ɫɬɟɩɟɧɶ ɫɠɚɬɢɹ CalgCC ɩɪɢɦɟɪɧɨ ɧɚ 0.5%. ɇɨ ɨɩɬɢɦɚɥɶɧɚɹ ɜɟɥɢɱɢɧɚ ɤɨɷɮɮɢɰɢɟɧɬɚ ɦɚɫɲɬɚɛɢɪɨɜɚɧɢɹ ɫɭɳɟɫɬɜɟɧɧɨ ɦɟɧɹɟɬɫɹ ɨɬ ɮɚɣɥɚ ɤ ɮɚɣɥɭ. Ɍɚɤ, ɧɚɩɪɢɦɟɪ, ɞɥɹ ɮɚɣɥɚ Obj2 ɦɚɤɫɢɦɚɥɶɧɨɟ ɭɥɭɱɲɟɧɢɟ ɫɠɚɬɢɹ — ɧɚ 6% — ɛɵɥɨ ɨɬɦɟɱɟɧɨ ɩɪɢ ɤɨɷɮɮɢɰɢɟɧɬɟ 4. ȼɵɜɨɞ: Ɇɚɫɲɬɚɛɢɪɨɜɚɧɢɟ ɫɱɟɬɱɢɤɚ ɩɨɫɥɟɞɧɟɝɨ ɜɫɬɪɟɱɟɧɧɨɝɨ ɫɢɦɜɨɥɚ (recency scaling) ɩɨɡɜɨɥɹɟɬ ɭɥɭɱɲɢɬɶ ɫɠɚɬɢɟ ɜ ɫɪɟɞɧɟɦ ɥɢɲɶ ɧɚ 0.5–1%, ɧɨ ɦɨɠɟɬ ɞɚɬɶ ɫɭɳɟɫɬɜɟɧɧɵɣ ɜɵɢɝɪɵɲ ɩɪɢ ɨɛɪɚɛɨɬɤɟ ɞɚɧɧɵɯ, ɫɬɚɬɢɫɬɢɱɟɫɤɢɟ ɯɚɪɚɤɬɟɪɢɫɬɢɤɢ ɤɨɬɨɪɵɯ ɩɨɞɜɟɪɠɟɧɵ ɱɚɫɬɵɦ ɢɡɦɟɧɟɧɢɹɦ. ɆȺɋɒɌȺȻɂɊɈȼȺɇɂȿ ȼ ȾȿɌȿɊɆɂɇɂɊɈȼȺɇɇɕɏ ɄɈɇɌȿɄɋɌȺɏ
ɂɡɜɟɫɬɧɨ, ɱɬɨ ɦɟɬɨɞɵ Ɉȼɍ A, B, C ɢ, ɜ ɦɟɧɶɲɟɣ ɫɬɟɩɟɧɢ, ɞɪɭɝɢɟ ɪɚɫɫɦɨɬɪɟɧɧɵɟ ɚɩɪɢɨɪɧɵɟ ɦɟɬɨɞɵ ɧɚɡɧɚɱɚɸɬ ɡɚɜɵɲɟɧɧɭɸ ɜɟɪɨɹɬɧɨɫɬɶ ɭɯɨɞɚ ɢɡ ɞɟɬɟɪɦɢɧɢɪɨɜɚɧɧɵɯ ɤɨɧɬɟɤɫɬɨɜ [15]. ɗɬɨ ɦɨɠɧɨ ɢɫɩɪɚɜɢɬɶ, ɭɦɧɨɠɚɹ ɫɱɟɬɱɢɤ ɟɞɢɧɫɬɜɟɧɧɨɝɨ ɫɢɦɜɨɥɚ ɧɚ ɨɩɪɟɞɟɥɟɧɧɵɣ ɤɨɷɮɮɢɰɢɟɧɬ. Ɍɚɤɨɣ ɩɪɢɟɦ ɛɵɥ ɜɩɟɪɜɵɟ ɨɩɢɫɚɧ ɜ [15] ɩɨɞ ɧɚɢɦɟɧɨɜɚɧɢɟɦ “deterministic scaling” — «ɞɟɬɟɪ168 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɦɢɧɢɫɬɢɱɟɫɤɨɟ ɦɚɫɲɬɚɛɢɪɨɜɚɧɢɟ». ɇɟɬɪɭɞɧɨ ɡɚɦɟɬɢɬɶ, ɱɬɨ ɷɬɨɬ ɦɟɯɚɧɢɡɦ ɟɫɬɶ ɱɚɫɬɧɵɣ ɫɥɭɱɚɣ recency scaling. ɗɮɮɟɤɬ ɨɬ deterministic scaling ɭɜɟɥɢɱɢɜɚɟɬɫɹ, ɟɫɥɢ ɩɪɢ ɷɬɨɦ ɢɫɩɨɥɶɡɭɟɬɫɹ ɱɚɫɬɢɱɧɨɟ ɢɫɤɥɸɱɟɧɢɟ ɩɪɢ ɨɛɧɨɜɥɟɧɢɢ, ɚ ɧɟ ɨɛɵɱɧɨɟ ɢɫɤɥɸɱɟɧɢɟ ɩɪɢ ɨɛɧɨɜɥɟɧɢɢ [15]. Deterministic scaling ɢɦɟɟɬ ɫɦɵɫɥ ɩɪɢɦɟɧɹɬɶ ɬɨɥɶɤɨ ɜ ɫɨɱɟɬɚɧɢɢ ɫ ɚɩɪɢɨɪɧɵɦɢ ɦɟɬɨɞɚɦɢ Ɉȼɍ, ɜɟɞɶ ɱɟɦ ɬɨɱɧɟɟ ɜɵɱɢɫɥɹɟɬɫɹ ɜɟɪɨɹɬɧɨɫɬɶ ɭɯɨɞɚ, ɬɟɦ ɩɨɥɶɡɵ ɨɬ ɷɬɨɝɨ ɦɚɫɲɬɚɛɢɪɨɜɚɧɢɹ ɦɟɧɶɲɟ. ɍȼȿɅɂɑȿɇɂȿ ɌɈɑɇɈɋɌɂ ɉɊȿȾɋɄȺɁȺɇɂə ɇȺɂȻɈɅȿȿ ȼȿɊɈəɌɇɕɏ ɋɂɆȼɈɅɈȼ
Ʉɨɧɬɟɤɫɬɵ ɛɨɥɶɲɨɣ ɞɥɢɧɵ ɜɫɬɪɟɱɚɸɬɫɹ ɪɟɞɤɨ, ɢ ɫɬɚɬɢɫɬɢɤɚ, ɧɚɛɢɪɚɟɦɚɹ ɜ ɫɨɨɬɜɟɬɫɬɜɭɸɳɢɯ ɄɆ, ɨɛɵɱɧɨ ɹɜɥɹɟɬɫɹ ɧɟɞɨɫɬɚɬɨɱɧɨɣ ɞɥɹ ɩɨɥɭɱɟɧɢɹ ɧɚɞɟɠɧɨɣ ɨɰɟɧɤɢ ɞɚɠɟ ɜ ɫɥɭɱɚɟ ɢɫɩɨɥɶɡɨɜɚɧɢɹ ɦɟɯɚɧɢɡɦɚ ɧɚɫɥɟɞɨɜɚɧɢɹ ɢɧɮɨɪɦɚɰɢɢ. ɇɚɢɛɨɥɟɟ ɧɟɝɚɬɢɜɧɨ ɷɬɨ ɩɪɨɹɜɥɹɟɬɫɹ ɩɪɢ ɩɪɟɞɫɤɚɡɚɧɢɢ ɧɚɢɛɨɥɟɟ ɜɟɪɨɹɬɧɵɯ ɫɢɦɜɨɥɨɜ (ɇɛȼɋ) ɢ ɧɚɢɦɟɧɟɟ ɜɟɪɨɹɬɧɵɯ ɫɢɦɜɨɥɨɜ (ɇɦȼɋ), ɬɚɤ ɤɚɤ ɧɚɯɨɠɞɟɧɢɟ ɢɯ ɢɫɬɢɧɧɨɣ ɱɚɫɬɨɬɵ ɬɪɟɛɭɟɬ ɛɨɥɶɲɨɝɨ ɱɢɫɥɚ ɧɚɛɥɸɞɟɧɢɣ. Ɉɱɟɜɢɞɧɨ, ɱɬɨ ɩɪɢ ɷɬɨɦ ɨɫɧɨɜɧɭɸ ɢɡɛɵɬɨɱɧɨɫɬɶ ɤɨɞɢɪɨɜɚɧɢɹ ɦɵ ɜɧɨɫɢɦ ɢɡ-ɡɚ ɧɟɬɨɱɧɨɣ ɨɰɟɧɤɢ ɧɟ ɇɦȼɋ, ɚ ɇɛȼɋ ɜ ɫɢɥɭ ɢɯ ɛɨɥɟɟ ɱɚɫɬɨɣ ɜɫɬɪɟɱɚɟɦɨɫɬɢ. ȼ ɷɬɢɯ ɫɥɭɱɚɹɯ ɟɫɬɟɫɬɜɟɧɧɵɦ ɹɜɥɹɟɬɫɹ ɭɱɟɬ ɢɧɮɨɪɦɚɰɢɢ ɪɨɞɢɬɟɥɶɫɤɨɣ ɄɆ, ɱɬɨ ɦɨɠɧɨ ɪɚɫɫɦɚɬɪɢɜɚɬɶ ɤɚɤ ɩɟɪɟɯɨɞ ɨɬ ɧɟɹɜɧɨɝɨ ɜɡɜɟɲɢɜɚɧɢɹ ɤ ɹɜɧɨɦɭ. ɉɨɞ ɇɛȼɋ ɛɭɞɟɦ ɡɞɟɫɶ ɩɨɧɢɦɚɬɶ ɫɢɦɜɨɥɵ ɫ ɨɰɟɧɤɚɦɢ ɜɟɪɨɹɬɧɨɫɬɟɣ p(si|o) p(smps|o)/2, ɝɞɟ p(smps|o) ɫɨɨɬɜɟɬɫɬɜɭɟɬ ɫɚɦɨɦɭ ɜɟɪɨɹɬɧɨɦɭ ɫɢɦɜɨɥɭ (most probable symbol) smps ɜ ɬɟɤɭɳɟɣ ɄɆ. ɑɚɫɬɨɬɵ ɇɛȼɋ ɛɭɞɟɦ ɤɨɪɪɟɤɬɢɪɨɜɚɬɶ, ɟɫɥɢ f(o) < f(o–1). ȼ ɷɬɢɯ ɫɥɭɱɚɹɯ ɄɆ(o) «ɦɨɥɨɞɚ», ɢ ɱɚɫɬɨɬɚ f(si|o) ɫɢɦɜɨɥɚ si ɟɳɟ, ɤɚɤ ɩɪɚɜɢɥɨ, ɦɟɧɶɲɟ ɱɚɫɬɨɬɵ f(si|o–1). ɍɬɨɱɧɟɧɧɨɟ ɡɧɚɱɟɧɢɟ fɫɤɨɪɪ(si|o) ɫɱɟɬɱɢɤɚ ɩɪɟɞɫɬɚɜɥɹɟɬ ɫɨɛɨɣ ɫɪɟɞɧɟɟ ɜɡɜɟɲɟɧɧɨɟ f(si|o) ɢ «ɩɪɢɜɟɞɟɧɧɨɣ» ɱɚɫɬɨɬɵ f ′( si | o − 1) :
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X 169 http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
f (o) ⋅ f ( si | o) + f (o − 1) ⋅ f ′( si | o − 1) , f (o) + f (o − 1) f (o ) − f ( s i | o ) f ′( si | o − 1) = f ( si | o − 1) ⋅ . f (o − 1) − f ( si | o − 1) f ɫɤɨɪɪ ( si | o) =
ɝɞɟ
ȼ ɫɥɭɱɚɟ ɢɫɩɨɥɶɡɨɜɚɧɢɹ ɧɚɫɥɟɞɭɟɦɵɯ ɱɚɫɬɨɬ ɚɧɚɥɨɝɢɱɧɭɸ ɤɨɪɪɟɤɰɢɸ ɢɦɟɟɬ ɫɦɵɫɥ ɩɪɢɦɟɧɹɬɶ ɩɪɢ ɧɚɫɥɟɞɨɜɚɧɢɢ. Ɉɱɟɜɢɞɧɨ, ɱɬɨ ɫɬɟɩɟɧɶ ɫɠɚɬɢɹ ɫɢɥɶɧɨ ɡɚɜɢɫɢɬ ɨɬ ɬɨɱɧɨɫɬɢ ɩɪɟɞɫɤɚɡɚɧɢɹ ɇɛȼɋ, ɩɨɷɬɨɦɭ ɩɨɫɥɟ ɜɵɩɨɥɧɟɧɢɹ ɤɨɪɪɟɤɰɢɢ ɱɚɫɬɨɬɵ ɰɟɥɟɫɨɨɛɪɚɡɧɨ ɞɟɥɚɬɶ ɚɞɚɩɬɢɜɧɭɸ ɨɰɟɧɤɭ ɜɟɪɨɹɬɧɨɫɬɢ ɫɢɦɜɨɥɚ ɩɨ ɚɧɚɥɨɝɢɢ ɫ SEE. ɇɚɡɨɜɟɦ ɬɚɤɭɸ ɬɟɯɧɢɤɭ Secondary Symbol Estimation (SSE) — «ɜɬɨɪɢɱɧɚɹ ɨɰɟɧɤɚ ɫɢɦɜɨɥɚ». ȼ ɤɨɦɩɪɟɫɫɨɪɟ PPMonstr ɜɟɪɫɢɢ H ɜɬɨɪɢɱɧɚɹ ɨɰɟɧɤɚ ɜɵɩɨɥɧɹɟɬɫɹ ɞɥɹ ɄɆ ɫ ɡɚɦɚɫɤɢɪɨɜɚɧɧɵɦɢ ɫɢɦɜɨɥɚɦɢ (ɄɆ ɬɢɩɚ m) ɢ ɧɟɞɟɪɦɢɧɢɪɨɜɚɧɧɵɯ ɄɆ ɫ ɧɟɡɚɦɚɫɤɢɪɨɜɚɧɧɵɦɢ ɫɢɦɜɨɥɚɦɢ (ɄɆ ɬɢɩɚ nm). ɉɨɥɹ ɤɨɧɬɟɤɫɬɨɜ ɞɥɹ SSE ɫɬɪɨɹɬɫɹ ɫɥɟɞɭɸɳɢɦ ɨɛɪɚɡɨɦ. Ⱦɥɹ ɄɆ ɬɢɩɚ nm: 1) ɱɚɫɬɨɬɚ f(smps|o) ɫɚɦɨɝɨ ɜɟɪɨɹɬɧɨɝɨ ɫɢɦɜɨɥɚ, ɤɜɚɧɬɭɟɦɚɹ ɞɨ 68 ɡɧɚɱɟɧɢɣ; 2) ɨɞɧɨɛɢɬɨɜɵɣ ɮɥɚɝ, ɭɤɚɡɵɜɚɸɳɢɣ, ɱɬɨ ɛɵɥɨ ɩɪɨɢɡɜɟɞɟɧɨ ɦɚɫɲɬɚɛɢɪɨɜɚɧɢɟ ɫɱɟɬɱɢɤɨɜ ɤɨɧɬɟɤɫɬɧɨɣ ɦɨɞɟɥɢ; 3) ɨɞɧɨɛɢɬɨɜɵɣ ɮɥɚɝ, ɯɪɚɧɹɳɢɣ ɪɟɡɭɥɶɬɚɬ ɫɪɚɜɧɟɧɢɹ ɩɨɪɹɞɤɚ o ɬɟɤɭɳɟɣ ɄɆ ɫɨ ɫɪɟɞɧɢɦ ɩɨɪɹɞɤɨɦ ɤɨɧɬɟɤɫɬɧɵɯ ɦɨɞɟɥɟɣ, ɜ ɤɨɬɨɪɵɯ ɛɵɥɢ ɡɚɤɨɞɢɪɨɜɚɧɵ ɩɨɫɥɟɞɧɢɟ 128 ɫɢɦɜɨɥɨɜ; 4) ɨɞɧɨɛɢɬɨɜɵɣ ɮɥɚɝ, ɩɪɢɧɢɦɚɸɳɢɣ ɡɧɚɱɟɧɢɟ 0, ɟɫɥɢ ɞɜɚ ɫɬɚɪɲɢɯ ɛɢɬɚ ɩɪɟɞɵɞɭɳɟɝɨ ɨɛɪɚɛɨɬɚɧɧɨɝɨ ɫɢɦɜɨɥɚ ɧɭɥɟɜɵɟ, ɢ ɡɧɚɱɟɧɢɟ 1 ɜ ɩɪɨɱɢɯ ɫɥɭɱɚɹɯ (ɚɧɚɥɨɝ ɩɨɥɹ 4 ɤɨɧɬɟɤɫɬɚ ɭɯɨɞɚ ɞɥɹ ɄɆ ɬɢɩɚ d ɜ SEE-d1); 5) ɨɞɧɨɛɢɬɨɜɵɣ ɮɥɚɝ, ɪɚɜɧɵɣ 0, ɟɫɥɢ ɞɜɚ ɫɬɚɪɲɢɯ ɛɢɬɚ ɫɢɦɜɨɥɚ smps ɧɭɥɟɜɵɟ, ɢ 1 ɜ ɨɫɬɚɥɶɧɵɯ ɫɥɭɱɚɹɯ (ɚɧɚɥɨɝ ɩɨɥɹ 6 Ʉɍ ɞɥɹ ɄɆ ɬɢɩɚ d ɜ SEE-d1). Ⱦɥɹ ɄɆ ɬɢɩɚ m: 1) ɨɰɟɧɤɚ ɜɟɪɨɹɬɧɨɫɬɢ p(smps|o), ɤɜɚɧɬɭɟɦɚɹ ɞɨ 40 ɡɧɚɱɟɧɢɣ; 170 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɨɞɧɨɛɢɬɨɜɵɣ ɮɥɚɝ ɪɟɡɭɥɶɬɚɬɚ ɫɪɚɜɧɟɧɢɹ ɫɪɟɞɧɟɣ ɱɚɫɬɨɬɵ ɡɚɦɚɫɤɢɪɨɜɚɧɧɵɯ ɢ ɧɟɡɚɦɚɫɤɢɪɨɜɚɧɧɵɯ ɫɢɦɜɨɥɨɜ; 3) ɨɞɧɨɛɢɬɨɜɵɣ ɮɥɚɝ, ɭɤɚɡɵɜɚɸɳɢɣ, ɱɬɨ ɬɨɥɶɤɨ ɨɞɢɧ ɫɢɦɜɨɥ ɨɫɬɚɥɫɹ ɧɟɡɚɦɚɫɤɢɪɨɜɚɧɧɵɦ; 4) ɚɧɚɥɨɝ ɩɨɥɹ 2 ɤɨɧɬɟɤɫɬɚ SSE ɞɥɹ ɄɆ ɬɢɩɚ nm (ɫɦ. ɩɪɟɞɵɞɭɳɢɣ ɫɩɢɫɨɤ); 5) ɚɧɚɥɨɝ ɩɨɥɹ 4 ɜ ɩɪɟɞɵɞɭɳɟɦ ɫɩɢɫɤɟ. Ɍɟɯɧɢɤɚ SSE ɪɚɡɪɚɛɨɬɚɧɚ ɒɤɚɪɢɧɵɦ ɢ ɢɫɩɨɥɶɡɭɟɬɫɹ ɞɥɹ ɭɬɨɱɧɟɧɢɹ ɩɪɟɞɫɤɚɡɚɧɢɹ ɇɛȼɋ ɜ ɤɨɦɩɪɟɫɫɨɪɟ PPMonstr ɜɟɪɫɢɢ H. 2)
Ɂɚɤɥɸɱɟɧɢɟ: ɉɪɢɦɟɧɟɧɢɟ SSE ɤ ɇɛȼɋ ɞɚɟɬ ɜɵɢɝɪɵɲ ɜ ɪɚɣɨɧɟ 0.5–1% ɢ ɨɫɨɛɟɧɧɨ ɩɨɥɟɡɧɨ ɩɪɢ ɫɠɚɬɢɢ ɧɟɨɞɧɨɪɨɞɧɵɯ ɞɚɧɧɵɯ, ɬ.ɟ. ɥɢɛɨ ɩɨɪɨɠɞɟɧɧɵɯ ɢɫɬɨɱɧɢɤɨɦ, ɛɵɫɬɪɨ ɦɟɧɹɸɳɢɦ ɫɜɨɢ ɯɚɪɚɤɬɟɪɢɫɬɢɤɢ, ɥɢɛɨ ɫɨɫɬɨɹɳɢɯ ɢɡ ɮɪɚɝɦɟɧɬɨɜ, ɫɝɟɧɟɪɢɪɨɜɚɧɧɵɯ ɫɭɳɟɫɬɜɟɧɧɨ ɨɬɥɢɱɚɸɳɢɦɢɫɹ ɢɫɬɨɱɧɢɤɚɦɢ. ɈȻɓɂɃ ɋɅɍɑȺɃ ɉɊɂɆȿɇȿɇɂə ȼɌɈɊɂɑɇɈɃ ɈɐȿɇɄɂ ɋɂɆȼɈɅȺ
ȿɫɬɟɫɬɜɟɧɧɨɣ ɹɜɥɹɟɬɫɹ ɢɞɟɹ ɩɪɢɦɟɧɟɧɢɹ SSE ɤɨ ɜɫɟɦ ɫɢɦɜɨɥɚɦ ɤɨɧɬɟɤɫɬɚ. Ⱦɟɣɫɬɜɢɬɟɥɶɧɨ, ɷɬɨɬ ɩɪɢɟɦ ɨɛɟɫɩɟɱɢɜɚɟɬ ɫɭɳɟɫɬɜɟɧɧɨɟ ɭɥɭɱɲɟɧɢɟ ɫɠɚɬɢɹ ɧɟɨɞɧɨɪɨɞɧɵɯ ɞɚɧɧɵɯ. Ɋɚɫɫɦɨɬɪɢɦ ɨɛɨɛɳɟɧɧɵɣ ɚɥɝɨɪɢɬɦ ɩɪɢɦɟɧɟɧɢɹ SSE ɩɨɞɪɨɛɧɟɟ6. ɉɭɫɬɶ ɫɢɦɜɨɥɵ ɄɆ ɯɪɚɧɹɬɫɹ ɜ ɜɢɞɟ ɭɩɨɪɹɞɨɱɟɧɧɨɝɨ ɫɩɢɫɤɚ, ɬɚɤ ɱɬɨ ɫɢɦɜɨɥ ɫ ɧɚɢɛɨɥɶɲɟɣ ɱɚɫɬɨɬɨɣ ɡɚɩɢɫɚɧ ɩɟɪɜɵɦ, ɬ.ɟ. ɢɦɟɟɬ ɪɚɧɝ 1. ɉɪɨɰɟɞɭɪɚ ɨɰɟɧɤɢ ɨɱɟɪɟɞɧɨɝɨ ɫɢɦɜɨɥɚ s ɩɪɢɨɛɪɟɬɚɟɬ ɜɢɞ ɰɟɩɨɱɤɢ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɵɯ ɨɰɟɧɨɤ ɚɥɶɬɟɪɧɚɬɢɜ «ɞɚ»/«ɧɟɬ»: «ɞɚ» — ɫɢɦɜɨɥ ɫ ɬɟɤɭɳɢɦ ɪɚɧɝɨɦ ɪɚɜɟɧ s, «ɧɟɬ» — ɫɢɦɜɨɥɵ ɪɚɡɥɢɱɚɸɬɫɹ, ɧɟɨɛɯɨɞɢɦɨ ɭɜɟɥɢɱɢɬɶ ɪɚɧɝ ɧɚ ɟɞɢɧɢɰɭ ɢ ɩɪɨɞɨɥɠɢɬɶ ɩɨɢɫɤ. ȼɟɪɨɹɬɧɨɫɬɶ «ɞɚ» ɞɥɹ ɪɚɧɝɚ i ɧɚɯɨɞɢɬɫɹ ɤɚɤ
6
Ⱥɥɝɨɪɢɬɦ ɪɚɡɪɚɛɨɬɚɧ ɢ ɪɟɚɥɢɡɨɜɚɧ Ⱦ.ɒɤɚɪɢɧɵɦ ɜ ɧɨɹɛɪɟ 2001 ɝɨɞɚ
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X 171 http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
Qi (o) = q SSE ( si | o) , ɝɞɟ q SSE ( si | o) — ɨɰɟɧɤɚ ɜɟɪɨɹɬɧɨɫɬɢ ɫɢɦɜɨɥɚ ɫ ɪɚɧɝɨɦ i, ɩɨɥɭɱɟɧɧɚɹ ɫ ɩɨɦɨɳɶɸ SSE ɩɨɫɥɟ ɨɰɟɧɢɜɚɧɢɹ ɫɢɦɜɨɥɚ ɫ ɪɚɧɝɨɦ i–1; ɜɵɱɢɫɥɹɟɬɫɹ ɧɚ ɨɫɧɨɜɚɧɢɢ ɨɛɵɱɧɨɣ ɨɰɟɧɤɢ q( si | o ) ɢ ɡɧɚɱɟɧɢɣ wi(o) ɩɨɥɟɣ ɤɨɧɬɟɤɫɬɚ ɞɥɹ SSE. q SSE ( si | o) = SSE ( q( si | o), w1 (o), w2 (o), wP (o)) ,
q ( si | o ) =
f ( si | o ) i −1
f (o) − ƒf ( s r | o) r =1
.
ɇɚɩɪɢɦɟɪ, ɩɭɫɬɶ ɫɩɢɫɨɤ ɫɢɦɜɨɥɨɜ ɬɟɤɭɳɟɣ ɄɆ(o) ɢɦɟɟɬ ɜɢɞ ‘ɜ’, ‘ɛ’, ‘ɚ’, ‘ɝ’. ȿɫɥɢ ɨɛɪɚɛɚɬɵɜɚɟɬɫɹ ɫɢɦɜɨɥ ‘ɚ’, ɬɨ ɨɧ ɛɭɞɟɬ ɨɰɟɧɟɧ ɩɨɫɪɟɞɫɬɜɨɦ ɰɟɩɨɱɤɢ ɨɬɜɟɬɨɜ «ɧɟɬ», «ɧɟɬ», «ɞɚ» ɢ ɩɨɥɭɱɢɬ ɜɟɪɨɹɬɧɨɫɬɶ (1 – Q1(o))·(1 – Q2(o))·Q3(o). Ⱦɚɥɶɧɟɣɲɟɟ ɭɥɭɱɲɟɧɢɟ ɫɠɚɬɢɹ ɨɛɟɫɩɟɱɢɜɚɟɬɫɹ ɫɨɟɞɢɧɟɧɢɟɦ SSE ɫ ɬɟɯɧɢɤɨɣ recency scaling. ȼ ɷɬɨɦ ɫɥɭɱɚɟ ɫɢɦɜɨɥɨɦ ɫ ɪɚɧɝɨɦ 1 ɫɱɢɬɚɟɬɫɹ ɩɨɫɥɟɞɧɢɣ ɜɫɬɪɟɱɟɧɧɵɣ ɜ ɤɨɧɬɟɤɫɬɟ ɫɢɦɜɨɥ (ɉȼɋ), ɟɫɥɢ, ɤɨɧɟɱɧɨ, ɨɧ ɧɟ ɡɚɦɚɫɤɢɪɨɜɚɧ. Ɍɚɤɚɹ «ɚɞɚɩɬɚɰɢɹ ɧɨɜɢɡɧɵ» ɩɨɡɜɨɥɹɟɬ ɡɧɚɱɢɬɟɥɶɧɨ ɭɥɭɱɲɢɬɶ ɩɪɢɫɩɨɫɨɛɥɹɟɦɨɫɬɶ ɦɨɞɟɥɢ ɤ ɩɨɬɨɤɭ ɞɚɧɧɵɯ ɫ ɦɟɧɹɸɳɢɦɢɫɹ ɜɟɪɨɹɬɧɨɫɬɧɵɦɢ ɯɚɪɚɤɬɟɪɢɫɬɢɤɚɦɢ. ɉɨɥɨɠɢɬɟɥɶɧɵɣ ɷɮɮɟɤɬ ɨɛɟɫɩɟɱɢɜɚɟɬ ɜɧɟɫɟɧɢɟ ɜ ɤɨɧɬɟɤɫɬɵ ɞɥɹ SSE ɮɥɚɝɨɜ, ɭɤɚɡɵɜɚɸɳɢɯ ɧɚ ɫɨɜɩɚɞɟɧɢɟ ɉȼɋ ɬɟɤɭɳɟɝɨ ɤɨɧɬɟɤɫɬɚ ɢ ɤɨɧɬɟɤɫɬɨɜ-ɩɪɟɞɤɨɜ. Ⱥɧɚɥɨɝɢɱɧɨ, ɩɪɢɫɜɚɢɜɚɬɶ ɉȼɋ ɪɚɧɝ 1 ɥɭɱɲɟ ɬɨɥɶɤɨ ɜ ɬɨɦ ɫɥɭɱɚɟ, ɟɫɥɢ ɨɧ ɪɚɜɟɧ ɉȼɋ «ɛɥɢɠɚɣɲɢɯ» ɩɪɟɞɤɨɜ. ȼ ɬɚɛɥ. 4.7 ɩɪɢɜɟɞɟɧɨ ɫɪɚɜɧɟɧɢɟ ɯɚɪɚɤɬɟɪɢɫɬɢɤ ɫɠɚɬɢɹ ɤɨɦɩɪɟɫɫɨɪɚ PPMonstr ɜɟɪɫɢɢ H ɢ ɟɝɨ ɦɨɞɢɮɢɤɚɰɢɢ, ɢɫɩɨɥɶɡɭɸɳɟɣ ɨɛɨɛɳɟɧɧɵɣ ɚɥɝɨɪɢɬɦ SSE ɜ ɫɨɱɟɬɚɧɢɢ ɫ ɚɞɚɩɬɚɰɢɟɣ ɧɨɜɢɡɧɵ. ȼ ɫɪɚɜɧɟɧɢɢ ɛɵɥɢ ɢɫɩɨɥɶɡɨɜɚɧɵ ɮɚɣɥɵ ɢɡ ɧɚɛɨɪɨɜ CalgCC ɢ VYCCT. ȼɫɟ ɮɚɣɥɵ, ɡɚ ɢɫɤɥɸɱɟɧɢɟɦ ɬɟɤɫɬɨɜɨɝɨ Book1, ɫɨɞɟɪɠɚɬ ɧɟɨɞɧɨɪɨɞɧɵɟ ɛɢɧɚɪɧɵɟ ɞɚɧɧɵɟ ɢɥɢ ɫɦɟɫɶ ɬɟɤɫɬɚ ɢ ɛɢɧɚɪɧɵɯ ɞɚɧɧɵɯ. ɂɫɩɨɥɶɡɨɜɚɥɢɫɶ ɦɨɞɟɥɢ 64-ɝɨ ɩɨɪɹɞɤɚ. 172 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
Ɍɚɛɥɢɰɚ 4.7 ɇɚɡɜɚɧɢɟ ɮɚɣɥɚ
Ɋɚɡɦɟɪ ɫɠɚɬɨɝɨ ɮɚɣɥɚ, ɛɚɣɬɨɜ
Book1 Fileware.doc Obj2 OS2.ini Samples.xls Wcc386.exe
205144 112111 65093 94218 70912 278045
ɞɥɹ ɜɟɪɫɢɢ ɇ
ɞɥɹ ɦɨɞɢɮɢɤɚɰɢɢ ɜɟɪɫɢɢ H 203669 100454 58466 83405 64666 255719
ɍɥɭɱɲɟɧɢɟ ɫɠɚɬɢɹ, %
ɉɚɞɟɧɢɟ ɫɤɨɪɨɫɬɢ ɫɠɚɬɢɹ, ɪɚɡ
0.7% 10.4% 10.2% 11.5% 8.8% 8.0%
2.0 2.5 2.1 2.2 2.0 3.3
ȼɵɜɨɞ: ɉɪɢɦɟɧɟɧɢɟ SSE ɤɨ ɜɫɟɦ ɫɢɦɜɨɥɚɦ ɤɨɧɬɟɤɫɬɚ ɜ ɫɨɱɟɬɚɧɢɢ ɫ ɚɞɚɩɬɚɰɢɟɣ ɧɨɜɢɡɧɵ ɡɧɚɱɢɬɟɥɶɧɨ ɭɥɭɱɲɚɟɬ ɫɠɚɬɢɟ ɧɟɨɞɧɨɪɨɞɧɵɯ ɞɚɧɧɵɯ. ɗɬɨ ɩɨɡɜɨɥɹɟɬ ɩɨɥɭɱɚɬɶ ɫɬɚɛɢɥɶɧɨ ɧɚɢɥɭɱɲɭɸ ɫɬɟɩɟɧɶ ɫɠɚɬɢɹ ɩɨ ɫɪɚɜɧɟɧɢɸ ɫ ɞɪɭɝɢɦɢ ɭɧɢɜɟɪɫɚɥɶɧɵɦɢ ɦɟɬɨɞɚɦɢ (BWT, LZ) ɩɪɢ ɨɛɪɚɛɨɬɤɟ ɮɚɣɥɨɜ ɫɚɦɵɯ ɪɚɡɧɨɨɛɪɚɡɧɵɯ ɬɢɩɨɜ, ɚ ɧɟ ɬɨɥɶɤɨ ɬɟɤɫɬɨɜ. ɐɟɧɨɣ ɭɜɟɥɢɱɟɧɢɹ ɫɬɟɩɟɧɢ ɫɠɚɬɢɹ ɹɜɥɹɟɬɫɹ ɩɚɞɟɧɢɟ ɫɤɨɪɨɫɬɢ ɜ 2 ɢ ɛɨɥɟɟ ɪɚɡ
PPM ɢ PPM* ɉɪɢ ɮɢɤɫɢɪɨɜɚɧɢɢ ɦɚɤɫɢɦɚɥɶɧɨɝɨ ɩɨɪɹɞɤɚ ɤɨɧɬɟɤɫɬɨɜ ɜ ɪɚɣɨɧɟ 5–6 PPM ɞɚɠɟ ɛɟɡ ɧɚɫɥɟɞɨɜɚɧɢɹ ɢɧɮɨɪɦɚɰɢɢ ɞɚɟɬ ɨɬɥɢɱɧɵɟ ɪɟɡɭɥɶɬɚɬɵ ɧɚ ɬɟɤɫɬɚɯ, ɧɨ ɧɟ ɨɱɟɧɶ ɯɨɪɨɲɨ ɪɚɛɨɬɚɟɬ ɧɚ ɜɵɫɨɤɨ ɢɡɛɵɬɨɱɧɵɯ ɞɚɧɧɵɯ ɫ ɛɨɥɶɲɢɦ ɤɨɥɢɱɟɫɬɜɨɦ ɞɥɢɧɧɵɯ ɩɨɜɬɨɪɹɸɳɢɯɫɹ ɫɬɪɨɤ. ȼ ɫɟɪɟɞɢɧɟ 1990-ɯ ɝɨɞɨɜ ɛɵɥ ɩɪɟɞɥɨɠɟɧ ɦɟɬɨɞ ɛɨɪɶɛɵ ɫ ɷɬɢɦ ɧɟɞɨɫɬɚɬɤɨɦ [6]. ɉɪɟɞɥɨɠɟɧɧɵɣ ɚɥɝɨɪɢɬɦ, PPM* (ɩɪɨɢɡɧɨɫɢɬɫɹ ɤɚɤ «ɩɢ-ɩɢ-ɷɦ ɫɬɚ»), ɛɵɥ ɨɫɧɨɜɚɧ ɧɚ ɢɫɩɨɥɶɡɨɜɚɧɢɢ ɤɨɧɬɟɤɫɬɨɜ ɧɟɨɝɪɚɧɢɱɟɧɧɨɣ ɞɥɢɧɵ. Ⱥɜɬɨɪɵ ɚɥɝɨɪɢɬɦɚ ɩɪɟɞɥɨɠɢɥɢ ɫɥɟɞɭɸɳɭɸ ɫɬɪɚɬɟɝɢɸ ɜɵɛɨɪɚ ɦɚɤɫɢɦɚɥɶɧɨɝɨ ɩɨɪɹɞɤɚ ɧɚ ɤɚɠɞɨɦ ɲɚɝɟ: ɦɚɤɫɢɦɚɥɶɧɵɣ ɩɨɪɹɞɨɤ ɫɨɨɬɜɟɬɫɬɜɭɟɬ ɩɨɪɹɞɤɭ ɫɚɦɨɝɨ ɤɨɪɨɬɤɨɝɨ ɞɟɬɟɪɦɢɧɢɪɨɜɚɧɧɨɝɨ ɤɨɧɬɟɤɫɬɚ. ɉɨɞ Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X 173 http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɞɟɬɟɪɦɢɧɢɪɨɜɚɧɧɵɦ ɩɨɧɢɦɚɟɬɫɹ ɤɨɧɬɟɤɫɬ, ɜ ɤɨɬɨɪɨɦ ɞɨ ɞɚɧɧɨɝɨ ɦɨɦɟɧɬɚ ɜɫɬɪɟɱɚɥɫɹ ɬɨɥɶɤɨ ɨɞɢɧ ɫɢɦɜɨɥ (ɥɸɛɨɟ ɱɢɫɥɨ ɪɚɡ). ȿɫɥɢ ɞɟɬɟɪɦɢɧɢɪɨɜɚɧɧɵɯ ɤɨɧɬɟɤɫɬɨɜ ɧɟɬ, ɬɨ ɜɵɛɢɪɚɟɬɫɹ ɫɚɦɵɣ ɞɥɢɧɧɵɣ ɫɪɟɞɢ ɢɦɟɸɳɢɯɫɹ. ɉɨɫɥɟ ɜɵɛɨɪɚ ɦɚɤɫɢɦɚɥɶɧɨɝɨ ɩɨɪɹɞɤɚ ɩɪɨɰɟɞɭɪɚ ɨɰɟɧɤɢ ɜɟɪɨɹɬɧɨɫɬɢ ɫɢɦɜɨɥɚ ɜ ɚɥɝɨɪɢɬɦɟ PPM* ɧɢɱɟɦ ɧɟ ɨɬɥɢɱɚɟɬɫɹ ɨɬ ɩɪɢɦɟɧɹɟɦɨɣ ɜ ɚɥɝɨɪɢɬɦɚɯ ɨɛɵɱɧɨɝɨ PPM, ɬ.ɟ. PPM-ɦɨɞɟɥɢɪɨɜɚɧɢɹ ɨɝɪɚɧɢɱɟɧɧɨɝɨ ɩɨɪɹɞɤɚ. Ɋɟɚɥɢɡɚɰɢɹ PPM*, ɨɩɢɫɚɧɧɚɹ ɜ [6], ɢɦɟɥɚ ɧɟ ɜɩɟɱɚɬɥɹɸɳɢɟ ɯɚɪɚɤɬɟɪɢɫɬɢɤɢ: ɫɠɚɬɢɟ ɧɚ ɭɪɨɜɧɟ PPMC ɩɨɪɹɞɤɚ 5, ɫɤɨɪɨɫɬɶ ɤɨɞɢɪɨɜɚɧɢɹ, ɤɚɤ ɭɬɜɟɪɠɞɚɟɬɫɹ, ɬɚɤɠɟ ɫɨɩɨɫɬɚɜɢɦɚ, ɧɨ ɩɚɦɹɬɢ ɪɚɫɯɨɞɭɟɬɫɹ ɡɧɚɱɢɬɟɥɶɧɨ ɛɨɥɶɲɟ. ɋɭɞɹ ɩɨ ɜɫɟɦɭ, ɚɜɬɨɪɚɦ ɨɱɟɧɶ ɯɨɬɟɥɨɫɶ ɞɨɤɚɡɚɬɶ ɩɪɟɜɨɫɯɨɞɫɬɜɨ ɢɯ ɫɯɟɦɵ ɧɚɞ ɞɪɭɝɢɦɢ ɦɟɬɨɞɚɦɢ PPM ɢ ɫɬɚɧɞɚɪɬɧɵɦ PPMC ɜ ɱɚɫɬɧɨɫɬɢ, ɧɚɥɢɱɢɟ ɤɨɬɨɪɨɝɨ ɜɟɫɶɦɚ ɫɨɦɧɢɬɟɥɶɧɨ. ɑɢɬɚɬɟɥɶ ɦɨɠɟɬ ɫɚɦɨɫɬɨɹɬɟɥɶɧɨ ɫɪɚɜɧɢɬɶ ɫɬɟɩɟɧɶ ɫɠɚɬɢɹ PPM* ɫ ɞɪɭɝɢɦɢ ɚɥɝɨɪɢɬɦɚɦɢ PPM, ɩɨɥɶɡɭɹɫɶ ɬɚɛɥ. 4.8 ɢ 4.9. ȼ ɩɪɢɧɰɢɩɟ, ɪɚɫɯɨɞɵ ɩɚɦɹɬɢ ɞɥɹ PPM ɢ PPM* ɦɨɝɭɬ ɛɵɬɶ ɨɞɢɧɚɤɨɜɵ, ɱɬɨ ɩɨɤɚɡɚɧɨ ɜ [4]. ȼɵɜɨɞ: ɉɪɟɢɦɭɳɟɫɬɜɨ ɩɨɞɯɨɞɚ PPM* ɧɚɞ ɨɛɵɱɧɵɦ PPM ɧɟ ɨɱɟɜɢɞɧɨ
Ⱦɨɫɬɨɢɧɫɬɜɚ ɢ ɧɟɞɨɫɬɚɬɤɢ PPM ȼɨɬ ɭɠɟ ɜ ɬɟɱɟɧɢɟ ɩɨɥɭɬɨɪɚ ɞɟɫɹɬɤɨɜ ɥɟɬ ɩɪɟɞɫɬɚɜɢɬɟɥɢ ɫɟɦɟɣɫɬɜɚ PPM ɨɫɬɚɸɬɫɹ ɧɚɢɛɨɥɟɟ ɦɨɳɧɵɦɢ ɩɪɚɤɬɢɱɟɫɤɢɦɢ ɚɥɝɨɪɢɬɦɚɦɢ ɫ ɬɨɱɤɢ ɡɪɟɧɢɹ ɫɬɟɩɟɧɢ ɫɠɚɬɢɹ. ɉɨ-ɜɢɞɢɦɨɦɭ, ɞɨɛɢɬɶɫɹ ɥɭɱɲɢɯ ɪɟɡɭɥɶɬɚɬɨɜ ɫɦɨɝɭɬ ɬɨɥɶɤɨ ɛɨɥɟɟ ɢɡɨɳɪɟɧɧɵɟ ɤɨɧɬɟɤɫɬɧɵɟ (ɜ ɲɢɪɨɤɨɦ ɫɦɵɫɥɟ) ɦɟɬɨɞɵ, ɤɨɬɨɪɵɟ, ɧɟɫɨɦɧɟɧɧɨ, ɛɭɞɭɬ ɩɨɹɜɥɹɬɶɫɹ, ɬɚɤ ɤɚɤ ɩɪɨɢɡɜɨɞɹɬɫɹ ɜɫɟ ɛɨɥɟɟ ɛɵɫɬɪɵɟ ɩɪɨɰɟɫɫɨɪɵ, ɚ ɨɛɴɟɦ ɨɩɟɪɚɬɢɜɧɨɣ ɩɚɦɹɬɢ ɗȼɆ ɫɬɚɧɨɜɢɬɫɹ ɜɫɟ ɛɨɥɶɲɟ. ɇɚɢɥɭɱɲɢɟ ɪɟɡɭɥɶɬɚɬɵ ɚɥɝɨɪɢɬɦɵ PPM ɩɨɤɚɡɵɜɚɸɬ ɧɚ ɬɟɤɫɬɚɯ: ɨɬɥɢɱɧɵɣ ɤɨɷɮɮɢɰɢɟɧɬ ɫɠɚɬɢɹ ɩɪɢ ɜɵɫɨɤɨɣ ɫɤɨɪɨɫɬɢ, ɱɟɦɭ ɧɚɝɥɹɞɧɵɦ ɩɪɢɦɟɪɨɦ ɹɜɥɹɸɬɫɹ ɤɨɦɩɪɟɫɫɨɪɵ PPMd ɢ 174 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
PPMonstr. Ʉɪɨɦɟ ɬɨɝɨ, ɟɫɥɢ ɫɬɨɢɬ ɡɚɞɚɱɚ ɦɚɤɫɢɦɢɡɚɰɢɢ ɫɬɟɩɟɧɢ ɫɠɚɬɢɹ ɨɩɪɟɞɟɥɟɧɧɵɯ ɞɚɧɧɵɯ, ɬɨ, ɫɤɨɪɟɟ ɜɫɟɝɨ, PPM-ɩɨɞɨɛɧɵɣ ɚɥɝɨɪɢɬɦ ɛɭɞɟɬ ɧɚɢɥɭɱɲɢɦ ɜɵɛɨɪɨɦ ɜ ɤɚɱɟɫɬɜɟ ɨɫɧɨɜɵ ɫɩɟɰɢɚɥɢɡɢɪɨɜɚɧɧɨɝɨ ɤɨɦɩɪɟɫɫɨɪɚ. ȿɫɥɢ ɜɵɣɬɢ ɡɚ ɪɚɦɤɢ ɱɚɫɬɧɨɣ ɩɪɨɛɥɟɦɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ, ɬɨ ɧɟɫɨɦɧɟɧɧɵɦ ɞɨɫɬɨɢɧɫɬɜɨɦ PPM ɹɜɥɹɟɬɫɹ ɜɨɡɦɨɠɧɨɫɬɶ ɩɨɥɭɱɟɧɢɹ ɯɨɪɨɲɟɣ ɫɬɚɬɢɫɬɢɱɟɫɤɨɣ ɦɨɞɟɥɢ ɨɛɪɚɛɨɬɚɧɧɨɣ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ ɤɚɱɟɫɬɜɟɧɧɵɯ ɞɚɧɧɵɯ (ɢɥɢ ɫɝɟɧɟɪɢɪɨɜɚɜɲɟɝɨ ɟɟ ɢɫɬɨɱɧɢɤɚ). Ⱦɟɣɫɬɜɢɬɟɥɶɧɨ, ɦɨɞɟɥɶ, ɩɨɡɜɨɥɹɸɳɭɸ ɷɮɮɟɤɬɢɜɧɨ ɩɪɟɞɫɤɚɡɵɜɚɬɶ ɧɟɢɡɜɟɫɬɧɵɟ ɫɢɦɜɨɥɵ ɫɨɨɛɳɟɧɢɹ, ɦɨɠɧɨ ɩɪɢɦɟɧɹɬɶ ɧɟ ɬɨɥɶɤɨ ɞɥɹ ɫɠɚɬɢɹ, ɧɨ ɢ ɞɥɹ ɪɟɲɟɧɢɹ ɡɚɞɚɱ ɤɨɪɪɟɤɰɢɢ ɬɟɤɫɬɚ ɜ ɫɢɫɬɟɦɚɯ OCR, ɪɚɫɩɨɡɧɚɜɚɧɢɹ ɪɟɱɢ, ɤɥɚɫɫɢɮɢɤɚɰɢɢ ɬɢɩɚ ɬɟɤɫɬɚ, ɫɟɦɚɧɬɢɱɟɫɤɨɝɨ ɚɧɚɥɢɡɚ ɬɟɤɫɬɚ, ɲɢɮɪɨɜɚɧɢɹ [18]. ɇɟɞɨɫɬɚɬɤɢ ɪɟɚɥɢɡɚɰɢɣ ɩɨɞɯɨɞɚ PPM ɡɚɤɥɸɱɚɸɬɫɹ ɜ ɫɥɟɞɭɸɳɟɦ: • ɦɟɞɥɟɧɧɨɟ ɞɟɤɨɞɢɪɨɜɚɧɢɟ (ɨɛɵɱɧɨ ɧɚ 5–10% ɦɟɞɥɟɧɧɟɟ ɤɨɞɢɪɨɜɚɧɢɹ); • ɧɟɫɨɜɦɟɫɬɢɦɨɫɬɶ ɤɨɞɟɪɚ ɢ ɞɟɤɨɞɟɪɚ ɜ ɫɥɭɱɚɟ ɢɡɦɟɧɟɧɢɹ ɚɥɝɨɪɢɬɦɚ ɨɰɟɧɤɢ; ɜ ɬɨ ɠɟ ɜɪɟɦɹ ɚɥɝɨɪɢɬɦɵ ɫɟɦɟɣɫɬɜɚ LZ77 ɞɨɩɭɫɤɚɸɬ ɫɟɪɶɟɡɧɭɸ ɦɨɞɢɮɢɤɚɰɢɸ ɤɨɞɟɪɚ ɛɟɡ ɧɟɨɛɯɨɞɢɦɨɫɬɢ ɢɫɩɪɚɜɥɟɧɢɹ ɞɟɤɨɞɟɪɚ; • ɦɟɞɥɟɧɧɚɹ ɨɛɪɚɛɨɬɤɚ ɦɚɥɨ ɢɡɛɵɬɨɱɧɵɯ ɞɚɧɧɵɯ (ɫɤɨɪɨɫɬɶ ɦɨɠɟɬ ɩɚɞɚɬɶ ɜ ɪɚɡɵ); • ɧɚɢɥɭɱɲɟɟ ɫɠɚɬɢɟ ɪɚɡɥɢɱɧɵɯ ɮɚɣɥɨɜ ɞɨɫɬɢɝɚɟɬɫɹ ɩɪɢ ɩɨɪɹɞɤɚɯ ɦɨɞɟɥɢ PPM ɜ ɪɚɣɨɧɟ 4…12 ɞɥɹ ɦɨɞɟɥɟɣ, ɧɟ ɩɪɢɦɟɧɹɸɳɢɯ ɬɟɯɧɢɤɭ ɧɚɫɥɟɞɨɜɚɧɢɹ ɢɧɮɨɪɦɚɰɢɢ ɢ/ɢɥɢ LOE, ɢ ɩɪɢ ɩɨɪɹɞɤɚɯ 16…32 ɜ ɩɪɨɬɢɜɧɨɦ ɫɥɭɱɚɟ; ɩɨɷɬɨɦɭ ɩɪɢ ɜɵɛɨɪɟ ɤɚɤɨɝɨ-ɬɨ ɮɢɤɫɢɪɨɜɚɧɧɨɝɨ ɩɨɪɹɞɤɚ ɦɨɞɟɥɢ ɦɵ ɦɨɠɟɦ ɬɟɪɹɬɶ ɥɢɛɨ ɜ ɫɬɟɩɟɧɢ ɫɠɚɬɢɹ, ɥɢɛɨ ɢɫɩɨɥɶɡɨɜɚɬɶ ɱɟɪɟɫɱɭɪ ɦɧɨɝɨ ɪɟɫɭɪɫɨɜ ɗȼɆ; • ɜ ɨɛɳɟɦ ɫɥɭɱɚɟ ɧɟɞɨɫɬɚɬɨɱɧɨ ɯɨɪɨɲɟɟ ɫɠɚɬɢɟ ɮɚɣɥɨɜ, ɫɬɚɬɢɫɬɢɱɟɫɤɢɟ ɯɚɪɚɤɬɟɪɢɫɬɢɤɢ ɤɨɬɨɪɵɯ ɩɨɞɜɟɪɠɟɧɵ ɱɚɫɬɵɦ ɢɡɦɟɧɟɧɢɹɦ ɬɚɤɨɝɨ ɬɢɩɚ, ɱɬɨ ɨɰɟɧɤɢ ɪɚɫɩɪɟɞɟɥɟɧɢɣ ɜɟɪɨɹɬɧɨɫɬɟɣ ɜ ɤɨɧɬɟɤɫɬɧɵɯ ɦɨɞɟɥɹɯ ɛɵɫɬɪɨ ɭɫɬɚɪɟɜɚɸɬ (ɬɚɤ ɧɚɡɵɜɚɟɦɚɹ ɧɟɫɬɚɛɢɥɶɧɨɫɬɶ ɫɬɚɬɢɫɬɢɤ Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X 175 http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɤɨɧɬɟɤɫɬɨɜ); ɫ ɬɨɱɤɢ ɡɪɟɧɢɹ ɬɚɤɨɣ ɚɞɚɩɬɚɰɢɢ ɨɛɵɱɧɵɟ ɚɥɝɨɪɢɬɦɵ PPM ɭɫɬɭɩɚɸɬ ɚɥɝɨɪɢɬɦɚɦ ɬɢɩɚ LZ77, ɯɨɬɹ ɢɡɜɟɫɬɧɵ ɫɩɨɫɨɛɵ ɨɫɥɚɛɥɟɧɢɹ ɢɥɢ, ɜɨɨɛɳɟ, ɭɫɬɪɚɧɟɧɢɹ ɷɬɨɝɨ ɧɟɩɪɢɹɬɧɨɝɨ ɷɮɮɟɤɬɚ (ɫɦ. ɩɨɞɩɭɧɤɬ «Ɉɛɳɢɣ ɫɥɭɱɚɣ ɩɪɢɦɟɧɟɧɢɹ ɜɬɨɪɢɱɧɨɣ ɨɰɟɧɤɢ ɫɢɦɜɨɥɚ»); • ɛɨɥɶɲɢɟ ɡɚɩɪɨɫɵ ɩɚɦɹɬɢ — ɞɟɫɹɬɤɢ ɦɟɝɚɛɚɣɬɨɜ — ɜ ɫɥɭɱɚɟ ɢɫɩɨɥɶɡɨɜɚɧɢɹ ɫɥɨɠɧɵɯ ɦɨɞɟɥɟɣ ɜɵɫɨɤɨɝɨ ɩɨɪɹɞɤɚ ɜ ɫɨɱɟɬɚɧɢɢ ɫ ɫɢɦɦɟɬɪɢɱɧɨɫɬɶɸ ɚɥɝɨɪɢɬɦɚ ɩɪɟɩɹɬɫɬɜɭɸɬ ɨɪɝɚɧɢɡɚɰɢɢ ɷɮɮɟɤɬɢɜɧɨɝɨ ɞɨɫɬɭɩɚ ɤ ɫɠɚɬɵɦ ɞɚɧɧɵɦ; • ɡɚɦɟɬɧɵɣ ɩɪɨɢɝɪɵɲ ɜ ɷɮɮɟɤɬɢɜɧɨɫɬɢ ɩɨ ɫɪɚɜɧɟɧɢɸ ɫ ɚɥɝɨɪɢɬɦɚɦɢ ɬɢɩɚ LZ77 ɩɪɢ ɫɠɚɬɢɢ ɮɚɣɥɨɜ, ɢɦɟɸɳɢɯ ɞɥɢɧɧɵɟ ɩɨɜɬɨɪɹɸɳɢɟɫɹ ɛɥɨɤɢ ɫɢɦɜɨɥɨɜ. ɉɪɚɤɬɢɱɟɫɤɢ ɜɫɟɝɞɚ ɦɨɠɧɨ ɩɨɞɨɛɪɚɬɶ ɢ ɧɚɫɬɪɨɢɬɶ ɬɚɤɭɸ PPM-ɦɨɞɟɥɶ, ɢɥɢ, ɬɨɱɧɟɟ, ɤɨɧɬɟɤɫɬɧɭɸ ɦɨɞɟɥɶ ɫ ɧɟɹɜɧɵɦ ɜɡɜɟɲɢɜɚɧɢɟɦ, ɱɬɨ ɨɧɚ ɛɭɞɟɬ ɞɚɜɚɬɶ ɥɭɱɲɟɟ ɫɠɚɬɢɟ, ɱɟɦ LZ ɢɥɢ BWT. ɇɟɫɦɨɬɪɹ ɧɚ ɷɬɨ, ɩɪɢɦɟɧɟɧɢɟ PPM-ɤɨɦɩɪɟɫɫɨɪɨɜ ɰɟɥɟɫɨɨɛɪɚɡɧɨ ɝɥɚɜɧɵɦ ɨɛɪɚɡɨɦ ɞɥɹ ɫɠɚɬɢɹ ɬɟɤɫɬɨɜ ɧɚ ɟɫɬɟɫɬɜɟɧɧɵɯ ɹɡɵɤɚɯ ɢ ɩɨɞɨɛɧɵɯ ɢɦ ɞɚɧɧɵɯ, ɩɨɫɤɨɥɶɤɭ ɩɪɢ ɨɛɪɚɛɨɬɤɟ ɦɚɥɨɢɡɛɵɬɨɱɧɵɯ ɮɚɣɥɨɜ ɜɟɥɢɤɢ ɜɪɟɦɟɧɧɵɟ ɡɚɬɪɚɬɵ. ɂɡɛɵɬɨɱɧɵɟ ɮɚɣɥɵ ɫ ɞɥɢɧɧɵɦɢ ɩɨɜɬɨɪɹɸɳɢɦɢɫɹ ɫɬɪɨɤɚɦɢ (ɧɚɩɪɢɦɟɪ, ɬɟɤɫɬɵ ɩɪɨɝɪɚɦɦ) ɢɦɟɟɬ ɫɦɵɫɥ ɫɠɢɦɚɬɶ ɫ ɩɨɦɨɳɶɸ BWTɤɨɦɩɪɟɫɫɨɪɨɜ ɢ ɞɚɠɟ ɫɥɨɜɚɪɧɵɯ ɤɨɦɩɪɟɫɫɨɪɨɜ, ɬɚɤ ɤɚɤ ɫɨɨɬɧɨɲɟɧɢɟ ɫɠɚɬɢɟ-ɫɤɨɪɨɫɬɶ-ɩɚɦɹɬɶ ɨɛɵɱɧɨ ɥɭɱɲɟ. Ⱦɥɹ ɫɢɥɶɧɨ ɢɡɛɵɬɨɱɧɵɯ ɞɚɧɧɵɯ ɩɪɟɞɩɨɱɬɢɬɟɥɶɧɟɟ ɜɫɟ-ɬɚɤɢ ɢɫɩɨɥɶɡɨɜɚɬɶ PPM, ɬɚɤ ɤɚɤ ɦɟɬɨɞɵ LZ ɢ BWT, ɨɫɨɛɟɧɧɨ ɧɟ ɢɫɩɨɥɶɡɭɸɳɢɟ ɩɪɟɞɨɛɪɚɛɨɬɤɭ, ɪɚɛɨɬɚɸɬ ɩɪɢ ɷɬɨɦ ɫɪɚɜɧɢɬɟɥɶɧɨ ɦɟɞɥɟɧɧɨ ɢɡ-ɡɚ ɞɟɝɪɚɞɚɰɢɢ ɫɬɪɭɤɬɭɪ ɞɚɧɧɵɯ. ɏɚɪɚɤɬɟɪɢɫɬɢɤɢ ɚɥɝɨɪɢɬɦɨɜ ɫɟɦɟɣɫɬɜɚ PPM: ɋɬɟɩɟɧɢ ɫɠɚɬɢɹ: ɨɩɪɟɞɟɥɹɸɬɫɹ ɞɚɧɧɵɦɢ, ɞɥɹ ɬɟɤɫɬɨɜ ɨɛɵɱɧɨ 3–4, ɞɥɹ ɨɛɴɟɤɬɧɵɯ ɮɚɣɥɨɜ 2–3. Ɍɢɩɵ ɞɚɧɧɵɯ: ɚɥɝɨɪɢɬɦɵ ɭɧɢɜɟɪɫɚɥɶɧɵ, ɧɨ ɥɭɱɲɟ ɜɫɟɝɨ ɩɨɞɯɨɞɹɬ ɞɥɹ ɫɠɚɬɢɹ ɬɟɤɫɬɨɜ. 176 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɋɢɦɦɟɬɪɢɱɧɨɫɬɶ: ɛɥɢɡɤɚ ɤ 1; ɨɛɵɱɧɨ ɞɟɤɨɞɟɪ ɧɟɦɧɨɝɨ ɦɟɞɥɟɧɧɟɟ ɤɨɞɟɪɚ. ɏɚɪɚɤɬɟɪɧɵɟ ɨɫɨɛɟɧɧɨɫɬɢ: ɦɟɞɥɟɧɧɚɹ ɨɛɪɚɛɨɬɤɚ ɦɚɥɨ ɢɡɛɵɬɨɱɧɵɯ ɞɚɧɧɵɯ.
Ʉɨɦɩɪɟɫɫɨɪɵ ɢ ɚɪɯɢɜɚɬɨɪɵ, ɢɫɩɨɥɶɡɭɸɳɢɟ ɤɨɧɬɟɤɫɬɧɨɟ ɦɨɞɟɥɢɪɨɜɚɧɢɟ HA
ɉɪɨɝɪɚɦɦɚ HA ɹɜɢɥɚɫɶ, ɩɨɠɚɥɭɣ, ɩɟɪɜɵɦ ɩɭɛɥɢɱɧɨ ɞɨɫɬɭɩɧɵɦ ɚɪɯɢɜɚɬɨɪɨɦ, ɢɫɩɨɥɶɡɭɸɳɢɦ ɤɨɧɬɟɤɫɬɧɨɟ ɦɨɞɟɥɢɪɨɜɚɧɢɟ. ɇɟ ɢɫɤɥɸɱɟɧɨ, ɱɬɨ HA ɫɬɚɥ ɛɵ ɨɱɟɧɶ ɩɨɩɭɥɹɪɧɵɦ ɚɪɯɢɜɚɬɨɪɨɦ, ɟɫɥɢ ɛɵ ɟɝɨ ɚɜɬɨɪ, Ƚɚɪɪɢ ɏɢɪɜɨɥɚ (Hirvola), ɧɟ ɩɪɟɤɪɚɬɢɥ ɪɚɛɨɬɚɬɶ ɧɚɞ ɩɪɨɟɤɬɨɦ. ȼ HA ɪɟɚɥɢɡɨɜɚɧɵ ɚɥɝɨɪɢɬɦ ɫɟɦɟɣɫɬɜɚ LZ77 ɢ ɚɥɝɨɪɢɬɦ ɬɢɩɚ PPM. Ⱥɥɝɨɪɢɬɦ PPM ɩɪɟɞɫɬɚɜɥɹɟɬ ɫɨɛɨɣ ɯɨɪɨɲɨ ɩɪɨɞɭɦɚɧɧɭɸ ɦɨɞɢɮɢɤɚɰɢɸ ɤɥɚɫɫɢɱɟɫɤɨɝɨ PPMC. Ɇɟɬɨɞ Ɉȼɍ ɹɜɥɹɟɬɫɹ ɚɩɪɢɨɪɧɵɦ ɢ ɨɫɧɨɜɵɜɚɟɬ ɨɰɟɧɤɭ ɭɯɨɞɚ ɢɡ ɄɆ ɧɚ ɤɨɥɢɱɟɫɬɜɟ ɢɦɟɸɳɢɯɫɹ ɜ ɧɟɣ ɫɢɦɜɨɥɨɜ ɫ ɧɟɛɨɥɶɲɨɣ ɱɚɫɬɨɬɨɣ. LOE ɧɟ ɩɪɨɢɡɜɨɞɢɬɫɹ, ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɶ ɫɩɭɫɤɚ ɫ ɄɆ ɜɵɫɨɤɢɯ ɩɨɪɹɞɤɨɜ ɹɜɥɹɟɬɫɹ ɨɛɵɱɧɨɣ. Ɇɚɤɫɢɦɚɥɶɧɵɣ ɩɨɪɹɞɨɤ ɄɆ ɪɚɜɟɧ 4, ɦɢɧɢɦɚɥɶɧɵɣ — ɦɢɧɭɫ ɟɞɢɧɢɰɟ. Ⱦɥɹ ɨɪɝɚɧɢɡɚɰɢɢ ɩɨɢɫɤɚ ɄɆ ɩɪɢɦɟɧɹɸɬɫɹ ɯɟɲ-ɰɟɩɨɱɤɢ. ɏɟɲɢɪɨɜɚɧɢɟ ɨɫɭɳɟɫɬɜɥɹɟɬɫɹ ɩɨ ɫɢɦɜɨɥɚɦ ɤɨɧɬɟɤɫɬɚ ɢ ɟɝɨ ɞɥɢɧɟ. Ɋɟɡɭɥɶɬɚɬɵ ɬɟɫɬɢɪɨɜɚɧɢɹ ɧɚ CalgCC, ɩɪɟɞɫɬɚɜɥɟɧɧɵɟ ɜ ɬɚɛɥ. 4.8, ɩɨɥɭɱɟɧɵ ɞɥɹ ɜɟɪɫɢɢ 0.999c. ɋɠɚɬɢɟ ɮɚɣɥɨɜ ɨɫɭɳɟɫɬɜɥɹɥɨɫɶ ɫ ɩɨɦɨɳɶɸ ɦɟɬɨɞɚ 2 ɩɪɨɝɪɚɦɦɵ, ɤɨɬɨɪɵɣ ɤɚɤ ɪɚɡ ɢ ɫɨɨɬɜɟɬɫɬɜɭɟɬ PPM. Ⱥɪɯɢɜɚɬɨɪ ɪɚɡɪɚɛɚɬɵɜɚɥɫɹ ɞɥɹ ɪɚɛɨɬɵ ɜ MS DOS, ɢ ɪɚɡɦɟɪ ɢɫɩɨɥɶɡɭɟɦɨɣ ɩɚɦɹɬɢ ɨɝɪɚɧɢɱɟɧ ɩɪɢɦɟɪɧɨ 400 ɤɛɚɣɬ, ɱɬɨ, ɜɨɨɛɳɟ ɝɨɜɨɪɹ, ɦɚɥɨ ɞɥɹ ɦɨɞɟɥɢ 4 ɩɨɪɹɞɤɚ, ɩɨɷɬɨɦɭ ɫɠɚɬɢɟ ɦɨɠɄɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X 177 http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɧɨ ɫɭɳɟɫɬɜɟɧɧɨ ɭɥɭɱɲɢɬɶ ɡɚ ɫɱɟɬ ɭɜɟɥɢɱɟɧɢɹ ɨɛɴɟɦɚ ɞɨɫɬɭɩɧɨɣ ɩɚɦɹɬɢ. CM
CM Ȼɭɥɚɬɚ Ɂɢɝɚɧɲɢɧɚ (Ziganshin) ɹɜɥɹɟɬɫɹ ɤɨɦɩɪɟɫɫɨɪɨɦ, ɩɪɢɦɟɧɹɸɳɢɦ ɛɥɨɱɧɨ-ɚɞɚɩɬɢɜɧɨɟ ɤɨɧɬɟɤɫɬɧɨɟ ɦɨɞɟɥɢɪɨɜɚɧɢɟ. Ⱥɥɝɨɪɢɬɦ ɪɚɛɨɬɵ ɤɨɞɟɪɚ ɫɥɟɞɭɸɳɢɣ. ɑɢɬɚɟɬɫɹ ɛɥɨɤ ɜɯɨɞɧɵɯ ɞɚɧɧɵɯ, ɩɨ ɭɦɨɥɱɚɧɢɸ ɞɨ 1 Ɇɛɚɣɬ, ɢ ɧɚ ɨɫɧɨɜɚɧɢɢ ɟɝɨ ɫɬɚɬɢɫɬɢɤɢ ɫɬɪɨɢɬɫɹ ɦɨɞɟɥɶ ɡɚɞɚɧɧɨɝɨ ɩɨɪɹɞɤɚ N. Ɇɨɞɟɥɶ ɫɨɯɪɚɧɹɟɬɫɹ ɜ ɤɨɦɩɚɤɬɧɨɦ ɜɢɞɟ ɜ ɜɵɯɨɞɧɨɦ ɮɚɣɥɟ, ɩɨɫɥɟ ɱɟɝɨ ɫ ɟɟ ɢɫɩɨɥɶɡɨɜɚɧɢɟɦ ɤɨɞɢɪɭɟɬɫɹ ɫɚɦ ɫɱɢɬɚɧɧɵɣ ɛɥɨɤ ɞɚɧɧɵɯ. Ɂɚɬɟɦ, ɟɫɥɢ ɟɳɟ ɧɟ ɜɟɫɶ ɜɯɨɞɧɨɣ ɮɚɣɥ ɨɛɪɚɛɨɬɚɧ, ɩɪɨɢɡɜɨɞɹɬɫɹ ɚɧɚɥɨɝɢɱɧɵɟ ɞɟɣɫɬɜɢɹ ɞɥɹ ɫɥɟɞɭɸɳɟɝɨ ɛɥɨɤɚ ɢ ɬ.ɞ. ɂɞɟɹ ɩɨɫɬɪɨɟɧɢɹ ɦɨɞɟɥɢ ɡɚɤɥɸɱɚɟɬɫɹ ɜ ɫɥɟɞɭɸɳɟɦ: • ɩɟɪɜɨɧɚɱɚɥɶɧɨ ɫɬɪɨɢɬɫɹ ɦɨɞɟɥɶ ɩɨɪɹɞɤɚ N, ɫɨɞɟɪɠɚɳɚɹ ɫɬɚɬɢɫɬɢɤɭ ɞɥɹ ɜɫɟɯ ɜɫɬɪɟɱɟɧɧɵɯ ɜ ɛɥɨɤɟ ɤɨɧɬɟɤɫɬɨɜ ɞɥɢɧɨɣ ɨɬ 0 ɞɨ N; • ɢɡ ɦɨɞɟɥɢ ɭɞɚɥɹɸɬɫɹ ɤɨɧɬɟɤɫɬɧɵɟ ɦɨɞɟɥɢ ɢ ɫɱɟɬɱɢɤɢ ɫɢɦɜɨɥɨɜ ɫ ɱɚɫɬɨɬɨɣ ɦɟɧɶɲɟ ɩɨɪɨɝɚ fmin, ɹɜɥɹɸɳɟɝɨɫɹ ɩɚɪɚɦɟɬɪɨɦ ɚɥɝɨɪɢɬɦɚ. Ⱦɟɪɟɜɨ ɨɫɬɚɜɲɢɯɫɹ ɄɆ ɡɚɩɢɫɵɜɚɟɬɫɹ ɜ ɜɵɯɨɞɧɨɣ ɮɚɣɥ, ɩɪɢ ɷɬɨɦ ɨɩɢɫɚɧɢɹ ɫɢɦɜɨɥɨɜ ɢ ɢɯ ɱɚɫɬɨɬ ɜ ɨɩɪɟɞɟɥɟɧɧɵɯ ɄɆ ɫɠɢɦɚɸɬɫɹ ɧɚ ɨɫɧɨɜɚɧɢɢ ɢɧɮɨɪɦɚɰɢɢ ɄɆ-ɩɪɟɞɤɨɜ. Ɉɰɟɧɤɚ ɜɟɪɨɹɬɧɨɫɬɢ ɭɯɨɞɚ ɢɡ ɄɆ ɩɪɢ ɤɨɞɢɪɨɜɚɧɢɢ ɫɚɦɢɯ ɞɚɧɧɵɯ ɡɚɜɢɫɢɬ ɨɬ ɤɨɥɢɱɟɫɬɜɚ ɟɟ ɞɨɱɟɪɧɢɯ ɄɆ, ɭɞɚɥɟɧɧɵɯ ɩɪɢ «ɩɪɨɱɢɫɬɤɟ» ɦɨɞɟɥɢ. ɋɨɛɫɬɜɟɧɧɨ ɚɥɝɨɪɢɬɦ ɨɰɟɧɤɢ ɜɟɪɨɹɬɧɨɫɬɢ ɫɢɦɜɨɥɨɜ ɧɟ ɨɬɥɢɱɚɟɬɫɹ ɨɬ ɤɥɚɫɫɢɱɟɫɤɨɝɨ PPM. ɉɪɨɝɪɚɦɦɚ ɧɚɩɢɫɚɧɚ ɞɨɫɬɚɬɨɱɧɨ ɞɚɜɧɨ ɢ ɧɟ ɨɬɜɟɱɚɟɬ ɫɨɜɪɟɦɟɧɧɵɦ ɬɪɟɛɨɜɚɧɢɹɦ ɧɚ ɫɨɨɬɧɨɲɟɧɢɟ ɫɤɨɪɨɫɬɢ ɢ ɫɬɟɩɟɧɢ ɫɠɚɬɢɹ. Ɍɟɦ ɧɟ ɦɟɧɟɟ, CM ɞɟɦɨɧɫɬɪɢɪɭɟɬ ɢɧɬɟɪɟɫɧɵɣ ɩɨɞɯɨɞ, ɢ ɩɪɢ ɫɨɨɬɜɟɬɫɬɜɭɸɳɟɣ ɞɨɪɚɛɨɬɤɟ ɩɪɚɤɬɢɱɟɫɤɨɟ ɢɫɩɨɥɶɡɨɜɚɧɢɟ ɬɚɤɨɣ ɬɟɯɧɢɤɢ ɦɨɠɟɬ ɛɵɬɶ ɰɟɥɟɫɨɨɛɪɚɡɧɨ. ɏɚɪɚɤɬɟɪɢɫɬɢɤɢ ɫɬɟɩɟɧɢ ɫɠɚɬɢɹ ɤɨɦɩɪɟɫɫɨɪɚ, ɩɪɢɜɟɞɟɧɧɵɟ ɜ ɬɚɛɥ. 4.8, ɛɵɥɢ ɩɨɥɭɱɟɧɵ ɩɪɢ ɡɚɩɭɫɤɟ ɩɪɨɝɪɚɦɦɵ ɫ ɩɚɪɚɦɟɬɪɚɦɢ –o4 ɢ –m10000000, ɬ.ɟ. ɛɵɥ ɡɚɞɚɧ ɩɨɪɹɞɨɤ N = 4, ɚ ɦɚɤɫɢɦɚɥɶ178 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɧɵɣ ɨɛɴɟɦ ɩɚɦɹɬɢ ɞɥɹ ɯɪɚɧɟɧɢɹ ɦɨɞɟɥɢ ɛɵɥ ɭɜɟɥɢɱɟɧ ɫ 5 Ɇɛɚɣɬ, ɢɫɩɨɥɶɡɭɟɦɵɯ ɩɨ ɭɦɨɥɱɚɧɢɸ, ɞɨ 10 Ɇɛɚɣɬ, ɱɬɨ ɨɛɟɫɩɟɱɢɥɨ ɨɬɫɭɬɫɬɜɢɟ ɩɟɪɟɩɨɥɧɟɧɢɹ ɩɪɢ ɨɛɪɚɛɨɬɤɟ ɜɫɟɯ ɮɚɣɥɨɜ CalgCC. RK ɂ RKUC
ɋ ɬɨɱɤɢ ɡɪɟɧɢɹ ɤɨɷɮɮɢɰɢɟɧɬɚ ɫɠɚɬɢɹ, ɪɚɡɪɚɛɚɬɵɜɚɟɦɵɣ Ɇɚɥɶɤɨɥɶɦɨɦ Ɍɟɣɥɨɪɨɦ (Taylor) ɚɪɯɢɜɚɬɨɪ RK ɹɜɥɹɟɬɫɹ ɥɭɱɲɢɦ ɫɪɟɞɢ ɫɭɳɟɫɬɜɭɸɳɢɯ ɧɚ ɦɨɦɟɧɬ ɧɚɩɢɫɚɧɢɹ ɷɬɨɣ ɤɧɢɝɢ. ɇɨ ɞɨɫɬɢɝɚɟɬɫɹ ɷɬɨ ɧɟ ɫɬɨɥɶɤɨ ɡɚ ɫɱɟɬ ɨɱɟɧɶ ɯɨɪɨɲɟɝɨ PPMɤɨɦɩɪɟɫɫɨɪɚ, ɫɤɨɥɶɤɨ ɛɥɚɝɨɞɚɪɹ ɛɨɥɶɲɨɦɭ ɤɨɥɢɱɟɫɬɜɭ ɩɪɢɦɟɧɹɟɦɵɯ ɬɟɯɧɢɤ ɩɪɟɞɜɚɪɢɬɟɥɶɧɨɝɨ ɩɪɟɨɛɪɚɡɨɜɚɧɢɹ ɞɚɧɧɵɯ, ɩɨɡɜɨɥɹɸɳɢɯ ɡɧɚɱɢɬɟɥɶɧɨ ɭɥɭɱɲɢɬɶ ɫɠɚɬɢɟ ɮɚɣɥɨɜ ɨɩɪɟɞɟɥɟɧɧɵɯ ɬɢɩɨɜ. ɂɦɟɧɧɨ ɝɪɚɦɨɬɧɨ ɪɟɚɥɢɡɨɜɚɧɧɵɣ ɩɪɟɩɪɨɰɟɫɫɢɧɝ ɢ ɩɨɡɜɨɥɹɟɬ ɩɨɤɚɡɵɜɚɬɶ RK ɫɬɚɛɢɥɶɧɨ ɯɨɪɨɲɢɟ ɪɟɡɭɥɶɬɚɬɵ ɩɪɢ ɫɠɚɬɢɢ ɬɚɤɢɯ ɬɢɩɨɜɵɯ ɞɚɧɧɵɯ, ɤɚɤ ɨɛɴɟɤɬɧɵɟ ɮɚɣɥɵ, ɮɚɣɥɵ ɪɟɫɭɪɫɨɜ, ɞɨɤɭɦɟɧɬɵ MS Word ɢ ɬɚɛɥɢɰɵ MS Excel, ɬɟɤɫɬɵ ɧɚ ɚɧɝɥɢɣɫɤɨɦ ɹɡɵɤɟ. ȼ RK ɪɟɚɥɢɡɨɜɚɧɨ ɞɜɚ ɚɥɝɨɪɢɬɦɚ: ɫɬɚɬɢɫɬɢɱɟɫɤɢɣ ɬɢɩɚ PPM ɢ ɫɥɨɜɚɪɧɵɣ ɬɢɩɚ Ɂɢɜɚ-Ʌɟɦɩɟɥɚ. ȼ ɤɚɱɟɫɬɜɟ PPM-ɤɨɦɩɪɟɫɫɨɪɚ ɜ RK ɩɪɢɦɟɧɹɟɬɫɹ ɨɛɥɟɝɱɟɧɧɵɣ ɜɚɪɢɚɧɬ ɩɪɨɝɪɚɦɦɵ RKUC, ɫɨɡɞɚɧɧɨɣ ɬɚɤɠɟ Ɍɟɣɥɨɪɨɦ. ɋ ɭɱɟɬɨɦ ɫɤɚɡɚɧɧɨɝɨ ɦɵ ɢɫɤɥɸɱɢɥɢ RK ɢɡ ɬɚɛɥɢɰɵ ɫɪɚɜɧɟɧɢɹ ɤɨɧɬɟɤɫɬɧɵɯ ɤɨɦɩɪɟɫɫɨɪɨɜ ɩɨ ɫɬɟɩɟɧɢ ɫɠɚɬɢɹ (ɬɚɛɥ. 4.8). RKUC ɪɟɚɥɢɡɭɟɬ ɤɨɧɬɟɤɫɬɧɨɟ ɦɨɞɟɥɢɪɨɜɚɧɢɟ ɫ ɦɚɤɫɢɦɚɥɶɧɵɦ ɩɨɪɹɞɤɨɦ 16. ɉɨɪɹɞɨɤ ɄɆ ɦɨɠɟɬ ɛɵɬɶ ɪɚɜɟɧ 16, 12, 8, 5, …, 0 ɢ, ɜɟɪɨɹɬɧɨ, –1. ɂɧɚɱɟ ɝɨɜɨɪɹ ɜ RKUC ɢɫɩɨɥɶɡɭɟɬɫɹ ɨɬɥɢɱɚɸɳɢɣɫɹ ɨɬ ɤɥɚɫɫɢɱɟɫɤɨɝɨ ɦɟɯɚɧɢɡɦ ɜɵɛɨɪɚ ɩɨɪɹɞɤɚ ɫɥɟɞɭɸɳɟɣ ɄɆ ɜ ɫɥɭɱɚɟ ɭɯɨɞɚ. ȼ ɞɨɩɨɥɧɟɧɢɟ ɤ ɷɬɨɦɭ ɜ ɡɚɜɢɫɢɦɨɫɬɢ ɨɬ ɩɚɪɚɦɟɬɪɨɜ ɜɵɡɨɜɚ ɩɪɨɝɪɚɦɦɵ ɦɨɠɟɬ ɜɵɩɨɥɧɹɬɶɫɹ LOE. ȿɳɟ ɨɞɧɚ ɢɡ ɨɩɰɢɣ ɤɨɦɩɪɟɫɫɨɪɚ ɪɚɡɪɟɲɚɟɬ ɢɫɩɨɥɶɡɨɜɚɬɶ ɩɪɢ ɨɰɟɧɤɟ ɜɟɪɨɹɬɧɨɫɬɢ ɫɬɚɬɢɫɬɢɤɭ, ɧɚɤɨɩɥɟɧɧɭɸ ɞɥɹ ɪɚɡɛɪɨɫɚɧɧɵɯ (sparse) ɤɨɧɬɟɤɫɬɨɜ, ɢɥɢ ɛɢɧɚɪɧɵɯ (binary) ɜ ɬɟɪɦɢɧɨɥɨɝɢɢ ɚɜɬɨɪɚ ɤɨɦɩɪɟɫɫɨɪɚ. ɂɞɟɹ ɡɚɤɥɸɱɚɟɬɫɹ ɜ ɬɨɦ, ɱɬɨ ɧɟɫɤɨɥɶɤɨ ɨɛɵɱɧɵɯ ɤɨɧɬɟɤɫɬɨɜ ɨɞɢɧɚɤɨɜɨɣ ɞɥɢɧɵ ɦɨɝɭɬ ɫɱɢɬɚɬɶɫɹ ɨɞɧɢɦ Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X 179 http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɤɨɧɬɟɤɫɬɨɦ, ɟɫɥɢ ɜ ɨɩɪɟɞɟɥɟɧɧɵɯ ɩɨɡɢɰɢɹɯ ɢɯ ɫɢɦɜɨɥɵ ɨɞɢɧɚɤɨɜɵ. ɇɚɩɪɢɦɟɪ, ɟɫɥɢ ɞɥɹ ɤɨɧɬɟɤɫɬɨɜ ɞɥɢɧɵ 4 ɬɪɟɛɭɟɬɫɹ ɫɨɜɩɚɞɟɧɢɹ ɩɟɪɜɨɝɨ7 (ɩɨɫɥɟɞɧɟɝɨ ɨɛɪɚɛɨɬɚɧɧɨɝɨ), ɜɬɨɪɨɝɨ ɢ ɱɟɬɜɟɪɬɨɝɨ ɫɢɦɜɨɥɨɜ, ɬɨ ɫɬɪɨɤɢ «ɚɛɫɞ» ɢ «ɚɚɫɞ» ɹɜɥɹɸɬɫɹ ɨɞɧɢɦ ɢ ɬɟɦ ɠɟ ɪɚɡɛɪɨɫɚɧɧɵɦ ɤɨɧɬɟɤɫɬɨɦ «ɚXɫɞ», ɝɞɟ X — ɥɸɛɨɣ ɫɢɦɜɨɥ. Ɍɚɤɢɦ ɨɛɪɚɡɨɦ, ɬɟɯɧɢɤɚ ɪɚɡɛɪɨɫɚɧɧɵɯ ɤɨɧɬɟɤɫɬɨɜ ɡɚɤɥɸɱɚɟɬɫɹ ɜ ɨɛɴɟɞɢɧɟɧɢɢ ɢɧɮɨɪɦɚɰɢɢ, ɫɨɛɢɪɚɟɦɨɣ ɞɥɹ ɧɟɫɤɨɥɶɤɢɯ ɤɥɚɫɫɢɱɟɫɤɢɯ ɤɨɧɬɟɤɫɬɨɜ. ɉɪɢɦɟɧɟɧɢɟ ɷɬɨɝɨ ɦɟɯɚɧɢɡɦɚ ɱɚɫɬɨ ɩɨɡɜɨɥɹɟɬ ɡɚɦɟɬɧɨ ɭɥɭɱɲɢɬɶ ɫɠɚɬɢɟ ɛɥɨɤɨɜ ɞɚɧɧɵɯ ɫ ɪɟɝɭɥɹɪɧɨɣ ɫɬɪɭɤɬɭɪɨɣ. ȼ RKUC ɩɪɢɦɟɧɹɟɬɫɹ ɭɥɭɱɲɟɧɧɵɣ ɜɚɪɢɚɧɬ ɚɞɚɩɬɢɜɧɨɣ Ɉȼɍ ɩɨ ɦɟɬɨɞɭ Z. ɉɪɢ ɬɟɫɬɢɪɨɜɚɧɢɢ ɢɫɩɨɥɶɡɨɜɚɥɫɹ RKUC ɜɟɪɫɢɢ 1.04, ɤɨɬɨɪɵɣ ɡɚɩɭɫɤɚɥɫɹ ɫ ɩɚɪɚɦɟɬɪɚɦɢ -m10 -o16 -x -b, ɬ.ɟ. ɢɫɩɨɥɶɡɨɜɚɥɚɫɶ ɦɨɞɟɥɶ 16 ɩɨɪɹɞɤɚ, ɨɝɪɚɧɢɱɟɧɧɚɹ 10 Ɇɛɚɣɬ ɩɚɦɹɬɢ, ɢ ɛɵɥɢ ɜɤɥɸɱɟɧɵ ɦɟɯɚɧɢɡɦɵ LOE ɢ ɪɚɡɛɪɨɫɚɧɧɵɯ ɤɨɧɬɟɤɫɬɨɜ. ȿɫɥɢ ɨɬɤɚɡɚɬɶɫɹ ɨɬ ɢɫɩɨɥɶɡɨɜɚɧɢɹ ɪɚɡɛɪɨɫɚɧɧɵɯ ɤɨɧɬɟɤɫɬɨɜ, ɬɨ ɫɬɟɩɟɧɶ ɫɠɚɬɢɹ ɬɟɤɫɬɨɜɵɯ ɮɚɣɥɨɜ ɭɥɭɱɲɚɟɬɫɹ ɩɪɢɦɟɪɧɨ ɧɚ 1%, ɚ ɛɢɧɚɪɧɵɯ (Geo, Obj1, Obj2) — ɭɯɭɞɲɚɟɬɫɹ ɧɚ ɧɟɫɤɨɥɶɤɨ ɩɪɨɰɟɧɬɨɜ. PPMN
Ʉɨɦɩɪɟɫɫɨɪ PPMN ɪɚɡɪɚɛɨɬɚɧ Ɇɚɤɫɢɦɨɦ ɋɦɢɪɧɨɜɵɦ (Smirnov) ɜ ɷɤɫɩɟɪɢɦɟɧɬɚɥɶɧɵɯ ɰɟɥɹɯ. Ɉɫɧɨɜɧɚɹ ɰɟɥɶ ɪɚɡɪɚɛɨɬɤɢ ɫɨɫɬɨɹɥɚ ɜ ɫɨɡɞɚɧɢɢ PPM-ɤɨɦɩɪɟɫɫɨɪɚ, ɨɛɟɫɩɟɱɢɜɚɸɳɟɝɨ ɫɬɟɩɟɧɶ ɫɠɚɬɢɹ ɧɚ ɭɪɨɜɧɟ ɤɨɦɩɪɟɫɫɨɪɨɜ, ɢɫɩɨɥɶɡɭɸɳɢɯ ɪɚɡɧɨɜɢɞɧɨɫɬɢ ɚɥɝɨɪɢɬɦɚ PPMZ, ɢ ɡɧɚɱɢɬɟɥɶɧɨ ɛɨɥɟɟ ɜɵɫɨɤɭɸ ɫɤɨɪɨɫɬɶ ɤɨɞɢɪɨɜɚɧɢɹ ɩɪɢ ɦɟɧɶɲɢɯ ɨɝɪɚɧɢɱɟɧɢɹɯ ɧɚ ɨɛɴɟɦ ɢɫɩɨɥɶɡɭɟɦɨɣ ɩɚɦɹɬɢ. ȼ PPMN ɪɟɚɥɢɡɨɜɚɧ ɚɥɝɨɪɢɬɦ PPM ɫ ɨɝɪɚɧɢɱɟɧɧɵɦ ɩɨɪɹɞɤɨɦ ɤɨɧɬɟɤɫɬɨɜ. Ɇɚɤɫɢɦɚɥɶɧɵɣ ɩɨɪɹɞɨɤ N ɦɨɞɟɥɢ ɪɚɜɟɧ 7, ɧɨ
7
ɋɢɦɜɨɥɵ ɤɨɧɬɟɤɫɬɚ ɨɛɵɱɧɨ ɧɭɦɟɪɭɸɬɫɹ ɫɩɪɚɜɚ ɧɚɥɟɜɨ, ɩɨɷɬɨɦɭ ɩɟɪɜɵɣ ɫɢɦɜɨɥ ɤɨɧɬɟɤɫɬɚ ɫɨɨɬɜɟɬɫɬɜɭɟɬ ɩɨɫɥɟɞɧɟɦɭ ɨɛɪɚɛɨɬɚɧɧɨɦɭ
180 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɬɚɤɠɟ ɪɟɚɥɢɡɨɜɚɧɵ ɜɚɪɢɚɧɬɵ ɦɨɞɟɥɢ ɫ «ɩɫɟɜɞɨɩɨɪɹɞɤɚɦɢ» 8 ɢ 9, ɩɪɢ ɤɨɬɨɪɵɯ ɤɚɠɞɨɣ ɄɆ(N), N = 8…9, ɜ ɞɟɣɫɬɜɢɬɟɥɶɧɨɫɬɢ ɦɨɠɟɬ ɫɨɨɬɜɟɬɫɬɜɨɜɚɬɶ ɧɟɫɤɨɥɶɤɨ ɤɨɧɬɟɤɫɬɨɜ ɩɨɪɹɞɤɚ N. ɂɧɚɱɟ ɝɨɜɨɪɹ, ɨɫɭɳɟɫɬɜɥɹɟɬɫɹ ɫɦɟɲɢɜɚɧɢɟ ɫɬɚɬɢɫɬɢɤɢ, ɧɚɛɢɪɚɟɦɨɣ ɞɥɹ ɧɟɫɤɨɥɶɤɢɯ ɩɨɯɨɠɢɯ ɤɨɧɬɟɤɫɬɨɜ. Ⱦɥɹ Ɉȼɍ ɢɫɩɨɥɶɡɭɟɬɫɹ ɚɞɚɩɬɢɜɧɵɣ ɦɟɯɚɧɢɡɦ, ɤɨɬɨɪɵɣ ɦɨɠɧɨ ɪɚɫɫɦɚɬɪɢɜɚɬɶ ɤɚɤ ɭɩɪɨɳɟɧɧɵɣ ɦɟɬɨɞ Z. ɂɫɩɨɥɶɡɭɟɬɫɹ ɬɨɥɶɤɨ ɨɞɢɧ ɬɢɩ ɤɨɧɬɟɤɫɬɚ ɭɯɨɞɚ, ɩɨɥɹ ɤɨɬɨɪɨɝɨ ɨɩɪɟɞɟɥɹɸɬɫɹ: • ɩɨɪɹɞɤɨɦ ɄɆ; • ɤɨɥɢɱɟɫɬɜɨɦ ɩɪɨɫɦɨɬɪɨɜ ɄɆ; • ɤɨɥɢɱɟɫɬɜɨɦ ɫɢɦɜɨɥɨɜ ɜ ɄɆ; • ɩɨɫɥɟɞɧɢɦ ɨɛɪɚɛɨɬɚɧɧɵɦ ɫɢɦɜɨɥɨɦ; • ɨɞɧɨɛɢɬɨɜɵɦ ɮɥɚɝɨɦ, ɭɤɚɡɵɜɚɸɳɟɦ ɧɚ ɬɨ, ɱɬɨ ɩɪɢ ɤɨɞɢɪɨɜɚɧɢɢ ɫɬɪɨɤɢ ɩɨɫɥɟɞɧɢɯ ɨɛɪɚɛɨɬɚɧɧɵɯ ɫɢɦɜɨɥɨɜ ɡɚɞɚɧɧɨɣ ɞɥɢɧɵ L = 16 ɧɢ ɪɚɡɭ ɧɟ ɩɪɨɢɫɯɨɞɢɥ ɭɯɨɞ. ȿɫɥɢ ɩɪɟɞɵɞɭɳɢɣ ɫɢɦɜɨɥ ɛɵɥ ɡɚɤɨɞɢɪɨɜɚɧ ɜ ɄɆ ɦɟɧɶɲɟɝɨ ɩɨɪɹɞɤɚ, ɱɟɦ ɭ ɬɟɤɭɳɟɣ ɪɚɫɫɦɚɬɪɢɜɚɟɦɨɣ, ɢɥɢ ɜɟɥɢɱɢɧɚ ɨɰɟɧɤɢ ɜɟɪɨɹɬɧɨɫɬɢ ɭɯɨɞɚ ɡɧɚɱɢɬɟɥɶɧɨ ɦɟɧɶɲɟ ɜɵɱɢɫɥɟɧɧɨɣ ɞɥɹ ɩɪɟɞɵɞɭɳɟɝɨ ɫɢɦɜɨɥɚ, ɬɨ ɩɪɨɢɡɜɨɞɢɬɶɫɹ ɭɜɟɥɢɱɟɧɢɟ ɨɰɟɧɤɢ. Ɉɛɧɨɜɥɟɧɢɟ ɫɱɟɬɱɢɤɨɜ ɤɨɧɬɟɤɫɬɧɨɣ ɦɨɞɟɥɢ ɭɯɨɞɨɜ ɢɦɟɟɬ ɫɥɟɞɭɸɳɭɸ ɫɩɟɰɢɮɢɤɭ: ɟɫɥɢ ɪɚɫɫɦɚɬɪɢɜɚɟɬɫɹ ɄɆ ɦɚɤɫɢɦɚɥɶɧɨɝɨ ɩɨɪɹɞɤɚ ɫɪɟɞɢ ɢɦɟɸɳɢɯɫɹ ɚɤɬɢɜɧɵɯ, ɬ.ɟ. ɧɟ ɩɪɨɢɡɜɨɞɢɥɫɹ ɭɯɨɞ, ɬɨ ɲɚɝ ɭɜɟɥɢɱɟɧɢɹ ɫɱɟɬɱɢɤɨɜ ɄɆɍ ɢɦɟɟɬ ɜɟɫ 4, ɢɧɚɱɟ — 1. Ʉɚɤ ɩɨɤɚɡɵɜɚɸɬ ɷɤɫɩɟɪɢɦɟɧɬɵ, ɢɫɩɨɥɶɡɭɟɦɚɹ ɫɯɟɦɚ ɩɪɟɜɨɫɯɨɞɢɬ ɦɟɬɨɞ Z ɩɨ ɬɨɱɧɨɫɬɢ Ɉȼɍ ɢ ɩɪɢ ɷɬɨɦ ɬɪɟɛɭɟɬ ɦɟɧɶɲɢɯ ɜɵɱɢɫɥɢɬɟɥɶɧɵɯ ɡɚɬɪɚɬ. Ʉɚɤ ɢ ɜ ɤɨɦɩɪɟɫɫɨɪɟ RKUC, ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɶ ɜɵɛɨɪɚ ɩɨɪɹɞɤɚ ɤɨɧɬɟɤɫɬɧɨɣ ɦɨɞɟɥɢ ɜ ɫɥɭɱɚɟ ɭɯɨɞɚ ɨɬɥɢɱɚɟɬɫɹ ɨɬ ɤɥɚɫɫɢɱɟɫɤɨɣ — ɱɚɫɬɶ ɩɨɪɹɞɤɨɜ ɩɪɨɫɬɨ ɧɟ ɢɫɩɨɥɶɡɭɟɬɫɹ. ɇɚɩɪɢɦɟɪ, ɩɪɢ N = 5 PPM-ɦɨɞɟɥɶ ɫɨɫɬɨɢɬ ɢɡ ɤɨɧɬɟɤɫɬɧɵɯ ɦɨɞɟɥɟɣ 5, 3, 2, 1, 0, –1 ɩɨɪɹɞɤɨɜ, ɩɨɷɬɨɦɭ ɜ ɫɥɭɱɚɟ ɭɯɨɞɚ ɢɡ ɄɆ(5) ɪɚɫɫɦɚɬɪɢɜɚɟɬɫɹ ɄɆ(3). Ɍɚɤɨɣ ɩɪɢɟɦ ɩɨɡɜɨɥɹɟɬ ɭɫɤɨɪɢɬɶ ɨɛɪɚɛɨɬɤɭ, ɚ ɭɦɟɧɶɲɟɧɢɟ ɫɬɟɩɟɧɢ ɫɠɚɬɢɹ ɥɢɛɨ ɧɟɡɧɚɱɢɬɟɥɶɧɨ, ɥɢɛɨ, ɧɚɨɛɨɪɨɬ, ɧɚɛɥɸɞɚɟɬɫɹ ɟɟ ɭɜɟɥɢɱɟɧɢɟ. Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X 181 http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
Ʉɚɤ ɭɠɟ ɭɩɨɦɢɧɚɥɨɫɶ ɪɚɧɟɟ, ɜ PPMN ɢɫɩɨɥɶɡɭɟɬɫɹ ɦɚɫɲɬɚɛɢɪɨɜɚɧɢɟ ɫɱɟɬɱɢɤɚ ɩɨɫɥɟɞɧɟɝɨ ɜɫɬɪɟɱɟɧɧɨɝɨ ɫɢɦɜɨɥɚ. ɍɥɭɱɲɟɧɢɸ ɫɠɚɬɢɹ ɧɟɨɞɧɨɪɨɞɧɵɯ ɮɚɣɥɨɜ ɬɚɤɠɟ ɫɩɨɫɨɛɫɬɜɭɟɬ ɨɝɪɚɧɢɱɟɧɢɟ ɧɚ ɤɨɥɢɱɟɫɬɜɨ ɄɆ ɩɨɪɹɞɤɨɜ 1 ɢ 2, ɩɪɢɜɨɞɹɳɟɟ ɤ ɢɧɬɟɧɫɢɜɧɨɦɭ ɨɛɧɨɜɥɟɧɢɸ ɷɬɢɯ ɄɆ — ɫɬɚɬɢɫɬɢɤɚ ɧɟ ɢɫɩɨɥɶɡɭɟɦɵɯ ɞɨɥɶɲɟ ɜɫɟɝɨ ɤɨɧɬɟɤɫɬɨɜ ɩɪɨɫɬɨ ɭɞɚɥɹɟɬɫɹ. ȼ PPMN ɩɪɢɦɟɧɹɟɬɫɹ ɭɩɪɨɳɟɧɧɵɣ ɫɩɨɫɨɛ ɧɚɫɥɟɞɨɜɚɧɢɹ ɢɧɮɨɪɦɚɰɢɢ: ɩɪɢ ɞɨɛɚɜɥɟɧɢɢ ɫɢɦɜɨɥɚ ɜ ɄɆ(o) ɧɚɱɚɥɶɧɨɟ ɡɧɚɱɟɧɢɟ ɟɝɨ ɫɱɟɬɱɢɤɚ ɨɩɪɟɞɟɥɹɟɬɫɹ ɱɚɫɬɨɬɨɣ ɫɢɦɜɨɥɚ ɜ ɬɨɣ ɄɆ(o–k), k > 0, ɜ ɤɨɬɨɪɨɣ ɨɧ ɛɵɥ ɡɚɤɨɞɢɪɨɜɚɧ. Ɇɟɯɚɧɢɡɦ ɢɧɤɪɟɦɟɧɬɚ ɫɱɟɬɱɢɤɨɜ ɫɨɨɬɜɟɬɫɬɜɭɟɬ ɨɛɵɱɧɨɦɭ ɢɫɤɥɸɱɟɧɢɸ ɩɪɢ ɨɛɧɨɜɥɟɧɢɢ. ɉɨ ɚɧɚɥɨɝɢɢ ɫ HA, ɜ ɤɚɱɟɫɬɜɟ ɫɬɪɭɤɬɭɪɵ ɞɚɧɧɵɯ ɞɥɹ ɞɨɫɬɭɩɚ ɤ ɄɆ ɢɫɩɨɥɶɡɭɸɬɫɹ ɯɟɲ-ɰɟɩɨɱɤɢ. Ⱦɥɹ ɭɫɤɨɪɟɧɢɹ ɩɨɢɫɤɚ ɤɨɧɬɟɤɫɬɧɵɯ ɦɨɞɟɥɟɣ ɤɚɠɞɵɣ ɫɢɦɜɨɥ ɄɆ(N) ɢɦɟɟɬ ɜɧɟɲɧɢɣ ɭɤɚɡɚɬɟɥɶ ɧɚ ɄɆ(N), ɫɨɨɬɜɟɬɫɬɜɭɸɳɭɸ ɫɥɟɞɭɸɳɟɦɭ ɫɢɦɜɨɥɭ ɨɛɪɚɛɚɬɵɜɚɟɦɨɝɨ ɩɨɬɨɤɚ. PPMN ɫɨɞɟɪɠɢɬ ɦɟɯɚɧɢɡɦɵ ɩɪɟɞɜɚɪɢɬɟɥɶɧɨɣ ɨɛɪɚɛɨɬɤɢ ɬɟɤɫɬɨɜ ɧɚ ɚɧɝɥɢɣɫɤɨɦ ɢ ɪɭɫɫɤɨɦ ɹɡɵɤɚɯ ɢ ɢɫɩɨɥɧɢɦɵɯ ɮɚɣɥɨɜ ɞɥɹ ɩɪɨɰɟɫɫɨɪɨɜ ɬɢɩɚ Intel x86 (ɫɦ. ɝɥɚɜɭ «ɉɪɟɞɜɚɪɢɬɟɥɶɧɚɹ ɨɛɪɚɛɨɬɤɚ ɞɚɧɧɵɯ»). Ʉɪɨɦɟ ɬɨɝɨ, ɢɦɟɸɬɫɹ ɫɪɟɞɫɬɜɚ ɤɨɞɢɪɨɜɚɧɢɹ ɬɚɛɥɢɰ 8-ɢ, 16-ɢ ɢ 32-ɯ ɛɢɬɧɵɯ ɷɥɟɦɟɧɬɨɜ, ɚ ɬɚɤɠɟ ɤɨɞɢɪɨɜɚɧɢɹ ɞɥɢɧ ɩɨɜɬɨɪɨɜ (RLE). ɉɚɪɚɦɟɬɪɵ SEE, ɦɟɯɚɧɢɡɦɨɜ ɧɚɫɥɟɞɨɜɚɧɢɹ ɢɧɮɨɪɦɚɰɢɢ ɢ ɨɛɧɨɜɥɟɧɢɹ ɫɱɟɬɱɢɤɨɜ ɧɚɫɬɪɨɟɧɵ ɧɚ ɨɛɟɫɩɟɱɟɧɢɟ ɧɚɢɥɭɱɲɟɣ ɫɬɟɩɟɧɢ ɫɠɚɬɢɹ ɜ ɪɟɠɢɦɟ ɨɛɪɚɛɨɬɤɢ ɬɟɤɫɬɨɜ ɫ ɢɫɩɨɥɶɡɨɜɚɧɢɟɦ ɫɪɟɞɫɬɜ ɩɪɟɩɪɨɰɟɫɫɢɧɝɚ. ȼ ɬɚɛɥ. 4.8 ɭɤɚɡɚɧɵ ɪɟɡɭɥɶɬɚɬɵ ɬɟɫɬɢɪɨɜɚɧɢɹ PPMN ɜɟɪɫɢɢ 1.00 beta 1 ɜ ɪɟɠɢɦɟ ɫɠɚɬɢɹ ɛɟɡ ɢɫɩɨɥɶɡɨɜɚɧɢɹ ɩɪɟɞɜɚɪɢɬɟɥɶɧɨɣ ɨɛɪɚɛɨɬɤɢ (ɨɩɰɢɹ –da ɤɨɦɩɪɟɫɫɨɪɚ). ɉɨɪɹɞɨɤ ɦɨɞɟɥɢ ɪɚɜɧɹɥɫɹ 6 (ɨɩɰɢɹ –o6), ɚ ɟɟ ɪɚɡɦɟɪ ɛɵɥ ɨɝɪɚɧɢɱɟɧ 20 Ɇɛɚɣɬ. PPMD ɂ PPMONSTR
ɉɪɨɝɪɚɦɦɵ PPMd ɢ PPMonstr Ⱦɦɢɬɪɢɹ ɒɤɚɪɢɧɚ (Shkarin) ɪɟɚɥɢɡɭɸɬ ɪɚɡɪɚɛɨɬɚɧɧɵɟ ɢɦ ɠɟ ɚɥɝɨɪɢɬɦɵ PPMII ɢ cPPMII (complicated PPMII, ɬ.ɟ. «ɭɫɥɨɠɧɟɧɧɵɣ» PPMII) [1]. Ɉɛɚ ɤɨɦ182 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɩɪɟɫɫɨɪɚ ɢɫɩɨɥɶɡɭɸɬ ɦɟɯɚɧɢɡɦ ɧɚɫɥɟɞɨɜɚɧɢɹ ɢɧɮɨɪɦɚɰɢɢ. ȼ PPMd ɩɪɢɦɟɧɹɟɬɫɹ ɚɞɚɩɬɢɜɧɵɣ ɦɟɬɨɞ Ɉȼɍ SEE-d1, ɚ ɜ PPMonstr — SEE-d2. Ʉɪɨɦɟ ɷɬɨɝɨ ɨɬɥɢɱɢɹ, ɜ PPMonstr ɪɟɚɥɢɡɨɜɚɧɨ ɧɟɫɤɨɥɶɤɨ ɞɨɩɨɥɧɢɬɟɥɶɧɵɯ ɩɪɢɟɦɨɜ ɭɥɭɱɲɟɧɢɹ ɫɠɚɬɢɹ, ɨɫɧɨɜɧɵɦɢ ɢɡ ɤɨɬɨɪɵɯ ɹɜɥɹɸɬɫɹ ɨɬɥɨɠɟɧɧɨɟ ɧɚɫɥɟɞɨɜɚɧɢɟ ɢ ɭɥɭɱɲɟɧɢɟ ɬɨɱɧɨɫɬɢ ɩɪɟɞɫɤɚɡɚɧɢɹ ɧɚɢɛɨɥɟɟ ɜɟɪɨɹɬɧɵɯ ɫɢɦɜɨɥɨɜ. PPMII ɹɜɥɹɟɬɫɹ ɨɞɧɢɦ ɢɡ ɚɥɝɨɪɢɬɦɨɜ, ɢɫɩɨɥɶɡɭɟɦɵɯ ɜ ɚɪɯɢɜɚɬɨɪɟ RAR ɜɟɪɫɢɢ 3. ȼ ɬɟɫɬɢɪɨɜɚɧɢɢ ɛɵɥɢ ɢɫɩɨɥɶɡɨɜɚɧɵ ɜɟɪɫɢɢ H ɤɨɦɩɪɟɫɫɨɪɨɜ. PPMd ɡɚɩɭɫɤɚɥɫɹ ɫ ɨɩɰɢɟɣ –o8, ɚ PPMonstr — ɫ ɨɩɰɢɟɣ –o1, ɱɬɨ ɫɨɨɬɜɟɬɫɬɜɭɟɬ ɦɨɞɟɥɹɦ 8 ɢ 64 ɩɨɪɹɞɤɨɜ. Ɇɚɤɫɢɦɚɥɶɧɵɣ ɪɚɡɦɟɪ ɦɨɞɟɥɢ ɛɵɥ ɨɝɪɚɧɢɱɟɧ 20 Ɇɛɚɣɬ (ɩɚɪɚɦɟɬɪ –m20) ɜ ɨɛɨɢɯ ɫɥɭɱɚɹɯ, ɱɬɨ ɩɪɟɞɨɬɜɪɚɬɢɥɨ ɫɛɪɨɫ ɫɬɚɬɢɫɬɢɤɢ ɦɨɞɟɥɢ, ɨɫɭɳɟɫɬɜɥɹɟɦɵɣ ɩɪɢ ɩɨɥɧɨɦ ɡɚɩɨɥɧɟɧɢɢ ɜɵɞɟɥɟɧɧɨɝɨ ɨɛɴɟɦɚ ɩɚɦɹɬɢ. PPMY
PPMY ɹɜɥɹɟɬɫɹ ɷɤɫɩɟɪɢɦɟɧɬɚɥɶɧɵɦ ɤɨɦɩɪɟɫɫɨɪɨɦ, ɪɚɡɪɚɛɚɬɵɜɚɟɦɵɦ ȿɜɝɟɧɢɟɦ ɒɟɥɜɢɧɵɦ (Shelwien). Ⱦɚɧɧɚɹ ɩɪɨɝɪɚɦɦɚ ɨɬɧɨɫɢɬɫɹ ɤ ɧɟɦɧɨɝɨɱɢɫɥɟɧɧɨɦɭ ɤɥɚɫɫɭ ɤɨɦɩɪɟɫɫɨɪɨɜ, ɢɫɩɨɥɶɡɭɸɳɢɯ ɩɨɥɧɨɟ ɫɦɟɲɢɜɚɧɢɟ. ɉɪɢ ɨɛɪɚɛɨɬɤɟ ɤɚɠɞɨɝɨ ɫɢɦɜɨɥɚ ɩɪɨɢɡɜɨɞɢɬɫɹ ɫɦɟɲɢɜɚɧɢɟ ɨɰɟɧɨɤ ɪɚɫɩɪɟɞɟɥɟɧɢɣ ɜɟɪɨɹɬɧɨɫɬɟɣ ɢɡ ɄɆ ɜɫɟɯ ɞɨɫɬɭɩɧɵɯ ɩɨɪɹɞɤɨɜ ɨɬ ɧɟɤɨɬɨɪɨɝɨ N ɞɨ –1. ȼɟɥɢɱɢɧɚ N ɨɝɪɚɧɢɱɢɜɚɟɬɫɹ ɫɜɟɪɯɭ ɡɧɚɱɟɧɢɟɦ ɨɞɧɨɝɨ ɢɡ ɩɚɪɚɦɟɬɪɨɜ ɩɪɨɝɪɚɦɦɵ. ȿɫɥɢ ɩɨɡɜɨɥɹɟɬ ɞɚɧɧɨɟ ɨɝɪɚɧɢɱɟɧɢɟ, ɬɨ ɜ ɤɚɱɟɫɬɜɟ ɄɆ ɦɚɤɫɢɦɚɥɶɧɨɝɨ ɩɨɪɹɞɤɚ ɜɵɛɢɪɚɟɬɫɹ ɄɆ ɫ ɫɚɦɵɦ ɞɥɢɧɧɵɦ ɤɨɧɬɟɤɫɬɨɦ, ɪɚɧɟɟ ɜɫɬɪɟɱɚɜɲɢɦɫɹ ɩɨ ɤɪɚɣɧɟɣ ɦɟɪɟ ɨɞɢɧ ɪɚɡ. Ʉɨɦɩɪɟɫɫɨɪ ɨɫɭɳɟɫɬɜɥɹɟɬ ɦɨɞɟɥɢɪɨɜɚɧɢɟ ɧɚ ɭɪɨɜɧɟ ɛɚɣɬɨɜ, ɩɨɷɬɨɦɭ ɄɆ(–1) ɫɨɞɟɪɠɢɬ ɫɱɟɬɱɢɤɢ ɞɥɹ ɜɫɟɯ 256 ɜɨɡɦɨɠɧɵɯ ɫɢɦɜɨɥɨɜ; ɡɧɚɱɟɧɢɟ ɤɚɠɞɨɝɨ ɫɱɟɬɱɢɤɚ ɪɚɜɧɨ 1. Ʉɪɨɦɟ ɫɱɟɬɱɢɤɨɜ ɜɫɬɪɟɱɚɟɦɵɯ ɜ ɟɟ ɤɨɧɬɟɤɫɬɟ ɫɢɦɜɨɥɨɜ, ɤɚɠɞɚɹ ɄɆ(o) ɫɨɞɟɪɠɢɬ ɟɳɟ ɞɜɟ ɩɟɪɟɦɟɧɧɵɟ: • ɱɢɫɥɨ ɫɢɦɜɨɥɨɜ ɜ ɤɨɧɬɟɤɫɬɟ; ɛɭɞɟɦ ɨɛɨɡɧɚɱɚɬɶ ɡɞɟɫɶ ɤɚɤ f(esc|o); ɩɪɢɧɹɬɨɟ ɨɛɨɡɧɚɱɟɧɢɟ ɯɚɪɚɤɬɟɪɢɫɬɢɤɢ ɨɛɭɫɥɨɜɥɟɧɨ ɬɟɦ, ɱɬɨ ɟɟ ɡɧɚɱɟɧɢɟ ɫɨɜɩɚɞɚɥɨ ɛɵ ɫ ɤɨɥɢɱɟɫɬɜɨɦ Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X 183 http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɭɯɨɞɨɜ ɢɡ ɄɆ(o), ɟɫɥɢ ɛɵ ɦɵ ɢɦɟɥɢ ɞɟɥɨ ɫ ɨɛɵɱɧɵɦ ɚɥɝɨɪɢɬɦɨɦ PPM; • ɱɢɫɥɨ ɫɥɭɱɚɟɜ, ɤɨɝɞɚ ɜɟɪɨɹɬɧɨɫɬɶ ɨɛɪɚɛɚɬɵɜɚɟɦɨɝɨ ɫɢɦɜɨɥɚ ɜ ɞɚɧɧɨɣ ɄɆ(o) ɛɵɥɚ ɦɚɤɫɢɦɚɥɶɧɨɣ ɩɨ ɫɪɚɜɧɟɧɢɸ ɫ ɩɪɨɱɢɦɢ ɤɨɧɬɟɤɫɬɧɵɦɢ ɦɨɞɟɥɹɦɢ; ɨɛɨɡɧɚɱɢɦ ɤɚɤ Opt(o). Ɉɰɟɧɤɢ ɜɟɪɨɹɬɧɨɫɬɢ ɫɢɦɜɨɥɚ, ɞɚɜɚɟɦɵɟ ɪɚɡɧɵɦɢ ɄɆ ɧɟɤɨɬɨɪɨɝɨ ɩɨɪɹɞɤɚ o, ɜɡɜɟɲɢɜɚɸɬɫɹ ɫ ɩɨɦɨɳɶɸ ɚɞɚɩɬɢɜɧɨ ɜɵɱɢɫɥɹɟɦɵɯ ɜɟɫɨɜ wo. ɉɪɨɰɟɞɭɪɭ ɧɚɯɨɠɞɟɧɢɹ wo ɦɨɠɧɨ ɨɩɢɫɚɬɶ ɫɥɟɞɭɸɳɢɦ ɨɛɪɚɡɨɦ:
min( f (o), ET ) − f ( esc | o) , f (o ) ( w ( opt ) + Opt (o)) Wo( opt ) = , w ( opt ) + f (o) wo = w ( E ) ⋅ W ( opt ) + (1 − w ( E ) ) ⋅ Wo( esc ) ⋅ Wo( opt ) , Wo( esc ) =
ɝɞɟ
f(o) — ɨɛɳɟɟ ɤɨɥɢɱɟɫɬɜɨ ɩɪɨɫɦɨɬɪɨɜ ɫɨɨɬɜɟɬɫɬɜɭɸɳɟɣ ɄɆ(o); ET, w(opt), w(E) — ɧɟɤɨɬɨɪɵɟ ɩɚɪɚɦɟɬɪɵ. Ʉɨɷɮɮɢɰɢɟɧɬɚɦ Wo( esc ) ɢ Wo(opt ) ɦɨɠɧɨ ɞɚɬɶ ɬɚɤɭɸ ɭɩɪɨɳɟɧɧɭɸ ɢɧɬɟɪɩɪɟɬɚɰɢɸ: • Wo( esc ) — ɷɬɨ ɜɟɪɨɹɬɧɨɫɬɶ ɬɨɝɨ, ɱɬɨ ɫɢɦɜɨɥ ɩɪɢɫɭɬɫɬɜɭɟɬ ɜ ɬɟɤɭɳɟɣ ɄɆ(o), ɢɥɢ, ɜ ɬɟɪɦɢɧɚɯ ɤɥɚɫɫɢɱɟɫɤɨɝɨ PPM, ɜɟɪɨɹɬɧɨɫɬɶ ɬɨɝɨ, ɱɬɨ ɭɯɨɞɚ ɧɟ ɛɭɞɟɬ; • Wo( opt ) — ɷɬɨ ɜɟɪɨɹɬɧɨɫɬɶ ɬɨɝɨ, ɱɬɨ ɢɦɟɧɧɨ ɞɚɧɧɚɹ ɄɆ(o) ɢɦɟɟɬ ɦɚɤɫɢɦɚɥɶɧɭɸ ɨɰɟɧɤɭ ɜɟɪɨɹɬɧɨɫɬɢ ɬɟɤɭɳɟɝɨ ɫɢɦɜɨɥɚ. Ⱥɥɝɨɪɢɬɦ ɧɚɯɨɠɞɟɧɢɹ ɡɧɚɱɟɧɢɣ ɩɚɪɚɦɟɬɪɨɜ ET, w(opt), w(E), ɨɛɟɫɩɟɱɢɜɚɸɳɢɣ ɯɨɪɨɲɢɣ ɤɨɷɮɮɢɰɢɟɧɬ ɫɠɚɬɢɹ, ɛɵɥ ɩɨɥɭɱɟɧ ɷɦɩɢɪɢɱɟɫɤɢɦ ɩɭɬɟɦ, ɢ ɪɟɡɭɥɶɬɚɬɵ ɜɵɱɢɫɥɟɧɢɣ ɫɜɟɞɟɧɵ ɜ ɬɚɛɥɢɰɵ. Ⱦɥɹ ɤɚɠɞɨɣ ɄɆ(o) ɜɟɥɢɱɢɧɵ ɩɚɪɚɦɟɬɪɨɜ ɜɵɛɢɪɚɸɬɫɹ ɢɡ ɫɨɨɬɜɟɬɫɬɜɭɸɳɟɣ ɬɚɛɥɢɰɵ ɩɨ ɚɞɪɟɫɭ, ɨɩɪɟɞɟɥɹɟɦɨɦɭ ɡɧɚɱɟɧɢɟɦ ɩɚɪɵ (o, N).
184 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ȼɨɨɛɳɟ ɝɨɜɨɪɹ, ɜ ɜɟɪɫɢɢ PPMY 3b ɢɫɩɨɥɶɡɭɟɬɫɹ ɞɨ 120 ɫɩɟɰɢɚɥɶɧɨ ɩɨɞɨɛɪɚɧɧɵɯ ɩɚɪɚɦɟɬɪɨɜ. ȼɨɡɦɨɠɧɨ, ɢɫɩɨɥɶɡɨɜɚɧɢɟ ɞɪɭɝɢɯ ɮɭɧɤɰɢɣ ɩɨɫɬɪɨɟɧɢɹ ɜɟɫɨɜ ɩɨɡɜɨɥɢɬ ɭɦɟɧɶɲɢɬɶ ɤɨɥɢɱɟɫɬɜɨ ɩɚɪɚɦɟɬɪɨɜ ɛɟɡ ɭɳɟɪɛɚ ɞɥɹ ɫɬɟɩɟɧɢ ɫɠɚɬɢɹ. ȼ ɬɚɛɥ. 4.8 ɩɪɢɜɟɞɟɧɵ ɪɟɡɭɥɶɬɚɬɵ ɫɠɚɬɢɹ ɧɚɛɨɪɚ ɮɚɣɥɨɜ CalgCC ɞɥɹ PPMY ɜɟɪɫɢɢ 3b. Ʉɨɞɟɪ ɡɚɩɭɫɤɚɥɫɹ ɫ ɨɩɰɢɟɣ /o64. ɉɊɈɂɁȼɈȾɂɌȿɅɖɇɈɋɌɖ ɇȺ ɌȿɋɌɈȼɈɆ ɇȺȻɈɊȿ CALGARY COMPRESSION CORPUS
ȼɫɟ ɪɚɫɫɦɨɬɪɟɧɧɵɟ ɤɨɦɩɪɟɫɫɨɪɵ ɢ ɚɪɯɢɜɚɬɨɪɵ ɛɵɥɢ ɩɪɨɬɟɫɬɢɪɨɜɚɧɵ ɧɚ ɧɚɛɨɪɟ CalgCC, ɨɩɢɫɚɧɧɨɦ ɜ ɩɭɧɤɬɟ «ɋɪɚɜɧɟɧɢɟ ɚɥɝɨɪɢɬɦɨɜ ɩɨ ɫɬɟɩɟɧɢ ɫɠɚɬɢɹ». Ⱦɥɹ ɫɪɚɜɧɟɧɢɹ ɞɨɛɚɜɥɟɧɵ ɯɚɪɚɤɬɟɪɢɫɬɢɤɢ ɬɪɢɜɢɚɥɶɧɨɝɨ ɤɨɦɩɪɟɫɫɨɪɚ Dummy, ɧɚ ɩɪɢɦɟɪɟ ɤɨɬɨɪɨɝɨ ɦɵ ɨɛɴɹɫɧɹɥɢ ɢɞɟɸ PPM. ȼ ɬɚɛɥɢɰɟ ɭɤɚɡɚɧɵ ɫɬɟɩɟɧɢ ɫɠɚɬɢɹ ɨɬɞɟɥɶɧɵɯ ɮɚɣɥɨɜ ɧɚɛɨɪɚ, ɫɪɟɞɧɹɹ ɫɬɟɩɟɧɶ ɫɠɚɬɢɹ, ɨɛɳɟɟ ɜɪɟɦɹ ɤɨɞɢɪɨɜɚɧɢɹ Tɤɨɞ ɢ ɞɟɤɨɞɢɪɨɜɚɧɢɹ Tɞɟɤ. ɋɪɟɞɧɹɹ ɫɬɟɩɟɧɶ ɜɵɱɢɫɥɹɥɚɫɶ ɤɚɤ ɫɪɟɞɧɹɹ ɧɟ ɜɡɜɟɲɟɧɧɚɹ ɩɨ ɪɚɡɦɟɪɭ ɮɚɣɥɨɜ ɫɬɟɩɟɧɶ ɫɠɚɬɢɹ. Ⱦɥɹ Tɤɨɞ ɢ Tɞɟɤ ɡɚ ɟɞɢɧɢɰɭ ɩɪɢɧɹɬɨ ɜɪɟɦɹ ɫɠɚɬɢɹ ɜɫɟɝɨ CalgCC ɤɨɦɩɪɟɫɫɨɪɨɦ PPMd. ɑɬɨɛɵ ɜɧɟɫɬɢ ɹɫɧɨɫɬɶ, ɡɚɦɟɬɢɦ, ɱɬɨ ɟɞɢɧɢɰɚ ɩɪɢɦɟɪɧɨ ɫɨɨɬɜɟɬɫɬɜɭɟɬ ɫɤɨɪɨɫɬɢ ɤɨɞɢɪɨɜɚɧɢɹ 700 ɤɛɚɣɬ/ɫ ɞɥɹ ɉɄ ɫ ɩɪɨɰɟɫɫɨɪɨɦ ɬɢɩɚ Pentium III 733 ɆȽɰ. Ɍɚɛɥɢɰɚ 4.8 Bib book1 book2 Geo News obj1 obj2 Paper1 Paper2 Pic Progc Progl
Dummy CM
HA
PPMY RKUC PPMN PPMd
PPMonstr
2.31 2.22 2.12 1.68 1.92 1.76 1.94 2.08 2.20 9.41 2.06 2.40
4.12 3.27 3.74 1.72 3.05 2.19 3.07 3.39 3.43 10.00 3.36 4.68
4.55 3.72 4.35 1.74 3.60 2.09 3.46 3.59 3.67 10.26 3.51 5.30
4.76 3.74 4.49 1.92 3.74 2.29 3.79 3.74 3.77 11.43 3.70 5.76
3.01 2.99 3.19 1.74 2.52 1.69 2.32 2.37 2.61 9.30 2.27 3.07
4.55 3.62 4.30 2.12 3.57 2.25 3.79 3.51 3.57 10.67 3.45 5.37
4.57 3.64 4.31 1.96 3.58 2.32 3.65 3.59 3.62 11.01 3.54 5.26
4.62 3.65 4.35 1.84 3.62 2.26 3.62 3.65 3.67 10.53 3.60 5.44
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X 185 http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
Progp Trans ɂɬɨɝɨ Tɤɨɞ Tɞɟɤ
Dummy CM
HA
PPMY RKUC PPMN PPMd
PPMonstr
2.36 2.28
2.99 2.96
4.71 5.23
5.33 6.35
5.30 6.40
5.19 6.17
5.26 6.35
5.76 6.84
2.62 0.5 0.6
3.07 2.4 0.8
4.00 3.0 3.1
4.39 14.6 15.6
4.46 6.5 6.7
4.46 1.9 2.0
4.46 1.0 1.0
4.70 2.3 2.4
ȾɊɍȽɂȿ ȺɊɏɂȼȺɌɈɊɕ ɂ ɄɈɆɉɊȿɋɋɈɊɕ
ɋɭɳɟɫɬɜɭɟɬ ɦɧɨɠɟɫɬɜɨ ɤɨɦɩɪɟɫɫɨɪɨɜ, ɩɪɢɦɟɧɹɸɳɢɯ ɤɨɧɬɟɤɫɬɧɨɟ ɦɨɞɟɥɢɪɨɜɚɧɢɟ, ɤɨɬɨɪɵɟ ɧɟ ɛɵɥɢ ɨɯɜɚɱɟɧɵ ɞɚɧɧɵɦ ɨɛɡɨɪɨɦ. Ɉɬɦɟɬɢɦ ɫɥɟɞɭɸɳɢɟ ɚɪɯɢɜɚɬɨɪɵ: • BOA, ɚɜɬɨɪ əɧ ɋɚɬɬɨɧ (Sutton); • ARHANGEL, ɚɜɬɨɪ ɘɪɢɣ Ʌɹɩɤɨ (Lyapko); • LGHA, ɹɜɥɹɸɳɢɣɫɹ ɪɟɚɥɢɡɚɰɢɟɣ ɚɪɯɢɜɚɬɨɪɚ HA ɧɚ ɹɡɵɤɟ Ⱥɫɫɟɦɛɥɟɪɚ, ɜɵɩɨɥɧɟɧɧɨɣ ɘɪɢɟɦ Ʌɹɩɤɨ; • UHARC, ɚɜɬɨɪ ɍɜɟ ɏɟɪɤɥɨɰ (Herklotz); • X1, ɚɜɬɨɪ ɋɬɢɝ ȼɚɥɟɧɬɢɧɢ (Valentini); ɚ ɬɚɤɠɟ ɤɨɦɩɪɟɫɫɨɪ PPMZ, ɚɜɬɨɪ ɑɚɪɥɶɡ Ȼɥɭɦ (Bloom).
Ɉɛɡɨɪ ɤɥɚɫɫɢɱɟɫɤɢɯ ɚɥɝɨɪɢɬɦɨɜ ɤɨɧɬɟɤɫɬɧɨɝɨ ɦɨɞɟɥɢɪɨɜɚɧɢɹ LOEMA
ɋɭɞɹ ɩɨ ɜɫɟɦɭ, ɜɩɟɪɜɵɟ ɚɥɝɨɪɢɬɦ ɤɨɧɬɟɤɫɬɧɨɝɨ ɦɨɞɟɥɢɪɨɜɚɧɢɹ ɛɵɥ ɪɟɚɥɢɡɨɜɚɧ ɜ 1982 ɝɨɞɭ Ɋɨɛɟɪɬɫɨɦ (Roberts) [2]. Ⱥɜɬɨɪ ɧɚɡɜɚɥ ɫɜɨɣ ɚɥɝɨɪɢɬɦ Local Order Estimation Markov Analysis (Ɇɚɪɤɨɜɫɤɢɣ ɚɧɚɥɢɡ ɩɨɫɪɟɞɫɬɜɨɦ ɨɰɟɧɢɜɚɧɢɹ ɥɨɤɚɥɶɧɨɝɨ ɩɨɪɹɞɤɚ). ȼ LOEMA ɢɫɩɨɥɶɡɭɟɬɫɹ ɩɨɥɧɨɟ ɫɦɟɲɢɜɚɧɢɟ ɨɰɟɧɨɤ ɄɆ ɪɚɡɥɢɱɧɨɝɨ ɩɨɪɹɞɤɚ, ɩɪɢ ɷɬɨɦ ɜɟɫɚ ɩɪɟɞɫɬɚɜɥɹɸɬ ɫɨɛɨɣ ɡɧɚɱɟɧɢɹ ɭɪɨɜɧɹ ɞɨɜɟɪɢɹ ɤ ɨɰɟɧɤɟ ɜ ɬɨɦ ɫɦɵɫɥɟ, ɤɚɤ ɷɬɨ ɩɨɧɢɦɚɟɬɫɹ ɜ ɦɚɬɟɦɚɬɢɱɟɫɤɨɣ ɫɬɚɬɢɫɬɢɤɟ. ɋɪɚɜɧɟɧɢɟ ɫɬɟɩɟɧɢ ɫɠɚɬɢɹ LOEMA ɫ ɞɪɭɝɢɦɢ ɚɥɝɨɪɢɬɦɚɦɢ ɡɚɬɪɭɞɧɟɧɨ, ɬ.ɤ., ɫ ɨɞɧɨɣ ɫɬɨɪɨɧɵ, ɩɪɨɝɪɚɦɦɚ, ɪɟɚɥɢɡɭɸɳɚɹ ɚɥɝɨɪɢɬɦ, ɧɟ ɫɬɚɥɚ ɩɭɛɥɢɱɧɨ ɞɨɫɬɭɩɧɨɣ, ɢ, ɫ ɞɪɭɝɨɣ ɫɬɨɪɨɧɵ, ɮɚɣɥɵ, ɧɚ ɤɨɬɨɪɵɯ Ɋɨɛɟɪɬɫ ɞɨɤɚɡɵɜɚɥ ɷɮɮɟɤɬɢɜɧɨɫɬɶ ɫɜɨɟɝɨ ɩɨɞɯɨɞɚ, ɬɚɤɠɟ ɧɟ ɞɨɫɬɭɩɧɵ. ɂɦɟɸɬɫɹ ɫɬɨ186 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɪɨɧɧɢɟ ɨɬɱɟɬɵ, ɩɨ ɤɨɬɨɪɵɦ LOEMA ɨɛɟɫɩɟɱɢɜɚɟɬ ɤɨɦɩɪɟɫɫɢɸ ɩɪɢɦɟɪɧɨ ɧɚ ɭɪɨɜɧɟ PPMC (ɫɦ. ɬɚɛɥ. 4.9) ɩɪɢ ɡɧɚɱɢɬɟɥɶɧɨ ɦɟɧɶɲɟɣ ɫɤɨɪɨɫɬɢ, ɱɬɨ ɜɵɝɥɹɞɢɬ ɜɩɨɥɧɟ ɩɪɚɜɞɨɩɨɞɨɛɧɨ. ɋɭɞɹ ɩɨ ɜɫɟɦɭ, LOEMA Ɋɨɛɟɪɬɫɚ ɩɨɡɜɨɥɹɥ ɬɨɥɶɤɨ ɨɰɟɧɢɜɚɬɶ, ɧɨ ɧɟ ɫɠɢɦɚɬɶ, ɬ.ɟ. ɜɵɩɨɥɧɹɥ ɢɫɤɥɸɱɢɬɟɥɶɧɨ ɫɬɚɬɢɫɬɢɱɟɫɤɨɟ ɦɨɞɟɥɢɪɨɜɚɧɢɟ. DAFC
Ⱥɥɝɨɪɢɬɦ Double-Adaptive File Compression (Ⱦɜɚɠɞɵ ɚɞɚɩɬɢɜɧɨɟ ɫɠɚɬɢɟ ɮɚɣɥɨɜ), ɪɚɡɪɚɛɨɬɚɧɧɵɣ Ʌɷɧɝɞɨɧɨɦ (Langdon) ɢ Ɋɢɫɫɚɧɟɧɨɦ (Rissanen) ɜ 1983 ɝɨɞɭ, ɫɵɝɪɚɥ ɫɟɪɶɟɡɧɭɸ ɪɨɥɶ ɜ ɪɚɡɜɢɬɢɢ ɤɨɧɬɟɤɫɬɧɵɯ ɦɟɬɨɞɨɜ [2]. ȼɨ-ɩɟɪɜɵɯ, ɜ ɧɟɦ ɜɩɟɪɜɵɟ, ɟɫɥɢ ɧɟ ɫɱɢɬɚɬɶ LOEMA, ɛɵɥɚ ɪɟɚɥɢɡɨɜɚɧɚ ɢɞɟɹ ɪɚɡɞɟɥɟɧɢɹ ɩɪɨɰɟɫɫɚ ɤɨɞɢɪɨɜɚɧɢɹ ɧɚ ɦɨɞɟɥɢɪɨɜɚɧɢɟ ɢ ɫɬɚɬɢɫɬɢɱɟɫɤɨɟ ɤɨɞɢɪɨɜɚɧɢɟ, ɚ ɬɚɤɠɟ ɢɞɟɹ ɨɞɧɨɜɪɟɦɟɧɧɨɣ ɚɞɚɩɬɚɰɢɢ ɫɬɪɭɤɬɭɪɵ ɦɨɞɟɥɢ (ɬ.ɟ. ɧɚɛɨɪɚ ɄɆ) ɢ ɱɚɫɬɨɬ ɫɢɦɜɨɥɨɜ. ȼɨ-ɜɬɨɪɵɯ, ɩɪɨɫɬɨɬɚ ɚɥɝɨɪɢɬɦɚ ɨɛɟɫɩɟɱɢɜɚɥɚ ɜɨɡɦɨɠɧɨɫɬɶ ɟɝɨ ɪɟɚɥɶɧɨɝɨ ɩɪɢɦɟɧɟɧɢɹ ɩɪɢ ɨɬɧɨɫɢɬɟɥɶɧɨ ɫɤɪɨɦɧɵɯ ɜɨɡɦɨɠɧɨɫɬɹɯ ɜɵɱɢɫɥɢɬɟɥɶɧɨɣ ɬɟɯɧɢɤɢ 1980-ɯ ɝɨɞɨɜ. ȼ-ɬɪɟɬɶɢɯ, DAFC ɩɨɥɸɛɢɥɫɹ ɧɚɭɱɧɵɦ ɪɚɛɨɬɧɢɤɚɦ, ɨɯɨɬɧɨ ɢɫɩɨɥɶɡɨɜɚɜɲɢɦ ɟɝɨ ɪɟɡɭɥɶɬɚɬɵ ɞɥɹ ɫɪɚɜɧɟɧɢɹ ɩɪɢ ɧɚɩɢɫɚɧɢɢ ɫɬɚɬɟɣ. ȼ DAFC ɢɫɩɨɥɶɡɭɸɬɫɹ ɤɨɧɬɟɤɫɬɧɚɹ ɦɨɞɟɥɶ ɧɭɥɟɜɨɝɨ ɩɨɪɹɞɤɚ ɢ n ɤɨɧɬɟɤɫɬɧɵɯ ɦɨɞɟɥɟɣ ɩɟɪɜɨɝɨ ɩɨɪɹɞɤɚ. ȼ ɧɚɱɚɥɟ ɫɠɚɬɢɹ ɢɫɩɨɥɶɡɭɟɬɫɹ ɄɆ(0), ɜ ɤɨɬɨɪɨɣ ɜɫɟ ɫɢɦɜɨɥɵ ɚɥɮɚɜɢɬɚ ɨɛɪɚɛɚɬɵɜɚɟɦɨɣ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ ɢɦɟɸɬ ɨɬɥɢɱɧɵɟ ɨɬ ɧɭɥɹ ɫɱɟɬɱɢɤɢ. ɉɨ ɦɟɪɟ ɯɨɞɚ ɤɨɞɢɪɨɜɚɧɢɹ ɄɆ(1) ɫɨɡɞɚɸɬɫɹ ɬɨɥɶɤɨ ɞɥɹ ɩɟɪɜɵɯ n ɫɢɦɜɨɥɨɜ, ɜɫɬɪɟɬɢɜɲɢɯɫɹ ɜ ɭɠɟ ɨɛɪɚɛɨɬɚɧɧɨɦ ɛɥɨɤɟ m ɪɚɡ. ɂɡ ɫɨɨɛɪɚɠɟɧɢɣ ɷɤɨɧɨɦɢɢ ɩɚɦɹɬɢ ɚɜɬɨɪɵ ɩɪɟɞɥɚɝɚɥɢ ɢɫɩɨɥɶɡɨɜɚɬɶ n = 31 ɢ m = 50. Ⱦɚɥɟɟ, ɟɫɥɢ ɬɟɤɭɳɢɣ ɫɢɦɜɨɥ ɜɫɬɪɟɱɚɟɬɫɹ ɜ ɤɨɧɬɟɤɫɬɟ C ɢ ɞɥɹ ɷɬɨɝɨ ɤɨɧɬɟɤɫɬɚ ɫɭɳɟɫɬɜɭɟɬ ɄɆ(1), ɬɨ ɩɪɨɢɡɜɨɞɢɬɫɹ ɩɨɩɵɬɤɚ ɡɚɤɨɞɢɪɨɜɚɬɶ ɫɢɦɜɨɥ ɜ ɧɟɣ, ɢɧɚɱɟ ɜɵɞɚɟɬɫɹ ɫɢɦɜɨɥ ɭɯɨɞɚ ɫ ɜɟɪɨɹɬɧɨɫɬɶɸ, ɨɰɟɧɢɜɚɟɦɨɣ ɩɨ ɦɟɬɨɞɭ A, ɢ ɫɢɦɜɨɥ ɤɨɞɢɪɭɟɬɫɹ ɜ ɄɆ(0).
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X 187 http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ȼ DAFC ɬɚɤɠɟ ɩɪɢɦɟɧɹɟɬɫɹ ɤɨɞɢɪɨɜɚɧɢɟ ɞɥɢɧ ɩɨɜɬɨɪɨɜ (RLE), ɤɨɬɨɪɨɟ «ɡɚɩɭɫɤɚɟɬɫɹ» ɩɪɢ ɜɫɬɪɟɱɟ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ ɢɡ ɬɪɟɯ ɨɞɢɧɚɤɨɜɵɯ ɫɢɦɜɨɥɨɜ. ɍɩɪɚɠɧɟɧɢɟ: ɋɪɚɜɧɢɬɟ DAFC ɫ ɚɥɝɨɪɢɬɦɨɦ ɪɚɛɨɬɵ ɤɨɦɩɪɟɫɫɨɪɚ Dummy. ȿɫɥɢ ɩɪɟɧɟɛɪɟɱɶ RLE, ɬɨ ɤɚɤɢɟ ɢɡɦɟɧɟɧɢɹ ɫɥɟɞɭɟɬ ɜɧɟɫɬɢ ɜ Dummy, ɱɬɨɛɵ ɩɨɥɭɱɢɬɶ ɪɟɚɥɢɡɚɰɢɸ DAFC? ɉɨɥɶɡɭɹɫɶ ɩɪɢɜɟɞɟɧɧɵɦɢ ɜ ɬɟɤɫɬɟ ɬɚɛɥɢɰɚɦɢ, ɫɪɚɜɧɢɬɟ DAFC ɢ Dummy ɩɨ ɫɬɟɩɟɧɢ ɫɠɚɬɢɹ ɮɚɣɥɨɜ ɧɚɛɨɪɚ CalgCC (ɫɦ. ɬɚɛɥ. 4.8. ɢ 4.9). ADSM
Ⱥɥɝɨɪɢɬɦ Adaptive Dependency Source Model (Ɇɨɞɟɥɶ ɢɫɬɨɱɧɢɤɚ ɫ ɚɞɚɩɬɢɪɭɸɳɟɣɫɹ ɡɚɜɢɫɢɦɨɫɬɶɸ) Ⱥɛɪɚɯɚɦɫɨɧɚ (Abrahamson) ɩɪɟɞɫɬɚɜɥɹɟɬ ɫɨɛɨɣ ɨɛɪɚɡɟɰ ɢɧɬɟɪɟɫɧɨɝɨ ɩɨɞɯɨɞɚ ɤ ɪɟɚɥɢɡɚɰɢɢ ɢɞɟɢ ɤɨɧɬɟɤɫɬɧɨɝɨ ɦɨɞɟɥɢɪɨɜɚɧɢɹ [2]. Ɂɞɟɫɶ ɨɫɭɳɟɫɬɜɥɹɟɬɫɹ ɱɢɫɬɨɟ ɤɨɧɬɟɤɫɬɧɨɟ ɦɨɞɟɥɢɪɨɜɚɧɢɟ 1 ɩɨɪɹɞɤɚ, ɧɨ ɫɨɛɫɬɜɟɧɧɨ ɨɰɟɧɤɚ ɫɬɪɨɢɬɫɹ ɧɚ ɨɫɧɨɜɚɧɢɢ ɬɨɥɶɤɨ ɨɞɧɨɝɨ ɪɚɫɩɪɟɞɟɥɟɧɢɹ ɱɚɫɬɨɬ, ɨɛɳɟɝɨ ɞɥɹ ɜɫɟɯ ɄɆ. Ⱦɨɫɬɢɝɚɟɬɫɹ ɷɬɨ ɫɥɟɞɭɸɳɢɦ ɨɛɪɚɡɨɦ. ȼ ɤɚɠɞɨɣ ɄɆ(1) ɫɱɟɬɱɢɤɢ ɫɢɦɜɨɥɨɜ ɯɪɚɧɹɬɫɹ ɜ ɜɢɞɟ ɭɩɨɪɹɞɨɱɟɧɧɨɝɨ ɩɨ ɜɟɥɢɱɢɧɟ ɱɚɫɬɨɬ ɫɩɢɫɤɚ. ɋɱɟɬɱɢɤɢ ɪɚɧɠɢɪɭɸɬɫɹ ɬɚɤ, ɱɬɨ ɫɢɦɜɨɥ ɫ ɧɚɢɛɨɥɶɲɟɣ ɱɚɫɬɨɬɨɣ ɢɦɟɟɬ ɧɚɢɦɟɧɶɲɢɣ ɪɚɧɝ 1, ɚ ɫ ɧɚɢɦɟɧɶɲɟɣ ɱɚɫɬɨɬɨɣ — ɧɚɢɛɨɥɶɲɢɣ ɪɚɧɝ. ɉɪɢ ɨɛɪɚɛɨɬɤɟ ɬɟɤɭɳɟɝɨ ɫɢɦɜɨɥɚ ɧɚɯɨɞɢɬɫɹ ɟɝɨ ɪɚɧɝ (ɷɬɨ ɦɨɠɟɬ ɛɵɬɶ ɩɪɨɫɬɨ ɧɨɦɟɪ ɫɢɦɜɨɥɚ ɜ ɭɩɨɪɹɞɨɱɟɧɧɨɦ ɫɩɢɫɤɟ ɫɢɦɜɨɥɨɜ ɬɟɤɭɳɟɣ ɤɨɧɬɟɤɫɬɧɨɣ ɦɨɞɟɥɢ), ɢ ɨɰɟɧɤɚ ɨɩɪɟɞɟɥɹɟɬɫɹ ɱɚɫɬɨɬɨɣ ɢɫɩɨɥɶɡɨɜɚɧɢɹ ɷɬɨɝɨ ɪɚɧɝɚ. ɑɚɫɬɨɬɵ ɪɚɧɝɨɜ ɢɡɦɟɧɹɸɬɫɹ ɩɨɫɥɟ ɤɨɞɢɪɨɜɚɧɢɹ ɤɚɠɞɨɝɨ ɫɢɦɜɨɥɚ. Ɍɚɤɢɦ ɨɛɪɚɡɨɦ, ɫɬɚɬɢɫɬɢɱɟɫɤɨɟ ɤɨɞɢɪɨɜɚɧɢɟ ɨɫɭɳɟɫɬɜɥɹɟɬɫɹ ɧɟ ɧɚ ɛɚɡɟ ɱɚɫɬɨɬɵ ɫɢɦɜɨɥɚ, ɚ ɧɚ ɨɫɧɨɜɚɧɢɢ ɤɨɥɢɱɟɫɬɜɚ ɩɨɹɜɥɟɧɢɣ ɫɢɦɜɨɥɨɜ ɫ ɫɨɨɬɜɟɬɫɬɜɭɸɳɢɦ ɪɚɧɝɨɦ ɱɚɫɬɨɬɵ. Ɋɚɫɫɦɨɬɪɢɦ ɫɠɚɬɢɟ ɫɬɪɨɤɢ “ɦɨɥɨɱɧɨɟ_ɦɨɥɨɤɨ”, ɧɚɱɢɧɚɹ ɫ ɨɬɦɟɱɟɧɧɨɝɨ ɧɚ ɪɢɫɭɧɤɟ ɫɬɪɟɥɤɨɣ ɫɢɦɜɨɥɚ. 188 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɦ ɨ
ɥ
ɨ
ɱ
ɧ
ɨ
ɟ
ɦ
ɨ
ɥ
ɨ
ɤ
ɨ
ȼ ɤɨɧɬɟɤɫɬɟ “ɦ” ɪɟɚɥɶɧɨ ɜɫɬɪɟɱɚɥɫɹ ɬɨɥɶɤɨ ɨɞɢɧ ɫɢɦɜɨɥ ‘ɨ’, ɫɨɨɬɜɟɬɫɬɜɭɸɳɢɣ ɬɟɤɭɳɟɦɭ, ɩɨɷɬɨɦɭ ɦɵ ɤɨɞɢɪɭɟɦ ‘ɨ’, ɨɩɢɪɚɹɫɶ ɧɚ ɱɚɫɬɨɬɭ fr(1) ɢɫɩɨɥɶɡɨɜɚɧɢɹ ɪɚɧɝɚ 1. Ɂɚɬɟɦ fr(1) ɨɛɧɨɜɥɹɟɬɫɹ ɤɚɤ fr(1)++. ɋɥɟɞɭɸɳɢɣ ɫɢɦɜɨɥ, ‘ɥ’, ɤɨɞɢɪɭɟɬɫɹ ɜ ɤɨɧɬɟɤɫɬɟ “ɨ”. ɋɨɨɬɜɟɬɫɬɜɭɸɳɚɹ ɄɆ(1) ɫɨɞɟɪɠɢɬ 3 ɪɟɚɥɶɧɨ ɧɚɛɥɸɞɚɜɲɢɯɫɹ ɫɢɦɜɨɥɚ — ‘ɥ’, ’ɱ’, ’ɟ’. ȿɫɥɢ ɩɪɢɧɹɬɶ, ɱɬɨ ɜ ɫɥɭɱɚɟ ɨɞɢɧɚɤɨɜɨɫɬɢ ɱɚɫɬɨɬ ɧɚɢɦɟɧɶɲɢɣ ɪɚɧɝ ɢɦɟɟɬ ɩɨɫɥɟɞɧɢɣ ɜɫɬɪɟɱɟɧɧɵɣ ɫɢɦɜɨɥ, ɬɨ ‘ɥ’ ɤɨɞɢɪɭɟɬɫɹ ɧɚ ɛɚɡɟ ɱɚɫɬɨɬɵ fr(3) ɩɪɢɦɟɧɟɧɢɹ ɪɚɧɝɚ 3. ɉɪɨɢɡɜɨɞɢɬɫɹ ɨɛɧɨɜɥɟɧɢɟ fr(3)++ ɢ ɩɟɪɟɯɨɞ ɤ ɨɛɪɚɛɨɬɤɟ ɫɥɟɞɭɸɳɟɣ ɛɭɤɜɵ (‘ɨ’). ɇɢ ɪɚɡɭ ɧɟ ɜɫɬɪɟɱɟɧɧɵɟ ɜ ɫɨɨɬɜɟɬɫɬɜɭɸɳɟɣ ɄɆ(1) ɫɢɦɜɨɥɵ, ɬ.ɟ. ɢɦɟɸɳɢɟ ɧɭɥɟɜɭɸ ɱɚɫɬɨɬɭ, ɧɟ ɬɪɚɤɬɭɸɬɫɹ ɤɚɤ ɨɫɨɛɵɣ ɫɥɭɱɚɣ, ɢɦ ɬɚɤɠɟ ɩɪɢɫɜɚɢɜɚɟɬɫɹ ɤɚɤɨɣ-ɬɨ ɪɚɧɝ. Ȼɵɥɢ ɢɫɫɥɟɞɨɜɚɧɵ ɪɚɫɲɢɪɟɧɢɹ ɚɥɝɨɪɢɬɦɚ ADSM ɞɥɹ ɜɬɨɪɨɝɨ ɢ ɬɪɟɬɶɟɝɨ ɩɨɪɹɞɤɨɜ [9]. Ɋɟɡɭɥɶɬɚɬɵ ɷɤɫɩɟɪɢɦɟɧɬɨɜ ɩɨɤɚɡɵɜɚɸɬ, ɱɬɨ, ɜ ɨɬɥɢɱɢɟ ɨɬ ɦɧɨɝɢɯ ɞɪɭɝɢɯ ɤɥɚɫɫɢɱɟɫɤɢɯ ɚɥɝɨɪɢɬɦɨɜ ɤɨɧɬɟɤɫɬɧɨɝɨ ɦɨɞɟɥɢɪɨɜɚɧɢɹ, ADSM ɚɤɬɭɚɥɟɧ ɢ ɩɨ ɫɟɣ ɞɟɧɶ, ɬɚɤ ɤɚɤ ɨɛɟɫɩɟɱɢɜɚɟɬ ɯɨɪɨɲɟɟ ɫɨɨɬɧɨɲɟɧɢɟ ɫɤɨɪɨɫɬɢ ɪɚɛɨɬɵ, ɨɛɴɟɦɚ ɢɫɩɨɥɶɡɭɟɦɨɣ ɩɚɦɹɬɢ ɢ ɤɨɷɮɮɢɰɢɟɧɬɚ ɫɠɚɬɢɹ. Ɍɚɤ, ɧɚɩɪɢɦɟɪ, ɬɟɯɧɢɤɚ ADSM ɢɫɩɨɥɶɡɨɜɚɧɚ ɜ ɭɬɢɥɢɬɟ ɛɟɡɭɳɟɪɛɧɨɝɨ ɫɠɚɬɢɹ ɢɡɨɛɪɚɠɟɧɢɣ BMF, ɹɜɥɹɸɳɟɣɫɹ ɨɞɧɨɣ ɢɡ ɥɭɱɲɢɯ ɜ ɫɜɨɟɦ ɤɥɚɫɫɟ. ɍɩɪɚɠɧɟɧɢɟ: ɋɨɠɦɢɬɟ ɫɬɪɨɤɭ ɫ ɫɚɦɨɝɨ ɧɚɱɚɥɚ, ɧɚɣɞɢɬɟ ɞɟɣɫɬɜɢɬɟɥɶɧɵɟ ɡɧɚɱɟɧɢɹ fr(1) ɢ fr(3), ɢɫɩɨɥɶɡɭɟɦɵɟ ɩɪɢ ɤɨɞɢɪɨɜɚɧɢɢ ‘ɨ’ ɢ ‘ɥ’ ɜ ɩɪɢɦɟɪɟ. DHPC
Ɍɟɯɧɢɤɚ Dynamic-History Predictive Compression (ɋɠɚɬɢɟ ɧɚ ɨɫɧɨɜɟ ɩɪɟɞɫɤɚɡɚɧɢɹ ɩɨ ɞɢɧɚɦɢɱɟɫɤɨɣ ɢɫɬɨɪɢɢ), ɩɪɟɞɥɨɠɟɧɧɚɹ ɍɢɥɶɹɦɫɨɦ (Williams), ɢɧɬɟɪɟɫɧɚ ɜ ɫɪɚɜɧɟɧɢɢ ɫ DAFC ɤɚɤ ɢɫɄɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X 189 http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɩɨɥɶɡɭɸɳɚɹ ɢɧɨɣ ɫɩɨɫɨɛ ɨɝɪɚɧɢɱɟɧɢɹ ɪɨɫɬɚ ɦɨɞɟɥɢ. ȼ ɷɬɨɦ ɚɥɝɨɪɢɬɦɟ ɩɪɨɢɫɯɨɞɢɬ ɫɨɡɞɚɧɢɟ ɄɆ(o) ɬɨɥɶɤɨ ɟɫɥɢ ɪɨɞɢɬɟɥɶɫɤɚɹ ɄɆ(o+1) ɞɨɫɬɚɬɨɱɧɨ ɱɚɫɬɨ ɢɫɩɨɥɶɡɨɜɚɥɚɫɶ. ȿɫɥɢ ɩɪɟɞɫɬɚɜɢɬɶ ɤɨɧɬɟɤɫɬ ɞɨɱɟɪɧɟɣ ɄɆ ɜ ɜɢɞɟ ɫɰɟɩɥɟɧɢɹ (ɤɨɧɤɚɬɟɧɚɰɢɢ) ɚC ɤɚɤɨɝɨ-ɬɨ ɫɢɦɜɨɥɚ a ɢ ɤɨɧɬɟɤɫɬɚ C ɪɨɞɢɬɟɥɶɫɤɨɣ, ɜ ɫɥɭɱɚɟ ɤɥɚɫɫɢɱɟɫɤɨɝɨ DAFC ɹɜɥɹɸɳɟɝɨɫɹ ɩɭɫɬɨɣ ɫɬɪɨɤɨɣ, ɬɨ ɦɨɠɧɨ ɞɚɬɶ ɬɚɤɭɸ ɫɪɚɜɧɢɬɟɥɶɧɭɸ ɯɚɪɚɤɬɟɪɢɫɬɢɤɭ. ȼ DAFC ɨɛɪɚɡɨɜɚɧɢɟ ɞɨɱɟɪɧɟɣ ɄɆ ɜɨɡɦɨɠɧɨ ɜ ɫɥɭɱɚɟ ɩɪɟɜɵɲɟɧɢɹ ɱɚɫɬɨɬɨɣ ɩɨɹɜɥɟɧɢɹ ɨɛɪɚɡɭɸɳɟɝɨ ɤɨɧɬɟɤɫɬ ɫɢɦɜɨɥɚ ‘ɚ’ ɡɚɞɚɧɧɨɝɨ ɩɨɪɨɝɚ, ɚ ɜ DHPC — ɩɪɢ ɩɪɟɜɵɲɟɧɢɢ ɩɨɪɨɝɚ ɱɚɫɬɨɬɨɣ ɩɨɹɜɥɟɧɢɹ ɪɨɞɢɬɟɥɶɫɤɨɝɨ ɤɨɧɬɟɤɫɬɚ C, ɬ.ɟ. ɬɨɥɶɤɨ «ɡɚɫɥɭɠɟɧɧɵɟ» ɄɆ ɦɨɝɭɬ ɢɦɟɬɶ «ɞɟɬɟɣ». ɉɪɢ ɢɫɱɟɪɩɚɧɢɢ ɞɨɫɬɭɩɧɨɣ ɩɚɦɹɬɢ ɪɨɫɬ ɦɨɞɟɥɢ DHPC ɩɪɟɤɪɚɳɚɟɬɫɹ, ɞɚɥɟɟ ɜɨɡɦɨɠɧɚ ɚɞɚɩɬɚɰɢɹ ɬɨɥɶɤɨ ɡɚ ɫɱɟɬ ɢɡɦɟɧɟɧɢɹ ɫɱɟɬɱɢɤɨɜ ɫɢɦɜɨɥɨɜ. Ȼɥɚɝɨɞɚɪɹ ɢɫɩɨɥɶɡɨɜɚɧɢɸ ɄɆ ɛɨɥɶɲɢɯ ɩɨɪɹɞɤɨɜ DHPC ɞɚɟɬ ɥɭɱɲɟɟ ɫɠɚɬɢɟ, ɱɟɦ DAFC, ɧɨ ɭɫɬɭɩɚɟɬ ɩɨ ɷɬɨɦɭ ɩɨɤɚɡɚɬɟɥɸ ɤɥɚɫɫɢɱɟɫɤɢɦ ɩɪɟɞɫɬɚɜɢɬɟɥɹɦ ɫɟɦɟɣɫɬɜɚ PPM (PPMC ɢ PPMD). ȺɅȽɈɊɂɌɆɕ PPMA ɂ PPMB
Ⱥɥɝɨɪɢɬɦɵ PPMA ɢ PPMB ɹɜɥɹɸɬɫɹ ɫɚɦɵɦɢ ɪɚɧɧɢɦɢ ɫɪɟɞɢ ɩɪɟɞɫɬɚɜɢɬɟɥɟɣ ɫɟɦɟɣɫɬɜɚ PPM [5]. Ɉɧɢ ɛɵɥɢ ɩɪɟɞɥɨɠɟɧɵ ɚɜɬɨɪɚɦɢ ɬɟɯɧɢɤɢ PPM ɨɞɧɨɜɪɟɦɟɧɧɨ ɜ ɨɞɧɨɣ ɢ ɬɨɣ ɠɟ ɫɬɚɬɶɟ ɢ ɦɨɝɭɬ ɪɚɫɫɦɚɬɪɢɜɚɬɶɫɹ ɤɚɤ ɟɞɢɧɫɬɜɟɧɧɵɟ «ɱɢɫɬɨɤɪɨɜɧɵɟ» PPM. ȼ PPMA ɢ PPMB ɩɪɢɦɟɧɹɟɬɫɹ Ɉȼɍ ɩɨ ɦɟɬɨɞɚɦ A ɢ B ɫɨɨɬɜɟɬɫɬɜɟɧɧɨ. ɉɨɫɥɟ ɤɨɞɢɪɨɜɚɧɢɹ ɫɢɦɜɨɥɚ ɩɪɨɢɡɜɨɞɢɬɫɹ ɩɨɥɧɨɟ ɨɛɧɨɜɥɟɧɢɟ ɫɱɟɬɱɢɤɨɜ. Ɂɧɚɱɟɧɢɹ ɫɱɟɬɱɢɤɨɜ ɫɢɦɜɨɥɨɜ ɧɟ ɦɚɫɲɬɚɛɢɪɭɸɬɫɹ, ɱɬɨ ɬɪɟɛɭɟɬ ɞɨɫɬɚɬɨɱɧɨ ɛɨɥɶɲɢɯ ɫɱɟɬɱɢɤɨɜ (ɚɜɬɨɪɵ ɚɥɝɨɪɢɬɦɨɜ ɢɫɩɨɥɶɡɨɜɚɥɢ 32-ɯ ɛɢɬɧɵɟ). WORD
Ⱥɥɝɨɪɢɬɦ WORD ɛɵɥ ɫɨɡɞɚɧ Ɇɨɮɮɚɬɨɦ (Moffat) ɜ ɤɨɧɰɟ 1980-ɯ ɝɨɞɨɜ ɫɩɟɰɢɚɥɶɧɨ ɞɥɹ ɫɠɚɬɢɹ ɬɟɤɫɬɨɜ, ɢ ɹɜɥɹɟɬɫɹ ɹɪɤɢɦ ɩɪɟɞɫɬɚɜɢɬɟɥɟɦ ɨɫɨɛɨɝɨ ɫɟɦɟɣɫɬɜɚ ɤɨɧɬɟɤɫɬɧɵɯ ɦɟɬɨɞɨɜ. 190 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ȼ ɚɥɝɨɪɢɬɦɟ ɢɫɩɨɥɶɡɭɸɬɫɹ ɄɆ ɧɟ ɬɨɥɶɤɨ ɞɥɹ ɫɢɦɜɨɥɨɜ, ɧɨ ɢ ɞɥɹ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɟɣ (ɫɬɪɨɤ) ɤɨɧɟɱɧɨɣ ɞɥɢɧɵ. ȼɟɫɶ ɚɥɮɚɜɢɬ ɫɠɢɦɚɟɦɨɝɨ ɛɥɨɤɚ ɞɟɥɢɬɫɹ ɧɚ «ɛɭɤɜɵ» ɢ «ɧɟ-ɛɭɤɜɵ». ɉɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɶ ɛɭɤɜ ɧɚɡɵɜɚɟɬɫɹ «ɫɥɨɜɨɦ», ɚ ɧɟ-ɛɭɤɜ — «ɧɟɫɥɨɜɨɦ». Ⱦɥɹ ɨɰɟɧɢɜɚɧɢɹ ɩɪɢɦɟɧɹɸɬɫɹ ɄɆ 1 ɢ 0 ɩɨɪɹɞɤɨɜ, ɩɪɢ ɷɬɨɦ ɛɭɤɜɚ ɩɪɟɞɫɤɚɡɵɜɚɟɬɫɹ ɛɭɤɜɨɣ, ɚ ɫɥɨɜɨ — ɫɥɨɜɨɦ, ɚɧɚɥɨɝɢɱɧɨ ɞɥɹ ɧɟ-ɛɭɤɜ ɢ ɧɟ-ɫɥɨɜ. ȿɫɥɢ ɨɛɪɚɛɚɬɵɜɚɟɦɨɟ ɫɥɨɜɨ ɧɢ ɪɚɡɭ ɧɟ ɜɫɬɪɟɱɚɥɨɫɶ ɜ ɄɆ(1) ɞɥɹ ɫɥɨɜ, ɬɨ ɩɪɨɢɡɜɨɞɢɬɫɹ ɭɯɨɞ ɧɚ ɭɪɨɜɟɧɶ ɄɆ(0); ɟɫɥɢ ɠɟ ɢ ɬɚɦ ɨɰɟɧɢɜɚɧɢɟ ɧɟɜɨɡɦɨɠɧɨ, ɬ.ɟ. ɬɚɤɚɹ ɫɬɪɨɤɚ ɜɫɬɪɟɬɢɥɚɫɶ ɜɩɟɪɜɵɟ, ɬɨ ɫɥɨɜɨ ɩɟɪɟɞɚɟɬɫɹ ɤɚɤ ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɶ ɛɭɤɜ. Ⱦɥɹ ɷɬɨɝɨ ɫɧɚɱɚɥɚ ɤɨɞɢɪɭɟɬɫɹ ɞɥɢɧɚ ɫɥɨɜɚ, ɚ ɡɚɬɟɦ ɫɨɫɬɚɜɥɹɸɳɢɟ ɟɝɨ ɛɭɤɜɵ ɫ ɢɫɩɨɥɶɡɨɜɚɧɢɟɦ ɄɆ ɩɟɪɜɨɝɨ, ɧɭɥɟɜɨɝɨ ɢ ɦɢɧɭɫ ɩɟɪɜɨɝɨ ɩɨɪɹɞɤɨɜ. ɉɪɢ ɨɰɟɧɤɟ ɜɟɪɨɹɬɧɨɫɬɟɣ ɛɭɤɜ ɢɫɩɨɥɶɡɭɟɬɫɹ ɬɟɯɧɢɤɚ ɭɯɨɞɨɜ. Ɉɛɪɚɛɨɬɤɚ ɧɟ-ɫɥɨɜ ɢ ɧɟ-ɛɭɤɜ ɨɫɭɳɟɫɬɜɥɹɟɬɫɹ ɚɧɚɥɨɝɢɱɧɨ. Ɍɚɤɢɦ ɨɛɪɚɡɨɦ, ɜ WORD ɢɫɩɨɥɶɡɭɟɬɫɹ ɜɫɟɝɨ 12 ɬɢɩɨɜ ɄɆ: ɩɟɪɜɨɝɨ ɢ ɧɭɥɟɜɨɝɨ ɩɨɪɹɞɤɚ ɞɥɹ ɫɥɨɜ (ɧɟ-ɫɥɨɜ), ɩɟɪɜɨɝɨ, ɧɭɥɟɜɨɝɨ ɢ ɦɢɧɭɫ ɩɟɪɜɨɝɨ ɩɨɪɹɞɤɚ ɞɥɹ ɛɭɤɜ (ɧɟ-ɛɭɤɜ), ɧɭɥɟɜɨɝɨ ɩɨɪɹɞɤɚ ɞɥɹ ɞɥɢɧ ɫɥɨɜ (ɧɟ-ɫɥɨɜ). Ⱦɥɢɧɚ ɫɥɨɜɚ (ɧɟ-ɫɥɨɜɚ) ɨɝɪɚɧɢɱɢɜɚɟɬɫɹ 20 ɫɢɦɜɨɥɚɦɢ. Ʉɚɤ ɢ ɜ ɫɥɭɱɚɟ DHPC, ɩɪɢ ɞɨɫɬɢɠɟɧɢɢ ɦɨɞɟɥɶɸ ɡɚɞɚɧɧɨɝɨ ɪɚɡɦɟɪɚ ɭɞɚɥɟɧɢɟ ɜɫɟɣ ɫɬɪɭɤɬɭɪɵ ɢɥɢ ɟɟ ɱɚɫɬɢ ɧɟ ɩɪɨɢɡɜɨɞɢɬɫɹ, ɩɪɨɫɬɨ ɩɪɟɤɪɚɳɚɟɬɫɹ ɪɨɫɬ.
ɋɪɚɜɧɟɧɢɟ ɚɥɝɨɪɢɬɦɨɜ ɤɨɧɬɟɤɫɬɧɨɝɨ ɦɨɞɟɥɢɪɨɜɚɧɢɹ ȼ ɬɚɛɥ. 4.9 ɩɪɟɞɫɬɚɜɥɟɧɵ ɫɜɟɞɟɧɢɹ ɨ ɫɬɟɩɟɧɢ ɫɠɚɬɢɹ ɮɚɣɥɨɜ ɧɚɛɨɪɚ CalgCC ɤɨɦɩɪɟɫɫɨɪɚɦɢ, ɪɟɚɥɢɡɭɸɳɢɦɢ ɫɨɨɬɜɟɬɫɬɜɭɸɳɢɟ ɚɥɝɨɪɢɬɦɵ ɤɨɧɬɟɤɫɬɧɨɝɨ ɦɨɞɟɥɢɪɨɜɚɧɢɹ. ȼ ɩɟɪɜɨɣ ɫɬɪɨɤɟ ɭɤɚɡɚɧɨ ɧɚɡɜɚɧɢɟ ɚɥɝɨɪɢɬɦɚ, ɜɨ ɜɬɨɪɨɣ, ɩɨ ɧɟɨɛɯɨɞɢɦɨɫɬɢ, ɩɨɪɹɞɨɤ ɢɫɩɨɥɶɡɨɜɚɧɧɨɣ ɦɨɞɟɥɢ — ɫɬɪɨɤɚ «o-N» ɭɤɚɡɵɜɚɟɬ, ɱɬɨ ɢɫɩɨɥɶɡɨɜɚɥɚɫɶ ɦɨɞɟɥɶ ɩɨɪɹɞɤɚ N. ȼ ɫɬɪɨɤɟ «ɂɬɨɝɨ» ɭɤɚɡɚɧɚ ɫɪɟɞɧɹɹ ɧɟ ɜɡɜɟɲɟɧɧɚɹ ɩɨ ɪɚɡɦɟɪɭ ɮɚɣɥɨɜ ɫɬɟɩɟɧɶ ɫɠɚɬɢɹ ɜɫɟɝɨ CalgCC.
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X 191 http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
Ⱥɥɝɨɪɢɬɦ cPPMII ɪɟɚɥɢɡɭɟɬ ɦɟɯɚɧɢɡɦ ɧɚɫɥɟɞɨɜɚɧɢɹ ɢɧɮɨɪɦɚɰɢɢ ɢ ɢɫɩɨɥɶɡɭɟɬ SEE-d2. Ɉɩɢɫɚɧɢɟ ɩɪɨɱɢɯ ɚɥɝɨɪɢɬɦɨɜ ɛɵɥɨ ɞɚɧɨ ɜɵɲɟ. Ɍɚɛɥɢɰɚ 4.9 ADSM DAFC WORD PPMC PPMC PPM* PPMD cPPMII o-3 o-5 o-5 o-64 Bib Book1 Book2 Geo News Obj1 Obj2 Paper1 Paper2 Pic Progc Progl Progp Trans ɂɬɨɝɨ
2.07 2.11 2.03 1.46 1.84 1.60 1.81 1.96 2.08 7.77 1.90 2.18 2.14 2.06
2.08 2.17 2.04 1.72 1.84 1.55 1.39 1.90 2.08 8.89 1.81 2.22 2.08 1.95
3.65 2.96 3.19 1.58 2.60 1.78 1.84 3.10 3.35 8.99 2.95 4.21 4.17 4.19
3.79 3.23 3.54 1.67 3.02 2.13 2.97 3.23 3.27 7.34 3.21 4.21 4.35 4.52
4.17 3.42 4.00 1.69 3.33 2.14 3.27 3.38 3.39 9.76 3.32 4.62 4.57 5.19
4.19 3.33 3.96 1.66 3.31 2.00 3.29 3.38 3.39 9.41 3.33 4.79 4.94 5.52
4.26 3.48 4.06 1.70 3.39 2.14 3.31 3.42 3.46 9.88 3.36 4.73 4.65 5.33
4.76 3.74 4.49 1.92 3.74 2.29 3.79 3.74 3.77 11.43 3.70 5.76 5.76 6.84
2.36
2.41
3.47
3.61
4.02
4.04
4.08
4.70
Ɍɚɤɢɦ ɨɛɪɚɡɨɦ, ɢɡɨɳɪɟɧɧɵɟ ɦɨɞɟɥɢ ɛɨɥɶɲɨɝɨ ɩɨɪɹɞɤɚ ɨɛɟɫɩɟɱɢɜɚɸɬ ɥɭɱɲɟɟ ɫɠɚɬɢɟ ɞɚɧɧɵɯ, ɧɨ ɪɚɡɧɢɰɚ ɜ ɩɪɨɢɡɜɨɞɢɬɟɥɶɧɨɫɬɢ ɫɯɟɦ ɨɛɵɱɧɨ ɫɨɫɬɚɜɥɹɟɬ ɥɢɲɶ ɞɟɫɹɬɤɢ, ɚ ɬɨ ɢ ɟɞɢɧɢɰɵ ɩɪɨɰɟɧɬɨɜ. ɉɨɷɬɨɦɭ ɨɛɨɫɧɨɜɚɧɧɵɣ ɜɵɛɨɪ ɚɥɝɨɪɢɬɦɚ ɦɨɞɟɥɢɪɨɜɚɧɢɹ ɫɥɟɞɭɟɬ ɞɟɥɚɬɶ ɧɚ ɛɚɡɟ ɤɨɦɩɥɟɤɫɧɨɣ ɨɰɟɧɤɢ, ɜɤɥɸɱɚɸɳɟɣ ɬɚɤɠɟ ɨɛɴɟɦ ɢɫɩɨɥɶɡɭɟɦɨɣ ɩɚɦɹɬɢ, ɫɤɨɪɨɫɬɢ ɤɨɞɢɪɨɜɚɧɢɹ ɢ ɞɟɤɨɞɢɪɨɜɚɧɢɹ, ɢ, ɤɨɧɟɱɧɨ ɠɟ, ɜɵɱɢɫɥɹɟɦɨɣ ɢɦɟɧɧɨ ɞɥɹ ɬɟɯ ɞɚɧɧɵɯ, ɤɨɬɨɪɵɟ ɬɪɟɛɭɟɬɫɹ ɫɠɢɦɚɬɶ.
Ⱦɪɭɝɢɟ ɦɟɬɨɞɵ ɤɨɧɬɟɤɫɬɧɨɝɨ ɦɨɞɟɥɢɪɨɜɚɧɢɹ ɋɪɟɞɢ ɧɟɪɚɫɫɦɨɬɪɟɧɧɵɯ ɨɫɬɚɥɫɹ ɢɧɬɟɪɟɫɧɵɣ ɦɟɬɨɞ ɭɧɢɜɟɪɫɚɥɶɧɨɝɨ ɫɠɚɬɢɹ Context Tree Weighting («ȼɡɜɟɲɢɜɚɧɢɟ ɤɨɧɬɟɤɫɬɧɨɝɨ ɞɟɪɟɜɚ»), ɢɥɢ CTW, ɤɨɬɨɪɵɣ ɩɨɬɟɧɰɢɚɥɶɧɨ ɨɛɟɫɩɟɱɢɜɚɟɬ ɥɭɱɲɭɸ ɫɬɟɩɟɧɶ ɫɠɚɬɢɹ ɫɪɟɞɢ ɜɫɟɯ ɢɡɜɟɫɬɧɵɯ ɚɥɝɨɪɢɬɦɨɜ [16]. 192 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ȼ CTW ɩɪɢ ɨɰɟɧɤɟ ɜɟɪɨɹɬɧɨɫɬɢ ɫɢɦɜɨɥɚ ɢɫɩɨɥɶɡɭɟɬɫɹ ɫ ɧɟɤɨɬɨɪɵɦ ɜɟɫɨɦ ɫɬɚɬɢɫɬɢɤɚ ɤɨɧɬɟɤɫɬɧɵɯ ɦɨɞɟɥɟɣ-ɩɪɟɞɤɨɜ, ɬ.ɟ. ɩɪɨɢɡɜɨɞɢɬɫɹ ɹɜɧɨɟ ɜɡɜɟɲɢɜɚɧɢɟ. Ʉɨɧɬɟɤɫɬɧɨɟ ɦɨɞɟɥɢɪɨɜɚɧɢɟ ɨɝɪɚɧɢɱɟɧɧɨɝɨ ɩɨɪɹɞɤɚ ɯɨɪɨɲɨ ɪɚɛɨɬɚɟɬ ɧɚ ɩɪɚɤɬɢɤɟ, ɨɛɟɫɩɟɱɢɜɚɹ ɜɵɫɨɤɭɸ ɫɬɟɩɟɧɶ ɫɠɚɬɢɹ ɩɪɢ ɬɟɪɩɢɦɵɯ ɬɪɟɛɨɜɚɧɢɹɯ ɤ ɜɵɱɢɫɥɢɬɟɥɶɧɵɦ ɪɟɫɭɪɫɚɦ. ɇɨ ɨɧɨ ɩɪɟɞɫɬɚɜɥɹɟɬ ɫɨɛɨɣ ɜɫɟɝɨ ɥɢɲɶ ɨɞɢɧ ɢɡ ɬɢɩɨɜ ɤɨɧɬɟɤɫɬɧɨɝɨ ɦɨɞɟɥɢɪɨɜɚɧɢɹ ɜ ɲɢɪɨɤɨɦ ɫɦɵɫɥɟ. Ɇɨɠɧɨ ɨɬɦɟɬɢɬɶ ɞɪɭɝɢɟ ɦɟɬɨɞɵ: • ɦɨɞɟɥɢ ɫɨɫɬɨɹɧɢɣ; ɜ ɤɚɱɟɫɬɜɟ ɤɨɧɤɪɟɬɧɨɝɨ ɚɥɝɨɪɢɬɦɚ ɦɨɠɧɨ ɭɤɚɡɚɬɶ «Ⱦɢɧɚɦɢɱɟɫɤɨɟ ɦɚɪɤɨɜɫɤɨɟ ɫɠɚɬɢɟ» (Dynamic Markov Compression, ɢɥɢ DMC) [4, 7]; • ɝɪɚɦɦɚɬɢɱɟɫɤɢɟ ɦɨɞɟɥɢ; ɤɨɧɤɪɟɬɧɵɣ ɚɥɝɨɪɢɬɦ — SEQUITUR [11]; • ɦɨɞɟɥɢ ɫ ɢɫɩɨɥɶɡɨɜɚɧɢɟɦ ɢɫɤɭɫɫɬɜɟɧɧɵɯ ɧɟɣɪɨɧɧɵɯ ɫɟɬɟɣ ɞɥɹ ɩɨɫɬɪɨɟɧɢɹ ɩɪɟɞɫɤɚɡɚɬɟɥɹ [14]. Ɋɚɫɫɦɨɬɪɟɧɢɟ ɚɥɝɨɪɢɬɦɨɜ ɦɨɞɟɥɢɪɨɜɚɧɢɹ ɞɚɧɧɵɯ ɜɢɞɨɜ ɜɵɯɨɞɢɬ ɡɚ ɪɚɦɤɢ ɷɬɨɣ ɤɧɢɝɢ.
ȼɨɩɪɨɫɵ ɞɥɹ ɫɚɦɨɤɨɧɬɪɨɥɹ8 1. Ɉɛɴɹɫɧɢɬɟ ɫɜɹɡɶ ɦɟɠɞɭ ɬɨɱɧɨɫɬɶɸ ɩɪɟɞɫɤɚɡɚɧɢɹ ɡɧɚɱɟɧɢɣ ɞɚɧɧɵɯ ɢ ɫɬɟɩɟɧɶɸ ɫɠɚɬɢɹ. 2. ɑɬɨ ɫɨɛɨɣ ɩɪɟɞɫɬɚɜɥɹɟɬ ɦɨɞɟɥɶ ɢɫɬɨɱɧɢɤɚ ɞɚɧɧɵɯ ɜ ɫɥɭɱɚɟ ɢɫɩɨɥɶɡɨɜɚɧɢɹ ɞɥɹ ɦɨɞɟɥɢɪɨɜɚɧɢɹ PPM-ɚɥɝɨɪɢɬɦɚ? 3. ɉɨɱɟɦɭ ɬɟɯɧɢɤɭ ɭɯɨɞɨɜ ɦɨɠɧɨ ɨɯɚɪɚɤɬɟɪɢɡɨɜɚɬɶ ɤɚɤ ɫɩɨɫɨɛ ɧɟɹɜɧɨɝɨ ɜɡɜɟɲɢɜɚɧɢɹ ɫɬɚɬɢɫɬɢɤɢ ɤɨɧɬɟɤɫɬɧɵɯ ɦɨɞɟɥɟɣ? 4. ȼ ɤɚɤɢɯ ɫɥɭɱɚɹɯ ɨɰɟɧɤɚ ɜɟɪɨɹɬɧɨɫɬɢ ɭɯɨɞɚ ɦɨɠɟɬ ɪɚɜɧɹɬɶɫɹ ɧɭɥɸ? 5. ɉɪɢɜɟɞɢɬɟ ɩɪɢɦɟɪ ɛɥɨɤɚ ɞɚɧɧɵɯ, ɤɨɬɨɪɵɟ ɜɵɝɨɞɧɟɟ ɫɠɢɦɚɬɶ, ɩɪɟɞɫɤɚɡɵɜɚɹ ɜɟɪɨɹɬɧɨɫɬɶ ɫɢɦɜɨɥɨɜ ɧɚ ɛɚɡɟ ɢɯ ɛɟɡ8
Ɉɬɜɟɬɵ ɤ ɜɨɩɪɨɫɚɦ ɢ ɭɩɪɚɠɧɟɧɢɹɦ ɢ ɢɫɯɨɞɧɵɟ ɬɟɤɫɬɵ ɩɪɨɝɪɚɦɦ ɜɵ ɦɨɠɟɬɟ ɧɚɣɬɢ ɧɚ http://www.compression.ru/
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X 193 http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
ɭɫɥɨɜɧɵɯ ɱɚɫɬɨɬ, ɚ ɧɟ ɫ ɩɨɦɨɳɶɸ PPM-ɦɨɞɟɥɢɪɨɜɚɧɢɹ ɩɨɪɹɞɤɚ 1. 6. ɉɨɱɟɦɭ ɩɪɢɦɟɧɟɧɢɟ ɦɟɬɨɞɚ ɢɫɤɥɸɱɟɧɢɹ ɜɫɟɝɞɚ ɭɥɭɱɲɚɟɬ ɫɬɟɩɟɧɶ ɫɠɚɬɢɹ? 7. Ʉɚɤ ɜɵ ɞɭɦɚɟɬɟ, ɰɟɥɟɫɨɨɛɪɚɡɧɨ ɥɢ ɩɪɢɦɟɧɟɧɢɟ ɦɟɬɨɞɚ ɧɚɫɥɟɞɨɜɚɧɢɹ ɢɧɮɨɪɦɚɰɢɢ ɞɥɹ ɨɛɧɨɜɥɟɧɢɹ ɫɬɚɬɢɫɬɢɤɢ ɤɨɧɬɟɤɫɬɧɵɯ ɦɨɞɟɥɟɣ ɭɯɨɞɚ? 8. ɉɨɱɟɦɭ ɜ ɫɥɭɱɚɟ ɢɫɩɨɥɶɡɨɜɚɧɢɹ ɧɚɫɥɟɞɨɜɚɧɢɹ ɢɧɮɨɪɦɚɰɢɢ ɩɪɢɦɟɧɟɧɢɟ ɦɟɬɨɞɚ ɢɫɤɥɸɱɟɧɢɹ ɩɪɢ ɨɛɧɨɜɥɟɧɢɢ ɨɛɵɱɧɨ ɧɟ ɩɨɡɜɨɥɹɟɬ ɞɨɫɬɢɝɚɬɶ ɩɨɬɟɧɰɢɚɥɶɧɨ ɜɨɡɦɨɠɧɨɣ ɫɬɟɩɟɧɢ ɫɠɚɬɢɹ? 9. ɉɨɱɟɦɭ ɦɟɬɨɞ ɧɚɫɥɟɞɨɜɚɧɢɹ ɢɧɮɨɪɦɚɰɢɢ ɹɜɥɹɟɬɫɹ ɩɨɬɟɧɰɢɚɥɶɧɨ ɛɨɥɟɟ ɦɨɳɧɵɦ ɫɩɨɫɨɛɨɦ ɤɨɦɩɟɧɫɚɰɢɢ ɧɟɞɨɫɬɚɬɤɚ ɫɬɚɬɢɫɬɢɤɢ ɜ ɤɨɧɬɟɤɫɬɧɵɯ ɦɨɞɟɥɹɯ ɜɵɫɨɤɢɯ ɩɨɪɹɞɤɨɜ, ɱɟɦ ɦɟɬɨɞ ɜɵɛɨɪɚ ɥɨɤɚɥɶɧɨɝɨ ɩɨɪɹɞɤɚ? 10.ȼ ɱɟɦ ɢɞɟɹ ɫɩɨɫɨɛɨɜ ɭɥɭɱɲɟɧɢɹ ɬɨɱɧɨɫɬɢ ɩɪɟɞɫɤɚɡɚɧɢɹ ɩɪɢ ɨɛɪɚɛɨɬɤɟ ɧɟɨɞɧɨɪɨɞɧɵɯ ɞɚɧɧɵɯ? 11.ɉɨɱɟɦɭ ɱɟɦ ɢɡɛɵɬɨɱɧɟɟ ɫɨ ɫɬɚɬɢɫɬɢɱɟɫɤɨɣ ɬɨɱɤɢ ɡɪɟɧɢɹ ɞɚɧɧɵɟ, ɬɟɦ ɫɤɨɪɨɫɬɶ ɢɯ ɨɛɪɚɛɨɬɤɢ PPM-ɚɥɝɨɪɢɬɦɚɦɢ ɜɵɲɟ? 12.ɍɤɚɠɢɬɟ ɡɚɞɚɱɢ, ɩɪɢ ɪɟɲɟɧɢɢ ɤɨɬɨɪɵɯ ɦɨɠɟɬ ɢɫɩɨɥɶɡɨɜɚɬɶɫɹ PPM-ɦɨɞɟɥɢɪɨɜɚɧɢɟ.
Ʌɢɬɟɪɚɬɭɪɚ 1. ɒɤɚɪɢɧ Ⱦ. ɉɨɜɵɲɟɧɢɟ ɷɮɮɟɤɬɢɜɧɨɫɬɢ ɚɥɝɨɪɢɬɦɚ PPM // ɉɪɨɛɥɟɦɵ ɩɟɪɟɞɚɱɢ ɢɧɮɨɪɦɚɰɢɢ, 34(3), ɫ.44-54, 2001. 2. Bell T.C., Witten I.H., Cleary, J.G. Modeling for text compression // ACM Computer Surveys, 24(4), pp.555-591, 1989. 3. Bloom C. Solving the problems of context modeling // California Institute of Technology, 1996. 4. Bunton S. On-Line Stochastic Processes in Data Compression // PhD thesis, University of Washington, 1996.
194 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
5. Cleary J.G., Witten I.H. Data compression using adaptive coding and partial string matching // IEEE Transactions on Communications, Vol. 32(4), pp.396-402, April 1984. 6. Cleary J.G., Teahan W.J. Unbounded length contexts for PPM // The Computer Journal, 40 (2/3), pp. 67-75. 1997. 7. Cormack G.V., Horspool R.N. Data compression using dynamic Markov modelling // The Computer Journal 30(6), pp.541-550. Dec. 1987. 8. Howard P.G. The design and analysis of efficient lossless data compression systems // PhD thesis, Brown University, Providence, Rhode Island. 1993. 9. Lelewer D.A., Hirschberg D.S. Streamlining Context Models for Data Compression. // Proceedings of Data Compression Conference, Snowbird, Utah, pp.313-322, 1991. 10. Moffat A. Implementing the PPM data compression scheme // IEEE Transactions on Communications, Vol. 38(11), pp.19171921, Nov. 1990. 11. Nevill-Manning C.G., Witten I.H. Linear-time, incremental hierarchy inference for compression // Proceedings of Data Compression Conference, J.A. Storer and M. Cohn (Eds.), Los Alamitos, CA: IEEE Press, pp.3-11. 1997. 12. Rissanen J.J., Langdon G.G. Universal modeling and coding // IEEE Transactions on Information Theory, Vol. 27(1), pp.12-23, Jan. 1981. 13. Shannon C.E. A mathematical theory of communication // The Bell System Technical Journal, Vol. 27, pp. 379–423, 623–656, July, October, 1948. 14. Schmidhuber J. Sequential neural text compression // IEEE Transactions on Neural Networks, Vol. 7(1), pp. 142-146. 1996. 15. Teahan W.J. Probability estimation for PPM // Proceedings of the New Zealand Computer Science Research Students Conference, 1995. University of Waikato, Hamilton, New Zealand.
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X 195 http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
16. Willems F.M.J., Shtarkov Y.M., Tjalkens T.J. The context-tree weighting method: Basic properties // IEEE Transactions on Information Theory, Vol. 41(3): pp. 653-664, May 1995. 17. Witten I.H., Bell T.C. The zero-frequency problem: estimating the probabilities of novel events in adaptive text compression // IEEE Transactions on Information Theory, Vol. 37(4), pp. 10851094. July 1991. 18. Witten I.H., Bray Z., Mahoui M., Teahan B. Text mining: a new frontier for lossless compression // University of Waikato, NZ, 1999.
ɋɩɢɫɨɤ ɚɪɯɢɜɚɬɨɪɨɜ ɢ ɤɨɦɩɪɟɫɫɨɪɨɜ 1. Bloom C. (1996) PPMZ — PPM Based Compressor — Win95/NT version. ftp://ftp.elf.stuba.sk/pub/pc/pack/ppmz_ntx.zip 2. Herklotz U. (2001) UHARC — high compression multimedia archiver. ftp://ftp.elf.stuba.sk/pub/pc/pack/uharc04.zip 3. Hirvola H. (1995) HA — file archiver utility. ftp://ftp.elf.stuba.sk/pub/pc/pack/ha0999.zip 4. Lyapko G. (2000) ARHANGEL — file archiving utility. ftp://ftp.elf.stuba.sk/pub/pc/pack/arh140.zip 5. Lyapko G. (1997) LGHA — archive processor. ftp://ftp.elf.stuba.sk/pub/pc/pack/lgha11g.zip 6. Shelwien E. (2001) PPMY — context modelling compressor. http://www.pilabs.org.ua/sh/ppmy_3b.zip 7. Shkarin D. (1999) BMF — lossless image compressor. ftp://ftp.elf.stuba.sk/pub/pc/pack/bmf_1_10.zip 8. Shkarin D. (2001) PPMDH — fast PPM compressor for textual data. ftp://ftp.elf.stuba.sk/pub/pc/pack/ppmdh.rar 9. Smirnov M. (2002) PPMN — not so fast PPM compressor. http://www.compression.ru/ms/ppmnb1+.rar 10. Sutton I. (1998) BOA constrictor archiver. ftp://ftp.elf.stuba.sk/pub/pc/pack/boa058.zip 11. Taylor M. (2000) RK — file archiver. ftp://ftp.elf.stuba.sk/pub/pc/pack/rk104a1d.exe 196 Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X http://www.compression.ru/
Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ / Ɋɚɡɞɟɥ 1 http://www.compression.ru/
12. Taylor M. (1999) RKUC — universal compressor. ftp://ftp.elf.stuba.sk/pub/pc/pack/rkuc104.zip 13. Valentini S. (1996) X1 archiver. ftp://ftp.elf.stuba.sk/pub/pc/pack/x1dos95a.zip 14. Ziganshin B. (1997). CM — static context modeling archiver. http://sochi.net.ru/~maxime/src/cm.cpp.gz
Ʉɧɢɝɚ “Ɇɟɬɨɞɵ ɫɠɚɬɢɹ ɞɚɧɧɵɯ”. ISBN 5-86404-170-X 197 http://www.compression.ru/