CN1043413A - Universal encode and decode method with variable length code and programmable circuit - Google Patents

Universal encode and decode method with variable length code and programmable circuit Download PDF

Info

Publication number
CN1043413A
CN1043413A CN 88109755 CN88109755A CN1043413A CN 1043413 A CN1043413 A CN 1043413A CN 88109755 CN88109755 CN 88109755 CN 88109755 A CN88109755 A CN 88109755A CN 1043413 A CN1043413 A CN 1043413A
Authority
CN
China
Prior art keywords
code
variable length
length code
length
output
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
Application number
CN 88109755
Other languages
Chinese (zh)
Other versions
CN1013631B (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.)
INST NO 30 MINISTRY OF MACHINE BUILDING AND ELECTRONICS INDUSTRY
Original Assignee
INST NO 30 MINISTRY OF MACHINE BUILDING AND ELECTRONICS INDUSTRY
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 INST NO 30 MINISTRY OF MACHINE BUILDING AND ELECTRONICS INDUSTRY filed Critical INST NO 30 MINISTRY OF MACHINE BUILDING AND ELECTRONICS INDUSTRY
Priority to CN 88109755 priority Critical patent/CN1013631B/en
Publication of CN1043413A publication Critical patent/CN1043413A/en
Publication of CN1013631B publication Critical patent/CN1013631B/en
Expired legal-status Critical Current

Links

Landscapes

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

Abstract

A kind of general coding and decoding method and programmable circuit at the variable length code of source encoding field extensive use.By in variable length code, introducing mathematic(al) structure, make that this variable length code can be with a few characteristic features parameter and simple, the algorithm of rule characterizes fully, the coding and decoding of the variable length code of the information source of different probability characteristic, only need to change a spot of characteristic parameter, utilize the simple of unification, the algorithm of rule is realized.The long very long variable length code of maximum length code can resolve into the long short variable length code of a plurality of maximum length codes under certain condition, thereby can easily realize its coding and decoding, and keeps mean code length constant.Hardware circuit is simple, and rule is able to programme.

Description

Universal encode and decode method with variable length code and programmable circuit
The present invention relates to a kind of universal encode and decode method with variable length code and programmable circuit.
Variable length code or information source entropy coding are the information preserving codings in the source encoding, are widely used in speech, image, fax, and literal is in the compressed encoding of information sources such as remotely-sensed data.German patent DE 3510-901, " Buffer circuit for re-encoding data signals " (buffer circuit of decoding data signal), DE3510-902, " circuitry for PCN encoded video data ", (circuit of PCN coding video frequency data) and DE 3632-682 " Data signals code converting circuitry " (data-signal sign indicating number change-over circuit) have related to a kind of coding and decoding method of variable length code.IEEE information theory journal 33 is rolled up the article " Data Structure of Huffman Codes and its Application to efficient Encoding and Decoding " (data structure of Huffman code and the application in effective coding and decoding) that the 1st phase 154-156 page or leaf HTANAKA delivers, and has also described a kind of coding and decoding method of variable length code.The coding and decoding method of all these variable length codes is all relevant with concrete avriable length codes and code length information or code tree structure.Therefore in the coding of variable length code and decoding, must deposit each avriable length codes and code length information or code tree structure information.This needs more memory space.Because the elongated characteristic of variable length code correctly marks off avriable length codes from code stream during decoding, during coding from the fixed length memory cell read code word then serial to send variable length code all be difficult.Above coding and decoding method has all spent more cost in this respect and has finished these work.Another important difficult problem during variable length code is used is exactly the versatility problem, no matter be Shannon code, and still fano code, Huffman code all is closely related with the statistical property of the information source that is encoded, and the variable length code that different statistical properties are found out is difference fully, and the shortage structure.Therefore these variable length codes all are not suitable for making general variable length code coding and decoding integrated circuit.Even manufacture the variable length code coding and decoding circuit that is exclusively used in certain information source statistical property, when more and/or code word size was longer when code word number, hardware size was quite huge.
More than former causing admittedly do not develop general variable length code coding and decoding integrated circuit so far, make that the user can only oneself build hardware circuit or the complicated computer program of establishment for a long time, even have to reduce the code efficiency of variable length code, adopt and be convenient to realize, at the accurate best variable length code of special source statistical property, for example Willie (Wyle) sign indicating number, linear code (A sign indicating number), logarithmic code (B sign indicating number) blocks Huffman code, revise Huffman code, segmentation correction Huffman code etc.
The objective of the invention is to develop a kind of general encode and decode method with variable length code, make it have the code efficiency that does not promptly reduce variable length code, make circuit realize variable length code coding and decoding integrated circuit simple, regular, that be fit to make general programmable again, realize having programming simply with software, memory space is little, the advantage that the number of times that on average turns round is few.
General plotting of the present invention is: introduce mathematic(al) structure in variable length code, make this variable length code to characterize fully with a spot of characteristic parameter and simple, regular algorithm institute.So just need not store code word and code length information or code tree structure information, to the information source of different statistical properties, a spot of characteristic parameter of programming utilizes the algorithm of simple rule just can realize the coding and decoding of the variable length code of various information source statistical property.
Coding and decoding method of the present invention is achieved in that
Information source
Wherein, S 0, S 1, S 2..., S M-1Be source symbol, P 0, P 1, P 2..., P M-1It is the probability of source symbol correspondence.N is the source symbol number.
Has P 0〉=P 1〉=... 〉=P M-1Information source is write as its isomorphism form:
Figure 881097551_IMG3
Claim 0,1,2 among the S ' ... N-1 is S among the S 0, S 1, S 2..., S M-1Code.
Use huffman algorithm (also can be the Shannon algorithm, fano algorithm) in these information source probability, find out the code word size of Huffman code (or Shannon code, fano code) of this information source and the code word number of each length, write as vector form: (n 1, n 2..., n j..., n L)
Wherein nj represents the code word number of code length j.Claim that this vector is the quantification source of information source S.Relational expression is arranged:
Σ j = 1 L n j = M
Come to determine quantification source (n like this 1, n 2..., n L) the avriable length codes that satisfies the prefix condition: message source code i can be write as
i = Σ k = 1 j - 1 n k + m j 0≤m j<n j(1)
If nj=0, mj=∞ then, no=0, i=0,1,2 ... N-1, its avriable length codes length is j, the decimal representation of code word is like this:
C i = Σ k = 1 j - 1 2 j - k n k + m j (2)
The variable length code of Que Dinging satisfies the condition of prefix coee like this, and it has same quantification source with the variable length code that comes out with huffman algorithm (or Shannon algorithm, fano algorithm) searching, thereby mean code length is identical.This variable length code of mathematic(al) structure of having introduced is from being short to length, code word numerical value is arranged from small to large, the code word of same code length is arranged in together continuously, compactly, the numerical value of same code length code word is constant with the difference of the numerical value of corresponding message source code, its characteristic parameter is one group of thresholding and difference, is determined by the quantification source of information source.
According to the quantification source,
Thresholding T j = Σ k = 1 j 2 j - k n k (3)
j=1,2,…,L
Difference Y j = Σ k = 1 j - 1 (2 j - k - 1)n k (4)
Regulation Y1=0 j=2,3 ..., L
The decoding algorithm of this variable length code of having introduced mathematic(al) structure is as follows:
(1) j=0, R=0, (j is the code length index, and R is a shift register),
(2) receive the code stream serial and import one in R,
(3) if j ← j+1 is R<Tj(thresholding), change (4), otherwise change (2),
(4) i=R-Yj(difference), the parallel message source code i that sends changes (1),
The encryption algorithm of this variable length code of having introduced mathematic(al) structure is as follows:
(1) j=0, parallel input message source code i,
(2)j←j+1,R=i+Yj,
(3), otherwise change (2) if R<Tj changes (4),
(4) the j position of output R,
(5)j←j-1,
(6), otherwise change (4) if j=0 changes (1).
The decoding algorithm and the encryption algorithm of this variable length code of having introduced mathematic(al) structure are all simple and regular, are fit to hardware circuit and realize, also are fit to software programming.Make a small amount of rewritable memory and be used to store characteristic parameter in circuit, promptly thresholding and difference just can be made general programmable coding circuit and the decoding circuit of having introduced the variable length code of mathematic(al) structure.
The long N of maximum length code greater than the introducing of L the variable length code of mathematic(al) structure, when satisfying condition
Σ K = 1 L 2 -k n k ≥0.5 (5)
The time, can resolve into a maximum length code length smaller or equal to the introducing of L the variable length code of mathematic(al) structure and maximum length code length variable length code less than the introducing mathematic(al) structure of N.If do not satisfy condition 5, can increase L and make it satisfied.Second maximum length code of having introduced the variable length code of mathematic(al) structure grown less than N, also can do decomposition again to it.Like this, the long very long introducing of maximum length code the variable length code of mathematic(al) structure just can be with the variable length code coder realization coding and decoding of the long weak point of a plurality of maximum length codes.The decomposition of this variable length code is not carried out concrete code word, need only carry out the quantification source.
Quantification source (n 1, n 2..., n N), N>L, satisfy following two conditions:
1 - 2 -j <= Σ K = 1 L 2 -k n k <1 - 2 - j- 1 1≤j≤L(6)
Σ k = 1 j′ 2 -k n k <=1 - 2 -j Σ k = 1 j ′ + 1 2 -k n k (7)
j≤j′≤L
Just can resolve into two quantification sources:
(n 1,n 2,…,n j+1,n j+1,…,n j′,r′ j′+1) (8)
(8) r in the formula weight source ' J '+1Determine by following formula:
Figure 881097551_IMG5
j+1≤j′<L
j′=L (10)
(9) each amount is respectively in the formula weight source:
r k=n k+jk=j′+2-j,…,N-j (11)
(8) the maximum length code length in the quantification source of formula is r ' J '+1Since when j '=L, r ' J '+1=0So the maximum length code length in (8) formula weight source is smaller or equal to L.(9) the maximum length code length in the quantification source of formula is to reduce through the maximum length code in the quantification source after decomposing is long, can also continue further decomposition is done in the quantification source of (9) formula, and the maximum length code in the quantification source after decomposing is long all smaller or equal to L.When coding and decoding, (8) formula weight source is undertaken by the coding and decoding method of narrating previously, and there was the prefix code of a code length j who is compiled out by the coder in (8) formula weight source in (9) formula weight source before coding and decoding.Coding and decoding after decomposing like this forms cordwood working method, and does not reduce the code efficiency that this has introduced the variable length code of mathematic(al) structure at all.
As one of means of the coding and decoding method of implementing the present invention relates to, Fig. 1 and Fig. 2 have provided general programmable variable length code decoding circuit and general programmable variable length coding circuit respectively.
In the decoding circuit of Fig. 1, serial avriable length codes code stream 9 is under the effect of the control signal 10 that is produced by control impuls generator 6, serial enters shift register 5, the thresholding of 5 content and memory 3 outputs compares at comparator 2, and control impuls generator 6 is given in 2 state output.When a complete code was received in the indication of 2 states, 6 produced a control impuls, and the difference content of content 5 and memory 4 outputs is subtracted each other at subtracter 1, and the parallel isometric message source code that translates of sending arrives data/address bus 11.
In the coding circuit of Fig. 2, the difference of isometric message source code of sending into by data/address bus 11 and memory 4 outputs after adder 1 addition, with the thresholding of memory 3 outputs at comparator 2 relatively, control impuls generator 6 is given in 2 state output.When an avriable length codes was compiled out in the indication of 2 state, 6 produce one squeezed into pulse, and shift register 5 is squeezed in 1 output, and 5 content is moved to left, and the avriable length codes of compiling out is exported serially.
The thresholding and the difference content of the memory 3,4 among Fig. 1, Fig. 2 were sent into by data/address bus 11 before work decoding.Address signal 12, chip selection signal 13, and read-write 14, internal work clock signal 15 is all provided by the outside.Decoding end signal or end-of-encode signal 16 are exported to external circuit.
After decompose in the long very long quantification source of maximum length code, its coding and decoding can realize with the variable length code compiler of the long short introducing mathematic(al) structure of a plurality of maximum length codes, also can in the variable length code coder of the long short introducing mathematic(al) structure of a maximum length code, increase K group thresholding and difference, thereby the coding and decoding of the variable length code in K quantification source after realizing decomposing with such coder is controlled the selection of thresholding and difference group by address signal.
The present invention compared with the prior art, its major advantage is:
1. The variable length code of the introducing mathematic(al) structure that the present invention proposes is by introducing mathematic(al) structure in variable length code, having broken away from the coding and decoding of best variable length code for a long time all needs to store the constraint of concrete code word and code length information or code tree structure information, has kept again code efficiency and the prefix coee condition of best variable length code simultaneously. Make this variable length code of having introduced mathematic(al) structure can be with a small amount of characteristic parameter and simple, the algorithm Complete Characterization of rule.
2, variable length code and the information source of introducing mathematic(al) structure are only set up complete by the quantizing of information source source Contact. The quantizing of information source source can be obtained according to the statistical property of information source by huffman algorithm or Shannon algorithm or fano algorithm. The quantification source that huffman algorithm is obtained has the shortest characteristic of mean code length, but each code word size with calculate relevantly with whole Making by Probability Sets, quantize obtaining of source and be one than complex calculations. Though the quantification source that the quantification source that the Shannon algorithm is obtained does not have huffman algorithm to obtain is so effective, its advantage is directly to obtain the code length of message source code i from probability P i. The variable length code of introducing mathematic(al) structure can utilize respectively the advantage of these two algorithms.
3, the variable length code of introducing mathematic(al) structure has by code length to be arranged from small to large from the numerical value that is short to long code word, and the code word continuous and compact ground of same code length is arranged in together, and the difference of the numerical value of the code word numerical value of code length and corresponding message source code is the characteristic of constant equally. Utilize these characteristics, the coding and decoding of the variable length code of the introducing mathematic(al) structure of various information source statistical property only needs to change a small amount of thresholding and a small amount of difference, simple, the regular encoding and decoding algorithm that recycling is unified and realizing. Has very strong versatility so that introduce the coding and decoding of the variable length code of mathematic(al) structure.
4, the variable length code of the long very long introducing mathematic(al) structure of maximum length code, can resolve into the long short variable length code of a plurality of maximum length codes under certain condition, thereby availablely a plurality ofly realize the coding and decoding of the variable length code of the introducing mathematic(al) structure that very long code is long than the long coder of short code or coder that have many group thresholdings and difference, and Not a hair of one's head shall be touched loses code efficiency. This decomposition only needs the quantification source is carried out. This just allows the variable length code coding and decoding integrated circuit of the long short introducing mathematic(al) structure of a large amount of making maximum length codes and can store the coding and decoding integrated circuit than short code length of many stack features parameter. Since this decomposability, many variable length codes of thinking that in the past realization is very difficult, and for example code word number is a lot of and/or the very long variable length code of code length can be realized.
5, introducing the coding﹠decoding algorithm of the variable length code of mathematic(al) structure, all is simple, and the operation of rule is only used addition, comparison, counting and shift operation. Therefore, the coding﹠decoding of introducing the variable length code of mathematic(al) structure is fit to hardware to be realized and software programming, is particularly suitable for manufacturing of general programmable variable length code coding and decoding integrated circuit. According to different quantizing of information source sources, different thresholdings and difference are sent in programming, realize the variable length code coding and decoding of the introducing mathematic(al) structure of various information source statistical property. In the time dependent application of information source statistical property, according to the information source statistics that changes Thresholding in the characteristic changing coder and difference just can be carried out the best coding and decoding of introducing the variable length code of mathematic(al) structure adaptively.
6, the complexity of the coding﹠decoding circuit of the variable length code of introducing mathematic(al) structure is directly proportional with the long L of maximum length code; The complexity change of the variable length code coding and decoding circuit of prior art is directly proportional with maximum codeword number N. With regard to the coding and decoding that is exclusively used in certain variable length code of determining information source, when code word number was less, the variable length code coding and decoding circuit of prior art was simpler; But when code word number was more, the coding and decoding circuit complexity of the variable length code of introducing mathematic(al) structure was littler.
Need to spell out, as long as follow the coding and decoding method that the present invention relates to, also can design other variable length code coding and decoding circuit.
The coding and decoding method that the present invention relates to also can be realized by preparing a computer program.

Claims (8)

1, a kind of coding and decoding method of variable length code, it is characterized in that in variable length code, introducing mathematic(al) structure, make this variable length code to characterize fully with a spot of characteristic parameter and simple, regular algorithm institute, mathematic(al) structure in the variable length code is the quantification source (n1 by the information source that is encoded, n2 ... nj ... nL) (wherein nj represents the code word number of code length j) introduce, this mathematic(al) structure be between the avriable length codes and avriable length codes and message source code between numerical relation, and satisfy the condition of prefix coee.
2, in accordance with the method for claim 1, it is characterized in that this variable length code of mathematic(al) structure of having introduced is from being short to length, code word numerical value is arranged from small to large, the code word of same code length is arranged in together continuously, compactly, the numerical value of same code length code word is constant with the difference of the numerical value of corresponding message source code, its characteristic parameter is one group of thresholding and difference, is determined by the quantification source of information source.
3, according to the method for claim 1 or 2, it is characterized in that obtaining after thresholding and the difference, decoding and encryption algorithm with variable length code of mathematic(al) structure are respectively:
Decode procedure:
(1) j=0, R=0, (j is the code length index, and R is a shift register),
(2) receive the code stream serial and import one in R,
(3) if j ← j+1 is R<Tj(thresholding), change (4), otherwise change (2),
(4) i=R-Yj(difference), the parallel message source code i that sends changes (1),
Cataloged procedure:
(1) j=0, parallel input message source code i,
(2)j←i+1,R=i+Yj,
(3), otherwise change (2) if R, Tj change (4),
(4) the j position of output R,
(5)j←j-1,
(6), otherwise change (4) if j=0 changes (1).
4,, it is characterized in that a maximum length code length equals the variable length code of the introducing mathematic(al) structure of N(N>L), when satisfying condition according to the method for claim 1 or 2
Σ K = 1 L 2 -k n k ≥0.5
The time, then can resolve into a maximum length code length smaller or equal to the variable length code of L and maximum length code length variable length code less than N, this decomposition also can continue, thereby the long short variable length code coder of available a plurality of maximum length code or the long short variable length code coder of the maximum length code that can store many group thresholdings and difference realize that maximum length code length equals the coding and decoding of the variable length code of N, and keeping mean code length constant, this decomposition is only carried out information source quantification source.
5, a kind of variable length code decoding circuit, it is characterized in that by subtracter (1), comparator (2), thresholding memory (3), difference memory (4), shift register (5) and pulse generator (6) are formed, receive the code stream serial and enter (5), the output of the output of (5) and (3) compares in (2), and the output control (6) of (2) produces control impuls, its result and line output are subtracted each other in the output of the output of (5) and (4) in (1).
6,, it is characterized in that on thresholding memory (3) and the difference memory (4) programming data line and read-write control line being arranged according to the described variable length coding circuit of claim 5.
7, a kind of coding circuit of variable length code, it is characterized in that by adder (1), comparator (2), thresholding memory (3), difference memory (4), shift register (5) and pulse generator (6) are formed, the isometric message source code of parallel input and the output of (4) are in (1) addition, and the output of the output of (1) and (3) is compared in (2), and the output control (6) of (2) produces control impuls, (5) are sent in the output of (1), by (5) serial output avriable length codes.
8,, it is characterized in that on thresholding memory (3) and difference memory (4), programming data line and read-write control line being arranged according to the described variable length coding circuit of claim 7.
CN 88109755 1988-12-17 1988-12-17 Universal encode and decode method with variable length code and programmable circuit Expired CN1013631B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 88109755 CN1013631B (en) 1988-12-17 1988-12-17 Universal encode and decode method with variable length code and programmable circuit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 88109755 CN1013631B (en) 1988-12-17 1988-12-17 Universal encode and decode method with variable length code and programmable circuit

Publications (2)

Publication Number Publication Date
CN1043413A true CN1043413A (en) 1990-06-27
CN1013631B CN1013631B (en) 1991-08-21

Family

ID=4835470

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 88109755 Expired CN1013631B (en) 1988-12-17 1988-12-17 Universal encode and decode method with variable length code and programmable circuit

Country Status (1)

Country Link
CN (1) CN1013631B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1098565C (en) * 1996-06-07 2003-01-08 大宇电子株式会社 Method and apparatus for decoding variable length code
CN102938685A (en) * 2012-11-15 2013-02-20 大连理工大学 Wireless sensor network data compression method based on variable-length encoding

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1098565C (en) * 1996-06-07 2003-01-08 大宇电子株式会社 Method and apparatus for decoding variable length code
CN102938685A (en) * 2012-11-15 2013-02-20 大连理工大学 Wireless sensor network data compression method based on variable-length encoding

Also Published As

Publication number Publication date
CN1013631B (en) 1991-08-21

Similar Documents

Publication Publication Date Title
CN1183683C (en) Position adaptive coding method using prefix prediction
JP6909265B2 (en) Audio / Video Sample Vector Pyramid Vector Quantization Indexing and Deindexing Methods and Devices
CN1139188C (en) Compression of palettized images and binarization for bitwise coding of M-ary alphabets therefor
US5045852A (en) Dynamic model selection during data compression
US6100825A (en) Cluster-based data compression system and method
CN103067022B (en) A kind of integer data lossless compression method, decompression method and device
KR101353170B1 (en) Encoder and decoder using arithmetic stage to compress code space that is not fully utilized
CN107483059B (en) Multi-channel data coding and decoding method and device based on dynamic Huffman tree
CN1064773C (en) Method and apparatus for encoding digital signals, method and apparatus for decoding the coded signals, and medium for recording the coded signals
CN1359196A (en) Quick joint image expert group Huffman coding and decoding method
WO2006070925A1 (en) Device and data method for selective compression and decompression and data format for compressed data
CN1085461C (en) Data coding device and digital code decoding device
CN108259911A (en) A kind of OLED screen Demura lossless date-compress, decompression method
CN1254921C (en) Improved huffman decoding method and device
CN111510156A (en) Method for dynamically compressing and decompressing large file based on segmentation
CN1737791A (en) Data compression method by finite exhaustive optimization
CN1650625A (en) Adaptive method and system for mapping parameter values to codeword indexes
CN101266796A (en) A quantified coding method and device
CN1043413A (en) Universal encode and decode method with variable length code and programmable circuit
CN116737716A (en) Time sequence data compression method and device
CN101980464B (en) Data coding method, decoding method, coder and decoder
Jalumuri A study of scanning paths for BWT-based image compression
CN1098565C (en) Method and apparatus for decoding variable length code
WO2021139796A1 (en) Method for constructing morton codes, encoder, decoder, and storage medium
CN111294055B (en) Coding and decoding method for data compression based on adaptive dictionary

Legal Events

Date Code Title Description
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C06 Publication
PB01 Publication
C13 Decision
GR02 Examined patent application
C14 Grant of patent or utility model
GR01 Patent grant
C19 Lapse of patent right due to non-payment of the annual fee
CF01 Termination of patent right due to non-payment of annual fee