У нас: 141825 рефератів
Щойно додані Реферати
Тор 100
Скористайтеся пошуком, наприклад
Реферат
Грубий пошук
Точний пошук
Вхід в абонемент
Курсова робота
Дипломна робота
Магістерська робота
Реферат
Контрольні роботи
Реферат
-
Реалізація ідеї арифметичного кодування
19
FV;>3> G8A;0, O:5 2E>48BL 2 [low; high]. B0:><C 28?04:C ?>40;LH5 :>4C20==O ?@>4>26C20B8 =5<>6;82>. "><C :>4C20;L=8: ?>28=5= A;V4:C20B8 70 B8<, I>1 V=B5@20; [low; high] 702648 1C2 4>A8BL H8@>:8<. 09?@>ABVH8< 70A>1>< 4;O FL>3> T 70157?5G5==O H8@8=8 V=B5@20;C =5 <5=H59 Max_frequency <0:A8<0;L=>3> 7=0G5==O AC<8 2AVE =0:>?8GC20=8E G0AB>B.@>1;5<0 2V4 T<=>3> ?5@5?>2=5==O @>73;O40TBLAO BV;L:8 2V4=>A=> :>4C20;L=8:0, B><C I> ?@8 45:>4C20==V :>6=>3> A8<2>;C ?@>F5A :@>:CT 70 >?5@0FVT9 :>4C20==O, V 2V4 <=5 ?5@5?>2=5==O =5 28=8:=5, O:I> 28:>=CTBLAO B0:5 A0<5 <0AHB01C20==O 7 B8<8 6 A0<8<8 C<>20<8.7.2 5@5?>2=5==O."5?5@ @>73;O=5<> <>6;82VABL ?5@5?>2=5==O ?@8 FV;>G8A;5=><C <=>65==V. 5@5?>2=5==O =5 28=8:=5, O:I> 4>1CB>: range*Max_frequency 2<VICTBLAO 2 FV;5 A;>2>, 1> =0:>?8G5=V G0AB>B8 =5 <>6CBL ?5@528IC20B8 Max_frequency. Range <0T =091V;LH5 7=0G5==O 2 Top_Value + 1, B><C <0:A8<0;L=> <>6;8289 4>1CB>: T 2^16*(2^14 1), O:5 <5=H5 2^30. ;O 287=0G5==O code_value B0 range 28:>@8AB0=89 B8? long, I>1 70157?5G8B8 32-E 1VB>2C B>G=VABL 0@8D<5B8G=8E >1G8A;5=L. 7.3 025@H5==O :>4C20==O.@8 7025@H5=V ?@>F5AC :>4C20==O =5>1EV4=> ?>A;0B8 C=V:0;L=89 B5@<V=0;L=89 A8<2>; (EOF-A8<2>;), 0 ?>BV< ?>A;0B8 4>AB0B=N :V;L:VABL1VBV2 4;O 30@0=BVW B>3>, I> 70:>4>20=89 @O4>: ?>B@0?8BL 2 ?V4AC<:>289 @>1>G89 V=B5@20;. '5@57 B5, I> ?@>F54C@0 done_encoding() <>65 1CB8 2?52=5=0 , I> low i high >1<565=V 01> B0:, I>:low < First_qtr < Half ( high, 01>low < Half < Third_qtr ( high, B> 7=0G5==N B@510 ?5@540B8 01 01> 10 2V4?>2V4=>, 4;O 2840;5==O =5287=0G5=>ABV, O:0 70;8H8;0AL. "0:8< G8=>< EOF C=V:0;L=> 287=0G0TBLAO >AB0==V<8 ?5@540=8<8 1VB0<8.8. >45;V 4;O 0@8D<5B8G=>3> :>4C20==O.@>3@0<0 ?>28==0 ?@0FN20B8 7 <>45;;N, O:0 O2;OT A>1>N ?0@C ?5@5:>4CNG8E B01;8FL index_to_char [] i char_to_index [], V <0A82 =0:>?8G5=8E G0AB>B cum_freq []. > >AB0==L>3> <0A82C 28AC20NBLAO B0:V 28<>38:Aum_freq [i 1] ( cum_freq [i];V:>;8 =5 @>18BLAO A?@>10 :>4C20B8 A8<2>; V, 4;O O:>3> Aum_freq [i 1] = cum_freq [i];Aum_freq [0] ( Max_frequency./:I> FV C<>28 28:>=CNBLAO, 7=0G5==O 2 <0A82V =5 ?>28==V <0B8 72 O7:C 7 4V9A=B<8 7=0G5==O<8 =0:>?8G5=8E G0AB>B A8<2>;V2 B5:ABC. 45:>4C20==O, V :>4C20==O 1C4CBL ?@0FN20B8 :>@5:B=>, ?@8 G><C >AB0==L><C 1C45 B@510 <5=H5 <VAFO, O:I> G0AB>B8 B>G=V.(3040T<> CA?VH=5 :>4C20==O 50VV! C 2V4?>2V4=>ABV 4> <>45;V 7 B01;8FV 1, O:, 27030;V, =5 2V4>1@060T A?@026=L>W G0AB>B8 2 B5:ABV).8.1 $V:A>20=V <>45;V.09?@>ABVH>N <>45;;N T B0:0 <>45;L, 2 O:V9 G0AB>B8 A8<2>;V2 ?>ABV9=V. >45;L 7 B01;8FV 1 7040T ?>ABV9=V G0AB>B8 A8<2>;V2 4;O 0;D02VBC a, e, i, u, o, !. ;O AB8A:C 0=3;V9AL:8E B5:ABV2 <>6=0 28:>@8AB0B8 G0AB>B8 7 G0AB8=8 !2>40 @0C=0. @>F54C@0 V=VFV0;V70FVW start_model () ?@>AB> ?V4@0E>2CT =0:>?8G5=C 25@AVN F8E G0AB>B, A?>G0B:C V=VFV0;V7C202H8 B01;8FV ?5@5:>4C20==O. (284:VABL 28:>=0==O ?@>F5AC :>4C20==O B0 45:>4C20==O <>6=0 ?@8A:>@8B8, O:I> FV B01;8FV ?5@52?>@O4:C20B8 B0:, I>1 =0926820=VHV A8<2>;8 @>7<VIC20;8AO =0 ?>G0B:C <0A82C cum_freq []. '5@57 B5, I> <>45;L T ?>ABV9=>N, ?@>F54C@0 update_model () 1C45 ?@>AB> ?CAB>N.!B@>3>N <>45;;N T B0:0 <>45;L, 2 O:V9 G0AB>B8 A8<2>;V2 B5:TVdVXЋ’аЮ଴Ш0bdtЋћ ўЄмо†фZ!b!Ь!м!о!"" """&"r"Њ"ъуъиЮХЮХЮХЮХЮХПЮПЮДАёА±А±АДЮАЮХ§ЮХЎ—Ў—Њ—Ў‚yhoNНhoNНCJhoNНCJmH"sH"hoNНCJmHnHujhoNНCJUhoNНCJhoNНCJmHsHhoNНhoNНhoNНmHsHhoNНhoNН5ЃCJmH"sH"hoNНCJhoNНhoNНCJhoNНCJmH"sH"hoNН5ЃCJ mH"sH"hoNН5ЃCJ,hoNН5Ѓ+TVdxєXЁвD¦ф nР*^¬ЪцоойШШШПЖйЖЖййййПППйµ$ЖЄЄ Ц0яяяяяяцЦяяяЦяяяЦяяяЦяяя4Цlaцъ"ь"###vvv$$Ifa$kdЊ$$If–lЦЦF”я¬ДЬ Ц0яяяяяяцЦяяяЦяяяЦяяяЦяяя4Цlaц# #$#,#B#vvv$$Ifa$kd$$If–lЦЦF”я¬ДЬ Ц0яяяяяяцЦяяяЦяяяЦяяяЦяяя4ЦlaцB#D#H#P#f#vvv$$Ifa$kd¤$$If–lЦЦF”я¬ДЬ Ц0яяяяяяцЦяяяЦяяяЦяяяЦяяя4Цlaцf#h#l#t#Љ#vvv$$Ifa$kd0$$If–lЦЦF”я¬ДЬ Ц0яяяяяяцЦяяяЦяяяЦяяяЦяяя4ЦlaцЉ#Њ#ђ# Ц0яяяяяяцЦяяяЦяяяЦяяяЦяяя4Цlaц®#°#І#Т(Ф(к(")xoofY$Жp$Ifa$$$Ifa$$„7`„7a$$a$ЃkdH$$If–lЦ”iЦF”я¬ДЬ Ц0яяяяяяцЦяяяЦяяяЦяяяЦяяя4Цlaц")$)L)„)†)®)д)№°°j°°Ekd<$$If–lЦ0¬ ќцЦяяЦяяЦяяЦяя4Цlaцl$$Ifa$EkdШ$$If–lЦ0¬ ќцЦяяЦяяЦяяЦяя4Цlaцlд)ж)*@*B*j* ќцЦяяЦяяЦяяЦяя4Цlaцl$$Ifa$Ekd $$If–lЦ0¬ ќцЦяяЦяяЦяяЦяя4Цlaцl ќцЦяяЦяяЦяяЦяя4Цlaцl$$Ifa$Ekdh$$If–lЦ0¬ ќцЦяяЦяяЦяяЦяя4Цlaцlћ- -И-...є/Ё54:А>В>№°°je$„7`„7a$$a$Ekd”$$If–lЦ09¬ 9sцЦяяЦяяЦяяЦяя4Цlaцl$$Ifa$Ekd0$$If–lЦ09¬ 9sцЦяяЦяяЦяяЦяя4Цlaцlц6ш67996:8:Є<¬<=м=В>?Ь@в@д@о@р@т@ц@ь@AAAAA<ABADANAPARAvA|A~A€ABBB BC$C(C0C2C|CENETEґEѕEШEдEжEтEцE>FHF¶FGGGG(G&H`HvH~H€HЋHКHужЬУЬУЬУЬжУИЬѕУѕУѕУЬѕУѕУѕУѕУѕУѕУѕУѕУѕУѕУѕУѕУЬУґУЬУЬѕУѕУЬУЬУѕУѕУѕґИґУѕУЬhoNНhoNН5ЃCJhoNНCJmHsHhoNН5ЃCJmH"sH"hoNНhoNНCJhoNНCJmH"sH"hoNНhoNНCJmH"sH"j»рhoNНCJmHsHGВ>??ЮCEENEPEєEDFјF&G(GhGЋGЮG$H&HvHxHРHFI IўIТIJ–JKzKцццццццццццццццццццццццццццц$„7`„7a$КHIIII"I@IўI®I°IјIѕIДIЖIОIТIJ–JљJМJЦJШJKKKK&K(KtKxKzKRLМLОLТLMnMVOёOPPPPPPZQ€QКQpSњSUU”UћUЄU°UІUъVWWчнчнчгчнчнчнчнчгЩчгнчгчнчнчгчРнЕгє°ҐгҐгчнчнчгчгҐгҐгнгнгнчгн bцццццццццццццццццццццццццццц$„7`„7a$WW~W€WЉWЋWђW a,a8a:a>a@aBaDaFaHa"b(b.b0b6b>bDbJbVb^bfbjbvbЂb†b€bђbљbњbћb bўb¬b®b°bІbёbѕbАbЖbОbФbЪbужЬжЬжЬжЬжЬжЬжПжЬжЬжЬжЕ»ЕужПж®ЬжужЬжЬжЬжЬжЬжЬжЬжПжЎжЬжЎжЬжужЬжЬjЈрhoNНCJmHsHhoNНhoNНCJmH"sH"hoNНCJmH"sH"hoNНCJmH"sH"jырhoNНCJmHsHhoNНCJmHsHhoNНhoNНCJmH"sH"jлрhoNНCJmHsH?Ъbдbкbмbфbшbcccc&c.c0cTc^c`cТcЮcаcмcрcЉdкdмdъdьd"e>f@fFfJfRfVfѕfДfЖfИfКfТfФfжgиgоgтgъgмhтhцhюhКiРiТiдiжipjrj b€dЉdмd"e$eXjXlZl~lЂlюop4p6pЄrтr2s4szt|tКtМtbv¤vTwђwцццццццццццццццццццццццккк$&FЖџa$$„7`„7a$Vm`mbmhmjm|m~mnnn$n(n2n4nfnlnnnxnЂnОno,o4o6o@oHoRoTovo~op4pЪpаprr r0r4rhrnrprrrtr|rЄrЪrЬrкrтr s"s,sttt|tКtluvuxu|u~u†uЋuђu’uљuњu uўu¬uґuмuтuфuцйцйцйЯцйцЯцЦЯцЦцЦЯЦЯцйцйцйЯцЯЛЯцЯцйцйЯцйцйцЯцѕцЯцѕцЯцЦЯЛЯцйцйцйцйцйцйцйЯцйjЈрhoNНCJmHsHhoNН5ЃCJmH"sH"hoNНhoNНCJhoNНCJmH"sH"hoNНhoNНCJmH"sH"hoNНCJmHsHKфuьuvbv„v†vўvwwww"w&w(w8w>w@wHwLwNwRwTwnwpwЊw’w‚z„z°zѕАВЖИМОТФШЪвё|В|Д|О|Ц|в~и~к~т~ш~R^`jrљЂєґї¶ївї$З0З2З<ЗцйЯцТцЯЙцЙцЙцЙцЙцЙцЙЯцјцЯёЯіЯйцйцйцйцйцйЯцйцйЯцйцйЯцЙцЙЯё±ёЯ¦ЯцйцhoNН5ЃCJmH"sH"UhoNН5ЃhoNНjЈрhoNНCJmHsHhoNНhoNНCJjірhoNНCJmHsHhoNНCJmH"sH"hoNНhoNНCJmH"sH"hoNНCJmHsHAђw’w‚z„z°zІzљґї¶ївїдїњДшЗѕОАОВОшОъОФСУИЪКЮМЮ ЯpЯrЯцфцфцлфллллллжлллллллллллл$a$$„7`„7a$$„7^„7a$ABC B>G=> 2V4?>2V40NBL A?5F8DV:0FVW <>45;V. 0?@8:;04, DV:A>20=0 <>45;L 7 ?@>3@0<8 1;87L:0 4> AB@>3>W <>45;V 4;O 45O:>3> D@03<5=B0 7 !2>40 @0C=0, 72V4:8 WW 1C;> 27OB8. 4=0:, 4;O B>3>, I>1 1CB8 VAB8=> AB@>3>N, WW A8<2>;8 2 FL><C D@03<5=BV, O:V =5 7 O2;ONBLAO, ?>28==V <0B8 ;VG8;L=8:8, I> 4>@V2=NNBL 0, 0 =5 1 (V ?@8 FL><C 65@B2C20B8 <>6;82>ABO<8 2EV4=8E B5:ABV2, O:V <VABOBL FV A8<2>;8). @V< B>3>, ;VG8;L=8:8 =5 ?>28==V <0AHB01C20B8AO 4> 7040=>W =0:>?8G5=>W G0AB>B8, O: F5 7@>1;5=> 2 ?@>3@0<V. 7030;V, AB@>30 <>45;L ?>28==0 1CB8 28@0E>20=0 9 ?5@540=0 ?5@54 ?5@5A8;0==O< 2;0A=5 B5:ABC. ;V@V V #VB=5= ?>:070;8, I> ?@8 7030;L=8E C<>20E F5 =5 40ABL 7030;L=>3> ?>:@0I5==O AB8A:C ?>@V2=O=> 7 >?8A0=8< =86G5 040?B82=8< :>4C20==O<.8.2 40?B82=0 <>45;L.>=0 7<V=NT G0AB>B8 265 7=0945=8E 2 B5:ABV A8<2>;V2. !?>G0B:C 2AV ;VG8;L=8:8 <>6CBL 1CB8 @V2=8<8, I> 2V4>1@06CT 2V4ACB=VABL ?>G0B:>28E 40=8E, 0;5 ?@8 ?5@53;O4V :>6=>3> 2EV4=>3> A8<2>;C 2>=8 7<V=NNBLAO, =01;86CNG8AL 4> A?>AB5@56C20=8E G0AB>B. :>4C20;L=8:, V 45:>4C20;L=8: 28:>@8AB>2CNBL >4=0:>2V ?>G0B:>2V 7=0G5==O (=0?@8:;04, @V2=V ;VG8;L=8:8) V >48= V B>9 A0<89 0;3>@8B< >=>2;5==O, I> 4>72>;8BL WE <>45;O< 702648 70;8H0B8AO =0 >4=><C @V2=V. >4C20;L=8: >B@8<CT =0ABC?=89 A8<2>;, :>4CT 9>3> B0 7<V=NT <>45;L. 5:>4C20;L=8: 7 OA>2CT =0ABC?=89 A8<2>; =0 >A=>2V A2>TW ?>B>G=>W <>45;V, 0 ?>BV< >=>2;NT WW.@>3@0<0 45<>=AB@CT B0:C 040?B82=C <>45;L, I> @5:><5=4CTBLAO 4;O 28:>@8AB0==O ?@8 AB8A:C B0 2V4=>2;5==V, >A:V;L:8 =0 ?@0:B8FV 2>=0 T :@0I>N =V6 DV:A>20=0 <>45;L 70 5D5:B82=VABN AB8A:C. =VFV0;V70FVO ?@>2>48BLAO B0:8< A0<5 G8=><, O: 4;O DV:A>20=>W <>45;V, 70 28:;NG5==O< B>3>, I> 2AV G0AB>B8 2AB0=>2;NNBLAO 2 =C;V. @>F54C@0 update_model (symbol), 28:;8:0TBLAO 7 encode_symbol () B0 decode_symbol () ?VA;O >1@>1:8 :>6=>3> A8<2>;C.=>2;5==O <>45;V T 4>A8BL 4>@>38< 7 ?@8G8=8 =5>1EV4=>ABV ?V4B@8<:8 =0:>?8G5=8E AC<. ?@>3@0<V 28:>@8AB0=V ;VG8;L=8:8 G0AB>B, O:V >?B8<0;L=> @>7<VI5=V 2 <0A82V 2 ?>@O4:C 7<5=H5==O A2>WE 7=0G5=L, I> T 5D5:B82=8< 284>< A0<>>@30=V7>20=>3> ;V=V9=>3> ?>HC:C. @>F54C@0 update_model () A?>G0B:C ?5@52V@OT =>2C <>45;L =0 ?@54<5B ?5@528I5==O =5N >1<565=L 70 25;8G8=>N =0:>?8G5=>W G0AB>B8, V O:I> 2>=> ?@8ACB=T, B> 7<5=HCT 2AV G0AB>B8 4V;5==O< =0 2, 72060NG8 ?@8 FL><C =0 B5, I>1 ;VG8;L=8:8 =5 ?5@5B2>@8;8AO 2 0, V ?5@5>1G8A;NT =0:>?8G5=V 7=0G5==O. >BV<, O:I> F5 =5>1EV4=>, update_model () ?5@52?>@O4:>2CT A8<2>;8 4;O B>3>, I>1 @>7<VAB8B8 ?>B>G=89 2 9>3> 2V@=V9 :0B53>@VW 2V4=>A=> G0AB>B=>3> ?>@O4:C, G5@3CNG8 4;O 2V4>1@065==O 7<V= ?5@5:>4C20;L=V B01;8FV. @57C;LB0BV, ?@>F54C@0 71V;LHCT 7=0G5==O 2V4?>2V4=>3> ;VG8;L=8:0 G0AB>B8 V 2?>@O4:>2CT 2V4?>2V4=V =0:>?8G5=V G0AB>B8.9. D5:B82=VABL AB8A:0==O.7030;V, ?@8 :>4C20==V B5:ABC 0@VD<5B8G=8< <5B>4><, :V;L:VABL 1VBV2 2 70:>4>20=><C @O4:C
Сторінки:
1
2
3
4
5
6