.hm2  .dh1 .ce Input/Output with Embedded Data Compression
.fm64 .df1 .ce -- Page .pa --
.ls1
.pl66
.rm72 .lm0
.tm5  .bm60
.ff1
.tc 72 1 0 0  0 1 4 1 3 1 3 1 3 1
.sh .sf


.ce ਩ . 嬠


.ce  -뢮  ᦠ⨥ 


.ce Input/Output with Embedded Data Compression



.ce  -- 1992





.ce Abstract


	The data compression techniques became very popular during the
last years. However, most compressors are implemented as standalone
applications which are hard to integrate into programs. This paper
describes input/output library with builtin compression, suitable for
embedding into applications. A quick survey of compression algorithms
is also provided.



.ce 


	 ᫥ ६ ⮤ ᦠ  稫 ப
࠭.   , 設⢮ ணࠬ ᦠ ॠ
  ⤥ ਫ,  㤭  ⥣  ணࠬ
짮⥫.  ࠡ 뢠 ⥪ -뢮  ஥
ᦠ⨥ , 㤮  ࠨ  ਪ ணࠬ. 
⠪ ⪨  ⬮ ᦠ.



.te 1 .ce  ⮤ ᦠ 


	⮤ ᦠ   筮  .
⠥  ⪨  ᭮   ॠ権, 
⥭騩, ,  .  ஡ ᢥ  ,
ਬ,  [祢᪨], [Witten].

	  "" 室   ஡.  
 --  ஢  ਩ (run length encoding, RLE).
 ⮤:  楯祪  ᨬ    ᨬ
 稪 ७. ஡ ⮨  ⮬, ⮡ ᯠ騪 
⫨  १饬 ⮪ ⠪ ஢   㣨
ᨬ. 襭 祢 -- ᭠  ⠪ 楯窨 묨
 (ਬ, ᯮ짮    ਧ ஢
ਨ). ⮤ 筮 䥪⨢  ᪨ ࠦ 
ଠ "  ᥫ" (ਬ, ଠ PCX ᯮ ஢
RLE).

	⪨ ⮤ RLE 祢 --  ⥯ ᦠ
(ਬ,  ⥪    ᬮ 㯠 ⮫쪮 楯窨
஡  砫 ப).

	  讥 㯫  筥 ନ.
 쭥襬  㤥 ᬠਢ 㯠騪 (compressor) 
ணࠬ, ८ࠧ   ⮪  (
䠩  ⥬ UNIX)  㣮, ⥫쭮 襣 ࠧ.
⢥⢥, ᯠ騪 (uncompressor) -- ணࠬ, ⢫
⭮ ८ࠧ, 祬 筮.  ࠧ,  ᪫砥
 ᬮ७ ⮤ ᦠ, 騥 ଠ (ਬ, ⮤
ᦠ ࠦ JPEG, ᭮  ८ࠧ 梥⮢,
ࠪ᪨  ࠧ砥 祫᪨ ).

	 ⮨ ஢  ।  
᫮ ( ). 筮 ஢ ࠢ ࠧ 
⮨  ய ஢. 祢,  訩 
ᦠ  ஢ 筮.  㭤⠫쭠 ⥮६
  ஢ 筨   ⮬,  ⮨
஢ ᥣ   ய 筨,    ᪮
㣮    [].

	쭥襥 㦤 ⮣  易   ᮢ .
[祢᪨], .15-54.

	,  ᦠ  ࠧ   -- ..
஢  ஢ (., ਬ, [Rissanen]).  
( ,  ॠ騥)  ᬠਢ ᨬ.

        砫 ਬ  孮 ஢.



.te 1 .ce ⮤ ஢


	஢ (encoding)    ⮪ ᨬ 
஬ 䠢, 祬  ᨬ ࠧ.  ஢
 ८ࠧ ⮣ ⮪  ⮪  쭮 . 
⨣ 㬥襭 ய ⮪ ⥬   ᨬ:
    ய樮쭠 ଠ樨, ᮤঠ饩 
室 ⮪. ᫨ । ⭮⥩  ⭮, 
 ந ⨬쭮 ஢.   ᫮  砥,
᫨ ।  ᨬ ࠭ ⭮.  ⮬ 砥
  ࠧ 室.

	 室: ᬮ 室 ⮪  ந
஢  ᭮ ᮡ࠭ ⨪ ( ⮬ ॡ 
室  䠩,  ࠭稢  ਬ ⠪ ⬮).
 室 ⮪  ⠪ 砥   ᠭ 奬
ᯮ짮 ஢,  㤥 ᯮ짮 ⥬
஬. ਬ -- ᪮ ஢ 䬥 [Huffman].

        ன 室 ᯮ ⠪ 뢠 ⨢ 
(adaptive coder).  ⮨  ⮬, ⮡  奬 ஢ 
ᨬ  室 .   室  
ॡ । ଠ樨  ᯮ짮 ஢   .
 ⮣ , 뢠 ஢ ⮪, ᨭ஭  ஬
 奬 ஢, 稭  ன ।।.
⨢ ஢    ⥯ ᦠ, ᪮
  ⥭   .  ਬ஬ 
᪮ ஢ 䬥 (. [Gallager], [Knuth], [Vitter]).

         ⢥ ਬ ᬮਬ ᪮ ஢ 䬥.
 ஢ ᮯ⠢ 室 ᨬ (筮 ।⠢塞
楯窠 ⮢ ࠧ筮 ) 楯窨 ⮢ ६ .  
  ᨬ ய樮쭠 筮   ,
⮬   .  ஢  䨪, 
   ஢ ( 䨪᭮ ஢  
ᨬ   䨪ᮬ   㣮 ᨬ; ஡
. [祢᪨], 29-34).

         室 䠢 ⮨   ᨬ:  a, b, c, d,
  ࠢ ᮮ⢥⢥ 1/2, 1/4, 1/8, 1/8.  ஢
䬥  ⮣ 䠢  ᫥饩 ⠡楩:

         ᨬ       室     室
                           ஢  ஢
        
           a       1/2      00            0
           b       1/4      01            10
           c       1/8      10            110
           d       1/8      11            111

        ਬ,  楯窨 abaaacb, ।⠢  室  00
01 00 00 00 10 01, 㤥 0 10 0 0 0 110 10 (஡  
㤮⢠ ⥭). 14   室  11   室. ஢ 
䬥 筮 ந  ࠭   筮 ॢ,  
ண 室 ᨬ,   㣠 "ᠭ"  0  1. 
ᨬ     ॢ  ⮬ ᨬ.  
ᯮ짮 ⨢ ஢ 䬥 ஡ ⮨ 
室 ﭭ ४஢ ॢ  ᮮ⢥⢨ 
饩 ⨪ 室 ⮪.

        ⮨⢠ ⮤ 䬥   筮 ᮪
᪮  襥 ⢮ ᦠ.   ࠢ⥫쭮 
⥭  ப ਬ; ਬࠬ  㦨 ணࠬ
compress  UNIX (ணࠬ ॠ)  ⠭ ஢ 
䠪ᮢ [Hunter] (⭠ ॠ).

	஢ 䬥   筮 
᫮,   ᨬ  ⤥쭮 楯窮  䠢
{0,1}).

        ⪮ ஢ 䬥  ᨬ ⥯
ᦠ   ⭮⥩ ᨬ  ⥫ ⥯ 2;
 易  ⥬,   ᨬ  *楫* ᫮ .
 મ    ஢ ᨬ쭮 䠢:
 ⮬ 砥 ᦠ⨥ *ᥣ* , ᬮ  ࠧ稥
⭮⥩ ᨬ;  䠪᪨ "㣫"   1/2!

         ஡   筮 饭   ஢
室 ⮪ (..   ᬮ७  ᨬ  'ab',
'abc', ...  a, b, c -- ᨬ 室 䠢).    
     (  㬥
ய樮쭮 ࠧ )  ਢ  १  
ॢ: ᫨, ਬ, ᨬ 室 䠢  8-⮢
  祭ﬨ 0 .. 255,   ஢   ᨬ 
砥 65536 ᨬ ( ⮫쪮  쥢  ॢ),  
஢   -- 16777216!  ⢥⢥  ॡ 
  ६ ஥ ॢ (  ⨢ ஢ -- 
६  ॢ,  ,  ६ ᦠ).   ⠢
 । 1/2   ᨬ  ⢨ ஢,   
稨 -- 1/4  1/6  ᮮ⢥⢥    2  3.
 ⥯ ᦠ,     祭 ⭮
ᨬ  ⥯ 1/2,   ⠪ 뢠 䬥᪮
஢.

        䬥᪮ ஢ (஡ ᠭ . [Witten])
 ⮤, 騬 㯠뢠 ᨬ 室 䠢 
  ᫮,  ⭮ ।   ᨬ.
楯 ⮤ 室  ࠡ⠬   60-x  (. [Abramson,
60-61]).  쭥襬 ⮤  ࠧ  ⥫쭮 ᮢ襭⢮
([Rissanen]).

	䬥᪮ ஢  ⨬, ⨣
⥮᪮ ࠭ ⥯ ᦠ, -- ய 室 ⮪.

	, ᦠ 䬥᪨ ஬, ᬠਢ 
 筠 ஡  ࢠ [0, 1).  ᦠ 
।⠢  ᫥⥫쭮     ⮩ ஡.
 ⮤ ⮨  ᫥饬: 室 ⥪ ᬠਢ 
 ⮩ ஡,   室 ᨬ  "ன"  ᮬ,
ய樮 ⭮  . ᭨ ࠡ ⮤ 
ਬ.

	 䠢 ⮨   ᨬ: a  b  ⭮ﬨ
ᮮ⢥⢥ 3/4  1/4.  㦥 ਫ , ஢ 䬥
  㯠뢠 ᫮   䠢.

	ᬮਬ ( ࠢ) ࢠ [0, 1). 쥬  
,   ய樮쭠 ⭮ ᨬ.   襬
砥  [0, 3/4)  [3/4, 1).   ⬠  ᫥饬: 
᫮  室 䠢 ᮮ⢥  ࢠ  [0,1).
⮬ ᫮ ᮮ⢥  ࢠ [0, 1). ᫥ 祭
 ᫥饣 ᨬ 䬥᪨  㬥蠥 ࢠ,
롨   ,  ᮮ⢥  㯨襬 ᨬ.
 楯窨  ࢠ, 뤥 ᫥ ࠡ⪨  
ᨬ, 筥, 筠   窨  ⮣ ࢠ.

	 ࠧ,  祭 ࢠ ய樮쭠
⭮  㥬 楯窨.

	믮   楯窨 "aaba":

   ᬮ७   ࢠ
         楯窠     

 0.    ""             [0, 1) = [0, 1)
 1.    "a"            [0, 3/4) = [0, 0.11)
 2.    "aa"           [0, 9/16) = [0, 0.1001)
 3.    "aab"          [27/64, 36/64) = [0.011011, 0.100100)
 4.    "aaba"         [108/256, 135/256) = [0.01101100, 0.10000111)

         ⢥     ᫮  ࢠ,
祭  蠣 4, ਬ, 0.1.

        䬥᪨  ࠡ⠥ ᨭ஭  ஬: 砢 
ࢠ [0, 1),  ᫥⥫쭮 । ᨬ 室
楯窨.  ⭮,  襬 砥  砫 ࠧ
(ய樮쭮 ⠬ ᨬ) ࢠ [0, 1)  [0, 0.11) 
[0.11, 1).  ᪮ ᫮ 0.0111 (। ஬  楯窨
"aaba") 室  ࢮ  ,    ᨬ: "a".
⥬   ࢠ [0, 0.11)  [0, 0.1001)  [0.1001,
0.1100) (ய樮쭮 ⠬ ᨬ).   롨ࠥ ,
⠪  0 < 0.0111 < 0.1001.  த  ,  筮
㥬   ᨬ.   ⮣, ⮡   ।
 楯窨,    ।   ⤥쭮, 
  䠢 ⥫ ᨬ " 楯窨".

         ᬮ७ ⮣ ⮤   ஡:
-, 室 ⢥ 䬥⨪,  ,
࠭祭 筮,  -, १ ஢ ⠭
⥭   砭 室 ⮪.  쭥訥 ᫥,
, 뢠 [Rubin],   ࠪ᪨   
楫᫥ 䬥⨪ 让 筮 (16-32 ࠧ鸞),  ⠪
 ६⠫쭮 ࠡ ⬠:    뤠
᫥⥫쭮   ⥭ 室 ⮪.



.te 1 .ce  室 ⮪


	 ਫ , ஢ ।⠢ ᮡ  
 㯠.    .. ஢ (modelling).  
㦥 ਫ  ⮬,  䬥᪮ ஢  
筮   ।. 㤥᭮! -- ᪫
⥫.  㤠   ।?    䠢 
?

	⢥      ⮪, ।⠢ ᮡ
(. [Rissanen], [Witten])  ᯮᮡ । ।
⭮⥩   㯫 । ᨬ.  ,
᪮ ᪨  (  ।  ) 
設⢥ 砥   ᨬ쭮 ⢠ ᦠ. ࠧ
訩  ।⠢ ⠪ 뢠 ⨢ ,
뢠騥 ⥪騩 ⥪.     ந 
室  ᦠ,  ॡ騥 ਮ   室
⮪   騥 । " ". 뤥 ⠪ 
"쭮 ⨢" ⬮, ⤠  ஥ ।
।⥭ ᫥ 㯨訬 ᨬ.

	 ࠧ 室  ⮩ ஡: ⥩訩  
-- ᡮ ⨪   ᨬ ᨬ  㣨
(஢ 筨 㫫: ⭮  ᨬ 
  ⮣,  ᨬ ⨫ । ).  ⠪
ᯮ짮 મ᪮ : ᡮ ⨪  
ᨬ  ⮬ ண ⢠ । ᨬ (
મ᪮ 筨 ࢮ 浪 ⭮  ᨬ
 ⮫쪮   ᫥ 祭 ᨬ,  ..).
મ᪨      ⨭ 筨, 
᫮ ﭨ   , ᮮ⢥⢥  쥬 ࠭
⠡ . ஬ ⮣,  ᯮ짮 ஢ 䬥 
   ⢮ ᦠ, ᪮ ஦ 
⭮ 筮 㦥 ਡ ⥯ﬨ 1/2.

	   室 ⮪  ⨢ ⬠
ᦠ,   㯮 ⮩  筮 䥪⨢ ⮤
஢ 筨   । , 
 ᦠ⨥   ⮯ . ⮤    
᫥   1980 . (. []),  ⥬ ८ ⫨,
஬, ﭮ    1986 . (. [Bentley]).

	 ⮤ ⮨  ᫥饬:  䠢 筨
⮨  N ᨬ  ࠬ 1, 2, ..., N.  ࠭ ᯨ᮪
ᨬ, ।⠢騩 ᮡ  ⠭ 䠢. 
㯫  室 ᨬ c, 饣   ᯨ᪥  i, 
।   i (ਬ, ⮭ : [祢᪨],
.69-73). ⥬  ⠢ ᨬ c  砫 ᯨ᪠,
㢥稢  1   ᨬ,  । c.  ࠧ,
 "" ᨬ    砫 ᯨ᪠   
⪨ .



.te 1 .ce 㯥⮥ ஢.  -


	 ᬮ७  ⮤   ஢
ᬠਢ  ⢥ 室  楯窨 ᨬ (⥪) 
஬ 筮 䠢.  ⮬ ⠢    裡
⮣ 室 䠢   묨, 騬 㯠 (筮
⠪ ।⠢묨   楯祪  䠢, 筮 饬 
256 ᨬ-).

	 ⥩襬 砥  ᯮ짮  ⢥ 室
䠢    ᨬ () 室 ⮪.  ⠪
ࠡ⠥ ⮤ squashing ணࠬ PKPAK (ᯮ짮 ᪮
஢ 䬥, 室 ). ⥯ ᦠ  ⮬
⭮⥫쭮  -- 浪 50%  ⥪⮢ 䠩.

	ࠧ 襩 ⥯ ᦠ    뤥 
室 ⮪  楯祪  ஢ 뫮  
楯窨.

	 ⮤,  ஬    , ਭ 
  (. [Lempel),  筮 뢠 LZ-compression.   
᫥饬: 㯠騪 ﭭ ࠭ ஥ ⢮ ᫥
ࠡ⠭ ᨬ  .    ࠡ⪨ 室 ⮪
 㯨訥 ᨬ    , ᤢ
।騥 ᨬ   ᠬ .   ⮣ ,
뢠 ⠪ ᪮騬 ᫮६ (sliding dictionary), 
 ࠧ ॠ; ᯥਬ⠫ ⥬ 㤠 ⠭, 
ணࠬ LHarc 1.13 ᯮe 4- , LHA 2.13  PKZIP
1.10 -- 8-,  ARJ 2.20 -- 16-.

	 뤥 (⥬ ᪠  ᫮) ᠬ 
砫 ப 室 ⮪, ᮢ    ப 
᫮,  뤠  室  (length, distance),  length -- 
  ᫮ ப,  distance -- ﭨ   
室 ப (  䠪᪨  ப  ,
⥭   ࠧ).  砥, ᫨ ⠪ ப  , 
室 ⮪   । ᨬ 室 ⮪.

	 ࢮ砫쭮 ᨨ ਬ । ᯮ짮
⥩訩   ᥬ ᫮. ६ ᦠ  ⠪ ॠ樨
뫮 ய樮쭮 ந  室 ⮪  ࠧ
,  ਣ  ࠪ᪮ ᯮ짮. , 
쭥襬 뫮 । ᯮ 筮 ॢ  ண
᪠  ᫮ [Bell],    冷  ᪮
ࠡ ⬠.

	 ࠧ,  - ८ࠧ  ⮪
室 ᨬ   ࠫ ⮪ length  distance.
祢,   ⮪  ⮪ ᨬ   䠢 L
 D,     ਬ   㯮  ⮤ (RLE,
஢ 䬥, 䬥᪮ ஢).    室 
奬 㯥⮣ ஢,  䥪⨢  ࠪ᪨
ᯮ㥬  饥 ६ (,  ⭮, ᯮ짮
஬).  ॠ樨 ⮣ ⮤ 室 
ᮣᮢ 뢮  ⮪   䠩.  ஡ 筮
蠥 ⥬ ।   ᨬ   ⮪.

	 ⠪ ⬥ ப  
-- (Lempel-Ziv-Welch compression, LZW).  
⫨ ᮪ ᪮ ࠡ   㯠, ⠪  
ᯠ, 筮 ஬ ॡ    
⭠ ॠ. ⮪ --  ⥯ ᦠ  ࠢ
 奬 㯥⮣ ஢. ⪮ 襬 . 
஡ ᢥ . [Welch].

	 ᫮, ࠭騩 ப ⥪  ᮤঠ騩 浪
2-4-8  ஭㬥஢ . 襬   256  ப,
騥   ᨬ,  ண ࠢ  .
 ᬠਢ 室 ⮪, ࠧ   ப 
     ᫮.

	⠥ ᪮쪮 ᨬ  ப s    ᫮
ப t -- ᠬ  䨪 s.       ஬
n.  뢥 ᫮ n  室 ⮪, ६⨬ 㪠⥫ 室
⮪  length (t) ᨬ ।    ᫮  ,
ᮤঠ饥 ப t+c,   -- । ᨬ  室 (ࠧ ᫥
t).  ८ࠧ ⮪ ᨬ  室  ⮪ ᮢ 祥
᫮  室.  ࠧ ᫮  4096   । 12
   .

	 ᯮ 楯窠   ᫮  .
 ९ ᫮ 㯠騪   ४ 
,   (  筮).

	 ࠪ᪮ ॠ樨 ⮣ ⬠ ᫥ , 
  ᫮, ஬ ᠬ , ᮤঠ ᨬ
楯窨, ࠭  ண 㣮 ,  ன  
ਯᠭ  ᨬ. ᫥⢨ ⮣   ⮩ ᯨ筮
ன   .



.te 1 .ce ஥஢. ᯮ짮 


	३ ⥯  ᠭ ⬮, ᯮ짮  襩
ॠ樨.  ᭠砫 -- ᪮쪮 ᫮  楫, ⠢ 
ࠧࠡ⪥  । ਭ 襭.

	० ᥣ, 㯠訪 ࠧࠡ뢠  楫 ࠨ 
 ணࠬ 짮⥫. ⮬  ॡ ࠧࠡ⪠
ᯥ樠쭮 ଠ 娢 䠩. 筮  ॡࠧ⥫
"䠩  䠩" (筮 ணࠬ compress  ⥬ UNIX). ,
뢠 筮 ⪨ ࠭祭  ᯮ㥬 :
ॠ  ᯮ 44K  㯠  ᥣ 12K 
ᯠ (  쥬 ,   ⮦ ⥫),  
६  PKZIP ॡ 90K  70K ᮮ⢥⢥, ARJ -- 275K  160K).
, 室 ᮪ ᪮ ᯠ;  ᪮  㯠
뢠   ࠭祭.

	室  ⮣,  ᯮ짮  - 
ࠧ஬ ᪮饣 ᫮ 4 ,   ஢
ॡ    ⢥   ⥯ ᦠ.  
஢   ﭨ ᯮ짮 ᪮ ஢
䬥  ᯥ樠쭮 ࠭  ॢ, ⨬஢
 ⥪⮢ 䠩.  ஬ ⮣,  ᯮ짮 
-ਥ஢  ᯠ, 騩 㬥 ᫮
⮢ 뫮  ᮮ⢥⢥ 㢥 ᪮ ࠡ.

	⨪, ᮡ࠭  ࠧࠡ⪥ ணࠬ, , 
 97%  㦥 楯祪  ,  ॢ室 16
ᨬ.    ⢥  ⥯ ᦠ 
 ॢ  16 ﬨ. 窨   len,  len >= 16,
஢  楯窨  16  ᫥騬 ⥫ ⮬
"७ "  祭 (len - 16).

	,  ﭨ (distances) 楯祪 ஢ 
訥 , 祭  室   [0..15] (
ࠧ  4096 ). 訥   ஢ 
ࠢ⥫쭮 讣 "㪫" । .

	 ᨬ (楯窨  1) ஢  楯窨
 1  ᫥騬 ⮬, ᮤঠ騬 ᠬ ᨬ.  ⬥,
 楯窨  2 ஢   楯窨,    
⤥ .   । 먣  3   ᨬ: (2 + 8
+ 2 + 8) = 20   2 楯窠  2 ᨬ  (2 + 4 + 8) = 14 
  ᨬ쭮 楯窥. ,  䨪
⬠ ᪠ ᮢ ப  䥪⨢ 㯠뢠
ਨ  楯祪 ᨬ:   ᪥ ᨬ  
᪮ 楯窠  﫠   :  ਬ, 楯窠
"abcabcabcabcabc" ஢  (1, "a"), (1, "b"), (1, "c"), (12,
3) -- 䠪᪨ १ 饭  ᠬ ᥡ  ᤢ  3 ᨬ.



.te 1 .ce    ணࠬ


	⨥ 室 ⮪ ⢫ 㭪樥 SquoPack(),
饩  室  짮⥫᪨ 㭪権 -뢮.
᭮ 横 ணࠬ   ।⠢ ᫥騬 ࠧ:


SquoPack()	{
	Init (); // init dictionary, trees, and output bit buffer

	while (not EOF)	{
		int	length;
		int	distance;

		FindMatch (&length, &distance);
		// scan input and find longest string in dictionary
		// which matches with it; record its length and distance
		// from the end of dictionary.

		EncodeLength (length);
		EncodeDistance (distance);

		UpdateDictionary (length);
		// this discards first 'length' chars
		// from the beginning of dictionary
		// and reads next characters from input
	}

	Done (); // output EOF marker and flush output buffers.
}


	 (dictionary) ᯥ稢 ࠭ 4096 ᫥
⠭ ᨬ,  271(=16+255)  㯨  室 ᨬ
   ப, ᮢ饩  室.  ॠ樨 뫮
ᯮ짮 ஢  ࠧ襭 䫨⮢ ⥬ ࠭
吝 ᯨ᪮.

	⢨ FindMatch ॠ ।⢥  㭪樨
SquoPack(); ⢨ UpdateDictionary ॠ 㭪樥 MoveBuf().
஢   ﭨ  뢮 祭  ⢫
ᮮ⢥⢥ 㭪樨 PutLen()  PutDist(). ,  ᢮ ।,
  㭪 PutBits()  PutByte()  ⭮ ਧ樨
뢮 楯祪 . ਬ ᪠ ⠭ 設
ॢ 䬥  ஢  "⮯ " (.
[]).

	ᯠ騪 ࠪ᪨  ॠ 
   ᥬ୮ 㭪樨 _SquoUnpack.



.te 1 .ce 䨫஢  ⨬


	ࢮ砫쭠  㯠騪 뫠 ᠭ  ⫠
ࠪ᪨    (ᯠ騪   ᠬ 砫 
ॠ  ᥬ).  १⮢ 䨫஢ 
  ⨬樨 㭪権 PutLen()  PutDist()  । 㭪樨
UpdateHash()   㬥 ६ ᦠ ਬ୮  18%.  ,
⨪ ,  ப  2, 3  4 ᨬ ⠢
 75% 饣 ⢠ (  ப  1, ..  
ᨬ).  室  㣮 ⮤ ஢ ( ६ 
ᨬ)  ⥫쭮 㢥 ᪮ ࠡ ணࠬ 
㬥 ॡ  .  쭥 ⨬ 易 
९뢠   ६ ⪮    ᥬ
( ᯠ  ᠭ  ᥬ 砫쭮).

	⮪, ᮤঠ騩 १ ஡ ᪮ ணࠬ,
 ⠪  ⠪  䨫஢騪, ਢ   2.



.te 1 .ce 㪮⢮ 짮⥫


  ᡮઠ:
====================

	짮⥫ ।  㭪樨, 騥 ॠ
ᮮ⢥⢥ 㯠  ᯠ  ⮪  (..,
ᦠ⨥  ᯮ짮 ᫥⥫쭮 -뢮). ᠭ
㭪権 室  䠩 squo.h, । --  䠩 squo.c,
lzp.asm, lzu.asm.  ᡮન ணࠬ 짮⥫ 室
 ᮮ⢥騥 쥪 㫨 (squo.obj, lzp.obj,
lzu.obj).   樨  쥪 㫥 室 䠩
style.h, squo.h, squo.c, lz.asi, lzp.asm, lzu.asm.  ⮢ ணࠬ
(⥩訩 㯠騪  䠩,  compress) 室 
䠩 squotest.c.

	 ࠧࠡ⪥, ⫠  ஢ ᯮ짮 
Turbo C 2.01,   compact. ७ ணࠬ  㣮
-  MS-DOS   ।⠢ ᫮⥩;  㣨
⥪, 祢,  ९뢠 㫥  몥
ᥬ. ᪮  ꥬ ,  㭪樨 ਢ,  ⠪
  뢠  㤭⥩.  饥 ६  ࠡ⠥
 UNIX-쭮 ᨥ ணࠬ.


䥩 맮:
=================

#include "squo.h"

extern	int	SquoPack (ReadFunc *reader, WriteFunc *writer);

extern	int	SquoUnpack (ReadFunc *reader, WriteFunc *writer);


頥 祭:
======================

	祭 0 砥 ᯥ譮 襭, 1 -- ᯥ譮.


ࠬ:
==========

	ࠬ reader  writer -- ᮮ⢥⢥ 㪠⥫ 
㭪樨   뢮, ।塞 짮⥫.  㭪樨
SquoPack, ਬ, reader  ⠢ 㯠 
(᪠, ।   ᨢ  ),  㭪樨 writer 
  । 㦥 㯠묨 (ਬ,    䠩).
஡ --  樮 ਬ squotest.c.

	 ReadFunc  WriteFunc ᠭ  筮 䠩 squo.h:

typedef	size_t	ReadFunc (void * buffer, size_t size);
typedef	size_t	WriteFunc (void * buffer, size_t size);

	ReadFunc ⠥ (WriteFunc ᮮ⢥⢥ 뢠) size 
(size <= 65535)   buffer. 頥 祭 -- ᫮
⠭ (ᠭ) .


訡:
=======

	 饩 ᨨ  訡 뢮  㯠 
ᯠ. 祬,  ।⢠   ॠ 
ணࠬ 짮⥫. ᯠ騪  ஫ ࠢ쭮
室  ( 砭 ).




.te 1 .ce ᯮ짮 筨


祢᪨, .. ⨥   ଠ樨. - .:   , 1989.
᪠ ࠡ, 饭 ⥮ਨ ஢ 筨.
ন   १,  ⮬ ᫥ 業 ᫮
⬮ ஢. 讥  㤥 㭨ᠫ .

 .. ⨥ ଠ樨   ⮯  // ஡ ।
ଠ樨. - 1980. - .16, N.4. - . 16-21. ࢮ ᠭ 쭮
⨢ ⮤ ⮯ .

 .   ⥮ਨ ଠ樨  ୥⨪. - .: , 1963.
 ᪨ १ ⥮ਨ ଠ樨.

Abramson, N. Information Theory and Coding. McGraw-Hill, New York,
1963. ࢠ 뫪  ⮤,   䬥᪨
஢ (. 61-62).

Bell, T.C. IEEE Trans. COM-34, pp. 1176-1182 (1986).
ਬ 筮 ॢ ᪠   -.

Bentley, J.L., Sleator, D.D., Tarjan, R.E., Wei, V.K. A locally
adaptive data compression scheme. Commun. ACM 29, 4 (Apr. 1986),
320-330. ᠭ 쭮 ⨢  ᦠ, ᯮ騩
⨪ " " ( ⮯  ).

Gallager, R.G. Variations on the theme by Huffman. IEEE Trans. Inf.
Theory IT-24, 6 (Nov. 1978), 668-674. 䥪⨢  ⨢
஢ 䬥.

Huffman, D.A. A method for the construction of minimum-redundancy
codes. Proc. Inst. Electr. Radio Eng. 40, 9 (Sept. 1952), 1098-1101.
᪠ ࠡ,  뢠 ஢ 䬥.

Hunter, R. and Robinson, A.H. International digital fscsimile coding
standarts. Proc. Inst. Electr. Electron. Eng, 68, 7 (July 1980),
854-867. ᠭ ਫ ஢ 䬥  ᦠ  ਩ 
୮- ࠦ.

Knuth, D.E. Dynamic Huffman coding. J. Algorithms 6, 2 (Feb. 1985),
163-180. ࠪ᪠ ॠ 쭮 ⨢ ஢
䬥.

Rissanen, J.J. Arithmetic codings as number representations. Acta
Polytech. Scand. Math. 31 (Dec. 1979), 44-51. 쭥襥 ࠧ⨥ 
䬥᪮ ஢.

Rissanen, J., and Langdon, G.G. Universal modelling and coding. IEEE
Trans. Inf. Theory IT-27, 1 (Jan 1981), 12-23.  
ࠧ ᦠ   ஢  ஢.

Rubin, F. Arithmetic stream coding using fixed precision registers.
IEEE Trans. Inf. Theory IT-25, 6 (Nov. 1979), 672-675.   
ࠡ,   室  䬥᪮ ஢:
᫥  䨪஢ 窮  ६⠫쭠 ࠡ ⬠.

Vitter, J.S. Two papers on dynamic Huffman codes. Tech. Rep. CS- 85-13.
Brown University Computer Science. Providence, R.I. Revised Dec. 1986.
⨬쭮 ⨢ ஢ 䬥.

Welch, T.E. A technique for high-perfomance data compression.  IEEE
Comput. 17, 6 (June 1984), 8-19. ᠭ   ᦠ ,
 ⫨騩, , ᮪ ⢮ ᦠ.  ⥭
 LZW (Lempel-Ziv-Welch compression)  筮 ७
(᪨ ଠ GIF, ⮤ shrinking ணࠬ PKZIP).

Witten, I.H., Neal, R.M., and Cleary, J.G. Arithmetic coding for data
compression. Commun. ACM 30, 6 (June 1987), 520-540. ᪠
ࠡ  䬥᪮ ஢.

Ziv, J., and Lempel, A. Compression of individual sequences via
variable-rate coding. IEEE Trans. Inf. Theory IT-24, 5 (Sept. 1978),
530-536. ᠭ ⮤ ᦠ, 騩 ப ⥪ 㪠⥫ 
  ࠭ 宦.    ᭮ 設⢮
ࠪ᪨ ᯮ㥬 ணࠬ ᦠ .



.te 1 .ce ਫ .  ணࠬ ᦠ  MS-DOS.


	 ᫥饩 ⠡ ᮤঠ १ ஢
ணࠬ  ᪮쪨 䠩.  ࠢ ਢ १
   娢஢  MS-DOS.   ᮤন
 ᦠ⮣ 䠩, ࠢ -- ⭮襭 ࠧ ᦠ⮣ 䠩 
ࠧ ਣ쭮 䠩.  squo.c ।⠢ ᮡ
室 ⥪   㫥 뢠 ணࠬ, 䠩 mawk.doc
-- ⥪  ᪮ 몥, 䠩 sos.doc -- ⥪  ᪮ 몥.
  'Original' ਢ ࠧ 㯠 䠩.


Filename   Original SquoTest 1.5 PKZIP 1.0   LHA 2.13     ARJ 2.30
---------  -------- ------------ ----------- ------------ -----------
SQUO.C        17821    5876  33%   5371  30%   5148  29%    5089  29%
MAWK.DOC      42961   17108  40%  15359  35%  15122  35%   14713  34%
SOS.DOC       28525   14373  50%  14356  50%  12957  45%   12500  44%


	 ਢ 祭 ( ) ணࠬ ᦠ
 MS-DOS  ⪨ 㪠 ⬮  ࠡ  쭥訬
뫪.   ࠦ ୮ Haruhiko Okumura ('Data
Compression Algorithms of LARC and LHarc'), Robert K Jung (ARJ archiver
documentation), PKWARE Inc. (PKZIP archiver documentation) 
।⠢ ଠ.


PKPAK 3.61:

⮤ Packed --  RLE.
⮤ Crunched --  LZW.
⮤ Squashed -- 室 ᪮ ஢ 䬥.

PKZIP 1.10:

⮤ Shrinked -- ஢  LZW  筮 ⪮
᫮  ६  .

⮤ Imploded -- ஢  - 
᪮ ஢ 䬥.

LHArc:
 -  ᪮ ஢ 䬥.

LHA:
 -  ᪮ ஢ 䬥.

ARJ:
 -  ਣ ⮤ ஢ (筨:
᪠ 㬥).


