GB2332127A - Variable length coding with code word length detection - Google Patents

Variable length coding with code word length detection Download PDF

Info

Publication number
GB2332127A
GB2332127A GB9725966A GB9725966A GB2332127A GB 2332127 A GB2332127 A GB 2332127A GB 9725966 A GB9725966 A GB 9725966A GB 9725966 A GB9725966 A GB 9725966A GB 2332127 A GB2332127 A GB 2332127A
Authority
GB
United Kingdom
Prior art keywords
length
code word
variable
code
memorized
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
GB9725966A
Other versions
GB2332127A9 (en
GB9725966D0 (en
GB2332127B (en
Inventor
Seung-Hyun Nam
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
WiniaDaewoo Co Ltd
Original Assignee
Daewoo Electronics Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Publication of GB2332127A9 publication Critical patent/GB2332127A9/en
Application filed by Daewoo Electronics Co Ltd filed Critical Daewoo Electronics Co Ltd
Priority to GB9725966A priority Critical patent/GB2332127B/en
Publication of GB9725966D0 publication Critical patent/GB9725966D0/en
Publication of GB2332127A publication Critical patent/GB2332127A/en
Application granted granted Critical
Publication of GB2332127B publication Critical patent/GB2332127B/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03MCODING; DECODING; CODE CONVERSION IN GENERAL
    • H03M7/00Conversion of a code where information is represented by a given sequence or number of digits to a code where the same, similar or subset of information is represented by a different sequence or number of digits
    • H03M7/30Compression; Expansion; Suppression of unnecessary data, e.g. redundancy reduction
    • H03M7/40Conversion to or from variable length codes, e.g. Shannon-Fano code, Huffman code, Morse code

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)

Abstract

The invention relates to a coding apparatus which detects the length of a variable-length code word using a Huffman code tree. Symbols to be coded are inputted to a code-book memory which generates a corresponding fixed-length code containing a variable-length code word. Each bit of a generated code word is successively selected, and for each bit, the number of terminal nodes at a corresponding level in a Huffman code tree is found. The boundary between the variable-length code and stuffing bits is calculated, and on the basis of this, the length of the variable-length code within the fixed length codeword is deduced. The coding apparatus avoids the need to memorize the length information of variable-length codes.

Description

1 VARIABLE-LENGTH CODING METHOD AND APPARATUS THEREOF is 2332127 This
invention relates to a variable-length coding method and an apparatus thereof. More particularly, the present invention relates to a method for transforming fixed-length code words into variable-length code words on the basis of Huffman code tree and an apparatus which can perform the method.
Generally, a variable-length coding method is a coding technique often used for compressing data without loss of data. The variable-length coding transforms all occurring possible data, which are generated from a data source and are represented into fixed-length code words, into variable-length code words according to occurring probability of the data, such that an average code length of the data is reduced. That is, by assigning variable-length code words to the library of all occurring possible code words, the average word length of the variable-length code is shorter than that of the original data, and therefore, data compression is achieved.
Huffman coding method is a procedure commonly used to construct a minimum redundant variable-length code for a known data statistic. Huffman coding method applies data of which statistics have already been known to Huffman code tree according to the statistic, and therefore the variable- length codes according to Huffman coding method are prefix-free variable length codes.
One example of a variable-length coding apparatus is disclosed in U.S. Pat. No. 3,675,212 issued to Josef Raviv, etc. on July 4, 1972. The variable-length coding apparatus suggested by Josef Raviv, etc.
- 2 includes a three-state associative memory which is employed as an encoding-decoding instrumentality for making conversions between fixedlength codes and variable-length codes. The three-state associative memory stores lengths of the variable-length code words associated with the fixed-length codes and variable-length codes.
Furthermore, the present inventor and assignee filed a decoding apparatus dated May 31, 1996, under the application number 08/655,838, which is now issued.
It is one object of the present invention to provide a method which can transform fixed-length code words into variable-length code words without memorizing the length information of variable-length code words.
It is other object of the present invention to provide an apparatus which can transform fixed-length code words into variable-length code words without memorizing the length information of variable-length code words.
In order to achieve the above objects, a method for translating symbols into variable-length code words according to the one aspect of the present invention includes the steps of: a) generating a memorized code word from a code-book memory by inputting a symbol to the code-book memory in which the variable-length code words are stored according to the symbols; b) detecting a length of a variablelength code word which is included in the memorized code word on the basis of selected code words, levels defined in a Huffman code tree by each of the selected code words, and numbers of terminal nodes in each of the levels, wherein the selected code words are generated by selecting m bit among bits of the memorized code word K times, where m = 1, 2, 3, 4,.. 1 K, and K denotes a maximum length of the variable length code word; and c) accessing the variable-length code word from the memorized code word according to the length of the variable-length code word.
According to another aspect of the present invention, a method for coding symbols into variablelength code words includes the steps of: a) generating a memorized code word from a code-book memory by inputting a symbol to the code-book memory in which the variable-length code words are stored; b) selecting m bit among bits of the memorized code word in order to generate selected code words, where m = 1, 2, 3, 4,... ' K, and K denotes a maximum length of the variable length code word; c) determining whether each of the selected code words consists of bits of a variable length code word on the basis of each level which is defined in Huffman code tree according to each selected code word, and numbers of terminal nodes in each level; and d) accessing the variable-length code word from the memorized code word according to a result of the step c). Preferably, the step c) includes the steps of: c-1) detecting the levels of each of the selected code words on the basis of the Huffman code tree; c-2) detecting the numbers of terminal nodes in each level; and c-3) operating a function LD(X),:
,.=E 2'J.Lj i-^ is - 4 wherein bi is the i-th bit value of a selected code word selected m bits in the memorized code word, L i is a total number of terminal nodes in the j-th level of the Huffman code tree; and c-4) determining whether each LD W. is a negative value or not.
According to other aspect of the present invention, an apparatus for translating symbols into variable-length code words includes: a) codebook memory means for storing variable-length code words with a maximum length of the variable-length code words according to the symbols b) variable-length detection means for detecting a length of a variablelength code word included in the memorized code word on the basis of selected code words, levels defined in a Huffman code tree by each of the selected code words, and numbers of terminal nodes in each of the levels, wherein the selected code words are generated by selecting m bit among the memorized code word K times, where m = 1, 2, 3, 4,... r K, and K is a maximum length of the variable length code word; and c) packing means for accessing the variable-length code word from the memorized code word according to the length of the variable-length code word.
According to the present invention, the method and the apparatus make it possible to translate the symbols into the lengths of the variable-length code words without storing the length information for the variable-length code words in a memory, such that it is not need a memory for storing the length information for the variable-length code words.
The foregoing and other objects, aspects and advantages will be better understood from the following detailed description of preferred embodiments of the invention with reference to the drawings, in which:
FIG. 1 is a circuit diagram for showing a variable-length coding apparatus according to one embodiment of the present invention; FIG. 2 is a circuit diagram for showing one example of the boundary detection part 500 depicted in FIG. 1 according to an embodiment of the present invention; FIG. 3 is a circuit diagram for showing one example of the computation part 530 depicted in FIG. 2 according to an embodiment of the present invention; FIG. 4 is a circuit diagram for showing one example of the length detection part 600 depicted in FIG. 1 according to an embodiment of the present invention; FIG. 5 is a circuit diagram for showing one example of the packing part 400 according to an embodiment of the present invention; FIG. 6 is a flowchart for illustrating the variable-length coding apparatus depicted in FIG. 1; FIG. 7 is a view for illustrating the packing part 400 depicted in FIG. 1; and FIG. 8 is a view for showing a structure of a canonical Huffman code tree.
Preferred embodiments of the present invention will be illustrated below with reference to the accompanying drawings.
A variable-length coding method and apparatus thereof according to an embodiment of the present invention are based on a canonical Huffman code tree.
A Huffman code tree having n symbols is composed of (2n-1) nodes. That is, the (2n-1) nodes include n terminal nodes having symbols and (n-1) connecting nodes not having symbols. A canonical Huffman code tree has a structure in which all terminal nodes are 3S positioned to the left of all connecting nodes in each 6 is level. It has been known that all Huffman code trees can be translated into canonical Huffman code trees without increasing the average code length.
FIG. 8 shows a structure of a canonical Huffman code tree for (a, b, c, d, e, f, g, h]. 8 symbols are positioned to the left of all connecting nodes. Each symbol has a coding bit string from the root to a terminal node thereof as its code word. For instance, a symbol [c] has 3 bits code word [1011 and a symbol [f] has 5 bits.4--ode word (111101. That is, each symbol has a variable-length code word which is defined in a Huffman code tree according to an occurrence probability thereof.
FIG. 1 is a circuit diagram for showing a variable-length coding apparatus according to one embodiment of the present invention.
Referring to FIG. 1, a variable-length coding apparatus includes a buffer part 100, a code-book memory 200, a variable-length detection part 300, and a packing part 400.
The buffer part 100 temporarily stores symbols inputted with a serial or parallel manner from an exterior, and outputs the symbols to the codebook memory 200 in response to a control signal(not shown in FIG. 1).
The code-book memory 200 stores variable-length code words with a maximum length of the variablelength code words according to the symbols or addresses corresponding to the symbols. Therefore, when a symbol (X1 to which a variable-length code word VLW(X) having a length less than the maximum length thereof is assigned is inputted to the code-book memory 200 through the buffer part 100, the code-book memory 200 generates a memorized code word M(X) including the variable-length code word VLW(X) thereof and stuffing bits, and provides the memorized code word MW to the variable-length detection part 300 and the packing part 400, respectively.
For example, when the maximum length of variablelength code words is K bits(K is of integer 1 or more) and a symbol (X1 is inputted to the codebook memory 200, the code-book memory 200 generates the memorized code word MW of an K-bit string, and outputs the memorized code word MW to the variable-length detection part 300 and the packing part 400, respectively.
The variable-length detection part 300 detects a length of a variablelength code word VLW(X) in the memorized code word MW which is provided from the code-book memory 200 on the basis of the canonical Huffman code tree, as depicted in FIG. 8.
The variable-length detection part 300 first detects a number of terminal nodes in each level of the Huffman code tree in order to detect the length of the variable-length code word VLW(X). And then, the variable- length detection part 300 operates with a computation manner, illustrated hereinafter, based on the number of terminal nodes in each level and the memorized code word MM, thereby generating a length value LEGM corresponding to the length of the variable-length code word VLW(X). And, the variablelength detection part 300 provides the length value LEG(X) to the packing part 400.
Preferably, the variable-length detection part 300 includes a boundary detection part 500 and a length detection part 600 in order to generate the length value LEGM, as shown in FIG. 1.
The boundary detection part 500 selects 1-bit to K-bit among bits of the memorized code word MW in turn, thereby respectively generating K selected code 8 is words BW(X),,=,, BW(X).,,, j BW(X).. Also, the boundary detection part 500 detects a number Of terminal nodes in a level corresponding to each of the selected code words BW (X) M= 1, 2 K. And then, the boundary detection part 500 compares the selected code words BW (X) wl, BW (X)m=2", BW(X) w:K and the numbers of the terminal nodes of levels to each other to thereby detect a boundary between bits of the variable-length code word VLW(X) and stuffing bits in the memorized code word M(X), and generates a boundary value MSB(X)., as a boundary detection result.
The length detection part 600 generates the length value LEGM of the variable-length code word VLWM on the basis of the boundary value MSB(X). from the boundary detection part 500, and provides the length value LEGM to the packing part 400.
FIG. 2 is a circuit diagram for showing one example of the boundary detection part 500 depicted in FIG. 1 according to an embodiment of the present invention.
Referring to FIG. 2, in order to generate the boundary value MSBM.. the boundary detection part 500 includes a code selection part 510, a level detection part 520, an 530, and a boundary value generation part 540.
The code selection part 510 selects 1-bit to Kbit among the bits of the memorized code word M(X) which is provided from the code-book memory 200 to thereby in turn generate the selected code words BW(X)j. BW(X)V-, BW(X) K ' and provides the selected code words BW(X)j, BW(X)V-, BW (X) K to the level detection part 520 and the computation part 530, respectively.
When a selected code word BW(X). is inputted from the code selection part 510 to the level detection 9 - part 520, the level detection part 520 detects level m of the selected code word BW(X), in the Huffman code tree, which is defined by a position of the selected code word BW(X), in the Huffman code tree, and a total number of terminal nodes from the root to the level m. And then, the level detection part 520 generates a level code word NW(X), corresponding to the level m and the total number of terminal nodes to the level m. In order to generate the level code word NW(X),, the level detection part 520 gives weights to the numbers of teminal nodes in each level according to each level, and sums up the weighted numbers of terminal nodes of each level.
That is, the sum WS(X), of the weighted numbers with respect to level m which is defined by the selected code word BW(X), is of the following form:
W-1 WSM'=E 2"l'-Li.
izO where j denotes a level in the Huffman code tree, and L, is a number of terminal nodes in level j.
The level detection part 520 translates the sum WSW, into a binary digit to generate the level code word NW(X). and provides the level code word NW(X). to the computation part 530.
The computation part 530 subtracts the level code words NW(X),, NWM2,... f NW(X)K from the selected code words BW(X)j, BW(X)V- 1 BW(X)K in order to generate subtraction result values W(X)j, W(X)2...., LD (X) K ' each of which denotes whether which the selected code words BW(X) w=l, 2, K are only composed of bits of the variable-length code word VLW(X) or not.
FIG. 3 is a circuit diagram for showing one example of the computation part 530 according to the present invention.
Referring to FIG. 3, since the maximum length of the variable-length code word is K bits, the computation part 530 preferably includes K subtracters 531 through 537.
A m-th subtracter of the computation part 530 subtracts the level code word NW(X). of level m from the selected code word BW (X) 0 of m-bits to generate an subtraction result value W(X). which is one of the subtraction result values LDW WC1, And then, the computation part 530 provides the subtraction result values LD (X) m=l, 2---.'K to the boundary value generation part 540.
The boundary value generation part 540 detects most significant bits MSB(X)w,' from each bit is strings of the subtraction result values LD (X) or,, a.... K and outputs the detected most significant bits MSB (X) apl, to the length detection part 600 as the boundary value MSB(X). which denotes the boundary between bits of the variable-length code word VLW(X) and stuffing bits in the memorized code word M(X).
Referring to FIG. 1 again, the length detection part 600 generates the length value LEGM on the basis of the boundary value MSB(X). which denotes the length of the variable-length code word VLW(X) in the memorized code word M(X).
FIG. 4 is a circuit diagram for showing one example of the length detection part 600 according to the present invention.
Referring to FIG. 4, the length detection part 600 includes K XOR gates to generate the length value LEGM.
A first XOR gate X0Rs the bit value 0 and MSB (X) 1, and the n-th XOR gate X0Rs MSB (X) n-1 and MSB(X)n, where n is of integer 2 through K.
And, logic values generated by each of the K XOR gates are outputted to the packing part 400 as the length value LEGM of the variable-length code word VLW(X) included in the memorized code word MW.
In FIG. 1, the packing part 400 selectively outputs the memorized code word M(X) according to the length value LEG (X), such that the packing part 400 only outputs the variable-length code word VLW(X) except for the stuffing bits.
FIG. 5 is a circuit diagram for showing one example of the packing part 400 according to an embodiment of the present invention.
Referring to FIG. 5, the packing part 400 includes an input part 410, an accumulation part 420, and an output part 430.
The input part 410 includes a first barrel shifter 411 and a first latch 412.
The first barrel shifter 411 slides on a 2K-bit string which are inputted from the first latch 412 and the code-book memory 200, according to the length value LEGM to thereby generate a first window bit string B, of Kbit-, and outputs the first window bit string B, to the first latch 412 in parallel.
The first latch 412 stores the first window bit string B1 and outputs the first latch bit string W, having the same bit values as those of the first window bit string B, to the first barrel shifter 411 and the output part 430, respectively. Therefore, as illustrated above, the first latch bit string W, of Kbit and the memorized code word MW of K-bit are inputted to the first barrel shifter 411 in parallel.
The accumulation part 420 includes an adder 421, a second latch 422, a subtracter 423, and a third latch 424.
The adder 421 adds the length value LEGM of the variable-length code word VLW(X) to a latched value L, is from the second latch 422 with a modulo-K, and provides an added value to the second latch 422. Further, the adder 421 generates a carry signal when the added value is greater than K. The carry signal is outputted to an exterior for informing a state that bits of the variable-length code word VLW(X) are only stored in a fourth latch 432 of the output part 430, as illustrated in detail below.
The second latch 422 stores the added value from an adder, and outputs the added value to the subtracter 423 and the adder 421, respectively.
The subtracter 423 subtracts the added value from K to thereby generate a subtracted value S.. And, the subtracter 423 provides the subtracted value S. to the third latch 424.
Then, the third latch 424 outputs the subtracted value S. as a control signal L 2 to the output part 430.
The output part 430 includes a second barrel shifter 431 and the fourth latch 432.
The second barrel shifter 431 slides on a 2K-bit string composed of the first latch bit string W, from the first latch 412 of the input part 410 and the bit string of the memorized code word MW in response to the control signal L2. to thereby generate a second window bit string of K bits.
And, a fourth latch 431 stores the second window bit string B2 with an input order of the second window bit string B.. The fourth latch 431 preferably has the same memory space as the maximum length K of the variable-length code word.
operations of the variable-length coding method and apparatus thereof according to the present invention will be described below in detail.
When all possible symbols occurring in a data source are [a, b, c, d, e, f, g, h] and frequently occurring numbers of each symbols are in turn 1510, 1310, 1210, 1110, 510, 210, 110, 110, each variable-length code word VLW(X) is assigned to the 8 symbols according to the occurrence frequent numbers of them, as shown in FIG. 8. Table 1 shows code values of the variable-length code words assigned to the 8 symbols according to the canonical Huffman code tree.
Variable-length code word of 1-bit is assigned to the most frequently occurring symbol (a], and variable- length code words of 6-bit are assigned to the least frequently occurring symbols [g and h].
Table 1
Symbol Variable-length code word [X] 1 VLW (X) a 0 b 1 0 0 c 1 0 1 d 1 1 0 e 1 1 1 0 f 1 1 1 1 0 9 1 1 1 0 h 1 1 1 1 The variablelength code words VLW(X) are stored to the code-book memory 200 according to the symbols used as addresses thereof, as shown in Table 2 below. When a variable-length code word VLW(X) is stored to the code-book memory 200, a MSB of the variable- length code word VLW(X) is first and lastly, a LSB thereof is stored at one memory unit of memory.
Therefore, since variable-length code words are stored with 6 bits which is the longest length of the variable-length code words, the code-book memory 200 outputs the memorized code-words MW of 6-bit when a 14 symbol X is inputted.
Table 2
Symbol Memorized code [X] word MM: MSB-> LSB a 0 X X X X X b 1 0 0 X X X c 1 0 1 X X X d 1 1 0 X X X e 1 1 1 0 X X f 1 1 1 1 0 X 9 1 1 1 1 0 h 1 1 1 1 1 x: stuffing bir7to-r--gon't care) FIG. 6 is a flowchart for illustrating the variable-length coding apparatus depicted in FIG. 1.
Referring to FIG. 6, in step 1, when the symbol [c] is inputted to the code-book memory 200 from the buffer part 100, the code-book memory 200 generates the memory code word M(c) having the bit string [lolxxxl corresponding to the symbol [c], as shown in table 2. And then, the code-book memory 200 provides the memory code word M(c) to the variable-length detection part 300 and the packing part 400, respectively(ST1 and ST2).
The memorized code word M(c) which is inputted to the variable-length detection part 300 is inputted to the code selection part 510 of the boundary detection part 500, as shown in FIG. 2. When the memorized code word M(c) is inputted to the code selection part 510, the code selection part 510 selects 1-bit to 6-bit among the memorized code word M(c) in turn to thereby generate selected code words BW(c) W-1, 2, 6, as shown in table 3. And then, the code selection part 510 provides each selected code word BW (c),,,, 2, 6 to the level detection part 510 and computation part 520, respectively(ST3).
Table 3 selected code word BW(c)m BW (c) w, 1 BW (C) w-2 l 0 BW (c).3 1 0 1 BW (C) nr-4 =1 0 1 1 BW (c) U=s =1 0 1 1 1 is BW (C) or-6 =1 0 1 1 1 1 when the selected code word BW (c) m, which is generated by selecting m-bit among the memorized code word M(c), is inputted to the level detection part 520, the level detection prat 520 detects the number of terminal nodes from level 1 to level m on the basis of the canonical Huffman code tree depicted in FIG. 8 and generates the level code word NW (c). weighed by each level, as illustrated above(ST4).
For example, when m=3, the code selection part 510 generates the selected code word BW(c). = [1011, as shown in table 3. Then, level detection part 520 gives weights to each level and sums up the weighed numbers of terminal nodes, thereby generating the SUM WS(C)3 as follows:
2 WS(c =E 2 3!.L j =8 i:c where j denotes a level in the canonical Huffman 16 - code tree, and L, denotes the number of terminal nodes in level j.
And then, the level detection part translates the SUM WS(C)3 into the binary digit to thereby generate the level code word NW(C)3100010001. Level code words NW(c),, (m=l, 2,..., 6) with respect to all selected code word BW (c). (m=l, 2,..., 6) are shown in table 4 below.
Table 4
1 NW (c) 1 1 0= 0000000 2 2= 000010 3 8= 001000 4 14=001110 5 30=011110 6 62=111110 When the level code words NW(c). (m=l, 2,..., 6) and the selected code word BW (c),, (m=l, 2,..., 6) are respectively inputted to the computation part 530, the level code words NW (c). (m=l, 2,..., 6) and the selected code words BW(c). (m=l, 2,..., 6) which are respectively inputted to the computation part 530 are respectively and in turn inputted to the first through sixth subtacter 531 through 536 of the computation part 530, as shown in FIG.3.
Each of the first through sixth subtacter 531 through 536 performs the same function LD(c). as follows:
LD(c)m=BW(c),,,-AWc),.
Therefore, the computation part 530 generates the first through sixth subtraction result LD(C)9r-1,2,-,6 as 17 - the operation result values LD (X=C).1,2,...,6 with respec to the symbol c, as shown in table 5 below Table 5 m LD (c) 0 MSB--> LSB 1 000001 2 000000 3 000001 4 111101 111001 110001 And, the first through sixth subtraction result LD(C).,-1,2....,, are provided to the boundary value is generation part 540(ST5).
Illustrating the step 5 in detail, the first through sixth subtacter 531 through 536 generate the first through sixth subtraction result LD(c).,',, -,6 according to the function LD(c)., as follows:
1 0 LD(c),=E 21 -'-k. -E 2 1-1-LA i-1 j =0 j 10 2 1 LD(c)2=E22-b,-E2-1.L =010 i=1 po j 3 2 LD(C)3= E2 3 -4b,- E 23 10 i=1 j=0 4 LD(c),=E2-'-.-E25-i.L =-7 i-1 j=0 j 10 18 where bi denotes the i-th bit value of the 4 3 I-D(C)4'= E2 4 -1-bi-E2 4-j L. = -3 10 i=1 po 6 5 LD( C)6 =E 2-'.b, -E 2 6 -1.LI= _ 15 10 f= 1 po selected code word BW(c)., and L, denotes the number of terminal nodes in level j.
In step 6, the boundary value generation part 540 detects the bit values of MSB (C) wF1,2_61 from each bit string of the subtraction results LD(c) or-1,2,...6, and outputs the bit values of MSB(C).-1,2-,6 as the boundary value MSB (C) OPM..A to the length detection part 60O(ST6).
In step 7, as shown in FIG. 4, each bit of the MSB (C) w=1,2..,6 = 10001111 which is inputted to the length detection part 600 is inputted to the first through sixth XOR gate in parallel, such that the length detection part 600 generates a bit string [0001001 as the length value LEGM which denotes the length of the variable length code word VLWM of the symbol [c]. And, the bit string [0001001 is provided to the packing part 400 (ST7).
In step 8, when the length value LEG(c) is inputted to the packing part 400, the packing part 400 detects the variable-length code word VLW(c) among the memorized code word M(c) in response to the length value LEG(c) and only outputs variable length code word VLW(c) to thereby encode the symbol [cl(ST8).
operations of the packing part 400 according to an embodiment of the present invention will be described below in detail with reference to FIG. 5 and 7.
FIG. 7 is a view for showing the outputs of each part of the packing part 400 when symbols [a, b, c, f, d, h, e, g, a, bl are inputted to the buffer part 100 in turn.
Referring to FIG. 7, in time t=l, since a memorized code word MW is not inputted from the code-book memory 200 to the packing part 400, the first barrel shifter 411 of the packing part 400 provides a bit string [x, x, x, x, x, xl as the f ist window bit string B(t=l), to the first latch 412 in response to the length value LEG(c)=0.
Therefore, the second latch 422 outputs Ll=0 to the subtracter 423 and the adder 421, respectively, such that the third latch 424 provides L2=6 as the control signal to the second barrel shifter 431. And, the second barrel shifter 431 outputs B (t=1)2[Xl X' x, x, x, xl as the second window bit string B (t=1)2 composed of bits from LSB to the sixth bit of the 2K bits, as shown in FIG. 7.
In time t=2, when the symbol [a] is inputted to the code-book memory 200 and the memorized code word M(a) for the symbol [a] is generated from the code book memory 200, the memorized code word M(a)=[al. x, x, x, x, x] is inputted to the first barrel shifter 411 of the input part 410 and the second barrel shifter 431 of the output part 430, respectively. At the same time, the length value LEG(a)=1 corresponding to the symbol [a] is generated from the variable length detection part 300, as illustrated above, and the length value LEG(a)=1 is provide to the first barrel shifter 411 and the adder 421, respectively.
When the length value LEG(a)=1 from the variable- - 20 length detection part 300 and the memorized code word MW from the code- book memory 200 are respectively inputted to the first barrel shifter 411, the barrel shifter 411 slides on the first latch bit string [x, x, x, x, x, xl from the first latch 412 and the bit string M (a) = [a,. x. x, x, x, xl of the memorized code word M (a) in response to the length value LEG (a) =1, so that thefirst barrel shifter 411 generates the first window bit string Wi= [x, x, x, x, x, a,], as shown in FIG. 7, and outputs the first window bit string W1==[X, x, x, x, x, a,] to the first latch 412. The first latch 412 outputs the first window bit string W,[x, x, x, x, x, a,] as the first latched bit string L, to the first barrel shifter 411 and the second barrel is shifter 431, respectively.
However, in this time, since the control signal L.=0 which provided from the third latch 424 of the accumulation part 420 is inputted to the second barrel shifter 431, the second barrel shifter 431 outputs a bit string [a,. x, x, x, x, xl to the fourth latch 432.
In time t=3, the memorized code word M(b)=[bl. b., b3, x, x, xl of the symbol [b] and the length value LEG(b)=3 are inputted to the first barrel shifter 411. The first barrel shifter 411 slides on a bit string [x, x, x, x, x, a,. b, j b2, b3, x, x, xl f ormed by the memorized code word M(b)=[bl, b,, b3, x, x, xl and the first latched bit string W,= [x, x, x, x, x, all in response to the length value LEG(b)=3, and accesses 6 bits after 3 bits from MSB of the bit string to thereby output the accessed 6 bits [x, x, a,. b,, b 21 b3] as the first window bit string B(t=3), to the first latch 412. Then, the first latch 412 outputs the first window bit string B(t=3),Ex, x, a,, b,, b2, b31 as the first latched bit string W, to the first barrel - 21 is shifter 411 and the second barrel shifter 421, respectively. On the other hand, the adder 421 adds the LEG(b)=3 to the Ll=1 from the second latch 422, and outputs the added value [41 to the second latch 422. The second latch 422 outputs the previous added value Ll=1 to the subtracter 423 and at the same time, stores the current added value Ll=4 therein instead of the previous added value L,=1.
The subtracter 423 subtracts the previous added value Ll=1 from the value [61, and provides the subtracted value S.=5 to the third latch 424. Then, the third latch 424 stores the subtracted value S.=5 and outputs the subtracted value S.=5 as the control signal L2=5 to the second barrel shifter 431.
The second barrel shifter 431 slides on a bit string lx, x, x, x, x, al. b,,, b2, b3, x, x, xl formed by the memorized code word M (b) = [b, g b2, b3, x. x, xl and the first latched bit string W1=[x, x, x, x, x, all in response to the control signal L,=5 which is provided from the third latch 424, and accesses 6 bits [al. b, j b2, b3, x, xl after 5 bits f rom MSB of the bit string. And then, the second barrel shifter 431 outputs the accessed 6 bits as the second window bit string B(t=3), =[a,, b,, b;, b3, x, xl to the fourth latch 432.
The fourth latch 432 stores the second window bit string B (t=3) 2 = [al. b, j b21 b3f X' X] - In time t=4, the memorized code word M (c) = [c,. C21 C31 X' X' X] of the symbol [c] and the length value LEG(c)=3 are inputted to the first barrel shifter 411.
The first barrel shifter 411 slides on a bit string [x, x, al. b,, b2, b31 CV C21 C31 X' X' X] formed by the memorized code word M(b)=[c,, C21 C31 X' x, xl and the first latched bit string W,= [x, x, al, b,.. b 2, b., c,] in response to the length value LEG(c)=3, and accesses 6 22 - r bits after 3 bits from MSB of the bit string to thereby output the accessed 6 bits [blf b2i b. cl. c., C3 1 as the first window bit string B (t=4), to the first latch 412. Then, the first latch 412 outputs the first window bit string B(t=4),=[bl, b2, b31 Cl' C2t C3] as the first latched bit string W, to the first barrel shifter 411 and the second barrel shifter 421, respectively.
on the other hand, the adder 421 adds the LEG (c) =3 to the L,=4 from the second latch 422 to thereby generate an added value [71. But, since the adder 421 performs with 6-module addition, the adder 421 outputs the added value [11 and the carry signal C=1. And, the adder 421 provides the added value [11 to the second latch 422, and outputs the carry signal C=1 to the exterior.
The second latch 422 outputs the previous added value L,=4 to the subtracter 423 and at the same time, replaces the previous added value L,=4 as the current added value Ll=l, as shown in FIG. 7.
The subtracter 423 subtracts the previous added value Ll=4 from the value [6), and provides the subtracted value S.=2 to the third latch 424. Then, the third latch 424 stores the subtracted value S.=2 and outputs the subtracted value S,=2 as the control signal L2=2 to the second barrel shifter 431.
And then, the second barrel shifter 431 slides on a bit string [x, x, a,. bl, b2, b,, c,, C2, C31 X# X' X] formed by the memorized code word M(b)=[c,, C.. C31 X' x, xl and the first latched bit string W,[x, x, a,, bl 1 b2, b31 in response to the control signal L.=2 which is provided from the third latch 424, and accesses 6 bits [a,. b,, b2r b31 Cli C,] after 2 bits from MSB of the bit string. And, the second barrel shifter 431 outputs the accessed 6 bits as the second window bit string B (t=4) 2 = (a,, bl, b2, b3, C1 1 C23 to the fourth latch 432.
In this time, all the 6 bits storage space of the fourth latch 432 are occupied by bits of the variablelength code words. Therefore, by accessing the bits outputted from the latch 432 in response to the occurrence of the carry signal C=1, we can obtain only bits of the variable-length code words except for the stuffing bits.
As the process illustrated above, the packing part 400 continuously output variable-length code words corresponding to inputted symbols.
Therefore, the present invention can translate the symbols into the variable-length code words without storing the length data in a memory.
While the invention has been described in terms of a preferred single embodiment, those skilled in the art will recognize that the invention can be practiced with modification within the scope of the appended claims.
24

Claims (25)

  1. A method for translating symbols into variable-length codewords by using a coding apparatus, the coding apparatus including a code-book memory for storing the variable-length code words with a maximum length of the variable-length code words according to the symbols, the method comprising the steps of:
    a) generating a memorized code word from the code-book memory by inputting a symbol to the codebook memory; b) detecting a length of a variable-length code word included in the memorized code word on the basis of selected code words, levels defined in Huffman code tree by each of the selected code words, and numbers of terminal nodes in each of the levels, wherein the selected code words are generated by selecting m bit among the memorized code word K times, where m = 1, 2, 3, 4, K, and K denotes a maximum length of the variable length code word; and c) accessing the variable-length code word from the memorized code word according to the length of the variable-length code word.
  2. 2. A method as claimed in Claim 1, wherein said step b) includes the steps of:
    b-1) detecting boundary between the variablelength code word and stuffing bits of the memorized code word on the basis of the selected code words and the numbers of terminal nodes in each of the levels in order to generate a boundary value; and b-2) detecting the length of the variable-length code word which is included in the the memorized code word on the basis of a boundary value by step b-1).
  3. 3. A method as claimed in Claim 1, or Claim 2, wherein said step b-1) includes the steps of:
    b-1-1) detecting the levels corresponding to each of the selected code words; b-1-2) detecting the numbers of terminal nodes in each of the levels; b-1-3) giving weights to the numbers of terminal nodes in response to the levels, thereby generating weighted numbers for each of the levels; b-1-4) summing up the weighted numbers from the root of the Huffman code tree to each of the levels, thereby generating sums corresponding to each of the levels; b-1-5) translating the sums into binary digits, thereby generating level code words corresponding to each of the sums; b-1-6) subtracting each of the level code words from the selected code words corresponding to each of level code words, thereby generating subtraction result values; and b-1-7) detecting most significant bits from the subtraction result values in order to output the most significant bits as the boundary value.
  4. 4. A method as claimed in any one of Claims 1 to 3, wherein said length of the variable-length code word is respresented by a length value which is generated by X0Ring the most significant bits to one another.
  5. 5. A method for translating symbols into variable-length code words by using a coding apparatus, the coding apparatus including a code-book memory for storing the variable-length code words with a maximum length of the variable-length code words according to the symbols, the method comprising the steps of:
    is a) generating a memorized code word from the code-book memory by inputting a symbol to the codebook memory; b) selecting m bit in the memorized code word in order to generate selected code words, where m = 1, 2, 3, 4. K, and K denotes a maximum length of the variable length code words; c) determining whether each of the selected code words consists of bits of a variable length code word on the basis of each level which is defined in Huffman code tree according to each selected code word, and numbers of terminal nodes in each level; and d) accessing the variable-length code word from the memorized code word according to a result of the step c).
  6. 6. A method as claimed in Claim 5, wherein said step c) includes the steps of:
    c-1) detecting the levels of each of the selected code words on the basis of the Huffman code tree; c-2) detecting the numbers of terminal nodes in each level; and c-3) operating a function LD(X)M:
    LD(X)M=B;f(A)m -NRA)m BW(A)_ =E 2"-bl I_.
    014- A NWM.=E 2m-l.
    wherein b, is the i-th bit value of a selected code word which is selected m bits among the memorized code word, and L, is a total number of terminal nodes in the j-th level of the Huffman code tree; and c-4) determining whether each LD W. is a negative value or not.
  7. 7. A method as claimed in Claim 5, or Claim 6, wherein said step d) accesses a selected code word having the longest length of selected code words having non-negative values as the variable length code word.
  8. S. An apparatus for translating symbols which are represented by fixedlength code words into variable-length code words, the apparatus comprising:
    a) code-book memory means for storing variablelength code words with a maximum length of the variable-length code words according to the symbols; b) variable-length detection means for detecting a length of a variablelength code word included in the memorized code word on the basis of selected code words, levels defined in Huffman code tree by each of the selected code words, and numbers of terminal nodes in each of the levels, wherein the selected code words are generated by selecting m bit among the memorized code word K times, where m = 1, 2, 3, 4. K, and K is a maximum length of the variable length code word; and c) packing means for accessing the variable- length code word from the memorized code word according to the length of the variable-length code word.
  9. 9. An apparatus as claimed in Claim 8, wherein said variable-length detection means includes:
    boundary detection means for detecting boundary between the variablelength code word and stuffing 28 is bits of the memorized code word on the basis of the selected code words and the numbers of terminal nodes in each of the levels in order to generate a boundary value; and length detection means for detecting the length of the variablelength code word which is included in the memorized code word on the basis of the boundary value.
  10. 10. An apparatus as claimed in Claim 8 or Claim 9, wherein said boundary detection means includes: means for detecting the levels corresponding to each of the selected code words; means for detecting the numbers of terminal nodes in each of the levels; means for giving weights to the numbers of terminal nodes in response to the levels, thereby generating weighted numbers for each of the levels; means for summing up the weighted numbers from the root of the Huffman code tree to each of the levels, thereby generating sums corresponding to each of the levels; means for translating the sums into binary digits, thereby generating level code words corresponding to each of the sums; means for subtracting each of the level code words from the selected code words corresponding to each of level code words, thereby generating subtraction result values; and means for detecting most significant bits from the subtraction result values in order to output the most significant bits as the boundary value.
  11. 11. An apparatus as claimed in any one of Claims 8 to 10, wherein said length value is generated by X0Ring the most significant bits to one another.
    is
  12. 12. An apparatus as claimed in any one of Claims 8 to 11, wherein said packing means includes a input part for selecting bits among a bit string in response to the length of the variable-length code word in order to generate a first window bit string, wherein the bit string consists of a bit string of the memorized code word and the first window bit string; an output part for detecting bits of the variable-length code word in the first window bit string and the bit string of the memorized code word in response to a control signal and outputting detected bits; and an accumulation part for accumulating a number of the detected bits to thereby generate the control signal.
  13. 13. An apparatus as claimed in any one of Claims 8 to 12, wherein said input part includes a first latch for outputting the first window bit string to the output part and a first barrel shifter; and the first barrel shifter for sliding on the bit string in response to the length of the variable length code word in order to generate a first window bit string.
  14. 14. An apparatus as claimed in any one of Claims 8 to 13, wherein said output part includes a second barrel shifter for sliding on the first window bit string and the bit string of the memorized code word in response to the control signal in order to detect the bits of the variable length code word; and a second latch for storing the bits of the variable length code word form the second barrel shifter.
  15. 15. An apparatus as claimed in any one of Claims 8 to 14, wherein said accumulation part includes a third latch for storing an added value from an adder; the adder for adding the length value of the variable-length code word to the added value from the third latch with a modulo-K, thereby generating a carry signal when the added value is K; and a subtracter for subtracting the added value from K to thereby generate the control signal.
  16. 16. An apparatus for translating symbols into variable-length code words, the apparatus comprising:
    a) means for generating a memorized code word from the code-book memory by inputting a symbol to the code-book memory; b) means for selecting m bit among the memorized code word in order to generate selected code words, where m = 1, 2, 3, 4,...., K, and K denotes a maximum length of the variable length code word; c) means for determining whether each of the selected code words consists of bits of a variable length code word on the basis of each level which is defined in Huffman code tree according to each selected code word, and numbers of terminal nodes in each level; and d) means for accessing the variable-length code word from the memorized code word according to a determination result.
  17. 17. An apparatus as claimed in Claim 16, wherein said determination means includes:
    c-1) means for detecting the levels of each of the selected code words on the basis of the Huffman 31 - code tree; c-2) means for detecting the numbers of terminal nodes in each level; and c-3) means for operating a function W(X).:
    IVW(A).
    2"I.LI wherein bi is the i-th bit value of a selected code word selected m bits among the memorized code word, L, is a total number of terminal nodes in the jth level of the Huffman code tree; and c-4) means for determining whether each LD(X), is a negative value or not.
  18. 18. An apparatus as claimed in Claim 16, or Claim 17, wherein said access means accesses a selected code word having the longest length of selected code words having non-negative values as the variable length code word.
  19. 19. An apparatus as claimed in any one of Claims 16 to 18, wherein said access means includes an input part for selecting bits among a bit string in response to the length of the variable-length code word in order to generate a first window bit string, wherein the bit string consists of a bit string of the memorized code word and the first window bit string; an output part for detecting bits of the variable-length code word in the first window bit string and the bit string of the memorized code word in response to a control signal and outputting detected bits; and an accumulation part for accumulating a number of the detected bits to thereby generate the control signal.
  20. 20. An apparatus as claimed in any one of Claims 16 to 19, wherein said input part includes a f irst latch for outputting the first window bit string to the output part and a first barrel shifter; and the first barrel shifter for sliding on the bit string in response to the length of the variablelength code word in order to generate a first window bit string.
  21. 21. An apparatus as claimed in any one of Claims 16 to 20, wherein said output part includes a second barrel shifter for sliding on the first window bit string and the bit string of the memorized code word in response to the control signal in order to detect the bits of the variable length code word; and a second latch for storing the bits of the variable length code word from the second barrel shifter.
  22. 22. An apparatus as claimed in any one of Claims 16 to 21, wherein said accumulation part includes a third latch for storing an added value from an adder; the adder for adding the length value of the variable-length code word to the added value from the third latch with a modulo-K, thereby generating a carry signal when the added value is K; and a subtracter for subtracting the added value from K to thereby generate the control signal.
  23. 23. An apparatus for translating symbols into variable-length code words substantially as 33 hereinbefore described with reference to Figures 1 to 8 of the accompanying drawings.
  24. 24. A method substantially as hereinbefore described with reference to any of Figures 1 to 7.
  25. 25. An apparatus substantially as hereinbefore described with reference to any of Figures 1 to 7.
GB9725966A 1997-12-08 1997-12-08 Variable-length coding method and apparatus thereof Expired - Fee Related GB2332127B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
GB9725966A GB2332127B (en) 1997-12-08 1997-12-08 Variable-length coding method and apparatus thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
GB9725966A GB2332127B (en) 1997-12-08 1997-12-08 Variable-length coding method and apparatus thereof

Publications (4)

Publication Number Publication Date
GB2332127A9 GB2332127A9 (en) 1900-01-01
GB9725966D0 GB9725966D0 (en) 1998-02-04
GB2332127A true GB2332127A (en) 1999-06-09
GB2332127B GB2332127B (en) 2003-05-07

Family

ID=10823297

Family Applications (1)

Application Number Title Priority Date Filing Date
GB9725966A Expired - Fee Related GB2332127B (en) 1997-12-08 1997-12-08 Variable-length coding method and apparatus thereof

Country Status (1)

Country Link
GB (1) GB2332127B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2003084076A1 (en) * 2002-04-02 2003-10-09 Nokia Corporation Coding transform coefficients in image / video encoder and/or decoders

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US3675212A (en) * 1970-08-10 1972-07-04 Ibm Data compaction using variable-length coding
US3918047A (en) * 1974-03-28 1975-11-04 Bell Telephone Labor Inc Decoding circuit for variable length codes
US4574382A (en) * 1983-10-05 1986-03-04 International Business Machines Corporation Variable length character code system
JPS6413247A (en) * 1987-07-03 1989-01-18 Sharp Kk Video tape recorder
US5696507A (en) * 1996-05-31 1997-12-09 Daewoo Electronics Co., Inc. Method and apparatus for decoding variable length code

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US3675212A (en) * 1970-08-10 1972-07-04 Ibm Data compaction using variable-length coding
US3918047A (en) * 1974-03-28 1975-11-04 Bell Telephone Labor Inc Decoding circuit for variable length codes
US4574382A (en) * 1983-10-05 1986-03-04 International Business Machines Corporation Variable length character code system
JPS6413247A (en) * 1987-07-03 1989-01-18 Sharp Kk Video tape recorder
US5696507A (en) * 1996-05-31 1997-12-09 Daewoo Electronics Co., Inc. Method and apparatus for decoding variable length code

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
WPI Abstract Accession No. 98-137037/199813 & JP 010013247A *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2003084076A1 (en) * 2002-04-02 2003-10-09 Nokia Corporation Coding transform coefficients in image / video encoder and/or decoders

Also Published As

Publication number Publication date
GB2332127A9 (en) 1900-01-01
GB9725966D0 (en) 1998-02-04
GB2332127B (en) 2003-05-07

Similar Documents

Publication Publication Date Title
US5382955A (en) Error tolerant thermometer-to-binary encoder
US4044347A (en) Variable-length to fixed-length conversion of minimum-redundancy codes
US4597057A (en) System for compressed storage of 8-bit ASCII bytes using coded strings of 4 bit nibbles
AU637826B2 (en) Improved data compression apparatus
JP2800880B2 (en) High-speed decoding arithmetic coding device
US5696507A (en) Method and apparatus for decoding variable length code
US6351569B1 (en) Coding method, decoding method, coding device and decoding device
US5982306A (en) Variable-length coding method and apparatus thereof
JPS6148298B2 (en)
US5901177A (en) High speed variable length code decoding apparatus and method
CN114900193A (en) Adaptive Huffman coding system and method
US5677690A (en) High speed variable length code decoding apparatus
US7002494B2 (en) Low memory and MIPS efficient technique for decoding Huffman codes using multi-stage, multi-bits lookup at different levels
JP2968112B2 (en) Code conversion method
De Agostino et al. On-line versus off-line computation in dynamic text compression zyxwvutsrqponmlkjihg
US5648775A (en) High speed variable length code decoding apparatus
US5736946A (en) High speed apparatus and method for decoding variable length code
GB2332127A (en) Variable length coding with code word length detection
Zavadskyi Binary-coded ternary number representation in natural language text compression
US4890326A (en) Method for compressing data
US5708430A (en) High speed variable length code decoding apparatus
JPS6374324A (en) Method for probability fitting in arithmetic encoding system
KR100268830B1 (en) High throughput variable length coder
US6580377B1 (en) Huffman decoding using cascaded sub-table lookup method
KR100268831B1 (en) High throughput variable length codec

Legal Events

Date Code Title Description
732E Amendments to the register in respect of changes of name or changes affecting rights (sect. 32/1977)
732E Amendments to the register in respect of changes of name or changes affecting rights (sect. 32/1977)

Free format text: REGISTERED BETWEEN 20130404 AND 20130410

PCNP Patent ceased through non-payment of renewal fee

Effective date: 20141208