Source: https://patents.google.com/patent/CN1098565C/en
Timestamp: 2020-06-06 08:07:37
Document Index: 566779425

Matched Legal Cases: ['art 52', 'art 52', 'art 52', 'art 52', 'art 52', 'art 52', 'art 52', 'art 52', 'art 52', 'art 52', 'art 52', 'art 52', 'art 52', 'art 3', 'art 52']

CN1098565C - Method and apparatus for decoding variable length code - Google Patents
Method and apparatus for decoding variable length code Download PDF
CN1098565C
CN1098565C CN96110405A CN96110405A CN1098565C CN 1098565 C CN1098565 C CN 1098565C CN 96110405 A CN96110405 A CN 96110405A CN 96110405 A CN96110405 A CN 96110405A CN 1098565 C CN1098565 C CN 1098565C
CN96110405A
CN1168030A (en
南承铉
1996-06-07 Application filed by 大宇电子株式会社 filed Critical 大宇电子株式会社
1996-06-07 Priority to CN96110405A priority Critical patent/CN1098565C/en
1997-12-17 Publication of CN1168030A publication Critical patent/CN1168030A/en
2003-01-08 Publication of CN1098565C publication Critical patent/CN1098565C/en
The present invention relates to a method and equipment for decoding a variable length code word at a high speed using a Huffman code tree. The present invention is characterized in that node order of a level of the Huffman code tree structure is used for storing a variable length coded code word, and predetermined computing operation is used for detecting node order of the coded code word; the node order is used as an address of a decoded code word when the variable length coded code word is decoded; when the Huffman code tree is changed by operation of a center system, the variable length code decoding is realized by storing variables simply in a memorizer and a latch without changing hardware; the coded code word is processed by using parallel computation and a clock regardless of the length of the decoded code word. Therefore, decoding speed of the present invention is higher than that of common variable length coding and decoding equipment and methods which use a position as a unit.
The method and apparatus of decoding variable length code
The present invention relates to the method and apparatus of decoding variable length code, particularly utilize the method and apparatus of the such avriable length codes of huffman code tree high-speed coding such as data image signal.
In general, data image signal has many advantages.For example, data image signal is better than analog picture signal aspect picture quality.Therefore, data image signal is used gradually more frequently, and this is recent trend.On the other hand, because digitized image information has a large amount of information capacities, so, must compress and reduce the number of to it for transmitted image information effectively.Therefore, utilized the effective method for compressing image of picture characteristics can be considered to the main field of Image Communication.In method of compressing image data, known hybrid coding method is to have made up the effective method of probability encoding and room and time compression.Most of hybrid coding methods are utilized the quantification and the variable-length encoding (VLC) of differential pulse code modulation (DPCM), discrete cosine transform (DCT), DCT coefficient.
Variable-length encoding is through being usually used in the coding techniques of free of losses data compression.According to this technology, fixed-length data is transformed to variable length codeword according to the statistics of data.In general, select the length of code word to make short code word be used for representing that frequent data that occur and long code word are used for representing not the so often data of appearance like this.By rightly avriable length codes is distributed to might the source code word the storehouse, the average word length degree of variable length code is shorter than the average word length degree of initial data, therefore, has realized data compression.The Hoffman code design is the method that is commonly used to constitute for known data statistics data the minimal redundancy variable length code.In general, can come the look-up table lookup operations of addressing look-up table to realize encoding operation by utilizing the input data.Code word and word length are stored as the content of showing and are sequentially exported to data channel with constant data rate through buffer.But, complicated in the decoded operation of receiving terminal.Because variable-length nature had to according to receiving bit string each code word be carried out segmentation before each code word can be decoded into the source symbol.Therefore, the design of variable length decoder always is difficult to the design of variable length coder.
The some kinds of methods of deciphering a succession of avriable length codes are arranged.The most a kind of tree search algorithm that is called of frequent use.Variable length code always can be used code word is represented as the tree of tree page or leaf (being also referred to as terminal node).Decoding is from the root of code tree, carries out along one of two branches at each node place under the guiding that receives bit string.In case arrived terminal node, just detected the end of code word and itself and remaining bit string is separated.This decoder comprises corresponding to logical circuit of tree and the control circuit by code tree.Since need search for by turn along code tree each decoding symbol, so it is this method can be very slow, especially all the more so to long code word.In general application, an incoming symbol is represented with some positions.The speed that reception is shifted into decoder is the several times of decoding data average speed.Therefore, must be being that the speed of output data rate several times is operated based on the decoder of tree search.
This high speed need ask the Digital Transmission for high definition TV (HDTV) signal to be even more important.In this HDTV system, total sampling rate (having made up luminance and chrominance information) is likely 100MHz.If employing variable-length encoding, the code word of maximum length often are 16.So the bit by bit decoding device need be to be the speed of 16 times of this sampling rates, promptly to be shifted with the speed of 1.6 gigabit/second and to detect the code word that is in this sampling rate.High like this speed realizes it being very difficult with present IC technology.
Also propose various device and deciphered a succession of avriable length codes.Elongated decoding equipment is divided into sequential decoding and parallel decoding.At first, sequential decoding is to begin to decipher the method for bit string according to the order at the bit string front end, and is divided into normal speed input structure, normal speed export structure and variable input/output structure.The design of sequential decoding is easy to, but because it has the normal speed input structure that each ground is handled the input bit string, so it has slow-footed problem.The elongated decoding equipment of the normal speed export structure that the M.T.Sun of Bell Core proposes is to be compressed into and the general equipment of read-only memory/programmable logic array (ROM/PLA) in showing that is entered into after long of maximum length code word length will import bit string, and this elongated decoding equipment searches for the code word that is stored in this table during the decoding of code word, the code word size that searches is displaced to barrel shifter (barrel shifter) and search for next code word (license to the United States Patent (USP) 5173695 of Bell Core and No. 5245338).Promptly because the elongated decoding equipment of normal speed export structure is deciphered a code word in one-period, so its decoding speed is faster than the decoding speed of the elongated decoding equipment of normal input structure.
After this, the operation of common decoder can more easily be understood.Suppose from data channel 107 and be input to the data flow of buffer 106 by bit stream a shown in Figure 13 1-a 8b 1-b 6c 1-c 15d 1-d 15e 1-e 12f 1-f 10g 1-g 9h 1-h 16... form a 1-a 8Be illustrated in 8 positions in first avriable length codes, b 1-b 6Be illustrated in 6 positions in second avriable length codes, or the like.
Before first clock signal, latch 131 is initialised, so " reading " output is " 1 ".Latch 121 also is initialised, so first barrel shifter 109 has the initial displacement of " 16 ".Since from latch 121 input " 16 " give adder 130 and also from latch 131 input 16 moulds 16 (equaling " 0 ") to adder 130, so the output of adder 130, the i.e. displacement of second barrel shifter 127 are " 16 ", " carry " is " 1 ".Because " reading " is " 1 ", so by 16 a 1-a 8b 1-b 6c 1c 2First data segment of forming inputs to interface section 102 by lead 105.At this moment, all latchs, barrel shifter 109 and 127 output and the output of PLA 116 all are noise levels, represent with " X " in Fig. 2.
In first clock cycle during signal, previous " carry " " 1 " became " reading " " 1 ", and this just retrieves next data segment to lead 105 from buffer 106.But when this clock signal, previous " carry " " 1 " makes the previous output of buffer 106 be read into latch 126.Still initialization is in " 16 " for latch 121, so the remaining of the displacement of first barrel shifter 109 " 16 ", adder 130 still is " 16 ", and " reading " is " 1 ", and " carry " is " 1 ".Because the displacement of second barrel shifter 127 is
The 32nd of " 16 " and 17-are a from latch 126 1-a 8b 1-b 6C 1C 2So this sequence appears at the output of second barrel shifter 127.Latch 100,111 and 125 contains noise, as the decoding word of the output of first barrel shifter 109 and PLA116 with code word size output also to comprise noise the same.
When the second clock signal, the previous output of second barrel shifter 127 is latched into latch 111.Because " reading " still is that " 1 " and first advanced potential are " 1 ", so from buffer 106 retrieval next data segment (the 3rd), the data segment in latch 126 (first) is latched into latch 125, the second data segments and is latched into latch 126.Latch 121 still is initialised, so the displacement of first barrel shifter 109 is " 16 ".This has just kept adder 130 to be output as " 16 ", " carry " and " reading " is " 1 ".Because the previous output of second barrel shifter 127 has comprised first data segment, so when the second clock signal, this section appears in the latch 111 and on 17-the 32nd input position of first barrel shifter 109.In " 16 " at first barrel shifter, 109 carry input places so by lead 112 with this first section output that is sent to barrel shifter." 16 " at second barrel shifter, 127 carry input places will be in latch 126 the second data segment C 3-C 5d 1-d 13Be sent to the output of second barrel shifter 127.Codeword table among the PLA116 is identified as code word " A " with 8 positions at first in first section.Decoding word table 119 is exported this fixed length decoding word A on lead 103.Code word size table 118 is exported the length " 8 " of this word on lead 120.
When the 3rd clock signal, this first data segment is latched into latch 110, and therefore is latched the one 16 input into first barrel shifter 109.Decoding length " 8 " in the past is latched into latch 121, and it promptly is the displacement of first barrel shifter 109.The output of first barrel shifter 109 is displaced to 9-the 24th input position, i.e. sequence b 1-b 6C 1-C 5d 1-d 5" carry " " 1 " during the second clock signal becomes " reading " " 1 " when the 3rd clock signal, so from buffer 106 next data segment of retrieval.In case the 3rd clock signal occurs, this previous " carry " " 1 " just was sent to latch 126 with former section from buffer 106, and was sent to latch 125 from latch 126." 8 " at latch 121 outputs are exported (equaling " 0 ") additions by adder 130 and the mould 16 before the latch 131, form the output of new equaling " 8 ".The displacement of second barrel shifter 127 is " 8 " now, and " carry " is " 0 ".The output of second barrel shifter 127 is now from its 9th input (d 6) beginning.So this sequence connects the input of first barrel shifter 109 when this sequence that connects together will be formed on next clock signal with sequence at first barrel shifter, 109 outputs.In the 3rd clock cycle, code word B is identified in preceding 6 inputs of codeword table 117, and fixed length decoding word B is output on lead 103, and code word size " 6 " is exported by code word size table 118.
Because previous " carry " be " 0 ", thus when the 4th clock signal next data segment of retrieval from buffer 106, it is identical with content under the clock cycle before that latch 125 and 126 content keep.The previous output of first barrel shifter 109 is with position b 1Begin to be admitted to the previous output of latch 110, the second barrel shifters 127 with position b 6Begin to be admitted to latch 111.The output of first barrel shifter 109 is displaced to the 22nd of 7-now, with position C in " 6 " of latch 121 outputs 1Beginning is with position d 11Finish.These same " 6 " are produced the displacement of second barrel shifter 127 for " 14 " by adder 130 and previous " 8 " addition.Being output in of second barrel shifter 127 is to be d with the input of the 15th position 12Beginning, it is the next position of following after the last position of first barrel shifter 109.Because the code word size that adds up is still less than " 16 ", " carry " output is still " 0 ".Code word C is by 119 outputs of decoding word table, and its code word size " 5 " is exported by code word size table 118.
When the 5th clock signal, the previous output of barrel shifter 112 is latched into latch 110, with position C 1-C 5Beginning, the previous output of second barrel shifter 127 is latched into latch 111.The output window of first barrel shifter 109 is according to 5 positions of previous code word size displacement, therefore with position d 1Beginning.Previous " 14 " addition in " 5 " in the latch 121 and the latch 131 obtains " 19 " at the output of adder 130, and this just is displaced to the 35th of 20-with second barrel shifter 127, has produced " carry " " 1 ".Code word D is by 119 outputs of decoding word table, and its length " 15 " is exported by code word size table 118.
When the 6th clock signal,,, be moved into latch 126 and latch 125 as the input of second barrel shifter 127 of first leading portion so " reading " is " 1 " and retrieve next data segment from buffer 106 because previous " carry " be " 1 ".According to the mode identical with aforesaid way, the output of first barrel shifter 109 is shifted in to first e of word that will be decoded with the next one 1Beginning.When the code word size " 15 " that had before added up at mould 16 produced the code word size " 18 " that adds up, code word E was decoded and produce one " carry ".
But above-mentioned common elongated decoding equipment must use ROM/PLA to show to search for code word.Therefore, when coding codeword changed, common elongated decoding equipment just had the problem that perhaps needs the user to change ROM or change the design of PLA.
Therefore, first purpose of the present invention provides the method for utilizing huffman code tree high-speed coding variable length code, when the decoding code word changes, does not change the design of storage based on the memory or the memory of the code word of huffman code tree.
Second purpose of the present invention provides the equipment that utilizes huffman code tree high-speed coding variable length code, when the decoding code word changes, do not change the design of storage based on the memory or the memory of the code word of huffman code tree.
In order to realize above-mentioned first purpose of the present invention, the method for decoding variable length code is provided, this method may further comprise the steps:
A) receive the coding bit string that is used to decipher, the coding bit string that is used to decipher that receives is compressed, export the compressed coding bit string that is used to decipher according to the longest code word size with a plurality of avriable length codes based on the Huffman code tree structure;
B) calculate the decoding that the node location value that is compressed the coding bit string is carried out the maximum length code word length of step a) output, carry out the decoding of this longest code word size so that detect from the boundary line of the code word that is compressed the coding bit string;
C) the node location value of calculating according to step b) detects the code length of avriable length codes;
D) calculate from level " 0 " in total number of terminal nodes corresponding to the level before the level that node was positioned at of the code word of the detection code length that meets step c);
E) with in the node location value of being calculated in the step b) corresponding to the node location value of the code length that in step c), detects and total number of terminal nodes addition of in step d), calculating, export this additive value;
F) read additive value with step e) code word to be decoded as the address from a memory, this described memory is sequentially stored this decoding code word according to the node location of the decoding code word root from the canonical huffman code tree;
G) judge whether to also have the bit string of importing to be decoded,,,, just turn back to step a) if the bit string to be decoded of input is arranged with regard to termination routine if there is not the bit string to be decoded of input.At the most handy formula of step b) PT k = &Sigma; i = 1 k 2 k - i &gamma; i - &Sigma; i = 0 k - 1 2 k - i L i Come the computing node positional value, PT wherein kExpression is imported position γ with the binary system from 1 to k in the level k of Hofman tree 1, γ 2, γ 3.... γ kConsistent node location, γ iBe each bit string γ 1, γ 2, γ 3... place value, L iIt is the total number of terminal nodes on the level " i ".Preferably calculate the length that code length obtains coding codeword by deducting " 1 " in the node location value that has negative value at first from the node location value of calculating in step c).In addition, wherein in step d), utilize S k = &Sigma; i = 0 k - 1 L i Calculate total number of terminal nodes S of the level before the level that the code word size node corresponding of detection is positioned at k, S kThe total number of terminal nodes of expression from level " 0 " to level " k " previous stage, L iThe number of terminal nodes of expression level " i ".
In order to realize above-mentioned second purpose of the present invention, the equipment of decoding variable length code is provided, this equipment comprises:
Compression section, be received in wherein comprise many avriable length codes according to the Huffman code tree structure the decoding bit string that is used to decipher so that the coding bit string that is used to decipher that is received according to the longest code word size compression, and shift out the decoding code word so that the next code bit string except that the decoding code word in the coding bit string that is used for deciphering is compressed according to the maximum length code word length;
The boundary line sampling part, the compressed coding bit string that is used to decipher that receives the maximum length code word length from compression section to be taken a sample in the boundary line of code word, so that calculate the node location value of the coding bit string that is used to decipher that is received and the node location value that output is calculated concurrently, also export the highest significant position of the node location value of being calculated with maximum length code word length;
At least one register, storage total number of terminal nodes from level " 0 " to the level before the level of corresponding codeword decoding with Hofman tree structure;
The code length test section, detect length according to the highest significant position of the node location value of being calculated that draws by the boundary line sampling part, and produce and select to select signal and produce to store from level " 0 " to selecting signal corresponding to second of total number of terminal nodes of the level before the level that node was positioned at of detected avriable length codes length in order to select and to enable register at least one register corresponding to first of the node location value of detected avriable length codes length from the avriable length codes that is used to decipher in the decoding bit string of boundary line sampling part;
Multiplexer, order output are selected the respective nodes positional value of the boundary line sampling part of signal selection by first of code length test section;
Latch, in the latch register from level " 0 " to corresponding stage before the level total number of terminal nodes total number of terminal nodes and the node corresponding positional value of multiplexer;
Adder is with respective nodes positional value and total number of terminal nodes addition.The output additive value; And
Memory is stored from the decoding code word of the root of canonical code tree according to the node location of coding codeword, and utilizes the additive value of adder to decipher code word accordingly as address output.
Compression section preferably includes the barrel shifter that shifts out the decoding code word from receive the decoding bit string.The code length test section preferably includes a plurality of XOR gate, and they logically carry out the XOR combination to the highest significant position of the node location value of boundary line sampling part, so that enable a register at least one register.Latch comprises first latch and second latch that latchs from the respective nodes positional value of multiplexer of the total number of terminal nodes in a plurality of total number of terminal nodes that is latched in the register.Memory is any in read-only memory, random access memory and the programmable logic array.And huffman code tree comprises terminal node with symbol and the connected node that does not have symbol, has to make its terminal node be arranged in the canonical huffman code tree in whole connected nodes left side of one-level.Can not increase average code and longways huffman code tree is transformed to the canonical huffman code tree.
In variable length code interpretation method of the present invention and equipment, because the variable-length encoding code word is stored in according to the node sequence consistent with the level of canonical Huffman code tree structure and consults in the memory, and the predetermined calculating operation of utilization detects the node sequence of coding codeword, so this node sequence is used as the address of deciphering code word when decoding variable-length encoding code word.Therefore, when huffman code tree during by the operation change of center system, can not change hardware and according to only in memory and latch the mode of storage of variables realize the decoding of variable length code.Also have, because can utilize parallel computation in the present invention handles coding codeword according to clock, do not consider to decipher the length of code word, so can be with than with the position being the high speed decoding coding codeword of the common variable length code decoding apparatus deciphered of unit and method.
To know its above-mentioned purpose and advantage more by describe most preferred embodiment of the present invention referring to accompanying drawing.
Fig. 1 is the block diagram of common elongated decoder;
Fig. 2 is the diagram of the decoded operation example of decoder in several clock cycle of key diagram 1;
Fig. 3 is the diagram that expression is used for the incoming bit stream of Fig. 2 example;
Fig. 4 is the schematic diagram that the structure of the canonical huffman code tree that can use in the present invention is described;
Fig. 5 is the block diagram of configuration of the variable length code decoding apparatus of explanation one embodiment of the invention;
Fig. 6 is the circuit diagram of the example of expression code length test section shown in Figure 5;
Fig. 7 is the flow chart of the elongated interpretation method of explanation one embodiment of the invention.
Below will describe physical structure, circuit arrangement and the method for operation of method and apparatus of the decoding variable length code of one embodiment of the invention in detail referring to accompanying drawing.
Fig. 4 schematically illustrates the structure of canonical huffman code tree.There is the huffman code tree of n symbol to form by (2n-1) individual node.Promptly (2n-1) individual node includes n terminal node of symbol and does not have (n-1) individual connected node of symbol.The structure of canonical huffman code tree is the left side that whole terminal nodes all are positioned at whole connected nodes on the one-level.Can not increase average code and longways all huffman code trees are transformed to the canonical huffman code tree.In Fig. 4, show the structure of the canonical huffman code tree of [a, b, c, d, e, f, g, h].8 symbols all are positioned at the left side of all connected nodes.Each symbol has the coding bit string as code word from root to its terminal node.For example, symbol C has the code word 101 of 3 positions, and symbol f has the code word 11110 of 5 positions.It is the avriable length codes that each symbol has the huffman code tree consistent with its probability of occurrence.The meaning of [x:y] shown in Fig. 4 is as follows.The value of symbol of " x " expression corresponding codewords." y " represents that this symbol is stored in the appropriate address in the memory.The storage address of each symbol of table 1 expression.
The storage image of table 1 Huffman binary tree
The storage address symbol data
0???????????????????????????????????????????????a
1???????????????????????????????????????????????b
2???????????????????????????????????????????????c
3???????????????????????????????????????????????d
4??????????????????????????????????????????????????e
5??????????????????????????????????????????????????f
6??????????????????????????????????????????????????g
7??????????????????????????????????????????????????h
For example, [C:2] expression comprises the symbol " C " of the avriable length codes " 101 " of 3 positions, and symbol " C " means that it is stored in the address of memory " 2 ".The longest code word size is 6 positions in Fig. 4, corresponding to symbol " g " and " h ".
Fig. 5 represents the configuration of the variable length code decoding apparatus of one embodiment of the invention.Referring to Fig. 5, the variable length code decoding apparatus of one embodiment of the invention comprises compression section 51, boundary line sampling part 52, register 53, code length test section 54, multiplexer 55, latch 56, adder 57 and memory 58.Compression section 51 is received in the coding bit string to be decoded that has wherein comprised many avriable length codes according to the Huffman code tree structure, the coding bit string to be decoded that compression section 51 receives according to the longest code word size compression, utilize the barrel shifter 511 in it to shift out the decoding code word, so that the continuous programming code bit string except that the decoding code word in coding bit string to be decoded is compressed according to the longest code word size.Boundary line sampling part 52 is compressed the take a sample boundary line of code word of coding bit string to be decoded from what compression section 51 received the maximum length code word lengths, utilizes the back that the formula (1) of explanation is calculated PT kWith the PT that is calculated kExport to multiplexer 55, the PT that output is calculated kMSB (Most Significant Bit, highest significant position) give code length test section 54 so that judge the PT that is calculated kBe just or negative.Calculate PT kMethod as follows: PT k = &Sigma; i = 1 k 2 k - i &gamma; i - &Sigma; i = 0 k - 1 2 k - i L i . . . . . . ( 1 ) PT wherein kExpression is imported position γ with the binary system from 1 to k in the k of Hofman tree level 1, γ 2, γ 3.... γ kConsistent node location, (top of each grade is node location " 0 ", and node location increases " 1 " when level falls progressively downwards), γ iBe each bit string (γ 1, γ 2, γ 3... .) place value, L iIt is total number of terminal nodes of level " i ".Promptly when the longest code word size was " M ", boundary line sampling part 52 was calculated all PT of 1≤i≤M concurrently iWhole PT of one code word kFor on the occasion of, should on the occasion of the expression node location.But, all PT beyond a codeword boundary line iAll has negative value.Therefore, from all PT iIn at first have negative value PT i" i " in deduct " 1 " numerical value just become the length of coding codeword.In register 53, comprise S 1, S 2, S 3... S MS iBe stored in respectively among first register 531, second register 532, the 3rd register 533...... M register 53M.Register 53 will be stored in S in the register among first register 531, second register 532, the 3rd register 533...... M register 53M according to the output signal level of code length test section 54 iExport to first latch 561 of latch 56.
Code length test section 54 is according to the node location value PT that is calculated that is drawn by boundary line sampling part 52 kMSB from the decoding bit string of boundary line sampling part 52, detect the avriable length codes length that is used to decipher, produce to select to select signal and to produce to select and enable register at least one register 53 to store from level " 0 " to selecting signal corresponding to second of total number of terminal nodes of the level before the level that node was positioned at of detected avriable length codes length corresponding to first of the node location of detected avriable length codes length.S kBe to utilize the resulting calculated value of formula described later (2), its represents from level " 0 " to level " i " total number of terminal nodes of level before. S k = &Sigma; i = 0 k - 1 L i . . . . . . ( 2 )
Fig. 6 represents the circuit diagram of code length shown in Figure 5 test section.Code length test section 54 comprises a plurality of XOR gate 61,62,63...... and 6M, the PT that they provide boundary line sampling part 52 kMSB carry out in logic XOR combination so that a register in the enable register 53.Multiplexer 55 is sequentially exported the node location value PT of the boundary line sampling part of selecting according to the first selection signal 52 k, so that the S of output code length test section 54 kGive second latch 562 of latch 56.Latch 56 comprises first and second latchs 561 and 562.Latch 56 latchs (keeping in) S from register 53 iWith a PT from multiplexer 55 iAdder 57 utilizes formula described later (3) with a PT iA S with latch 56 iAddition, output additive value A IjGive memory 58.
A Ij=S i+ PT i(3) the A here IjIt is the storage address of " j " position of the code word of a terminal node " i " level of being arranged in the canonical huffman code tree.In other words, adder 57 will have been stored therein corresponding at the node location value S of code word corresponding to the search boundary line in the level of the node of the code word of search boundary line iSecond latched value with stored therein from level 0 in the first latched value addition corresponding to total number of terminal nodes of the level before the level that node was positioned at of the code word of search boundary line.In memory 58, the decoding code word is stored according to the node location of the coding codeword root from the canonical code tree, utilizes the A of adder 57 IjExport corresponding decoding code word as the address, have ROM, RAM or programmable logic array (PLA).
With below by to decipher the operation that variable length code decoding apparatus and variable length code interpretation method are described as the code word to be decoded of binary coding bit string " 101100001110...... ".This bit string " 101100001110...... " conventional letter string " cbaae...... ".Fig. 7 is the flow chart of the variable length code interpretation method of explanation one embodiment of the invention.
Interpretation method of the present invention will be described as follows, in the look-up table memory, according to corresponding to the terminal node of the canonical code tree of coding codeword from root to lowermost level ground sequential storage code word to be decoded.Compression section 51 calculates the address value of pointing out the position of storage code word to be decoded in memory 58.
At step S71, compression section 51 receives coding bit string to be decoded " 101100001110...... ", according to the reception bit string " 101100 " in the coding bit string to be decoded of 6 compression receptions of the longest code word size (M), output compression bit string " 101100 " is given boundary line sampling part 52 then.Then at step S72, the compression coding bit string to be decoded that boundary line sampling part 52 receives the maximum length code word lengths from compression section 51 concurrently take a sample code word the boundary line and utilize formula (1) computing node positional value PT kIn this embodiment, because the longest as shown in Figure 4 code word size is 6 positions, so boundary line sampling part 52 is utilized γ 1γ 2γ 3γ 4γ 5γ 6Calculate the PT of all 1≤i≤6 scopes iBy utilizing formula (1) that PT is calculated in " 1 " substitution " K " as follows 1 PT 1 = &Sigma; 2 i = 1 1 &gamma; i 1 - i - &Sigma; i = 0 0 2 1 - i L i = 2 0 &CenterDot; &gamma; 1 - 2 1 &CenterDot; L 0
During this period, because γ i is the L of binary code " 1 " and the number of terminal nodes of representative in each grade 0And L 1Be respectively decimal code " 0 " and " 1 ", so PT 1Value can obtain as follows.
PT i＝2 0·1-2 1·0＝1
PT 4According to identical mode by " 4 " substitution " K " is calculated as follows, because γ 1γ 2γ 3γ 4Be binary code code " 1011 ", and represent the L of the number of terminal nodes in each grade 0, L 1, L 2And L 3Be respectively " 0 ", " 1 ", " 0 " and " 3 ", PT 4 = &Sigma; i = 1 4 2 4 - i &gamma; i - &Sigma; i = 0 4 2 4 - i L i ＝(2 3·γ i+2 2·γ 2+2 1·γ 3+2 0·γ 4)-(2 4·L 0+2 3·L 1+2 2·L 2+2 1·L 3)＝-3
When decimal code " 3 " was transformed to 2 complement code, decimal code " 3 " became " 1011101 " with 6 bit representations.Because the most left position MSB is " 1 ", so can point out PT 4It is negative value.Can calculate PT according to the mode identical with aforesaid way 2, PT 3, PT 5And PT 4Each value.The result is shown in following table 2.
Table 2 ????PT k ????????????PT k Sign The decimal system Binary system (MSB → LSB) ????PT 1 ????1 ????000001 Just ????PT 2 ????0 ????000000 Just ????PT 3 ????1 ????000001 Just ????PT 4 ????-3 ????111101 Negative ????PT 5 ????-8 ????111000 Negative ????PT 6 ????-18 ????101110 Negative
At this moment, boundary line sampling part 52 is exported the PT that is calculated 1, PT 2, PT 3, PT 4, PT 5And PT 6Give multiplexer 55 so that use the address of decoding code word.Boundary line sampling part 52 is also exported PT 1, PT 2, PT 3, PT 4, PT 5And PT 6The MSB0 of calculated value, 0,0,1,1 and 1 gives code length test section 54, so that judge PT 1, PT 2, PT 3, PT 4, PT 5And PT 6Calculated value be just or negative.In the present invention promptly, because the node number has been stored in the first, second, third, fourth, the 5th, the 6th of register 53 ... among M register 531,532,533,534,535, the 536......53M, so code length test section 54 receives PT from boundary line sampling part 52 1, PT 2, PT 3, PT 4, PT 5And PT 6The MSB0 of calculated value, 0,0,1,1 and 1 controls relevant register.Be the first input end reception MSB0 of code length test section 54 by first XOR gate 61,0,0,1,1 and 1 first " 0 ", receive second " 0 " by second input of first XOR gate 61 and the first input end of second XOR gate 62, receive the 3rd " 0 " by second input of second XOR gate 62 and the first input end of the 3rd XOR gate 63, receive the 4th " 1 " by second input of the 3rd XOR gate 63 and the first input end of the 4th XOR gate 64, receive the 5th " 1 " by second input of the 4th XOR gate 64 and the first input end of the 5th XOR gate 65, receive the 6th " 1 " by second input of the 5th XOR gate 65 and the first input end of the 6th XOR gate 66, the first input end by the 6th XOR gate 66 receives the 6th " 1 " and second input by the 6th XOR gate 66 and receives " 1 " and become " 1 " so that only enable the 3rd XOR gate 63.Therefore, be the S of " 1 " 3Export to first latch 561 from the 3rd XOR gate 63 that has been enabled as mentioned above.
As shown in table 2, because PT 1, PT 2And PT 3MSB all be " 0 ", so they all have positive sign.PT 1, PT 2And PT 3Decimal code " 1 ", " 0 " and " 1 " point out the node location extremely gone up corresponding respectively.So PT 4, PT 5And PT 6MSB all be " 1 ", so they all have negative sign.Therefore, code length test section 54 can produce the position of " 1 " by search, promptly at the PT of border sampling part 52 kIn at first negative value calculate the level of code tree structure at the place, last position of current decoding code word.Promptly calculate first code word size according to the bit string of input.In an embodiment of the present invention, in step S73 by from " i ", promptly produce at first and deduct " 1 " " 4 " of negative value and (i-1=4-1) obtained to be arranged in the third level and point out to decipher the code word size of code word size " 3 " (i.e. " 101 " of " 101100001110...... ") at first.In step S74, utilize then formula (2) calculate from level " 0 " to counting S corresponding to total node of the level before the level that node was positioned at the code tree structure of the decoding code word " 101 " of code word size " 3 " 3 S 3 = &Sigma; i = 0 3 - 1 L i = L 0 + L 1 + L 2 = 0 + 1 + 0 = 1
Code length test section 54 produces second according to the code word size that is calculated " 3 " then and selects signal, is used for the PT that is calculated from 52 selections of boundary line sampling part 3, i.e. node location on the node place level of the code tree structure of the detected code word that is used to decipher, and output produced second select signal to give multiplexer 55.Multiplexer 55 is selected PT then 3Value is exported to second latch 562.
Then, at step S75, adder 57 is with the PT of second latch 562 3S with first latch 561 3Addition, output additive value A 33Give memory 58.Additive value A 33It is the address of wherein having stored corresponding to the memory 58 of the decoding code word of the coding codeword of searching code boundary line.Therefore, at step S76, memory 58 is from adder 57 receiver address A 33=2 so as output corresponding to the decoding code word " C " of this address " 2 ", so code word is decoded.Then, the code length " 3 " of compression section 51 54 reception decoding code words " 101 " from the code length test section, it is according to the input position (100001110......) (100001) except that decoding bit string " 101 " in the longest code word size (M) the 6 compression subsequent bit, to compress bit string " 100001 " and export to boundary line sampling part 52, decoding compression bit string " 100001 " therefore can be deciphered whole input bit string 100001110...... in the same way.
Compression section 51 judges whether to be still waiting to decipher bit string then in step S77.As the result that step S77 judges, if do not have bit string to be decoded and decoding to finish, compression section 51 just finishes decoding.But when bit string to be decoded, compression section 51 just turns back to step S71, repeats the operation after step S71 in the same way.
In other words, at first calculate the decoding code word size, utilize formula (3) to calculate the storage address of having stored this code word.The i.e. PT of the corresponding codewords by will be in huffman code tree iWith its S iThe phase Calais obtains this storage address.In this embodiment, code length is 3.Therefore storage address can be according to PT 3+ S 3Obtain.Because PT 3As shown in table 2 is " 1 " and S 3As the total number of terminal nodes from root to level " 2 " is " 1 ", so storage address is " 2 ".Therefore, in last step, system has obtained last decoding symbol by the data of reading corresponding to storage address " 2 ".Be that the user can know that the decoding symbol of storage in storage address " 2 " is " C ".In other words, obtained at three the significance bit γs of coding in the bit string by calculating operation 1γ 2γ 3(=" 101 ") corresponding to the code word of symbol " C ".Can utilize the mode identical that it is encoded by code length with the many decoding of remaining coding bit string displacement code word with aforesaid way.Promptly because γ 1γ 2γ 3Decoded, so barrel shifter shifts out decoded γ from the decoding bit string 1γ 2γ 3And reception successor value γ 3γ 4γ 5γ 6γ 7γ 8γ 9γ 10γ 11... (" 100001110...... ") deciphers these received successor value γ in the same way 3γ 4γ 5γ 6γ 7γ 8γ 9γ 10γ 11....Therefore, just obtained information symbol string " cbaae...... " corresponding to bit string 101100001110.......
As mentioned above, according to the present invention, because the variable-length encoding code word is stored in according to the node sequence consistent with the level of canonical Huffman code tree structure and consults in the memory, and the predetermined calculating operation of utilization detects the node sequence of coding codeword, so node sequence is used as the address of deciphering code word when decoding variable-length encoding code word.Therefore, when huffman code tree during by the operation change of center system, can not change hardware and according to only in memory and latch the mode of storage of variables realize the decoding of variable length code.Also have, owing to can utilize parallel computation to come coding codeword to be handled and not consider to decipher the length of code word in the present invention, so can be with than with the position being common variable length code decoding apparatus and the high speed decoding coding codeword of method that unit is deciphered according to clock.Therefore, the present invention can be used to can compensating motion contrary compressed image, for example MPEG1, MPEG2 and H261 also can be used to the multiple compression of rest image, JPEG for example, and all can carry out the application of entropy coding.
Under the situation of spirit of the present invention or main feature, can implement the present invention according to other concrete mode.Therefore should treat present embodiment from described all angles, scope of the present invention points out by appended claim rather than by above description, changes therefore in the meaning of the equivalent of claim and within the scope all and all will be contained by claim.
1. the method for a decoding variable length code said method comprising the steps of:
F) read additive value with step e) code word to be decoded as the address from a memory, this described memory is sequentially stored this decoding code word according to the node location of the decoding code word root from the canonical huffman code tree; And
G) judge whether to also have the bit string of importing to be decoded,,,, just turn back to step a) if the bit string to be decoded of input is arranged with regard to termination routine if there is not the bit string to be decoded of input.
2. the method for decoding variable length code as claimed in claim 1, node location value is wherein utilized formula in step b) PT k = &Sigma; i = 1 k 2 k - i &gamma; i - &Sigma; i = 0 k - 1 2 k - i L i Calculate, wherein PT kExpression is imported position γ with the binary system from " 1 " to " k " in the level " k " of Hofman tree 1, γ 2, γ 3.... γ kConsistent node location, γ iBe each bit string γ 1, γ 2, γ 3... place value, L iIt is total number of terminal nodes of level " i ".
3. the method for decoding variable length code as claimed in claim 1, wherein code length calculates by deducting " 1 " in the node location value that has negative value at first from the node location value of calculating in step c), so that obtain the length of coding codeword.
4. the method for decoding variable length code as claimed in claim 1, wherein at total number of terminal nodes S corresponding to the level before the level that node was positioned at of the code word size that detects kIn step d), utilize formula S k = &Sigma; i = 0 k - 1 L i Calculate S kThe total number of terminal nodes of expression from level " 0 " to level " k " previous stage, L iThe number of terminal nodes of expression level " i ".
5. the equipment of a decoding variable length code, described equipment comprises:
Compression section, be received in wherein and comprise the decoding bit string that is used to decipher of many avriable length codes so that compress the coding bit string that is used to decipher that is received and shift out the decoding code word so that the next code bit string except that the decoding code word in the coding bit string that is used for deciphering is compressed according to the maximum length code word length according to the longest code word size according to the Huffman code tree structure;
The boundary line sampling part, the compressed coding bit string that is used to decipher that receives maximum length code length from compression section to be taken a sample in the boundary line of code word, so that calculate the node location value of the coding bit string that is used to decipher that is received and the node location value that output is calculated concurrently, and export the highest significant position of the node location value of being calculated with maximum length code word length;
At least one register, storage total number of terminal nodes from level " 0 " to the level before the level of the codeword decoding that has the Hofman tree structure accordingly;
The code length test section, detect length according to the highest significant position of the node location value of being calculated that draws by the boundary line sampling part, and produce and select to select signal and produce to select and enable register at least one register to store from level " 0 " to selecting signal corresponding to second of total number of terminal nodes of the level before the level that node was positioned at of detected avriable length codes length corresponding to first of the node location value of detected avriable length codes length from the avriable length codes that is used to decipher in the decoding bit string of described boundary line sampling part;
Multiplexer, order output are selected the respective nodes positional value of the described boundary line sampling part of signal selection by first of described code length test section;
Latch, latch in the described register from level " 0 " to corresponding stage before the level a plurality of total number of terminal nodes a total number of terminal nodes and the node corresponding positional value of described multiplexer;
Adder is with respective nodes positional value and total number of terminal nodes addition, output additive value; And
6. the equipment of decoding long code as claimed in claim 5, wherein said compression section comprise the barrel shifter that shifts out the decoding code word from the decoding bit string that receives.
7. the equipment of decoding long code as claimed in claim 5, wherein said code length test section comprises a plurality of XOR gate, they logically carry out the XOR combination to the highest significant position of the node location value of boundary line sampling part, so that enable a register in described at least one register.
8. the equipment of decoding long code as claimed in claim 5, wherein said latch comprise first latch of the total number of terminal nodes in a plurality of total number of terminal nodes that latchs described register and latch second latch of the respective nodes positional value of described multiplexer.
9. the equipment of decoding long code as claimed in claim 5, wherein said memory are any in read-only memory, random access memory and the programmable logic array.
10. the equipment of decoding long code as claimed in claim 5, wherein huffman code tree comprises terminal node with symbol and the connected node that does not have symbol, has to make its terminal node be arranged in the canonical huffman code tree in whole connected nodes left side of level.
11. the equipment of decoding long code as claimed in claim 5, wherein huffman code tree can not increase average code and is transformed to the canonical huffman code tree longways.
CN96110405A 1996-06-07 1996-06-07 Method and apparatus for decoding variable length code CN1098565C (en)
CN96110405A CN1098565C (en) 1996-06-07 1996-06-07 Method and apparatus for decoding variable length code
CN1168030A CN1168030A (en) 1997-12-17
CN1098565C true CN1098565C (en) 2003-01-08
ID=5120817
CN (1) CN1098565C (en)
CN101808248B (en) * 2009-02-13 2012-01-11 联咏科技股份有限公司 Adaptive paradigm Hoffmann decoder, method thereof and image decoder
CN1043413A (en) * 1988-12-17 1990-06-27 机械电子工业部第三十研究所 Universal encode and decode method with variable length code and programmable circuit
CN1108019A (en) * 1993-11-29 1995-09-06 大宇电子株式会社 High speed variable length code decoding apparatus
1996-06-07 CN CN96110405A patent/CN1098565C/en not_active IP Right Cessation
CN1168030A (en) 1997-12-17
JP3517224B2 (en) 2004-04-12 Variable length encoding and decoding method using a plurality of mapping tables, and apparatus therefor
KR100959532B1 (en) 2010-05-27 Decoding method of CAVLC
JP4865757B2 (en) 2012-02-01 Apparatus, image processing system, camera module, and image processing circuit for image processing using a limited number of bits
USRE39925E1 (en) 2007-11-27 Fast JPEG huffman encoding and decoding
EP1832000B1 (en) 2010-10-27 Device and data method for selective compression and decompression and data format for compressed data
US8038074B2 (en) 2011-10-18 Data compression
US8055085B2 (en) 2011-11-08 Blocking for combinatorial coding/decoding for electrical computers and digital data processing systems
1997-10-22 SE01 Entry into force of request for substantive examination
2003-03-05 TR01 Transfer of patent right
Effective date of registration: 20030124
Address after: Seoul City, Korea
Patentee after: Daewoo Electronics Co., Ltd.
Patentee before: Daewoo Electronics Co., Ltd.
2013-06-05 CP01 Change in the name or title of a patent holder
Address after: Seoul, South Korea
2013-06-05 TR01 Transfer of patent right
Effective date of registration: 20130507
Address after: ottawa
Patentee after: Fengye Vision Technology Co., Ltd.