CN1123125C - Variable-length coding method and apparatus thereof - Google Patents

Variable-length coding method and apparatus thereof Download PDF

Info

Publication number
CN1123125C
CN1123125C CN 97125432 CN97125432A CN1123125C CN 1123125 C CN1123125 C CN 1123125C CN 97125432 CN97125432 CN 97125432 CN 97125432 A CN97125432 A CN 97125432A CN 1123125 C CN1123125 C CN 1123125C
Authority
CN
China
Prior art keywords
code word
variable length
level
storage
bit string
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.)
Expired - Fee Related
Application number
CN 97125432
Other languages
Chinese (zh)
Other versions
CN1219803A (en
Inventor
南承铉
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.)
Fengye Vision Technology 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
Application filed by Daewoo Electronics Co Ltd filed Critical Daewoo Electronics Co Ltd
Priority to CN 97125432 priority Critical patent/CN1123125C/en
Publication of CN1219803A publication Critical patent/CN1219803A/en
Application granted granted Critical
Publication of CN1123125C publication Critical patent/CN1123125C/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

  • Compression, Expansion, Code Conversion, And Decoders (AREA)

Abstract

The present invention discloses a method for converting symbols to code words with variable length, which comprises the following steps that (a) a signal is input to a code book memory of a code word with variable length, and a storage code word is generated from the code book memory; (b) the number of terminating nodes in each layer and each layer defined by each selected code word in the selected code word and a Huffman code tree is used as a basis, and the length of the code word with variable length in the storage code word is detected; (c) the code word with variable length in the storage code word is read by the length of the code word with variable length. Therefore, the method realizes that symbols are converted to code words with variable length, and length data does not need to be stored in the memory.

Description

Variable-length coding method and device thereof
The present invention relates to a kind of coding method and device of variable length.Relating in particular to a kind of serves as the device that the basis converts the fixed length code word method of variable length code word to and realizes this method with the huffman coding tree.
Usually, variable-length coding method is a kind of coding techniques that is usually used in not losing the ground packed data.Variable Length Code produces data source and all exist possible data to convert the code word of variable length to according to the probability that data exist with the fixed length code word table shows, thereby makes the mean code length of data obtain reduction.Promptly be, by for the code word that might the exist code word of giving a variable length, the mean code length of variable length code word is shorter than the code length of initial data, so the compression of data is just finished.
The huffman coding method is generally used for constructing for known statistics the Variable Length Code of a minimal redundancy.The huffman coding method is applied to huffman coding tree to data based its statistical value of known its statistical value, therefore, is free prefix Variable Length Code according to the Variable Length Code of huffman coding method.
Realize announcing in No. the 3rd, 675,212, the United States Patent (USP) that an example of the device of Variable Length Code proposes by Josef Raviv etc. in July, 1972.The Variable Length Code device of propositions such as Josef Raviv comprises a ternary associative storage, and this three-state associative storage is used as the media of finishing a coding-decoding of changing between block code and the Variable Length Code.The length of the variable length code word that this three-state associative memory store and block code are related with Variable Length Code.
In addition, the present inventor and assignee have applied for a code translator with application number 08/655,838, and the date is on May 31st, 1996, and this application is now open.
An object of the present invention is to provide and a kind ofly the fixed length code word can be converted to the variable length code word and needn't store the method for the code length information of variable length code word.
Another object of the present invention provides and a kind ofly the fixed length code word can be converted to the variable length code word and needn't store the device of the code length information of variable length code word.
In order to realize above purpose, according to an aspect of the present invention symbol transition is become a method of variable length code word to comprise following each step: a) by coming to produce a storage code word to symbol of code book memory input from the code book memory, wherein the variable length code word is just stored in the code book memory according to these symbols; B) number with the selected code word level that selected code word defines by each in the huffman coding tree and each layer termination node serves as that basic the inspection is included in the length of storing the variable length code word in the code word, wherein, selected code word produces by K selection m position in everybody of storage code word, wherein m=1,2,3,4 ..., K, K represents the maximum length of variable length code word; C) from the storage code word, visit this variable length code word according to the length of variable length code word.
According to another aspect of the present invention, a method symbol being weaved into the variable length code word comprises following each step: a) come to produce a storage code word by importing a symbol to the code book memory of storage variable length code word from the code book memory; B) selection m position produces selected code word from everybody of storage code word, wherein m=1,2,3,4 ..., K, K represents the maximum length of this variable length code word; C) according to the number of the termination node in each selected code word and each layer, serve as whether basis each selected code word of decision comprises everybody in the variable length code word with every layer of defining in the huffman coding tree; D) according to the code word of the result of step c) this variable length of visit from the storage code word.Step c) can also comprise following each step: serve as the number of plies that each selected code word is detected on the basis with the huffman coding tree c-1); C-2) detect in each layer the number of termination node; C-3) carry out function LD (X) m:
LD(X) m=BW(X) m-NW(X) m BW ( X ) m = Σ i = 1 m 2 m - i · b i NW ( X ) m = Σ j = 0 m - 1 2 m - j · L j
Wherein bi is storage selected value of i position in the selected code word of m position in the code word, and Lj is the number of termination node in the j layer in the huffman coding tree; Whether c-4) detect each LD (X) m is negative value.
According to other aspects of the invention, the device that converts symbol to the variable length code word comprises: a) the variable length code word code book storage arrangement that storage has the variable length code word of extreme length according to symbol; B) number of termination node detects the variable length checkout gear that is included in the length of variable length code word in the storage code word in the level of setting according to the huffman coding of selected code word, each selected code word definition, each layer, wherein selected code word produces by K selection m position in the storage code word, m=1,2,3,4 ..., K, K is the maximum length of this variable length code word; C) encapsulation (packing) that reads the variable length code word from the storage code word according to the length of variable length code word is installed.
According to the present invention, its method and apparatus makes the length information that symbol transition is become the length of variable length code word and needn't store the variable length code word in memory become possibility, therefore, no longer needs to be used for to store the memory of the length information of variable length code word.
Referring to below in conjunction with the detailed description of accompanying drawing to most preferred embodiment, can more be expressly understood the present invention above-mentioned with other purpose, feature and advantage.Wherein:
Fig. 1 is for representing a Variable Length Code manipulated or operated apparatus according to one embodiment of present invention;
The circuit diagram of an example of the Boundary Detection parts 500 that Fig. 2 describes among Fig. 1 of the present invention for expression;
The circuit diagram of an example of the calculating unit 530 that Fig. 3 describes among Fig. 2 of the present invention for expression;
The circuit diagram of an example of the code length detection part 600 that Fig. 4 describes among Fig. 1 of the present invention for expression;
Fig. 5 is the circuit diagram of an example of these clearly demarcated middle package parts 400 of expression;
Fig. 6 is the flow chart that the Variable Length Code device of describing among Fig. 1 is shown;
Fig. 7 is the view that the package parts of describing among Fig. 1 400 are shown;
Fig. 8 is the view of the structure of expression standard huffman coding tree.
Below with reference to accompanying drawings most preferred embodiment of the present invention is illustrated.
Variable-length coding method of the present invention and device thereof are set based on a standard huffman coding.The one huffman coding tree with n symbol comprises (2n-1) individual node.Promptly be that this (2n-1) individual node comprises that n has the termination node of symbol and (n-1) the individual connected node that does not have symbol.Standard huffman coding tree has a structure, and promptly all termination nodes are positioned at the left side of all connected node of each layer.As everyone knows, all huffman coding trees can convert standard huffman coding tree to and needn't increase average code length.
Fig. 8 has represented a structure corresponding to the standard huffman coding tree of [a, b, c, d, e, f, g, h].8 symbols are positioned at the left side of all connected nodes.Each symbol has a coding bit string from root to the termination node, and this bit string promptly is its code word.For example, symbol [c] has one three bit word [101] and symbol [f] has a five-bit code word [11110].Be that each symbol has a variable length code word according to the definition in the huffman coding tree of its probability of happening.
Fig. 1 is a Variable Length Code manipulated or operated apparatus of expression one embodiment of the invention.
Contrast Fig. 1, Variable Length Code device comprise a buffer unit 100, code book memory 200, a variable length detection part 300 and package parts 400.
Buffer unit 100 is stored provisionally from the symbol of external series or parallel input, and the responsive control signal (not shown in figure 1) is to code book memory 200 output symbols.
Code book memory 200 has the variable length code word of the variable length code word of maximum length according to symbol or the storage of symbol corresponding address.So, when length is input to code book memory 200 less than the specified symbol [X] of the variable length code word VLW (X) of its maximum length by buffer unit 100, code book memory 200 produces one and comprises the storage code word M (X) of variable length code word VLW (X) and filler thereof, and should store code word M (X) and offer variable length detection part 300 and package parts 400 respectively.
For example, when the maximum length of variable length code word is that K position (K be 1 or bigger integer) and symbol [X] are when being input in the code book memory 200, code book memory 200 produces the character string storage code word M (X) of K positions, and should store code word M (X) and output to variable length detection part 300 and package parts 400 respectively.
Variable length detection part 300 detects the length of variable length code word VLW (X) in the storage code word M (X) that code book memory 200 is provided according to standard huffman coding tree shown in Figure 8.
Variable length detection part 300 at first detects the number that huffman coding is set termination node in each layer, to detect the length of variable length code word VLW (X).Variable length detection part 300 calculates according to the number and the storage code word M (X) of the termination node of each layer then, and shown in hereinafter, thereby generation is corresponding to a length value L EG (X) of variable length code word VLW (X) length.Variable length detection part 300 offers package parts 400 with this length value L EG (X) again.
Variable length detection part 300 can also comprise that as shown in Figure 1 Boundary Detection parts 500 and a code length detection part 600 produce length value L EG (X).
Boundary Detection parts 500 are selected 1 among everybody to the K position successively at storage code word M (X), in order to produce respectively K selected code word BW (X) m=1, BW (X) m=2 ..., BW (X) m=K.And, Boundary Detection parts 500 detect corresponding each selected code word BW (X) m=1,2 ..., the number of the termination node in the level of K.Then Boundary Detection parts 500 more selected code word BW (X) m=1, BW (X) m=2 ..., BW (X) m=K and the number of termination node in the layer separately, with the border of variable length code word VLW (X) among the detection of stored code word M (X), and produce the result of boundary value MSB (X) m as Boundary Detection with filler.
Boundary value MSB (X) m that code length detection part 600 provides according to Boundary Detection parts 500 produces the length value L EG (X) of variable length code word VLW (X), and this length value L EG (X) is offered package parts 400.
Fig. 2 has represented the circuit diagram of an example of the described Boundary Detection parts 500 of Fig. 1 among the present invention.
With reference to Fig. 2, in order to produce boundary value MSB (X) m, Boundary Detection parts 500 comprise a coding alternative pack 510, level detection part 520,530 and boundary value production parts 540.
Everybody of the storage code word M (X) that coding alternative pack 510 provides from the code book memory 1 of selection produce successively to the K position selected code word BW (X) 1, BW (X) 2 ..., BW (X) K, and with selected code word BW (X) 1, BW (X) 2 ..., BW (X) K offers level detection part 520 and calculating unit 530 respectively.
When a selected code word BW (X) m from coding alternative pack 510 when being input to level detection part 520, level detection part 520 detects the m layer of selected code word BW (X) m in the huffman coding tree, this is defined by the position of selected code word in the huffman coding tree, and detects the sum of the termination node from root to the m layer.Then, level detection part 520 produces the level code word NW (X) corresponding to the sum of m layer and the termination node from root to the m layer.In order to produce level code word NW (X), level detection part 520 is given weights according to level for the numeral of the termination node of each layer, and the weight number of the termination node of each layer is all added up mutually.
So, be following form corresponding to summation WS (X) m of the weight number of the defined m layer of selected code word BW (X): WS ( X ) m = Σ i = 0 m - 1 2 m - j · L j 10 Wherein j refers to the one deck in the huffman coding tree, and Lj is a numeral of the termination node of j layer.
Level detection part 520 converts summation WS (X) m to binary digit and produces level code word NW (X) m and level code word NW (X) m is offered calculating unit 530.
Calculating unit 530 from selected code word BW (X) 1, BW (X) 2 ..., deduct among BW (X) K level code word NW (X) 1, NW (X) 2 ..., NW (X) K produce subtraction result value LD (X) 1, LD (X) 2 ..., LD (X) K, each value be used to refer to selected code word BW (X) m=1,2 ..., whether K only be made up of variable length code word VLW (X).
The circuit diagram of an example of the calculating unit 530 that Fig. 3 describes among Fig. 2 of the present invention for expression.
With reference to Fig. 3, the maximum length of variable length code word is the K position, and calculating unit 530 also comprises K subtracter 531 to 537.
Selected code word BW (X) m that m subtracter of calculating unit 530 deducts the m position with level code word NW (X) m of m layer produce a subtraction result value LD (X) m as value LD (X) m=1,2 of subtraction result ..., one of K.Then calculating unit 530 with this subtraction result value LD (X) m=1,2 ..., K offers boundary value production part 540.
Boundary value generation value parts 540 from subtraction result value LD (X) m=1,2 ..., detect among the K highest significant position MSB (X) m=1,2 ..., K, and with detected highest significant position MSB (X)=1,2 ..., K outputs to code length detection part 600 as boundary value MSB (X) m on the border of variable length code word VLW (X) and filler among the indication storage code word M (X).
Referring again to Fig. 1, code length detection part 600 produces length value L EG (X) according to boundary value MSB (X) m on the border of variable length code word VLW (X) and filler among the indication storage code word M (X).
Fig. 4 is the circuit diagram of expression according to an example of the code length detection part 600 described in Fig. 1 of the present invention.
With reference to Fig. 4, code length detection part 600 comprises that K " exclusive OR " door produces length value L EG (X).
First " exclusive OR " goalkeeper MSB (X) 1 and 0 gets " exclusive OR ", and when n is an integer 2 during to K, n " exclusive OR " goalkeeper MSB (X) n-1 and MSB (X) n get " exclusive OR ".
And the logical value that each produced of K " exclusive OR " door is used as the length value L EG (X) that is included in the variable length code word VLW (X) among the storage code word M (X) and outputs to package parts 400.
In Fig. 1, package parts 400 are exported storage code word M (X) selectively according to length value L EG (X), so 400 of package parts are exported this variable length code word VLW (X) and do not exported its filler.
Fig. 5 is the circuit diagram of an example of package parts 400 among expression the present invention.
With reference to Fig. 5, package parts 400 comprise an input block 410, add up parts 420 and an output block 430.
Input block 410 comprises an one-level barrel shifter (first barrel shifter) 411 and one-level latchs (first latch) 412.
One-level barrel shifter 411 moves in the character string from the 2K position of one-level latch 412 and code book memory 200 inputs, produce a K position one-level window bit string B1 according to length value L EG (X), and with the parallel one-level latch 412 that outputs to of this K position one-level window bit string B1.
One-level latch 412 is stored this K position one-level window bit string B1 and will be had the one-level of identical place value to latch bit string W1 with one-level window bit string B1 and outputs to one-level barrel shifter 411 and output block 430 respectively.Therefore, as shown previously, the storage code word M (X) that the one-level of K position latchs bit string W1 and K position is walked abreast is input to one-level barrel shifter 411.
The parts 420 that add up comprise an adder 421, secondary latch 422, subtracter 423 and three grades of latchs 424.
Adder 421 is carried out mould K addition with the length value L EG (X) of variable length code word VLW (X) and the latched value L1 of secondary latch 422, and the result of addition is offered secondary latch 422.In addition, if the value of addition during greater than K, adder 421 will produce a carry signal.This carry signal will output to the outside and only be stored in the level Four latch 432 of output block 430 with everybody of the variable length code word VLW (X) of announcement, as following to discuss.
The value of the addition that secondary latch 422 storage adders transmit, and it is outputed to subtracter 423 and adder 421 respectively.
Subtracter 423 subtracts each other the value of K and addition gained, thereby produces a subtraction value S0.And the poor S0 that subtracter 423 will subtract each other gained offers three grades of latchs 424.
Then, three grades of latchs 424 will subtract each other gained difference S0 and output to output block 430 as control signal.
Output block 430 comprises a secondary barrel shifter 431 and a level Four latch 432.
Move on the bit string of the character string of secondary barrel shifter 431 2K position of one-level latch 412 in from input block 410 and storage code word M (X), responsive control signal produces the secondary window bit string of a K position.
A best tool 431 of level Four latch provides the input sequence of this secondary window bit string B2 for secondary window bit string B2.Level Four latch 431 has the memory space with the identical size of maximum length K of variable length code word.
The operation of variable-length coding method of the present invention and device thereof will be described in detail below.
In data source the symbol that might exist be followed successively by 1510,1310,1210,1110,510,210,110,110 for [a, b, c, d, e, f, g, h] and the recurrent number of times of each symbol, as shown in Figure 8, according to they recurrent number of times, each variable length code word VLW (X) is distributed to 8 symbols.The code value of the variable length code word of 8 symbols is distributed in table 1 expression according to standard huffman coding tree.1 variable length code word is distributed to the symbol [a] of normal generation, and 6 variable length code word is distributed to the symbol [g and h] of minimum generation.
Table 1
Symbol [X] Variable length code word VLW (X)
a 0
b 100
c 101
d 110
e 1110
f 11110
g 111110
h 111111
Represented as following table 2, be stored in code book memory 200 according to symbol variable length code word VLW (X) as its address.When variable length code word VLW (X) stored code book memory 200 into, the MSB of variable length code word VLW (X) and LSB were storing a memory cell of memory into respectively at first and at last.
Therefore, because the variable length code word has been provided promptly 6 of length the longest in the variable length code word, when a symbol x input, the storage code word M (X) that 200 outputs of code book memory are 6.
Table 2
Symbol [X] Variable length code word VLW (X)
a 0xxxxx
b 100xxx
c 101xxx
d 110xxx
e 1110xx
f 11110x
g 111110
h 111111
X: filler (or need not)
Fig. 6 is the flow chart of the Variable Length Code device of description in the presentation graphs 1
With reference to Fig. 6, in the first step, when symbol [x] was input to code book memory 200 from cushioning parts 100, as shown in table 2, code book memory 200 produced the storage code word M (c) that consistently has bit string [101xxx] with symbol [c].Then, code book memory 200 will be stored code word M (c) and offer variable length detection part 300 and package parts 400 (ST1 and ST2) respectively.
As shown in Figure 2, the storage code word M (c) that is input to variable length detection part 300 is imported into the coding alternative pack 510 of Boundary Detection parts 500.When storage code word M (c) is input to coding during alternative pack 510, as shown in table 3, coding alternative pack 510 from storage code word M (c), select successively 1 to 6 produce selected code word BW (c) m=1,2 ..., 6.Then, coding alternative pack 510 with each selected code word BW (c) m=1,2 ..., 6 offer level detection part 510 and calculating unit 520 (ST3) respectively.
Table 3
Selected code word BW (c) m
BW(c)m=1=1
BW(c)m=2=10
BW(c)m=3=101
BW(c)m=4=1011
BW(c)m=5=10111
BW(c)m=6=101111
When being input to level detection part 520 by selected code word BW (c) m that selects the m position to be produced from storage code word M (c), as shown in Figure 8, level detection part 520 serves as the number that the termination node from ground floor to the m layer is detected on the basis with the huffman coding tree, and as shown above, produce level code word NM (c) m (ST4) of each layer.
For example, as shown in table 3 when m=3, coding alternative pack 510 produces selected code word BW (c) 3=[101].Then, level detection part 520 is given weights for each layer, and weights of these termination nodes are added up mutually, in order to produce addition and WS (c) 3 as follows: WS ( c ) 3 = Σ i = 0 2 2 3 - j · L j = 8 Wherein j specifies the one deck in the standard huffman coding tree, and Lj points out the number of termination node in the j layer.
Then, the level detection part will and WS (c) 3 convert binary number to produce level code word NW (c) 3=[0001000].About all selected code word BW (c) m (m=1,2 ..., 6) level code word NW (c) m (m=1,2 ..., 6) shown in following table 4.
Table 4
m NW(c)
1 0=0000000
2 2=000010
3 8=001000
4 14=001110
5 30=011110
6 62=111110
When level code word NW (c) m (m=1,2 ..., 6) and selected code word BW (c) m (m=1,2 ..., 6) when being input to calculating unit 530 respectively, as shown in Figure 3, be input to respectively calculating unit 530 level code word NW (c) m (m=1,2 ..., 6) and selected code word BW (c) m (m=1,2 ..., 6) be input to first to the 6th subtracter 531 to 536 of calculating unit 530 respectively successively.
It is as follows that in first to the 6th subtracter 531 to 536 each is carried out identical function LD (c) m:
LD(c)m=BW(c)m-NW(c)m
Therefore, shown in following table 5, calculating unit 530 produce first to the 6th subtracter 531 to 536 LD as a result (c) m=1,2 ..., 6 as about operating result value LD (X=c) m=1,2 of symbol c ..., 6.
Table 5
m LD(c)m MSB→LSB
1 000001
2 000000
3 000001
4 111101
5 111001
6 110001
LD as a result (c) m=1,2 of first to the 6th subtracter 531 to 536 ..., 6 be provided for boundary value production part 540 (ST5).
To going on foot in 5 the detailed description, according to function LD (c) m that the following describes, first to the 6th subtracter 531 to 536 produce first to the 6th subtraction result LD (c) m=1,2 ..., 6, LD (c) m is described as follows: LD ( c ) 1 = Σ i = 1 1 2 1 - i · b i - Σ j = 0 0 2 1 - j · L j = 1 10 LD ( c ) 2 = Σ i = 1 2 2 2 - i · b i - Σ j = 0 1 2 2 - j · L j = 0 10 LD ( c ) 3 = Σ i = 1 3 2 3 - i · b i - Σ j = 0 2 2 3 - j · L j = 1 10 LD ( c ) 5 = Σ i = 1 5 2 5 - i · b i - Σ j = 0 4 2 5 - j · L j = - 7 10 LD ( c ) 4 = Σ i = 1 4 2 4 - i · b i - Σ j = 0 3 2 4 - j · L j = - 3 10 LD ( c ) 6 = Σ i = 1 6 2 6 - i · b i - Σ j = 0 5 2 6 - j · L j = - 15 10 Wherein bi represents the value of the i position of selected code word, and Lj represents the number of termination node in the j layer.
In the 6th step, boundary value production part 540 from subtraction result LD (c) m=1,2 ..., detect in each bit string of 6 MSB (c) m=1,2 ..., 6 value, and with MSB (c) m=1,2 ..., 6 value as boundary value MSB (c) m=1,2 ..., 6 output to code length detection part 600 (ST6).
In the 7th step, as shown in Figure 4, be input to code length detection part 600 MSB (c) m=1,2 ..., 6=[000111] each outputed to first to the 6th " exclusive OR " door by parallel, so code length detection part 600 produces the length value L EG (c) of bit strings [000100] as the length of the variable length code word of designated symbols [c].And this bit string [000100] is provided for package parts 400 (ST7).
In the 8th step, as length value L EG (c) when being provided for package parts 400, variable length code word VLW (c) among the package parts 400 detection of stored code word M (c) is with response length value LEG (c), and only exports the coding (ST8) of variable length code word VLW (c) as symbol [c].
With reference to Fig. 5 and Fig. 7 the operation of package parts among the present invention 400 is described in detail below.
Fig. 7 for expression when symbol [a, b, c, d, e, f, g, a, b] when being input to buffer unit 100 successively, the view of the output of each part of package parts.
With reference to Fig. 7, when time t=1, because storage code word M (X) is not input to package parts 400 from code book memory 200, as the response to length value L EG (c), the one-level barrel shifter 411 of package parts 400 is provided to one-level latch 412 with a bit string [X, X, X, X, X, X] as one-level window bit string B (t=1) 1.
Therefore, secondary latch 422 is respectively to subtracter 423 and adder 421 output L1=0, so three grades of latchs 424 output to secondary barrel shifter 431 with L2=6 as control signal.Then, as shown in Figure 7, secondary barrel shifter 431 output B (t=1) 2=[x, x, x, x, x, x] as the 6th the secondary window bit string B (t=1) that comprises from LSB to the 2K position.
When t=2, [a] is input to code book memory 200 when symbol, and when the storage code word M (a) of symbol [a] had produced from code book memory 200, storage code word M (a)=[a1, x, x, x, x, x] was input to the one-level barrel shifter 411 of input block 410 and the secondary barrel shifter 431 of output block 430 respectively.Simultaneously, as described above, the length value L EG (a)=1 that symbol [a] is corresponding produces from variable length detection part 300, and this length value L EG (a)=1 is offered one-level barrel shifter 411 and adder 421 respectively.
When the storage code word M (a) that produces length value L EG (a)=1 that produces from variable length detection part 300 and the code book memory 200 is input to one-level barrel shifter 411 respectively, one-level barrel shifter 411 latchs bit string [x in the one-level from one-level latch 412, x, x, x, x, x] and the storage code word M (a) bit string M (a)=[a1, x, x, x, x, x] go up and move with response length value LEG (a)=1, so, as shown in Figure 7, one-level barrel shifter 411 produces one-level window bit string W1=[x, x, x, x, x, a1], and with this one-level window bit string W1=[x, x, x, x, x, a1] output to one-level latch 412.One-level latch 412 is with this one-level window bit string W1=[x, x, x, x, x, a1] latch bit string L1 as one-level and output to one-level barrel shifter 411 and secondary barrel shifter 431 respectively.
Yet this moment, secondary barrel shifter 431 was to level Four latch 432 output one bit strings [a1, x, x, x, x, x] because the control signal L2=0 that three grades of latchs 424 in the parts 420 that add up are provided has been input to secondary barrel shifter 431.
When t=3, the storage code word M (b) of symbol [b]=[b1, b2, b3, x, x, x] and length value L EG (b)=3 are imported into one-level barrel shifter 411.One-level barrel shifter 411 is latching bit string W1=[x, x, x, x, x, a1 by storage code word M (b)=[b1, b2, b3, x, x, x] and one-level] bit string [x, x, x, x, x, a1, b1, b2, b3, x, x, x] formed goes up mobile, and begin to read 6 from three of the MSB back of this bit string, output to one-level latch 412 in order to these 6 [x, x, a1, b1, b2, b3] that will be read as one-level window bit string B (t=3) 1.Then, one-level latch 412 is with one-level window bit string B (t=3) 1=[x, x, a1, b1, b2, b3] latch bit string W1 as one-level and output to one-level barrel shifter 411 and secondary barrel shifter 431 respectively.On the other hand, adder 421 with LEG (b)=3 with from the L1=1 addition of secondary latch 422, and will output to secondary latch 422 with [4].Simultaneously, secondary latch 422 outputed to subtracter 423 with last time with L1=1, stored that current and L1=4 replace last time and L1=1.
That subtracter 423 will be worth that [6] deduct last time and L1=1, and will differ from S0=5 and offer three grades of latchs 424.Also will differ from S0=5 outputs to secondary barrel shifter 431 as control signal L2=5 to three grades of latch 424 storage difference S0=5 then.
Secondary barrel shifter 431 is latching bit string W1=[x, x, x, x, x, a1 by storage code word M (b)=[b1, b2, b3, x, x, x] and one-level] bit string [x, x, x, x, x, a1, b1, b2, b3, x, x, x] formed goes up mobilely responding the control signal L2=5 that three grades of latchs 424 provide, and begins to read 6 [a1, b1, b2, b3, x, x] from 5 of the MSB back of this bit string.Then, secondary barrel shifter 431 with read these 6 as secondary window bit string B (t=3) 2=[a1, b1, b2, b3, x, x] output to level Four latch 432.
Level Four latch 432 store secondary window bit string B (t=3) 2=[a1, b1, b2, b3, x, x].
When t=4, the storage code word M (c) of symbol [c]=[c1, c2, c3, x, x, x] and length value L EG (c)=3 are input to one-level barrel shifter 411.Response length value LEG (c)=3 one-level barrel shifter 411 is latching bit string W1=[x, x, a1, b1, b2, b3 by storage code word M (c)=[c1, c2, c3, x, x, x] and one-level] bit string [x, x, a1, b1, b2, b3, c1, c2, c3, x, x, x] formed goes up mobile, and begin to read 6 from three of the MSB back of this bit string, in order to 6 of gained [b1, b2, b3, c1, c2, c3] are outputed to one-level latch 412 as one-level window bit string B (t=4) 1.Then, one-level latch 412 is with one-level window bit string B (t=4) 1=[b1, b2, b3, c1, c2, c3] latch bit string W1 as one-level and output to one-level barrel shifter 411 and secondary barrel shifter 431 respectively.
On the other hand, adder 421 with LEG (c)=3 with produce one and [7] in the Calais mutually from the L1=4 of secondary latch 422.But because adder 421 is carried out moulds 6 additions, thus adder 421 outputs and for [1], carry signal be C=1.Then, adder 421 will offer secondary latch 422 with [1], and outside output carry signal.
Secondary latch 422 simultaneously with last time output to subtracter 423 with L1=4, as shown in Figure 7, and with and L1=1 replace last time and L1=4.
Subtracter 423 deducts last time from [6] and L1=4, and will differ from S0=2 and offer three grades of latchs 424.Then, three grades of latch 424 saved differences S0=2 and difference S0=2 outputed to secondary barrel shifter 431 as control signal L2=2.
Then, respond the control signal L2=2 secondary barrel shifter 431 that three grades of latchs 424 provide and latching bit string W1=[x, x, a1, b1, b2, b3 by storage code word M (b)=[c1, c2, c3, x, x, x] and one-level] mobile on the bit string [x, x, a1, b1, b2, b3, c1, c2, c3, x, x, x] formed, and begin to read 6 [a1, b1, b2, b3, c1, c2] from 2 of the MSB back of this bit string.Then, secondary barrel shifter 431 with 6 bit strings being read as secondary window bit string B (t=4) 2=[a1, b1, b2, b3, c1, c2] output to level Four latch 432.
At this moment, 6 memory spaces of all of level Four latch 432 are shared by the variable length code word.Therefore, by reading every appearance with response carry signal C=1 of level Four latch 432 outputs, we can obtain the variable length code word except that filler.
The process that goes out as shown above, package parts are constantly exported the code word of variable length according to the symbol of input.
Therefore, the present invention can convert symbol to the code word of variable length and needn't store the length of data in memory.
Although described the present invention in conjunction with most preferred embodiment above, those skilled in the art should be appreciated that the present invention can also make amendment, but all modifications must belong in the scope and spirit essence of the present invention of appended claim book defined.

Claims (20)

1. one kind by using a code device to convert symbol to the method for variable length code word, and this code device comprises that one is used for the code book memory of variable length code word that according to symbol storage has the variable length code word of maximum length, and this method comprises following each step:
A) come to produce a storage code word by import a symbol to the code book memory from the code book memory;
B) with selected code word, the number of the level of selected code word definition and each layer termination node serves as that the length that is included in the variable length code word in the storage code word is checked on the basis by each in huffman coding tree, wherein, selected code word produces for K time by selection m position in everybody of storage code word, wherein m=1,2,3,4 ..., K, K represents the maximum length of variable length code word;
C) from the storage code word, visit the variable length code word according to the length of variable length code word;
2. the method shown in claim 1, wherein said step b) comprise following each step:
B-1) based on selected code word and every layer of termination interstitial content, the border of variable length code word and filler is to produce a boundary value in the detection of stored code word;
B-2) based on step b-1) produce boundary value, detection is included in the length of storing the variable length code word in the code word.
3. method as claimed in claim 2, wherein said step b-1) comprise following each step:
B-1-1) detect the number of plies of each selected code word correspondence;
B-1-2) detect the termination node number of each layer correspondence;
B-1-3) composing weights by layer for the number of termination node, is that each layer produces a weights numeral thus;
B-1-4) weights numeral addition that will be from the root of huffman coding tree to each layer, in order to produce corresponding each layer and;
B-1-5) will with convert binary number to, produce thus corresponding each and the level code word;
B-1-6) the selected code word with corresponding each level code word deducts the level code word, obtains subtracting each other difference thus;
B-1-7) from subtract each other difference, detect highest significant position so that highest significant position is exported as boundary value.
4. method as claimed in claim 3, the length of wherein said variable length code word represent that with a length value this length value is produced by two highest significant position phases " exclusive OR ".
5. one kind is used a code device to become the method for variable length code word, this code device to comprise a code book memory of variable length code word that storage has the variable length code word of maximum length according to symbol symbol transition, and this method comprises following each step:
A) come to produce a storage code word by import a symbol to the code book memory from the code book memory;
B) in the storage code word, select the m position to produce selected code word, wherein m=1,2,3,4 ..., K, K represents the maximum length of variable length code word;
C) according to the number of termination node in each selected code word and each layer,, detect each selected code word and whether comprise the every of variable length code word based on each layer of huffman coding tree;
D) according to the visit variable length code word from the storage code word of the result in the step c), wherein said step c) comprises following each step:
C-1) serve as the level that each selected code word is detected on the basis with the huffman coding tree;
C-2) detect in each layer the number of termination node;
C-3) carry out function LD (X) m:
LD(X) m=BW(X) m-NW(X) m BW ( X ) m = Σ i = 1 m 2 m - i · b i NW ( X ) m = Σ j = 0 m - 1 2 m - j · L j
Wherein bi is for choosing the value of i position in the resulting selected code word in m position from the storage code word, and Lj is for setting the sum of termination node in the j layer at huffman coding;
Whether c-4) detect each LD (X) m is negative.
6. method as claimed in claim 5, the visit of wherein said step d) have the longest selected code word in the selected code word of nonnegative value, with it as the variable length code word.
7. one kind will become the device of variable length code word with the symbol transition that the fixed length code word table shows, this device comprises:
A) has the code book memory of variable length code word of the variable length code word of maximum length according to symbol storage;
B) based in selected code word, the huffman coding tree by the number of termination node in each layer of each selected code word definition and each layer, detect and be included in the variable length checkout gear of storing the variable length code word length in the code word,
Wherein, selected code word produces by K selection m position in everybody of storage code word, wherein m=1,2,3,4 ..., K, K represents the maximum length of variable length code word;
C) come optionally to export the code word packaging system of variable length code word according to the length of variable length code word from storage.
8. device as claimed in claim 7, wherein said variable length checkout gear comprises:
Based on the number of termination node in selected code word and each layer, detect in storing code word between the variable length code word and filler the border to produce the Boundary Detection device of a boundary value;
Based on boundary value, detect the code length checkout gear of the length that is included in the variable length code word in the storage code word.
9. device as claimed in claim 8, wherein said Boundary Detection device comprises:
Detection is corresponding to the device of the number of plies of each selected code word;
Detect the device of termination interstitial content in each layer;
By the number given weights of layer, be used for the device that produces weights into every layer for the termination node;
Weights addition that will be from the root of huffman coding tree to each layer, produce corresponding each layer and device;
Will with convert binary number to, produce corresponding each and the device of level code word;
To deduct the level code word corresponding to the selected code word of each level code word, produce the device of the difference of subtracting each other;
From the difference of subtracting each other, detect the device of highest significant position so that highest significant position is exported as boundary value.
10. device as claimed in claim 9, wherein said length value is produced by two highest significant position phases " exclusive OR ".
11. device as claimed in claim 7, wherein said compression set comprises:
The length of a response variable length code word selects everybody to produce the input block of an one-level window bit string from bit string, and wherein, this bit string comprises storage code word and one-level window bit string;
Response one control signal detects everybody of variable length code word in the bit string of one-level window bit string and storage code word, and with detected everybody output to output block; And
One is added up detected everybody numeral, in order to produce the parts that add up of control signal.
12. device as claimed in claim 11, wherein said input block comprise an one-level latch, are used for one-level window bit string is outputed to output block and one-level barrel shifter; And
On bit string, move length, produce the one-level barrel shifter of one-level window bit string with response variable length code word.
13. device as claimed in claim 11, wherein said output block comprise a secondary barrel shifter, responsive control signal moves on the bit string of one-level window bit string and storage code word to detect the every of variable length code word; And
Storage is from everybody secondary latch of the variable length code word of secondary barrel shifter.
14. device as claimed in claim 11, wherein said accumulator comprise one be used for storing from adder and three grades of latchs;
With adder in the length value of variable length code word and the three grades of latchs and that carry out mould K addition, when carry signal of adder generation when be K; And
One with K deduct addition and subtracter, be used for producing control signal.
15. one kind becomes the device of variable length code word with symbol transition, this device comprises:
A) produce a device of storing code word to the code book memory from the code book memory by symbol of input;
B) in order to produce selected code word, from the storage code word, select the device of m position, wherein m=1,2,3,4 ..., K, K represents the maximum length of variable length code word;
C), decide each selected code word whether to comprise every device of variable length code word according to the termination interstitial content of each selected code word and every layer based on the layer of huffman coding tree definition; And
D) according to the device of result's visit variable length code word from the storage code word of decision.Wherein said determination device comprises:
C-1), detect the device of the level of each selected code word based on the huffman coding tree;
C-2) detect in each layer the device of the number of termination node; And
C-3) the device LD (X) of execution function LD (X) m m=BW (X) m-NW (X) m BW ( X ) m = Σ i = 1 m 2 m - i · b i NW ( X ) m = Σ j = 0 m - 1 2 m - j · L j
Wherein bi is for choosing the value of i position in the resulting selected code word in m position from the storage code word, and Lj is for setting the sum of termination node in the j layer at huffman coding; And
Whether c-4) detect each LD (X) m is the device of negative.
16. the selected code word that device as claimed in claim 15, the visit of wherein said access means have the longest length and have a nonnegative value is as the variable length code word.
17. device as claimed in claim 15, wherein said access means comprises that the length of a response variable length code word selects everybody to produce the input block of an one-level window bit string from bit string, wherein, this bit string comprises storage code word and one-level window bit string;
Response one control signal in the bit string of one-level window bit string and storage code word, detect the variable length code word everybody with, and with detected everybody output to output block; And
One is added up detected everybody numeral to produce the parts that add up of control signal.
18. device as claimed in claim 17, wherein said input block comprise an one-level latch, are used for one-level window bit string is outputed to output block and one-level barrel shifter; And
The length of response variable length code word moves on bit string to produce the one-level barrel shifter of one-level window bit string.
19. device as claimed in claim 17, wherein said output block comprise a secondary barrel shifter, responsive control signal moves on the bit string of one-level window bit string and storage code word to detect the every of variable length code word; And
Storage is from everybody secondary latch of the variable length code word of secondary barrel shifter.
20. device as claimed in claim 17, wherein said accumulator comprise one be used for storing from adder and three grades of latchs;
With adder in the length value of variable length code word and the three grades of latchs and that carry out mould K addition, when carry signal of adder generation when be K; And
One with K deduct addition and subtracter, be used for producing control signal.
CN 97125432 1997-12-08 1997-12-08 Variable-length coding method and apparatus thereof Expired - Fee Related CN1123125C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 97125432 CN1123125C (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
CN 97125432 CN1123125C (en) 1997-12-08 1997-12-08 Variable-length coding method and apparatus thereof

Publications (2)

Publication Number Publication Date
CN1219803A CN1219803A (en) 1999-06-16
CN1123125C true CN1123125C (en) 2003-10-01

Family

ID=5177273

Family Applications (1)

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

Country Status (1)

Country Link
CN (1) CN1123125C (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6563440B1 (en) * 2001-10-19 2003-05-13 Nokia Corporation Apparatus and method for decoding Huffman codes using leading one/zero string length detection
US6690307B2 (en) * 2002-01-22 2004-02-10 Nokia Corporation Adaptive variable length coding of digital video
CN100394693C (en) * 2005-01-21 2008-06-11 华中科技大学 Coding and decoding method for variable long code

Also Published As

Publication number Publication date
CN1219803A (en) 1999-06-16

Similar Documents

Publication Publication Date Title
CN1049778C (en) Calculator
CN1499731A (en) Low density parity check code decoder and method thereof
CN1215862A (en) Computing method and computing apparatus
CN1254921C (en) Improved huffman decoding method and device
CN1230054A (en) Self-adaption probability estimating method, self-adaption coding method and self-adaption decoding method
CN1291379A (en) Interleaving/deinter leaving device and method for communication system
CN1703089A (en) A two-value arithmetic coding method of digital signal
US7548175B2 (en) Encoding apparatus, decoding apparatus, encoding method, computer readable medium storing program thereof, and computer data signal
CN1297616A (en) Address generator and address generating method for use in turbo interleaver/deinterleaver
KR100221002B1 (en) Digital information encoding apparatus, digital information decoding apparatus, digital information encoding/decoding apparatus, digital information encoding method and digital information decoding method
CN1252566A (en) Method and device for access control of direct memory
CN1288863C (en) Method and device for generating OVSF
CN1714513A (en) Addresses generation for interleavers in TURBO encoders and decoders
CN1163054C (en) Image processor
CN1123125C (en) Variable-length coding method and apparatus thereof
CN1341295A (en) Block interleaving for turbo coding
CN1302624C (en) Decoder for trellis-based channel encoding
CN1106081C (en) Code translation circuit
US4972497A (en) Image coding system
JPH05183443A (en) Code conversion method
US5859926A (en) Device and method for data coding and decoding
CN1731684A (en) The method and apparatus of constructing low-density parity check (LDPC) matrix
CN1179662A (en) Pattern matching apparatus
CN1155161C (en) Tebo code decoder and its decoding method
CN1592117A (en) Mobile telephone, apparatus, method, and program for calculating an interleave parameter

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
C41 Transfer of patent application or patent right or utility model
TR01 Transfer of patent right

Effective date of registration: 20031216

Address after: Seoul

Patentee after: Daewoo Electronics Co., Ltd.

Address before: Seoul

Patentee before: Daewoo Electronics Co., Ltd.

ASS Succession or assignment of patent right

Owner name: FENGYE VISION TECHNOLOGY CO., LTD.

Free format text: FORMER OWNER: DAEWOO ELECTRONICS CO., LTD.

Effective date: 20130506

C41 Transfer of patent application or patent right or utility model
TR01 Transfer of patent right

Effective date of registration: 20130506

Address after: ottawa

Patentee after: Fengye Vision Technology Co., Ltd.

Address before: Seoul, South Kerean

Patentee before: Daewoo Electronics Co., Ltd.

CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20031001

Termination date: 20141208

EXPY Termination of patent right or utility model