Home Technique Codeword

Codeword



Concept

CodewordreferstothesignalencodedbyHuffmancode.

Aframecontainsmdatabits(message)andrredundantbits(checkbits).Thetotallengthoftheframe=databits+redundantbits.TheX-thbitunitcontainingdataandcheckbitsusuallybecomesanX-bitcodeword.Thecodewordiscomposedofseveralcodeelements,andthecommunicationincomputercommunicationisrepresentedbyseveralbitsofbinarycode.

Becauseelectronicequipmentcanonlyrepresenttwostatesof0and1,sowhenprocessingsymbolselectronically,thesymbolsneedtobebinarycoded.Forexample,theASCIIcodeusedinthecomputeristhe8-bitbinarycodeofthecommonlyusedsymbolsinthecomputer.Inpractice,thecharacterscanalsobespecificallycodedaccordingtothesituation.

Workingprinciple

Assumingthatacertainsourcehasfivesymbolsu1,u2,u3,u4andu5,thecorrespondingprobabilityisP1=0.4,P2=0.1,P3=P4=0.2,P5=0.1.First,thesymbolsarequeuedindescendingorderofprobability.Whenencoding,startfromthetwosymbolswiththesmallestprobability,andselectonebranchas0andtheotherbranchas1.Here,wechoose0fortheupperbranchand1forthelowerbranch.Thencombinetheprobabilitiesofthetwobranchesthathavebeencoded,andre-queue.Repeatedlyusetheabovemethodseveraltimesuntilthecombinedprobabilityisnormalized.ItcanbeseenfromFigures(a)and(b)thatalthoughtheaveragecodelengthsofthetwoareequal,thesamesymbolcanhavedifferentcodelengths,thatis,thecodingmethodisnotunique.,Theremaybeseveralbrancheswithequalprobability,resultinginanon-uniquequeuingmethod.Generally,ifthenewlymergedbranchisarrangedtotheuppermostbranchwithequalprobability,itwillhelpshortenthecodelengthvariance,andthecompiledcodewillbeclosertotheequallengthcode.Herethecodingofpicture(a)isbetterthan(b).

ThecodewordoftheHuffmancode(thecodeofeachsymbol)isadifferentprefixcodeword,thatis,anycodewordwillnotbethefrontpartofanotherWhentransmittingtogether,thereisnoneedtoaddanisolationsymbolinthemiddle.Aslongasthereisnoerrorduringtransmission,thereceivingendcanstillseparateeachcodewordwithoutconfusion.

Inpracticalapplications,inadditiontousingregularcleaningtoeliminateerrordiffusionandbufferstoragetosolveratematching,themainproblemistosolvethestatisticalmatchingofsmallsymbolsets,suchasblack(1),white(0)Thestatisticalmatchingoffaxsourcesuses0and1runsofdifferentlengthstoformanenlargedsymbolsetsource.Runlengthreferstothelengthofthesamecodeelement(suchasthelengthornumberofacontinuousstringof0orastringof1inabinarycode).AccordingtotheCCITTstandard,itisnecessarytocount2×1728kindsofrunlengths(lengths),sothatthestoragecapacityduringimplementationistoolarge.Infact,theprobabilityofalongrunisverysmall,soCCITTalsostipulates:iflrepresentsthelengthoftherun,thenl=64q+r.Amongthem,qiscalledthemaincode,andristhebasecode.Whenencoding,therunlengthofnotlessthan64iscomposedofthemaincodeandthebasecode.Whenlisanintegermultipleof64,onlythecodeofthemaincodeisused,andthecodeofthebasecodenolongerexists.

ThemaincodeandbasecodeofthelongrunarebothcodedbyHuffmanrules,whichiscalledmodifiedHuffmancode,andtheresultsareavailableinatable.Thismethodhasbeenwidelyusedindocumentfaxmachines.

This article is from the network, does not represent the position of this station. Please indicate the origin of reprint
TOP