CN101022554A - Variable-length code decoding method based on zero-prefix code - Google Patents

Variable-length code decoding method based on zero-prefix code Download PDF

Info

Publication number
CN101022554A
CN101022554A CN 200710064445 CN200710064445A CN101022554A CN 101022554 A CN101022554 A CN 101022554A CN 200710064445 CN200710064445 CN 200710064445 CN 200710064445 A CN200710064445 A CN 200710064445A CN 101022554 A CN101022554 A CN 101022554A
Authority
CN
China
Prior art keywords
node
code
bit
child node
child
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN 200710064445
Other languages
Chinese (zh)
Other versions
CN100527847C (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.)
Tsinghua University
Original Assignee
Tsinghua University
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 Tsinghua University filed Critical Tsinghua University
Priority to CN 200710064445 priority Critical patent/CN100527847C/en
Publication of CN101022554A publication Critical patent/CN101022554A/en
Application granted granted Critical
Publication of CN100527847C publication Critical patent/CN100527847C/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

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

Abstract

本发明涉及基于零前缀码的变长码解码方法,属于数字视频编解码技术领域。该方法包括:生成多个基于0前缀码的多叉树,根据该多叉树对码流进行变长码解码;该树的结构包括:由一个根节点及其多级节点构成的0前缀码字比特序列,根节点只记录其子节点的个数,其它各级节点还记录所述码字序列的比特位,每个节点最多存在4个子节点,如果该节点的子节点个数为0,该节点为叶子节点,叶子节点同时记录和码字对应的语法元素值。本发明具有较高的效率,能够满足在实时编解码系统中的应用。

The invention relates to a variable-length code decoding method based on a zero-prefix code, and belongs to the technical field of digital video coding and decoding. The method includes: generating a plurality of multi-fork trees based on 0-prefix codes, and performing variable-length code decoding on the code stream according to the multi-fork trees; the structure of the tree includes: a 0-prefix code composed of a root node and its multi-level nodes word bit sequence, the root node only records the number of its child nodes, and other nodes at all levels also record the bits of the code word sequence, each node has a maximum of 4 child nodes, if the number of child nodes of this node is 0, This node is a leaf node, and the leaf node simultaneously records the value of the syntax element corresponding to the codeword. The invention has higher efficiency and can meet the application in real-time codec system.

Description

Decoding length changeable code method based on zero prefix code
Technical field
The invention belongs to the digital video decoding technical field, specifically, is the method for decoding about the CAVLC form that H.264/AVC quick reference stipulates in the standard.
Background technology
H.264/AVC be digital video coding standard of new generation, the cooperative development group (JVT) that it organizes ISO to form by International Telecommunication Association (ITU) and mpeg standard is developed jointly.H.264/AVC as the video technique standard, can be adapted to the every field of Video Applications, comprise the wireless application of low code check, Internet video is used, and the TV broadcast applications of high definition and DVD use.
H.264/AVC with former coding standard H.263, MPEG-4 is similar, it all is the hybrid coding pattern that adopts based on predictive transformation, the advantage of the standard before having absorbed simultaneously, on coding efficiency more H.263, MPEG-4 is enhanced, and can save 40% code check under the situation of equal quality.H.264/AVC code stream is divided into two levels, the video coding layer (VideoCoding Layer, VLC) and network abstract layer (Network Abstract Layer, NAL).Core data after video coding layer essential record compressed video content, the network abstract layer essential record is described the information of particular network environment, divides by such level, helps the encapsulation and the transmission control of data in network of video data.
H.264/AVC cataloged procedure mainly is divided into following components:
(1) infra-frame prediction is to eliminate spatial redundancies;
(2) carry out inter prediction by motion search, to eliminate temporal redundancy;
(3) residual block that the difference between original picture block and the prediction piece is formed carries out transform and quantization;
(4) the coefficient residual error that obtains after quantizing is reset and entropy coding.
Decode procedure mainly is divided into following components:
(1) entropy decoding is reset decoded coefficient;
(2) coefficient after resetting is carried out inverse quantization and inverse transformation;
(3) obtain predicting piece by infra-frame prediction or inter prediction;
(4) obtain decoded picture by prediction piece and residual block.
In H.264/AVC encoding, entropy coding is divided into two kinds: the binary arithmetic coding (CABAC) of variable length code of context-adaptive (CAVLC is called for short variable length code) and context-adaptive.The CAVLC entropy coding is a kind of Variable Length Code, Variable Length Code is the probability that utilizes different syntactic elements to occur in code stream, utilize the code word of different bit lengths that syntactic element is encoded, the code word that the syntactic element that probability of occurrence is high is lacked corresponding to bit length, the code word that the syntactic element that probability is lower is grown corresponding to bit length.In the process of coding, the form by code table is writing down the pairing code word of different syntax element information.Because in different frame of video, the probability distribution of syntax element information is inequality, adopt unified code table can not reach very high compression efficiency, in CAVLC entropy coding process, the information of the syntactic element of the image block correspondence of the vicinity that employing has been encoded is adjusted the code table of coding institute reference dynamically, make the probability distribution of code word in the selected code table of coding more approaching, to reach higher compression efficiency with the probability distribution of actual syntax element information.Adopt the CAVLC coding that the coefficient residual error is H.264/AVC carried out entropy coding, need the syntactic element of coding that TotalCoeff (number of non-0 coefficient in the retracing sequence) is arranged, TrailingOnes (retracing sequence end 1 or-1 number), total_zeros (number of last non-0 coefficient preceding 0 in the retracing sequence), run_before (number of each non-0 coefficient preceding 0 in the retracing sequence).The syntactic element correspondence of each different code tables, but TotalCoeff and TrailingOnes are the modes that adopts assembly coding, by to the syntactic element combined coding of two couplings and be merged into a code word to improve compression efficiency, because be incorporated in the code word behind two kinds of syntax element information codings, corresponding code table length increases when just encoding than a syntactic element to some extent.
In decode procedure, obtain the value of concrete syntactic element for the code word from code stream, need from the code stream memory, read the code word of equal length according to the length of the code word that occurs in the code table, mate with the code word in the code table then, if coupling is unsuccessful, then switch to the next code word that occurs in the code table, carry out identical operations.Adopting decodes in such a way needs frequent visit code stream memory, and can find correct code word after needing under the poorest situation whole code table traveled through, and finishes decode procedure.This processing method inefficiency is unsuitable for being applied in the real-time coding/decoding system.
Summary of the invention
The objective of the invention is for overcoming the weak point of prior art, propose a kind of decoding length changeable code method based on zero prefix code, the present invention generates multiway tree according to the CAVLC code table.Be the form of conversion CAVLC code table, this method,, is decoded with reference to the CAVCL code table to residual block for the user provides in meeting the code stream of prescribed by standard H.264/AVC in the application of the system that real-time is had relatively high expectations towards H.264/AVC; This method has higher efficient, can satisfy the application in the real time codec system.
The decoding length changeable code method based on zero prefix code that the present invention proposes is characterized in that this method comprises: generate a plurality of multiway trees based on 0 prefix code, according to this multiway tree code stream is carried out decoding length changeable code;
The structure of described multiway tree based on 0 prefix code comprises: by the 0 prefix code word bit sequence that a root node and multistage node thereof constitute, downstream site is the child node of its superior node; Wherein, root node only writes down the number of its child node, other nodes at different levels are except that the number of its child node of record, also write down the bit of described codeword sequence, the bit of described child node record is the bit of its superior node record and follow-up bit, there are at most 4 child nodes in each node, and each child node writes down the bit of the 0-3 0 of follow-up non-zero bit position and preceding 0 respectively; If the child node number of this node is 0, this node is a leaf node, and leaf node writes down the syntax element value with the code word correspondence simultaneously.
Principle of the present invention:
The present invention is based on the principle of Variable Length Code.Because what coded system was carried out is Variable Length Code, not having a code word in same code table row is the prefix of another code word, the CAVLC code table is converted to tree represents.Because in the CAVLC code table, the code word intermediate value is that 0 bit occupies bigger ratio, adopts 0 prefix trees to come CAVLC is changed, and can improve whole decoding efficiency.
The present invention has following characteristics:
1. because code word is stored by tree structure, only need read bitstream data in order, reduce visit memory.
2. only need visit corresponding multiway tree when decoding, needn't search for, improve decoding efficiency code table.
3. can corresponding a plurality of bits based on node in the multiway tree of 0 prefix code, for most code word, can travel through less node, just find corresponding syntax element information.
The present invention is applied in the real-time system, can decoder simplification, improve processing speed.
Description of drawings
Fig. 1 is the node structure of the multiway tree based on 0 prefix code of the present invention.
Fig. 2 is the CAVLC code table of syntactic element total_zeros institute reference in the present embodiment decoding.
The multiway tree structure that Fig. 3 is generated according to the CAVLC code table for present embodiment based on 0 prefix code.
Embodiment
The present invention will be described in detail below in conjunction with drawings and Examples.
The decoding length changeable code method based on zero prefix code that the present invention proposes is characterized in that this method comprises: generate a plurality of multiway trees based on 0 prefix code, according to this multiway tree code stream is carried out decoding length changeable code; Wherein, the structure based on the multiway tree of 0 prefix code comprises: by the 0 prefix code word bit sequence that a root node and multistage node thereof constitute, downstream site is the child node of its superior node; Wherein, root node only writes down the number of its child node, other nodes at different levels are except that the number of its child node of record, also write down the bit of described codeword sequence, the bit of described child node record is the bit of its superior node record and follow-up bit, there are at most 4 child nodes in each node, and each child node writes down the bit of the 0-3 0 of follow-up non-zero bit position and preceding 0 respectively; If the child node number of this node is 0, this node is leaf node (representing that then code word finishes), and leaf node writes down the syntax element value with the code word correspondence simultaneously.
The content of a node in this multiway tree as shown in Figure 1, comprises its child node number, child node pointer or syntax element value (if leaf node does not then have the child node pointer, if not leaf node, then not having syntax element value);
Above-mentioned multiway tree based on 0 prefix code is to utilize the code table of defined in the standard H.264/AVC to generate, its concrete generation method comprises: at first multiway tree is carried out initialization (promptly be initialized as and only contain the tree that a child node number is 0 root node), and variable E is set, its value is 1 or 0; Utilize this tree to generate multiway tree again, specifically may further comprise the steps based on 0 prefix code:
1) root node of putting tree is a present node, reads a code word in the code table, and first bit that bit pointer P points to code word is set, and finishes then to forward 5 to as code table);
2) N bit of this code word read in the position of pointer P indication, up to the bit place value that reads be 1 or N=3 or code word finish, moving hand P to the next one will read bit, and judge whether pointer P has arrived the end of code word, if code word finishes, then variable E puts 1, otherwise puts 0; If have 1 in the bit bit string that reads, then forward 3 to); If do not have 1 in the bit bit string that reads, then forward 4 to);
3) whether N child node judging present node exists, and as not existing, then sets up corresponding child node, whether the byte point number of judging present node is less than N, as less than N, the child node number of then revising present node is N, and mobile present node is to its N child node.If E=1, it is leaf node that present node then is set, and will be stored in this node deserved video grammar element information, finishes the conversion of current code word, forwards 1 to); If E=0 then forwards 2 to);
4) whether N+1 child node of disconnected present node exists, and as not existing, then sets up mutually deserved child node, whether the child node number of judging present node is less than N+1, as less than N+1, the child node number of then revising present node is N+1, and mobile present node is to its N+1 child node.If then present node is set is leaf node, and will be stored in this node, finish the conversion of current code word, forward 1 to) deserved video grammar element information; If E=0 then forwards 2 to).
5) structure based on the multiway tree of 0 prefix code finishes.
After finishing based on the multiway tree of 0 prefix code structure, in the decode procedure afterwards, just do not need to decode with reference to the code table in the standard H.264/AVC, only needing with reference to the multiway tree based on 0 prefix code be decodable code, can avoid the matching process of complexity like this.
The multiway tree based on 0 prefix code according to above-mentioned generation carries out decoding length changeable code to code stream, specifically may further comprise the steps:
1) root node that described multiway tree is set is a present node, bit pointer P is set points to the next code stream bit that will read, if code stream finishes, then forwards 6 to);
2) get the son node number N of present node, make N=N-1, child node counting K is set, and K=0;
3) the fruit code stream finishes, and then represents the code stream mistake, forwards 6 to); Otherwise, read the code stream bit that this pointer P points to, make K=K+1, pointer P move on to the next one will read bit, if the code stream bit value that reads is 1, then forward 4 to); If value is 0, then forward 5 to);
4) K the child node that present node is set is present node, judges whether present node is leaf node, if then read the video grammar element information that is stored in this node, and forward 1 to); If not leaf node, then forward 2 to);
5) make N=N-1,, and forward 4 to) if N=0 then makes K=K+1; Otherwise forward 3 to);
6) decoding of the current code stream of end.
So just finished with reference to based on the decoding of the multiway tree of 0 prefix code H.264/AVC residual block code stream.
By the following examples a kind of multiway tree coding/decoding method based on 0 prefix code according to the CAVLC code table proposed by the invention is elaborated.
The multiway tree based on 0 prefix code that present embodiment adopts adopts the son node number that this node is stored in the territory in each node, the span of child node is 0-4, wherein 0 represents leaf node.
Fig. 2 is the CAVLC code table of syntactic element total_zeros (number of last non-0 coefficient preceding 0 in the retracing sequence) institute's reference in the present embodiment decoding, wherein the value of the syntactic element total_zeros that decoding obtains is shown in code table first tabulation, the code word that may exist in the code stream is shown in eight tabulations of the secondary series to the of code table, with the syntax element value correspondence in the code word in the delegation and this row first row, the different TotalCoeff that obtains according to decoding (number of non-0 coefficient in the retracing sequence) value is chosen code word and is decoded from different row.
Present embodiment is listed as the multiway tree based on 0 prefix code that is converted to first of CAVLC code table among Fig. 2, as shown in Figure 3.Comprise a root node and level Four node among the figure, wherein, the node of the superiors is represented root node, and wherein writing down its child node is 4.The child node of a node of every grade (if exist) is followed successively by first child node of this node, second child node, the 3rd child node and the 4th child node by order from left to right.The Bit String on each node next door is represented one section bit bit string in certain code word of this nodes records, and the Bit String on leaf node next door is corresponding to one of its record complete code word.Present embodiment is that 000011 code word is decoded to one section bit stream, be with reference among Fig. 3 based on appropriate section in the multiway tree of 0 prefix code, as shown in Figure 3.Its coding/decoding method comprises: read the child node number in the root node, value is 4, reads bit stream, because front three all void value is 1 bit, subtract a bit so read son node number, i.e. 3 bits, and present node is moved to the 4th child node of root node; Read the child node number in the present node, value is 4, reads bit stream, because second for value is 1 bit, thus read 2 bits, and the 2nd child node that present node is set is present node; Read the child node number in the present node, value is 4, reads bit stream, because first for value is 1 bit, thus only read 1 bit, and the 1st child node that present node is set is present node; Read the child node number in the present node, value is 0, so this codeword decoding finishes, obtaining the total_zeros value is 7.
This code word is with reference in the process of decoding based on the multiway tree of 0 prefix code, only traveled through the part that a brace in this multiway tree has 3 progression nodes.As seen, adopt method of the present invention can obtain code word faster to deserved syntax element information.

Claims (3)

1, a kind of decoding length changeable code method based on zero prefix code is characterized in that this method comprises: generate a plurality of multiway trees based on 0 prefix code, according to this multiway tree code stream is carried out decoding length changeable code;
The structure of described multiway tree based on 0 prefix code comprises: by the 0 prefix code word bit sequence that a root node and multistage node thereof constitute, downstream site is the child node of its superior node; Wherein, root node only writes down the number of its child node, other nodes at different levels are except that the number of its child node of record, also write down the bit of described codeword sequence, the bit of described child node record is the bit of its superior node record and follow-up bit, there are at most 4 child nodes in each node, and each child node writes down the bit of the 0-3 0 of follow-up non-zero bit position and preceding 0 respectively; If the child node number of this node is 0, this node is a leaf node, and leaf node writes down the syntax element value with the code word correspondence simultaneously.
2, the method for claim 1, it is characterized in that the generation method of described multiway tree based on 0 prefix code, this method at first are initialized as multiway tree and only contain the initialization tree that a child node number is 0 root node, and variable E is set, its value is 1 or 0; Utilize this initialization to set the multiway tree that generates based on 0 prefix code again, specifically may further comprise the steps:
1) root node that tree is set is a present node, reads a code word in the code table, and first bit that bit pointer P points to code word is set, and finishes then to forward 5 to as code table);
2) read N bit of this code word from the position of pointer P indication, up to the bit place value that reads be 1 or N=3 or code word finish, moving hand P to the next one will read bit, and judge whether pointer P has arrived the end of code word, if code word finishes, then variable E puts 1, otherwise puts 0; If have 1 in the bit bit string that reads, then forward 3 to); If do not have 1 in the bit bit string that reads, then forward 4 to);
3) whether N child node judging present node exists, and as not existing, then sets up corresponding child node, whether the byte point number of judging present node is less than N, as less than N, the child node number of then revising present node is N, and mobile present node is to its N child node.If E=1, it is leaf node that present node then is set, and will be stored in this node deserved video grammar element information, finishes the conversion of current code word, forwards 1 to); If E=0 then forwards 2 to);
4) whether N+1 child node judging present node exists, and as not existing, then sets up mutually deserved child node, whether the child node number of judging present node is less than N+1, as less than N+1, the child node number of then revising present node is N+1, and mobile present node is to its N+1 child node.If then present node is set is leaf node, and will be stored in this node, finish the conversion of current code word, forward 1 to) deserved video grammar element information; If E=0 then forwards 2 to);
5) structure based on the multiway tree of 0 prefix code finishes.
3, the method for claim 1 is characterized in that, the described multiway tree based on 0 prefix code according to generation carries out decoding length changeable code to code stream, specifically may further comprise the steps:
1) root node that described multiway tree is set is a present node, bit pointer P is set points to the next code stream bit that will read, if code stream finishes, then forwards 6 to);
2) read the son node number N of present node, make N=N-1, child node counting K is set, and K=0;
3) if code stream finishes, then represent the code stream mistake, forward 6 to); Otherwise, read the code stream bit that this pointer P points to, make K=K+1, pointer P move on to the next one will read bit, if the code stream bit value that reads is 1, then forward 4 to); If value is 0, then forward 5 to);
4) K the child node that present node is set is present node, judges whether present node is leaf node, if then read the video grammar element information that is stored in this node, and forward 1 to); If not leaf node, then forward 2 to);
5) make N=N-1,, and forward 4 to) if N=0 then makes K=K+1; Otherwise forward 3 to);
Finish the decoding of current code stream.
CN 200710064445 2007-03-16 2007-03-16 Variable-length code decoding method based on zero-prefix code Expired - Fee Related CN100527847C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 200710064445 CN100527847C (en) 2007-03-16 2007-03-16 Variable-length code decoding method based on zero-prefix code

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 200710064445 CN100527847C (en) 2007-03-16 2007-03-16 Variable-length code decoding method based on zero-prefix code

Publications (2)

Publication Number Publication Date
CN101022554A true CN101022554A (en) 2007-08-22
CN100527847C CN100527847C (en) 2009-08-12

Family

ID=38710183

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 200710064445 Expired - Fee Related CN100527847C (en) 2007-03-16 2007-03-16 Variable-length code decoding method based on zero-prefix code

Country Status (1)

Country Link
CN (1) CN100527847C (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102473315A (en) * 2009-08-20 2012-05-23 汤姆森特许公司 Method and apparatus for reusing tree structures to encode and decode binary sets
CN104579567A (en) * 2015-01-08 2015-04-29 无锡清华信息科学与技术国家实验室物联网技术中心 Method and device for coding reverse path
CN104661038A (en) * 2009-12-10 2015-05-27 Sk电信有限公司 Decoding apparatus using a tree structure

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1397869B1 (en) * 2001-05-22 2006-11-02 Koninklijke Philips Electronics N.V. Method of decoding a variable-length codeword sequence
CN1331360C (en) * 2004-02-24 2007-08-08 上海交通大学 Method for decoding codes in variable lengths
CN1780398A (en) * 2004-11-18 2006-05-31 上海乐金广电电子有限公司 CAVLC decoding method

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102473315A (en) * 2009-08-20 2012-05-23 汤姆森特许公司 Method and apparatus for reusing tree structures to encode and decode binary sets
CN104661038A (en) * 2009-12-10 2015-05-27 Sk电信有限公司 Decoding apparatus using a tree structure
CN104661038B (en) * 2009-12-10 2018-01-05 Sk电信有限公司 Use the decoding apparatus of tree structure
CN104579567A (en) * 2015-01-08 2015-04-29 无锡清华信息科学与技术国家实验室物联网技术中心 Method and device for coding reverse path
CN104579567B (en) * 2015-01-08 2018-10-12 无锡清华信息科学与技术国家实验室物联网技术中心 The coding method of inverse path and device

Also Published As

Publication number Publication date
CN100527847C (en) 2009-08-12

Similar Documents

Publication Publication Date Title
KR101924249B1 (en) Hierarchical entropy encoding and decoding
CN100492916C (en) Variable-length code using multiple mapping table and decoding method and apparatus
CN102783035B (en) Parallel entropy coding and decoding methods and devices
CN100488254C (en) Entropy coding method and decoding method based on text
JP2008527902A (en) Adaptive entropy coding and decoding method and apparatus for stretchable coding
CN103002283A (en) Side Information Generation Method for Multi-View Distributed Video Compression
CN101494461B (en) Variable length symbol grade invertible encoding and decoding method for joint source and channel
Banister et al. Robust image transmission using JPEG2000 and turbo-codes
CN101022554A (en) Variable-length code decoding method based on zero-prefix code
CN100551064C (en) Variable length encoding method and device
KR20100009032A (en) Lossless data compression method
CN100581253C (en) Method and apparatus for decoding bit stream
Lee et al. Soft decoding of VLC encoded data for robust transmission of packetized video
CN100499815C (en) Video frequency coding and de-coding method for supporting video frequency frame random reading
Ezhilarasan et al. A new entropy encoding technique for multimedia data compression
US6801668B2 (en) Method of compressing data by use of self-prefixed universal variable length code
CN100466749C (en) An error-resistant image encoding and decoding method based on distributed source coding
JPH08340258A (en) Variable length encoding/decoding device
JP2001274690A (en) Variable length decoder
WO2020258188A1 (en) Decoding method, decoder and decoding system
Subbalakshmi et al. Joint source-channel decoding for MPEG-4 coded video over wireless channels
CN106603081B (en) Universal arithmetic coding method and decoding method thereof
CN113453002A (en) Quantization and entropy coding method and apparatus
CN100414996C (en) Method and apparatus for encoding and decoding key value data
CN1321533C (en) Method for Joint Encoding/Decoding of Largest Macroblock Type and Coded Block Mode

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
C17 Cessation of patent right
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20090812

Termination date: 20140316