EP1142128A1 - Variable-length decoding - Google Patents
Variable-length decodingInfo
- Publication number
- EP1142128A1 EP1142128A1 EP00974492A EP00974492A EP1142128A1 EP 1142128 A1 EP1142128 A1 EP 1142128A1 EP 00974492 A EP00974492 A EP 00974492A EP 00974492 A EP00974492 A EP 00974492A EP 1142128 A1 EP1142128 A1 EP 1142128A1
- Authority
- EP
- European Patent Office
- Prior art keywords
- memory location
- memory
- data
- branches
- huffman tree
- 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.)
- Withdrawn
Links
- 238000011156 evaluation Methods 0.000 claims abstract description 10
- 238000000034 method Methods 0.000 claims description 14
- 230000000694 effects Effects 0.000 claims description 3
- 238000004590 computer program Methods 0.000 claims 2
- 238000010586 diagram Methods 0.000 description 4
- 230000006870 function Effects 0.000 description 4
- 101000652578 Homo sapiens Thyroid transcription factor 1-associated protein 26 Proteins 0.000 description 2
- 102100030344 Thyroid transcription factor 1-associated protein 26 Human genes 0.000 description 2
- 230000008901 benefit Effects 0.000 description 2
- 238000004891 communication Methods 0.000 description 2
- 238000007906 compression Methods 0.000 description 2
- 230000006835 compression Effects 0.000 description 2
- 238000010561 standard procedure Methods 0.000 description 2
- 230000010455 autoregulation Effects 0.000 description 1
- 238000013144 data compression Methods 0.000 description 1
- 230000003247 decreasing effect Effects 0.000 description 1
- 239000000284 extract Substances 0.000 description 1
- 230000008569 process Effects 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- 238000013139 quantization Methods 0.000 description 1
- 230000004044 response Effects 0.000 description 1
- 230000009466 transformation Effects 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H03—ELECTRONIC CIRCUITRY
- H03M—CODING; DECODING; CODE CONVERSION IN GENERAL
- H03M7/00—Conversion of a code where information is represented by a given sequence or number of digits to a code where the same, similar or subset of information is represented by a different sequence or number of digits
- H03M7/30—Compression; Expansion; Suppression of unnecessary data, e.g. redundancy reduction
- H03M7/40—Conversion to or from variable length codes, e.g. Shannon-Fano code, Huffman code, Morse code
-
- H—ELECTRICITY
- H03—ELECTRONIC CIRCUITRY
- H03M—CODING; DECODING; CODE CONVERSION IN GENERAL
- H03M7/00—Conversion of a code where information is represented by a given sequence or number of digits to a code where the same, similar or subset of information is represented by a different sequence or number of digits
- H03M7/30—Compression; Expansion; Suppression of unnecessary data, e.g. redundancy reduction
- H03M7/40—Conversion to or from variable length codes, e.g. Shannon-Fano code, Huffman code, Morse code
- H03M7/42—Conversion to or from variable length codes, e.g. Shannon-Fano code, Huffman code, Morse code using table look-up for the coding or decoding process, e.g. using read-only memory
- H03M7/425—Conversion to or from variable length codes, e.g. Shannon-Fano code, Huffman code, Morse code using table look-up for the coding or decoding process, e.g. using read-only memory for the decoding process only
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/90—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using coding techniques not provided for in groups H04N19/10-H04N19/85, e.g. fractals
- H04N19/91—Entropy coding, e.g. variable length coding [VLC] or arithmetic coding
Definitions
- the invention relates to decoding data which has been variable-length encoded in accordance with a Huffman tree
- the invention may be applied, for example, in an MPEG decoder (MPEG is an abbreviation of Motion Pictures Expert Group)
- Variable-length encoding is based on the following principle
- Data to be encoded is composed of va ⁇ ous different symbols, just like a text is composed of various different words.
- a symbol which frequently occurs in the data is coded by means of a relatively short code word, that is, a code word which comp ⁇ ses relatively few bits
- a symbol which rarely occurs in the data is coded by means of a longer code word.
- data is composed of four symbols A, B, C and D
- the data is composed of symbol A for 50 %, of symbol B for 25% and of symbols C and D for 12.5 % each
- the symbol A may be represented by a 1-bit binary code word, the symbol B by a 2-bit binary code word, and the symbols C and D by a 3-bit binary code word
- the average code-word length m the encoded data will be less than 2 bits.
- variable-length encoding A basic aspect of variable-length encoding is how to distinguish between different code words. If the code words are fixed in length, that is if each code word has a length of 2 bits for example, we know that there will be a new code word every 2 bits. If code words are not fixed in length, which is the case in variable-length encoding, another technique should be applied to distinguish between different code words
- a first-level node constitutes the beginning of the tree
- One first-level branch has a leaf at its end which leaf represents the symbol A
- a binary zero (0) is associated to this branch
- the other first-level branch has a second-level node at its end.
- a binary one (1) is associated to this branch.
- There are two second-level branches connected to the second-level node One second-level branch has a lea" at its end, which leaf represents the symbol B A binary zero (0) is associated to this branch
- the other second-level branch has a third-level node at its end A binary one (1) is associated to this second-level branch
- Each third-level branch has a leaf at its end.
- one leaf represents the symbol C and the other the symbol D
- a binary zero (0) is associated to the branch w hose leaf represents the symbol C
- a binary one (1) is associated to the branch whose leaf represents the symbol D
- the Huffman tree desc ⁇ bed above provides the following code words To reach the leaf representing symbol A, one must pass via the first-level branch to which a binary zero (0) is associated The code word for symbol A is therefore 0 To reach the leaf representing symbol B, one must pass via the first-level branch to which a bmar ⁇ one (1) is associated ana then via the second-level branch to which a binary (0) is associated The code word for symbo B is therefore 10 To reach the leaf representing symbol C, one must pass via the first-level branch to which a binary one (1) is associated, then via the second-level branch to which a binary (1) is associated and then via the third-level branch to which a binary (0) is associated The code word for symbol C is therefore 110 To reach the leaf representing symbol D, one must pass via the first-level branch to which a binary one (1) is associated, then via the second-level branch to which a binary (1) is associated and then via the third-level branch to which a binary (1) is associated The code word for symbol D is therefore 111 Data which has been variable-length
- the invention takes the following aspects into consideration.
- the data compression factor that can be achieved by means of va ⁇ able-length encoding basically depends on two factors It depends on the statistical properties of the data to be encoded, and on the Huffman tree in accordance with which the data is encoded
- a Huffman tree that provides a satisfactory compression factor for a given type of data may not give a satisfactory compression factor for another type of data, because the two types of data have different statistical properties. For this reason, it is desirable to have different va ⁇ able-length codes for different types of data, each code having its own specific Huffman tree
- va ⁇ able-length decoder such as desc ⁇ bed hereinbefore in the background-art part.
- Such a solution requires a dedicated decoding logic circuit for each code
- the decoding logic circuits will generally be relatively complex, because va ⁇ able-length codes are generally relatively complex. Consequently, this solution requires an appreciable amount of circuitry and is therefore relatively expensive.
- Another solution is to use a general purpose processor and to provide va ⁇ able-length decoding software for each va ⁇ able-length code.
- data which has been va ⁇ able-length encoded in accordance with a Huffman tree is decoded in the following manner.
- a memory is used in which the Huffman tree has been stored so that branches of the Huffman tree are represented by memory locations. If a memory location represents a branch that is followed by subsequent branches, the memory location contains a pointer to memory locations representing these subsequent branches.
- the memory location represents a branch that is not followed by subsequent branches, which means the branch has a leaf at its end, the memory location contains an end-of-code indication and output-symbol data
- a decoding processor car ⁇ es out a selection step and an evaluation step with each data element in a sequence of data elements
- the decoding processor selects a memory location on the basis of the data element and the content of the most recently selected memory location
- the decoding processor checks if the memory location that has been selected contains the end- of code indication If so, the decoding processor provides an output symbol on the basis of the output-symbol data
- the decoding processor can be relatively simple, because it car ⁇ es out a relatnely simple standard procedure with each data element in the data to be decoded What is more, the standard procedure does not depend on the Huffman tree That is, the decoding processor can be used for carrying out different types of va ⁇ able-length decoding. In order to allow different types of va ⁇ able-length decoding, it is thus sufficient to replace one H
- the invention thus allows decoding of va ⁇ ous va ⁇ able-length codes with relatively simple decoding circuitry.
- the method of va ⁇ able-length decoding desc ⁇ bed in the background art portion requires relatively complicated decoding circuitry m order to achieve the same Va ⁇ able-length decoding in accordance with the invention may require somewhat more memory than va ⁇ able-length decoding desc ⁇ bed the background art portion
- the invention will provide a saving on decoding circuitry, which will outweigh cost of additional storage capacity, if there is any such cost
- the invention allows cost-effective implementations
- the invention and additional features, which may be optionally used to implement the invention to advantage, are apparent from and will be elucidated with reference to the drawings desc ⁇ bed hereinafter
- FIG. 1 is a conceptual diagram illustrating basic features of the invention as claimed in claim 1
- Fig 2 is a diagram illustrating a Huffman tree
- Fig 3 is a block diagram illustrating a decoder for decoding data which has been encoded in accordance with the Huffman tree illustrated m Fig 2
- Fig 4 is a flow chart illustrating a method in accordance with which the decoder illustrated m Fig. 3 may operate
- Fig. 5 is a block diagram illustrating an MPEG decoder in accordance with the invention DETAILED DESCRIPTION OF THE DRAWINGS
- a digit or a suffix is added to the letter reference in order to distinguish like entities
- the digit or the suffix may be omitted for convenience or it may be replaced by an aste ⁇ sk m the case where its value is not important (do not care value). This applies to the desc ⁇ ption as well as the claims
- Fig 1 illustrate basic features for decoding data which has been va ⁇ able-length encoded in accordance with a Huffman tree HT.
- a memory MEM is used in which the Huffman tree HT has been stored so that branches of the Huffman tree are represented by memory locations ML. If a memory location represents a branch that is followed by subsequent branches, the memory location contains a pointer P to memory locations representing these subsequent branches. If the memory location represents a branch that is not followed by subsequent branches, the memory location contains an end-of-code indication ECI and output-symbol data OSD
- a decoding processor DPR car ⁇ es out a selection step SEL and an evaluation step EVA with each data element DE in a sequence of data elements.
- the decoding processor selects a memory location on the basis of the data element and the content of the most recently selected memory location.
- the decoding processor checks if the memory location that has been selected contains the end- of-code indication. If so, the decoding processor provides an output symbol OS on the basis of the output-symbol data
- Fig. 2 illustrates an example of a Huffman tree
- the Huffman tree defines a va ⁇ able-length coding of four symbols- A, B, C and D
- the Huffman tree comp ⁇ ses nodes NO, branches BR and leaves LF There is a first, second and third-level node NO1, NO2 and NO3, respectively. There are two first, second and third-level branches BR1*, BR2*, and BR3*, respectively.
- a binary value which may be zero (0) or one (1), is assigned to each branch BR.
- Leaves LF1, LF2, LF3 and LF4 represent symbols A, B, C and D, respectively
- the Huffman tree defines a code word for each symbol A, B, C and D in the following manner
- the first-level node NO1 is taken as a starting node From this node there is a certain path to each symbol.
- the code word is formed by the binary values assigned to the branches BR in the path in order of decreasing significance.
- the path to symbol C is formed by the branches BR12, BR22 and BR31 to which the binary values 1, 1 and 0 are assigned, respectively. Consequently, the code word for symbol C is 110
- Fig. 3 illustrates a decoder for decoding data which has been encoded m accordance with the Huffman tree illustrated in Fig. 2.
- the decoder comp ⁇ ses a decoding processor DPR and a memory MEM.
- the memory comp ⁇ ses several memory cells @. Each memory cell @ has a specific address.
- the memory cells @0, @ 1 and @2 are divided in two halves These memory cells compnse a left-half portion and a ⁇ ght-half portion. Each portion contains an address. It may further contain a flag v. For example, the left-half portion of the memory cell @0 comp ⁇ ses the flag and the address of memory cell @ 10
- the memory MEM of the decoder illustrated in Fig 3 contains the Huffman tree illustrated in Fig. 2.
- the Huffman tree has been stored in a particular manner.
- the memory cells @0, @ 1 and @2 represent the first, second and third-level branches, BR , BR2* and BRS* , respectively.
- the left-half portions of these memory cells represent the branches BR* 1 which have been assigned a binary zero (0)
- the ⁇ ght-half portions represent the branches BR*2 which have been assigned a binary one (1).
- It a portion of a memory cell @ represents a branch BR which is connected to subsequent branches, the portion contains the address of the memory cell which represents these further branches.
- the ⁇ ght-half portion of the memory cell @0 represents branch BR12 of the Huffman tree. This branch is further connected to the branches BR21 and BR22.
- the memory cell @ 1 represents these branches. Therefore, the ⁇ ght-half portion of the memory cell @0 contains the address of memory cell @ 1. If a portion of a memory cell @ represents a branch BR which has a leaf LF at its end, the portion contains the flag V. The portion further contains the address of the memory cell which contains the symbol that belongs to this leaf
- Fig. 4 illustrates a method in accordance with which the decoder illustrated in Fig. 3 may operate.
- the method comp ⁇ ses six steps S1-S6. Steps S 1-S4 are earned out with each subsequent bit of the data to be decoded. Steps S5 and S6 are earned out only when the current bit forms the last bit of a code word. In that case, the decoder provides an output symbol.
- step SI the decoding processor reads a memon cell @ which has been selected as the next-to-be-read memory cell du ⁇ ng a senes of steps S1-S6 earned out previously RD[NXT@].
- the memory cell which is read in step S 1 is either memory cell @0, @1 or @2. This will be further explained hereinafter
- step S2 the decoding processor selects input data from the memory cell @0, @ 1 or @2 which has been read in step SI
- the input data is either the left-half portion of the memory cell or the nght-half portion.
- step S4 the decoding processor checks whether the input data contains a flag V e ED 9 If so, the decoding processor car ⁇ es out steps S5 and S6 If not, the decoding processor will directly carry out step S I anew for the subsequent bit in the data to be decoded
- step S5 the decoding processor reads a memory cell which, in step S3, has been selected as the next-to-be-read memory cell RD[NXT@] This memory cell is eithei memory cell @ 10, @ 11, @ 12 or @ 13 It thus contains a symbol The symbol is outputted
- the decoder illustrated in Fig 3 which operates in accordance with the method illustrated in Fig 4, is an example of an implementation of the basic features illustrated in Fig 1 In this respect, the following remarks are made
- the memory locations ML in Fig 1 are implemented in Fig 3 in the form of the nght-half and left-half portions of the memory cel @ 1, @2 and @3
- the output symbol data OSD in Fig 1 are implemented in Fig 3 in the form of addresses of the memory cells @ 10, @ 11, @ 12 and @ 13.
- the selection step SEL in Fig 1 is implemented in Fig 4 in the form ot steps the S 1-S3 and S6
- the content of the most recently selected memory location in Fig 4 is either the address of memory cell @ 1 or @2, or the flag whicn constitutes the end-of-code indication In the latter case, tne decoding processor will subsequently read memory cell @0, which represents the beginning of the Huffman tree
- the evaluation step EVA in Fig 1 is implemented in Fig 4 in the form of the steps S4 and S5
- Fig 5 illustrates an MPEG decoder in accordance with the invention
- the MPEG decoder provides, in response to an MPEG data stream MDS, va ⁇ ous types of decoded data, such as video data VED and audio data AUD. for example
- the MPEG decoder compnses an input section INP. a va ⁇ able-length decoder ⁇ T-D and further decoding circuitr)
- VLD The va ⁇ able-length decoder VLD comp ⁇ ses a memory MEM and a decoding processor
- the memory MEM contains vanous Huffman trees HT[1] HT[N] belonging to vanous types of data
- the Huffman trees are stored in a manner as explained hereinbefore with reference to Fig 1
- the MPEG decoder basically operates as follows
- the input section INP recognizes the type of data which is currently being received
- the input section INP recognizes the type of data which is currently being received
- the input section INP recognizes the type of data which is currently being received
- the input section INP supplies an identification signal IS to the va ⁇ able-length decoder VLD
- the identification signal IS tells the va ⁇ able- length decoder VLD, as it were, which type of data it currently receives
- the decoding processor DPR uses the identification signal IS to read the correct Huffman tree HT from the memory MEM More specifically, the identification signal IS determines the address at which the decoding processor DPR will start to read the memory for decoding a code word Accordingly, the va ⁇ able-length decoder VLD supplies va ⁇ able-length decoded data, which may vary in type, to the further decoding circuitry FDC
- the further decoding circuitry FDC further processes this data, which processing may include inverse quantization, discrete cosine transformation and motion compensation, for example
- the Huffman trees HT[1] HT[N] contained in the memory MEM, as illustrated in Fig. 5, may have been pre-stored in a factory However, one or more Huffman trees may also have been stored after the MPEG decoder left the factory
- a Huffman tree can be stored by means of memory-configuration data supplied to the MPEG decoder
- the memory-configuration data will generally compnse the data to be stored in the memory MEM and information about where this data should be stored in the form of codes, for example
- the memory configuration-data can be supplied to the MPEG decoder by means of a communication network like the Internet, for example
- FIG. 3 illustrates only one possible implementation in which a branch is represented by a left-half or a right-half portion of a memory cell. Another possible implementation is that each branch is represented by a different memory cell. In that case, a memory cell representing a branch which is followed by further branches, should contain a pointer pointing to the memory cells that represent these further branches. The value of the current bit from the data to be decoded will then determine which one of these memory cells should be read.
- FIG. 3 illustrates only one possible implementation in which output symbols are stored in dedicated memory cells.
- a memory location which represents a branch having a leaf at its end contains the address of the memory cell containing the appropriate output symbol.
- Another possible implementation is to directly store an output symbol in a memory location which represents a branch having a leaf at its end.
- An advantage of such an implementation is that it will require one step less to provide an output symbol compared with the possibility illustrated in Fig. 3.
- the drawings are very diagrammatic, each representing only one possible embodiment of the invention. Thus, although a drawing shows different functions as different blocks, this by no means excludes that a single item of hardware or software carries out several functions. Nor does it exclude that a function is carried out by an assembly of items of hardware or software, or both.
- the decoding processor DPR illustrated in Fig. 3 can be implemented by means of a suitably programmed computer circuit.
- a set of instructions contained in a program memory can cause the computer circuit to effect various operations described hereinbefore with reference to Figs. 3 and 4.
- the set of instructions can be loaded into the program memory by reading a data carrier such as, for example, a disk that contains the set of instructions.
- the reading can be effected through a communication network such as, for example, the Internet.
- a service provider will make the set of instructions available to the public. Any reference sign in a claim should not be construed as limiting the claim.
- the word “comprising” does not exclude the presence of other elements or steps than those listed in a claim.
- the word "a” or “an” preceding an element or step does not exclude the presence of a plurality of such elements or steps.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Compression, Expansion, Code Conversion, And Decoders (AREA)
- Compression Or Coding Systems Of Tv Signals (AREA)
Abstract
Data which has been variable-length encoded in accordance with a Huffman tree (HT), is decoded in the following manner. A memory (MEM) is used in which the Huffman tree has been stored so that branches of the Huffman tree are represented by memory locations (ML). If a memory location represents a branch that is followed by subsequent branches, the memory location contains a pointer (P) to memory locations representing these subsequent branches. If the memory location represents a branch that is not followed by subsequent branches, the memory location contains an end-of-code indication (ECI) and output-symbol data (OSD). A decoding processor (DPR) carries out a selection step (SEL) and an evaluation step (EVA) with each data element (DE) in a sequence of data elements. In the selection step, the decoding processor selects a memory location on the basis of the data element and the content of the most recently selected memory location. In the evaluation step, the decoding processor checks if the memory location that has been selected contains the end-of-code indication. If so, the decoding processor provides an output symbol (OS) on the basis of the output-symbol data. This manner of variable-length decoding allows cost-efficient implementations, in particular when various types of variable-length codes need to be decoded. It is particularly suitable for use in an MPEG decoder.
Description
Variable-length decoding
FIELD OF THE INVENTION
The invention relates to decoding data which has been variable-length encoded in accordance with a Huffman tree The invention may be applied, for example, in an MPEG decoder (MPEG is an abbreviation of Motion Pictures Expert Group)
BACKGROUND ART
Variable-length encoding is based on the following principle Data to be encoded is composed of vaπous different symbols, just like a text is composed of various different words. A symbol which frequently occurs in the data is coded by means of a relatively short code word, that is, a code word which compπses relatively few bits A symbol which rarely occurs in the data is coded by means of a longer code word. For example, let it be assumed that data is composed of four symbols A, B, C and D Let it further be assumed that the data is composed of symbol A for 50 %, of symbol B for 25% and of symbols C and D for 12.5 % each The symbol A may be represented by a 1-bit binary code word, the symbol B by a 2-bit binary code word, and the symbols C and D by a 3-bit binary code word When the data is encoded with these code words, the average code-word length m the encoded data will be less than 2 bits.
A basic aspect of variable-length encoding is how to distinguish between different code words. If the code words are fixed in length, that is if each code word has a length of 2 bits for example, we know that there will be a new code word every 2 bits. If code words are not fixed in length, which is the case in variable-length encoding, another technique should be applied to distinguish between different code words
Variable-length encoding in accordance with a Huffman tree allows to distinguish between different code words in an efficient manner What follows is an example of a Huffman tree for encoding the four symbols A, B, C and D presented hereinbefore A first-level node constitutes the beginning of the tree There are two first-level branches connected to this node One first-level branch has a leaf at its end which leaf represents the symbol A A binary zero (0) is associated to this branch The other first-level branch has a second-level node at its end. A binary one (1) is associated to this branch. There are two
second-level branches connected to the second-level node One second-level branch has a lea" at its end, which leaf represents the symbol B A binary zero (0) is associated to this branch
The other second-level branch has a third-level node at its end A binary one (1) is associated to this second-level branch There are two third-level branches connected to the third-level node Each third-level branch has a leaf at its end. one leaf represents the symbol C and the other the symbol D A binary zero (0) is associated to the branch w hose leaf represents the symbol C A binary one (1) is associated to the branch whose leaf represents the symbol D
The Huffman tree descπbed above provides the following code words To reach the leaf representing symbol A, one must pass via the first-level branch to which a binary zero (0) is associated The code word for symbol A is therefore 0 To reach the leaf representing symbol B, one must pass via the first-level branch to which a bmar\ one (1) is associated ana then via the second-level branch to which a binary (0) is associated The code word for symbo B is therefore 10 To reach the leaf representing symbol C, one must pass via the first-level branch to which a binary one (1) is associated, then via the second-level branch to which a binary (1) is associated and then via the third-level branch to which a binary (0) is associated The code word for symbol C is therefore 110 To reach the leaf representing symbol D, one must pass via the first-level branch to which a binary one (1) is associated, then via the second-level branch to which a binary (1) is associated and then via the third-level branch to which a binary (1) is associated The code word for symbol D is therefore 111 Data which has been variable-length encoded in accordance with a Huffman tree may be decoded in the following manner A data register selects a sequence of bits from the data and supplies this sequence to a decoding logic circuit The decoding logic circuif recognizes, as it were, a code word contained in the sequence of bits Accordingly, the decoding logic circuit selects from the memory the symbol that represents the code word Foi example, let it be assumed that data has been encoded with the code words 0, 10, 110 and 111 representing symbols A, B, C and D, respectively, as descπbed hereinbefore In that case, the decoding logic reads symbol A, B C or D from the memory if the data register contains —0 - 10, 110 or 111, respectively, the sign - representing a do-not-care value A method of decoding as descπbed m this paragraph appears to be disclosed m US Patent 5.828,907
SUMMARY OF THE INVENTION
It is an object of the invention to allow cost-effective implementations of decoding data that has been encoded in accordance with a Huffman tree
The invention takes the following aspects into consideration. The data compression factor that can be achieved by means of vaπable-length encoding basically depends on two factors It depends on the statistical properties of the data to be encoded, and on the Huffman tree in accordance with which the data is encoded A Huffman tree that provides a satisfactory compression factor for a given type of data, may not give a satisfactory compression factor for another type of data, because the two types of data have different statistical properties. For this reason, it is desirable to have different vaπable-length codes for different types of data, each code having its own specific Huffman tree
In many applications, such as multi-media for example, it is desired to handle different types of data which have been vaπable-length encoded in different manners. In pπnciple, this can be achieved by providing for each vaπable-length code, a dedicated vaπable-length decoder such as descπbed hereinbefore in the background-art part. Such a solution requires a dedicated decoding logic circuit for each code The decoding logic circuits will generally be relatively complex, because vaπable-length codes are generally relatively complex. Consequently, this solution requires an appreciable amount of circuitry and is therefore relatively expensive. Another solution is to use a general purpose processor and to provide vaπable-length decoding software for each vaπable-length code. However, this software-based solution will be relatively slow in terms of decoding throughput. It may require a fast general purpose processor in order to achieve a satisfactory decoding speed. Such a processor is relatively expensive and, therefore, the software-based solution will also be expensive In accordance with the invention, data which has been vaπable-length encoded in accordance with a Huffman tree, is decoded in the following manner. A memory is used in which the Huffman tree has been stored so that branches of the Huffman tree are represented by memory locations. If a memory location represents a branch that is followed by subsequent branches, the memory location contains a pointer to memory locations representing these subsequent branches. If the memory location represents a branch that is not followed by subsequent branches, which means the branch has a leaf at its end, the memory location contains an end-of-code indication and output-symbol data A decoding processor carπes out a selection step and an evaluation step with each data element in a sequence of data elements In the selection step, the decoding processor selects a memory location on the basis of the data
element and the content of the most recently selected memory location In the evaluation step the decoding processor checks if the memory location that has been selected contains the end- of code indication If so, the decoding processor provides an output symbol on the basis of the output-symbol data The decoding processor can be relatively simple, because it carπes out a relatnely simple standard procedure with each data element in the data to be decoded What is more, the standard procedure does not depend on the Huffman tree That is, the decoding processor can be used for carrying out different types of vaπable-length decoding. In order to allow different types of vaπable-length decoding, it is thus sufficient to replace one Huffman tree stored in the memory by another Huffman tree or to store different Huffman trees in the memory and to select a Huffman tree by defining a start address
The invention thus allows decoding of vaπous vaπable-length codes with relatively simple decoding circuitry. In contrast, the method of vaπable-length decoding descπbed in the background art portion requires relatively complicated decoding circuitry m order to achieve the same Vaπable-length decoding in accordance with the invention may require somewhat more memory than vaπable-length decoding descπbed the background art portion However, for many applications, the invention will provide a saving on decoding circuitry, which will outweigh cost of additional storage capacity, if there is any such cost Thus, the invention allows cost-effective implementations The invention and additional features, which may be optionally used to implement the invention to advantage, are apparent from and will be elucidated with reference to the drawings descπbed hereinafter
BRIEF DESCRIPTION OF THE DRAWINGS Fig. 1 is a conceptual diagram illustrating basic features of the invention as claimed in claim 1
Fig 2 is a diagram illustrating a Huffman tree
Fig 3 is a block diagram illustrating a decoder for decoding data which has been encoded in accordance with the Huffman tree illustrated m Fig 2 Fig 4 is a flow chart illustrating a method in accordance with which the decoder illustrated m Fig. 3 may operate
Fig. 5 is a block diagram illustrating an MPEG decoder in accordance with the invention
DETAILED DESCRIPTION OF THE DRAWINGS
The following remarks relate to reference signs. Like entities are designated by like letter references in all the Figures Several similar entities may appear in a single Figure
In that case, a digit or a suffix is added to the letter reference in order to distinguish like entities The digit or the suffix may be omitted for convenience or it may be replaced by an asteπsk m the case where its value is not important (do not care value). This applies to the descπption as well as the claims
Fig 1 illustrate basic features for decoding data which has been vaπable-length encoded in accordance with a Huffman tree HT. A memory MEM is used in which the Huffman tree HT has been stored so that branches of the Huffman tree are represented by memory locations ML. If a memory location represents a branch that is followed by subsequent branches, the memory location contains a pointer P to memory locations representing these subsequent branches. If the memory location represents a branch that is not followed by subsequent branches, the memory location contains an end-of-code indication ECI and output-symbol data OSD A decoding processor DPR carπes out a selection step SEL and an evaluation step EVA with each data element DE in a sequence of data elements. In the selection step, the decoding processor selects a memory location on the basis of the data element and the content of the most recently selected memory location. In the evaluation step, the decoding processor checks if the memory location that has been selected contains the end- of-code indication. If so, the decoding processor provides an output symbol OS on the basis of the output-symbol data
Fig. 2 illustrates an example of a Huffman tree The Huffman tree defines a vaπable-length coding of four symbols- A, B, C and D The Huffman tree compπses nodes NO, branches BR and leaves LF There is a first, second and third-level node NO1, NO2 and NO3, respectively. There are two first, second and third-level branches BR1*, BR2*, and BR3*, respectively. A binary value, which may be zero (0) or one (1), is assigned to each branch BR. Leaves LF1, LF2, LF3 and LF4 represent symbols A, B, C and D, respectively The Huffman tree defines a code word for each symbol A, B, C and D in the following manner The first-level node NO1 is taken as a starting node From this node there is a certain path to each symbol. The code word is formed by the binary values assigned to the branches BR in the path in order of decreasing significance. For example, the path to symbol C is formed by the branches BR12, BR22 and BR31 to which the binary values 1, 1 and 0 are assigned, respectively. Consequently, the code word for symbol C is 110
Fig. 3 illustrates a decoder for decoding data which has been encoded m accordance with the Huffman tree illustrated in Fig. 2. The decoder compπses a decoding processor DPR and a memory MEM. The memory compπses several memory cells @. Each memory cell @ has a specific address. The memory cells @0, @ 1 and @2 are divided in two halves These memory cells compnse a left-half portion and a πght-half portion. Each portion contains an address. It may further contain a flag v. For example, the left-half portion of the memory cell @0 compπses the flag and the address of memory cell @ 10 The memory cells
@10, @ 11, @ 12 and @ 13 compnse the symbols A, B. C and D, respectively
The memory MEM of the decoder illustrated in Fig 3 contains the Huffman tree illustrated in Fig. 2. The Huffman tree has been stored in a particular manner. The memory cells @0, @ 1 and @2 represent the first, second and third-level branches, BR , BR2* and BRS* , respectively. The left-half portions of these memory cells represent the branches BR* 1 which have been assigned a binary zero (0) The πght-half portions represent the branches BR*2 which have been assigned a binary one (1). It a portion of a memory cell @ represents a branch BR which is connected to subsequent branches, the portion contains the address of the memory cell which represents these further branches. For example, the πght- half portion of the memory cell @0 represents branch BR12 of the Huffman tree. This branch is further connected to the branches BR21 and BR22. The memory cell @ 1 represents these branches. Therefore, the πght-half portion of the memory cell @0 contains the address of memory cell @ 1. If a portion of a memory cell @ represents a branch BR which has a leaf LF at its end, the portion contains the flag V. The portion further contains the address of the memory cell which contains the symbol that belongs to this leaf
Fig. 4 illustrates a method in accordance with which the decoder illustrated in Fig. 3 may operate. The method compπses six steps S1-S6. Steps S 1-S4 are earned out with each subsequent bit of the data to be decoded. Steps S5 and S6 are earned out only when the current bit forms the last bit of a code word. In that case, the decoder provides an output symbol.
In step SI, the decoding processor reads a memon cell @ which has been selected as the next-to-be-read memory cell duπng a senes of steps S1-S6 earned out previously RD[NXT@]. The memory cell which is read in step S 1 is either memory cell @0, @1 or @2. This will be further explained hereinafter
In step S2, the decoding processor selects input data from the memory cell @0, @1 or @2 which has been read in step SI The input data is either the left-half portion of the memory cell or the nght-half portion. The left-half portion is selected for input data when the
current bit is a bmarv zero (0) CB=0=>LH@=LD The nght-half portion is selected for input data if the current bit is a binary one (1) CB=1=>RH@=ID
In step S3, the decoding processor extracts the address contained in the input data This address defines the next-to-be-read memory cell NXT<S> = @eLD In step S4, the decoding processor checks whether the input data contains a flag V e ED 9 If so, the decoding processor carπes out steps S5 and S6 If not, the decoding processor will directly carry out step S I anew for the subsequent bit in the data to be decoded
In step S5, the decoding processor reads a memory cell which, in step S3, has been selected as the next-to-be-read memory cell RD[NXT@] This memory cell is eithei memory cell @ 10, @ 11, @ 12 or @ 13 It thus contains a symbol The symbol is outputted
In step S6, the decoding processor selects memory cell @0 as the next-to-be- read memory cell NXT@ = @0 Subsequently the decoding processor will carry out step SI anew for the subsequent bit in the data to be decoded
When the decoding processor carnes out the senes of steps S1-S6 for the first time, the current bit may not be the first bit of a code word This does not matter The effect will be that only the first decoded symbol is wrong The symbols decoded subsequently will be correct This auto-regulation feature is due to the fact that the data has been vaπable-length encoded in accordance with a Huffman tree
The decoder illustrated in Fig 3, which operates in accordance with the method illustrated in Fig 4, is an example of an implementation of the basic features illustrated in Fig 1 In this respect, the following remarks are made The memory locations ML in Fig 1 are implemented in Fig 3 in the form of the nght-half and left-half portions of the memory cel @ 1, @2 and @3 The output symbol data OSD in Fig 1 are implemented in Fig 3 in the form of addresses of the memory cells @ 10, @ 11, @ 12 and @ 13. which addresses are contained m the left-half portions of memory cells @0, @ 1, @2 and the πght-half portion of the memon cell @2, respectiveh The selection step SEL in Fig 1 is implemented in Fig 4 in the form ot steps the S 1-S3 and S6 In this respect, it is noted that the content of the most recently selected memory location in Fig 4 is either the address of memory cell @ 1 or @2, or the flag whicn constitutes the end-of-code indication In the latter case, tne decoding processor will subsequently read memory cell @0, which represents the beginning of the Huffman tree The evaluation step EVA in Fig 1 is implemented in Fig 4 in the form of the steps S4 and S5
Fig 5 illustrates an MPEG decoder in accordance with the invention The MPEG decoder provides, in response to an MPEG data stream MDS, vaπous types of decoded data, such as video data VED and audio data AUD. for example The MPEG decoder
compnses an input section INP. a vaπable-length decoder λT-D and further decoding circuitr)
FDC The vaπable-length decoder VLD compπses a memory MEM and a decoding processor
DPR The memory MEM contains vanous Huffman trees HT[1] HT[N] belonging to vanous types of data The Huffman trees are stored in a manner as explained hereinbefore with reference to Fig 1
The MPEG decoder basically operates as follows The input section INP recognizes the type of data which is currently being received For example, the input section
INP can recognize that data elements of the MPEG data stream represent a seπes of DCT coefficients or a motion vector, for example The input section INP supplies an identification signal IS to the vaπable-length decoder VLD The identification signal IS tells the vaπable- length decoder VLD, as it were, which type of data it currently receives The decoding processor DPR uses the identification signal IS to read the correct Huffman tree HT from the memory MEM More specifically, the identification signal IS determines the address at which the decoding processor DPR will start to read the memory for decoding a code word Accordingly, the vaπable-length decoder VLD supplies vaπable-length decoded data, which may vary in type, to the further decoding circuitry FDC The further decoding circuitry FDC further processes this data, which processing may include inverse quantization, discrete cosine transformation and motion compensation, for example
The Huffman trees HT[1] HT[N] contained in the memory MEM, as illustrated in Fig. 5, may have been pre-stored in a factory However, one or more Huffman trees may also have been stored after the MPEG decoder left the factory For example, a Huffman tree can be stored by means of memory-configuration data supplied to the MPEG decoder The memory-configuration data will generally compnse the data to be stored in the memory MEM and information about where this data should be stored in the form of codes, for example The memory configuration-data can be supplied to the MPEG decoder by means of a communication network like the Internet, for example
The drawings and their descπption hereinbefore illustrate rather than limit the invention It will be evident that there are numerous alternatives which fall within the scope of the appended claims In this respect, the following closing remarks are made Any type of Huffman tree can be stored in a memory in a manner as illustrated m Fig 1 The Huffman tree shown is this Figure is relatively simple The Huffman tree shown in Fig 3 is relatively simple too The reason for this is to allow a good comprehension of the invention with a descπption that is concise In practice, a Huffman tree will be more complicated For example, the Huffman tree which is used in MPEG for coding DCT
coefficients is much more complicated. Nevertheless, this Huffman can be stored in a memory in accordance with the principle illustrated in Fig. 1. The Huffman trees shown in Figs. 1 and
3 are rather specific in that with each node there is one branch which has a leaf at its end, and another branch which is followed by further branches. This by no means excludes storage of Huffman trees which do not have this specific feature.
There are various manners to store a Huffman tree in a memory. Fig. 3 illustrates only one possible implementation in which a branch is represented by a left-half or a right-half portion of a memory cell. Another possible implementation is that each branch is represented by a different memory cell. In that case, a memory cell representing a branch which is followed by further branches, should contain a pointer pointing to the memory cells that represent these further branches. The value of the current bit from the data to be decoded will then determine which one of these memory cells should be read.
There are various manners to provide an output symbol. Fig. 3 illustrates only one possible implementation in which output symbols are stored in dedicated memory cells. A memory location which represents a branch having a leaf at its end, contains the address of the memory cell containing the appropriate output symbol. Another possible implementation is to directly store an output symbol in a memory location which represents a branch having a leaf at its end. An advantage of such an implementation is that it will require one step less to provide an output symbol compared with the possibility illustrated in Fig. 3. There are numerous ways of implementing functions by means of items of hardware or software, or both. In this respect, the drawings are very diagrammatic, each representing only one possible embodiment of the invention. Thus, although a drawing shows different functions as different blocks, this by no means excludes that a single item of hardware or software carries out several functions. Nor does it exclude that a function is carried out by an assembly of items of hardware or software, or both.
For example, the decoding processor DPR illustrated in Fig. 3 can be implemented by means of a suitably programmed computer circuit. A set of instructions contained in a program memory can cause the computer circuit to effect various operations described hereinbefore with reference to Figs. 3 and 4. The set of instructions can be loaded into the program memory by reading a data carrier such as, for example, a disk that contains the set of instructions. The reading can be effected through a communication network such as, for example, the Internet. In that case, a service provider will make the set of instructions available to the public.
Any reference sign in a claim should not be construed as limiting the claim. The word "comprising" does not exclude the presence of other elements or steps than those listed in a claim. The word "a" or "an" preceding an element or step does not exclude the presence of a plurality of such elements or steps.
Claims
1. A decoder for decoding data which has been variable-length encoded in accordance with a Huffman tree (HT), characterized in that the decoder comprises: a memory (MEM) in which the Huffman tree is stored so that branches of the Huffman tree are represented by memory locations (ML); if a memory location represents a branch that is followed by subsequent branches, the memory locations contain a pointer (P) to memory locations representing these subsequent branches; if the memory location represents a branch that is not followed by subsequent branches, the memory location contains an end-of- code indication (ECI) and output-symbol data (OSD); a decoding processor (DPR) for carrying out the following steps with each data element (DE) in a sequence of data elements: a selection step (SEL) in which a memory location is selected on the basis of the data element and the content of the most recently selected memory location; and an evaluation step (EVA) in which it is checked whether the memory location that has been selected contains the end-of code indication and, if so, an output symbol (OS) is provided on the basis of the output-symbol data.
2. A method of decoding data which has been variable-length encoded in accordance with a Huffman tree (HT), characterized in that the method employs a memory in which the Huffman tree is stored so that branches (B) of the Huffman tree are represented by memory locations (ML); if a memory location represents a branch that is followed by subsequent branches, the memory location contains a pointer (P) to memory locations representing these subsequent branches; if the memory location represents a branch that is not followed by subsequent branches, the memory location contains an end-of-code indication (ECI) and output-symbol data (OSD), the method being further characterized in that the following steps are carried out with each data element (DE) in a sequence of data elements: a selection step (SEL) in which a memory location is selected on the basis of the data element and the content of the most recently selected memory location; and a evaluation step (EVA) in which it is checked whether the memory location that has been selected contains the end-of code indication and, if so, an output symbol (OS) is provided on the basis of the output-symbol data
3 A method of configuπng a decoder for decoding data which has been vaπable length encoded in accordance with a Huffman tree (HT), the method being charactenzed in that the Huffman tree (HT) is stored in a memorv so that branches of the Huffman tree are represented by memory locations (ML), if a memory location represents a branch that is followed by subsequent branches, the memory location contains a pointer (P) to memory locations (ML) representing these subsequent branches, if the memory location represents a branch that is not followed by subsequent branches, the memory location contains an end-of- code indication (ECI) and output-symbol data (OSD) for generating an output symbol (OS)
4 A method of providing memory-configuration data enabling storage of a Huffman tree (HT) in a memory so that branches of the Huffman tree are represented by memory locations (ML), if a memory location represents a branch that is followed by subsequent branches, the memory location contains a pointer (P) to memory locations (ML) representing these subsequent branches, if the memory location represents a branch that is not followed by subsequent branches, the memory location contains an end-of-code indication (ECI) and output-symbol data (OSD) for generating an output symbol (OS)
5 A computer program product for a decoder compπsmg a memory (MEM) in which a Huffman tree is stored so that branches of the Huffman tree are represented by memory locations (ML), it a memory location represents a branch that is followed by subsequent branches, the memory locations contain a pointer (P) to memory locations representing these subsequent branches, if the memory location represents a branch that is not followed by subsequent branches, the memory location contains an end-of-code indication (ECI) and output-symbol data (OSD), the computer program product compnsing a set of instructions which, when loaded into the decoder, causes the decoder to effect the following steps with each data element (DE) in a sequence of data elements a selection step (SEL) in which a memory location is selected on the basis of the data element and the content of the most recently selected memory location; and an evaluation step (EVA) in which it is checked whether the memory location that has been selected contains the end-of code indication and, if so, an output symbol (OS) is provided on the basis of the output-symbol data.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| EP00974492A EP1142128A1 (en) | 1999-10-29 | 2000-10-26 | Variable-length decoding |
Applications Claiming Priority (4)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| EP99402712 | 1999-10-29 | ||
| EP99402712 | 1999-10-29 | ||
| PCT/EP2000/010715 WO2001031794A1 (en) | 1999-10-29 | 2000-10-26 | Variable-length decoding |
| EP00974492A EP1142128A1 (en) | 1999-10-29 | 2000-10-26 | Variable-length decoding |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| EP1142128A1 true EP1142128A1 (en) | 2001-10-10 |
Family
ID=8242159
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| EP00974492A Withdrawn EP1142128A1 (en) | 1999-10-29 | 2000-10-26 | Variable-length decoding |
Country Status (6)
| Country | Link |
|---|---|
| EP (1) | EP1142128A1 (en) |
| JP (1) | JP2003513313A (en) |
| KR (1) | KR20010101330A (en) |
| CN (1) | CN1342343A (en) |
| TW (1) | TW494645B (en) |
| WO (1) | WO2001031794A1 (en) |
Families Citing this family (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US7348902B2 (en) | 2003-07-29 | 2008-03-25 | Intel Corporation | Method for efficient variable length decoding |
| KR100720684B1 (en) * | 2005-05-09 | 2007-05-21 | 이화여자대학교 산학협력단 | Huffman decoding method and decoding device using balanced binary search tree |
| TW201143306A (en) * | 2010-05-19 | 2011-12-01 | Hon Hai Prec Ind Co Ltd | Method for storing information of nodes in a huffman tree and method for decoding data using an array of the huffman tree |
| CN111884660B (en) * | 2020-07-13 | 2022-06-17 | 山东云海国创云计算装备产业创新中心有限公司 | Huffman coding equipment |
Family Cites Families (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US4475174A (en) * | 1981-09-08 | 1984-10-02 | Nippon Telegraph & Telephone Public Corporation | Decoding apparatus for codes represented by code tree |
-
2000
- 2000-10-26 EP EP00974492A patent/EP1142128A1/en not_active Withdrawn
- 2000-10-26 KR KR1020017008336A patent/KR20010101330A/en not_active Withdrawn
- 2000-10-26 CN CN00804407A patent/CN1342343A/en active Pending
- 2000-10-26 WO PCT/EP2000/010715 patent/WO2001031794A1/en not_active Ceased
- 2000-10-26 JP JP2001533634A patent/JP2003513313A/en active Pending
-
2001
- 2001-02-14 TW TW090103251A patent/TW494645B/en not_active IP Right Cessation
Non-Patent Citations (1)
| Title |
|---|
| See references of WO0131794A1 * |
Also Published As
| Publication number | Publication date |
|---|---|
| WO2001031794A1 (en) | 2001-05-03 |
| KR20010101330A (en) | 2001-11-14 |
| JP2003513313A (en) | 2003-04-08 |
| TW494645B (en) | 2002-07-11 |
| CN1342343A (en) | 2002-03-27 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US6587057B2 (en) | High performance memory efficient variable-length coding decoder | |
| Hashemian | Memory efficient and high-speed search Huffman coding | |
| US6621429B2 (en) | Huffman decoding method and decoder, huffman decoding table, method of preparing the table, and storage media | |
| US5491480A (en) | Variable length decoder using serial and parallel processing | |
| US6549148B2 (en) | Encoding and decoding apparatus using context | |
| US5136289A (en) | Dictionary searching system | |
| JPH07283739A (en) | Method and device to compress and extend data of short block | |
| US20130099947A1 (en) | Data Compression Utilizing Variable and Limited Length Codes | |
| US6975253B1 (en) | System and method for static Huffman decoding | |
| US6546053B1 (en) | System and method for decoding signal and method of generating lookup table for using in signal decoding process | |
| KR20030025273A (en) | Self-descriptive data tag | |
| US6512775B1 (en) | Method and apparatus for a programmable bitstream parser for audiovisual and generic decoding systems | |
| US20030174076A1 (en) | Huffman decoding method and apparatus | |
| US20040021593A1 (en) | Apparatus and method for decoding variable length code | |
| US8094048B2 (en) | Method of decoding syntax element in context-based adaptive binary arithmetic coding decoder and decoding device therefor | |
| US7205915B2 (en) | Method of decoding variable length prefix codes | |
| EP1142128A1 (en) | Variable-length decoding | |
| CN108880559B (en) | Data compression method, data decompression method, compression device and decompression device | |
| US7650040B2 (en) | Method, apparatus and system for data block rearrangement for LZ data compression | |
| JP3080149B2 (en) | Pattern encoding method and decoding method, and encoding apparatus and decoding apparatus using the method | |
| US6205255B1 (en) | Method and apparatus for run-length encoding of multi-colored images | |
| US6919827B2 (en) | Method and apparatus for effectively decoding Huffman code | |
| JP2003111021A (en) | Encoded image data decoding device, method and program | |
| CN115934730B (en) | Data processing method and device, medium and computer equipment | |
| JP3036868B2 (en) | Variable length decoder |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PUAI | Public reference made under article 153(3) epc to a published international application that has entered the european phase |
Free format text: ORIGINAL CODE: 0009012 |
|
| AK | Designated contracting states |
Kind code of ref document: A1 Designated state(s): AT BE CH CY DE DK ES FI FR GB GR IE IT LI LU MC NL PT SE |
|
| AX | Request for extension of the european patent |
Free format text: AL;LT;LV;MK;RO;SI |
|
| 17P | Request for examination filed |
Effective date: 20011105 |
|
| RBV | Designated contracting states (corrected) |
Designated state(s): DE ES FR GB IT |
|
| STAA | Information on the status of an ep patent application or granted ep patent |
Free format text: STATUS: THE APPLICATION HAS BEEN WITHDRAWN |
|
| 18W | Application withdrawn |
Effective date: 20050613 |