CN100527847C - 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
CN100527847C
CN100527847C CN 200710064445 CN200710064445A CN100527847C CN 100527847 C CN100527847 C CN 100527847C CN 200710064445 CN200710064445 CN 200710064445 CN 200710064445 A CN200710064445 A CN 200710064445A CN 100527847 C CN100527847 C CN 100527847C
Authority
CN
China
Prior art keywords
node
go
code
bit
tree
Prior art date
Application number
CN 200710064445
Other languages
Chinese (zh)
Other versions
CN101022554A (en
Inventor
Dai Qionghai
Shi Yiping
Er Guihua
Original Assignee
Univ Tsinghua
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 Univ Tsinghua filed Critical Univ Tsinghua
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

Links

Description

基于零前缀码的变长码解码方法技术领域本发明属于数字视频编解码技术领域,具体来说,是关于快速参照化264"7(:标准中规定的CAVLC表格进行解码的方法。背景技术H. 264/AVC是新一代数字视频编码标准,它是由国际电联(ITU)和MPEG标准组织ISO组成的合作开发组(JVT)共同开发的。H. 264/AVC作为视频技术标准,能够适应于视频应用的各个领域,包括低码率的无线应用,网络视频应用,高清晰度的电视广播应用和DVD应用。H. 264/AVC和以前的编码标准H. 263, MPEG-4类似,都是采用基于预测变换的混合编码模式,同时吸收了以前的标准的优势,在编码性能上较H. 263, MPEG-4有了较大的提高,在同等质量的情况下能够节约40%的码率。H. 264/AVC的码流分为两个层次,视频编码层(Video Coding Layer , VLC)和网络抽象层(Network Abstract Layer ,NAL)。视频编码层主要记录对视频内容进行压縮后 Field-based variable length code decoding method of the present invention is a zero prefix code belongs to digital video encoding and decoding technologies, and in particular, relates to fast reference of 264 "7 (: The method specified in the standard table for decoding CAVLC BACKGROUND H . 264 / AVC is a new digital video coding standard, which is to develop group (the JVT) of the ITU (ITU) and MPEG standards organizations jointly developed by ISO composition .H. 264 / AVC standard as the video technology, it is possible to adapt in various fields of video applications, including low bit rate wireless applications, video applications, network, application of high-definition television and DVD applications .H. 264 / AVC coding standard previously and H. 263, MPEG-4 are similar both based hybrid coding mode is predictive conversion while absorbing the advantages of the previous standard, in coding performance than H. 263, MPEG-4 has been enhanced in the case of the same quality can save 40% of the code after rate .H. 264 / AVC code stream is divided into two levels, a video coding layer (video coding layer, VLC) and a network abstraction layer (network abstract layer, NAL). video coding layer mainly recording video content compression 的核心数据,网络抽象层主要记录描述特定网络环境的信息,通过这样的层次划分,有利于视频数据的封装和数据在网络中的传输控制。H. 264/AVC的编码过程主要分为以下几个部分:(1) 帧内预测,以消除空间冗余度;(2) 通过运动搜索进行帧间预测,以消除时间冗余度;(3) 对原始图像块和预测块之间的差别形成的残差块进行变换和量化;(4) 对量化后得到的系数残差进行重排和熵编码。 解码过程主要分为以下几个部分:(1) 熵解码,对解码后的系数进行重排;(2) 对重排后的系数进行反量化和反变换;(3) 通过帧内预测或帧间预测得到预测块;(4) 通过预测块和残差块得到解码图像。在H.264/AVC编码中,熵编码分为两种:上下文自适应的可变长度编码(CAVLC,简称变长码)和上下文自适应的二进制算术编码(CABAC)。 CAVLC熵编码是一种可变长编码,可变长编码 The core data network abstraction layer mainly recorded information describing a particular network environment, through such division level conducive to the transmission control data and video data encapsulated in the network .H. 264 / AVC coding process consists of the following parts: (1) intra prediction, in order to eliminate spatial redundancy; (2) inter-frame prediction by the motion search to eliminate the temporal redundancy; (3) forming the difference between the original image block and the prediction block the transformed and quantized residual block; (4) the quantized residual coefficients obtained rearranging and entropy encoding decoding process divided into the following sections: (1) entropy decoding, on the decoded weight coefficient. discharge; (2) rearrangement of coefficients inverse quantized and inverse transformation; (3) by intra prediction or inter prediction block to obtain prediction; (4) a decoded image obtained by the prediction block and a residual block H.. 264 / AVC coding, the entropy coding is divided into two types: context-adaptive variable length coding (the CAVLC, referred to as a variable length code) and context adaptive binary arithmetic coding (CABAC) CAVLC entropy coding is a variable length. coding, variable length coding 利用不同的语法元素在码流中出现的概率,利用不同比特长度的码字对语法元素进行编码,出现概率高的语法元素对应于比特长度较短的码字,概率较低的语法元素对应于比特长度较长的码字。在编码的过程中,通过码表的形式记录着不同的语法元素信息所对应的码字。由于在不同的视频帧中,语法元素信息的概率分布不相同,采用统一的码3表不能够达到很高的压縮效率,在CAVLC熵编码过程中,采用已编码的邻近的图像块对应的语法元素的信息来动态的调整编码所参照的码表,使编码所选择的码表中码字的概率分布同实际的语法元素信息的概率分布更接近,以达到较高的压縮效率。 Using the probability of occurrence in the code stream different syntax elements, using codewords of different bit lengths for encoding syntax elements, a high probability of a syntax element corresponding to a bit shorter length codeword appears lower probability corresponding to a syntax element longer bit length codewords in the encoding process, the form of the code table is recorded syntax elements of different code words corresponding to the information. Since the different video frame, the probability distribution of the syntax element information are not the same, using unified code table 3 are not able to achieve high compression efficiency, in CAVLC entropy coding process, using information encoded neighboring image blocks corresponding to a syntax element encoded code table dynamic adjustment referred to the coding probability of code words in the code table selection probability distribution with the actual distribution of information syntax elements closer in order to achieve higher compression efficiency. 采用CAVLC编码对li 264/AVC中的系数残差进行熵编码,需要编码的语法元素有TotalCoeff (重排序列中非0系数的个数),TrailingOnes (重排序列末尾的1或者-l的个数),total—zeros (重排序列中最后一个非0系数前0的个数),run—before (重排序列中每个非0系数前0的个数)。 Using CAVLC residual coding coefficients li 264 / AVC in the entropy encoding, syntax elements to be encoded with a TotalCoeff (column reordering number of nonzero coefficients), a TrailingOnes (reordering end of column 1 or -l number), total-zeros (last column reordering before a non-0 coefficient number 0), (column reordering run-before the number of 0 coefficients before each non-zero). 每个的语法元素对应着不同的码表,但是TotalCoeff和TrailingOnes是采用组合编码的方式,通过对两个匹配的语法元素联合编码并合并成一个码字以提高压縮效率,由于两种语法元素信息编码后合并在一个码字中,相应的码表长度就比一个语法元素进行编码时有所增加。 Each syntax elements corresponding to different code tables, but TotalCoeff and TrailingOnes is the use of a combination coding method, by matching two syntax elements jointly encoded and combined into a single codeword to improve compression efficiency, since both the syntax element when combined increase in a code word, the respective code length table are encoded syntax elements after a specific information coding. 在解码过程中,为了从码流中的码字得到具体的语法元素的值,需要按照码表中出现的码字的长度从码流存储器中读取相同长度的码字,然后同码表中的码字进行匹配,如果匹配不成功,则切换到码表中出现的下一个码字,进行相同的操作。 In the decoding process, in order to obtain the value of the specific syntax element from the codeword stream, it needs to be read from the code word of the same length according to the length of the code stream memory codewords appearing in the table, then the same code table codewords match, if match is unsuccessful, then the switch to the next codeword appearing in the table, the same operations. 采用这样的方式进行解码需要频繁的访问码流存储器,而且在最差的情况下需要对整个码表进行遍历后才能够找到正确的码字,完成解码过程。 Decoding such a way requires frequent access code stream memory, and in the worst case, the need to traverse the entire table after the code can find the correct codeword, the decoding process is completed. 这种处理方法效率低下,不适于应用在实时的编解码系统中。 This approach is inefficient, not suitable for use in real-time encoding and decoding system.

发明内容 SUMMARY

本发明的目的是为克服已有技术的不足之处,提出一种基于零前缀码的变长码解码方法,本发明根据CAVLC码表生成多叉树。 Object of the present invention is to overcome the deficiencies of the prior art, to provide a variable length decoding method based on a zero prefix code, the present invention generates a multi-tree code table according to CAVLC. 即变换CAVLC码表的形式,该方法面向H. 264/AVC在实时性要求较高的系统的应用,为使用者提供了在符合H. 264/AVC标准所规定的码流中,对残差块参照CAVCL码表进行解码;这种方法具有较高的效率,能够满足在实时编解码系统中的应用。 I.e. CAVLC transform of code tables, the method for H. 264 / AVC in a high real-time requirements of the application system, provides the user specified in compliance with H. 264 / AVC standard bit stream, the residual Referring CAVCL block decoding code table; this method has a high efficiency, real-time applications in the codec system can satisfy.

本发明提出的基于零前缀码的变长码解码方法,其特征在于,该方法包括:生成多个 The present invention is made variable length decoding method based on a zero prefix code, wherein, the method comprising: generating a plurality of

基于0前缀码的多叉树,根据该多叉树对码流进行变长码解码; 0 based multi-prefix tree performs variable length decoding of the code stream based on the multi-tree;

所述的基于O前缀码的多叉树的结构包括:由一个根节点及其多级节点构成的O前缀码字比特序列,下级节点是其上级节点的子节点;其中,根节点只记录其子节点的个数,其它各级节点除记录其子节点的个数外,还记录所述码字序列的比特位,所述子节点记录的比特位是其上级节点记录的比特位及后续的比特位,每个节点最多存在4个子节点,各子节点分别记录后续的非零比特位及其前的0-3个0的比特位;如果该节点的子节点个数为O,该节点为叶子节点,叶子节点同时记录和码字对应的语法元素值; Based on the multi-O prefix code tree structure comprises: O prefix code word bits, and lower nodes of a multi-stage root node is a child node configuration of their parent node; wherein the root node which records only number of child nodes, the other nodes except the recording levels to its number of child nodes is also recorded bits of the codeword sequence, said child nodes recording bits are bits of its parent node records and the subsequent bits, there are up to four child nodes of each node, child nodes are recorded 0-3 bits and the subsequent non-zero bits of 0 before; if the number of children of the node is O, the node leaf nodes, and leaf nodes simultaneously recording a codeword corresponding to a syntax element value;

所述根据生成的基于O前缀码的多叉树对码流进行变长码解码,具体包括以下步骤-1)设置所述多叉树的根节点为当前节点,设置比特位指针P指向下一个将要读取的码流比特位,如果码流结束,则转到6); O according to the generated prefix tree plurality of variable-length code stream to code decoding, comprises the steps of -1), provided the multi-tree root node as the current node, the pointer P bit set based on the next point bit stream of bits to be read, if the end of the stream, go to 6);

2) 读取当前节点的子节点数N,令^N-1,设置子节点计数K,且1(=0; 2) Read the number of children of the current node N, so ^ N-1, provided the child node count K, and 1 (= 0;

3) 如果码流结束,则表示码流错误,转到6);否则,读取该指针P指向的码流比特位,♦K=K+1,指针P移到下一个将要读取的比特位,读取的码流比特位如果值为l,则转到4); 3) If the end of the stream, then stream error, go to 6); otherwise, the bit stream read pointer P points, ♦ K = bit K + 1, the pointer P will be moved to a next read bit, the read bit stream if the value l, the go 4);

如果值为0,则转到5); If the value is 0, then go to 5);

4) 设置当前节点的第K个子节点为当前节点,判断当前节点是否为叶子节点,如果是,则读取存储在该节点中的视频语法元素信息,并转到l);如果不是叶子节点,则转到2); 4) Set the current node to a first child node of the current node K, determines whether the current node is a leaf node, if so, the video syntax element information stored in the read node, and go to L); if not a leaf node, go to 2);

5) 令恥N-1,如果NO,则令K-K+1,并转到4);否则转到3); 5) Let shame N-1, if NO, the order K-K + 1, and go to 4); otherwise, go to 3);

46)结束当前码流的解码。 46) the end of the decoding of the current code stream. 本发明的原理: Principles of the invention:

本发明基于可变长编码的原理。 The present invention is based on the principle of variable length coding. 由于编码系统进行的是可变长编码,在同一个码表列中 Since the system encoding is variable length encoding in the same column of the code table

不存在一个码字是另一个码字的前缀,把CAVLC码表转换为树来表示。 There is not a code word is a prefix of another code word, the code table is converted to CAVLC represented as a tree. 由于在CAVLC码表中, Since CAVLC in code table,

码字中值为O的比特位占有较大的比例,采用O前缀树来对CAVLC进行转换,能够提高整体的 O is the codeword bit large proportion, using a prefix tree to CAVLC O conversion can be improved overall

解码效率。 Decoding efficiency.

本发明具有以下特点: The present invention has the following characteristics:

1. 由于码字按树结构进行存储,只需按顺序读取比特流数据,减少对存储器的访问。 1. Since the code words stored according to a tree structure, by simply sequentially read bit stream data, reducing access to the memory.

2. 解码时只需访问对应的多叉树,不必对码表进行搜索,提高了解码效率。 Just visit 2. decoding multi-tree corresponding to the code table does not have to search, to improve the decoding efficiency.

3. 基于O前缀码的多叉树中一个节点可对应多个比特位,对于大部分的码字,能够遍历较少的节点,就找到对应的语法元素信息。 3. O prefix tree based on the plurality of nodes may correspond to a plurality of bits, for most of the codeword can traverse fewer nodes, to find information corresponding to the syntax elements.

将本发明应用在实时系统中,能够简化解码器,提高处理速度。 The present invention is applied in the real-time system, the decoder can be simplified to improve the processing speed.

附图说明 BRIEF DESCRIPTION

图1为本发明的基于0前缀码的多叉树的节点结构。 0 prefix based multi-node tree structure of FIG. 1 of the present invention. 图2为本实施例解码中语法元素tota1—zeros所参照的CAVLC码表。 Example syntax elements decoded tota1-zeros referred CAVLC code table 2 of the present embodiment FIG. 图3为本实施例根据CAVLC码表所生成的基于0前缀码的多叉树结构。 Figure 3 is a tree structure based on multi-0 prefix embodiment according to the generated code table CAVLC embodiment.

具体实施方式 Detailed ways

下面结合附图及实施例对本发明进行详细的说明。 The present invention will be described in detail below in conjunction with the accompanying drawings and embodiments.

本发明提出的基于零前缀码的变长码解码方法,其特征在于,该方法包括:生成多个基于O前缀码的多叉树,根据该多叉树对码流进行变长码解码;其中,基于O前缀码的多叉树的 The present invention proposes a variable length decoding method based on a zero prefix code, wherein, the method comprising: generating a plurality of multi-based O prefix tree performs variable length decoding of the code stream based on the multi-tree; wherein , based on multi-prefix tree is O

结构包括:由一个根节点及其多级节点构成的O前缀码字比特序列,下级节点是其上级节点 Structure comprising: O prefix codeword bit sequence, by the lower node and a root node configured multistage its upper node

的子节点;其中,根节点只记录其子节点的个数,其它各级节点除记录其子节点的个数外,还记录所述码字序列的比特位,所述子节点记录的比特位是其上级节点记录的比特位及后续的比特位,每个节点最多存在4个子节点,各子节点分别记录后续的非零比特位及其前的O的0-3个0的比特位;如果该节点的子节点个数为O,该节点为叶子节点(则表示码字结束),叶子节点同时记录和码字对应的语法元素值。 Child node; wherein the root node which records only the number of child nodes, the other nodes at all levels except the number of records of its child nodes, but also the recording bit codeword sequence, said child nodes recording bit is the bit and subsequent bits are recorded in upper node, each node there are four sub-most child nodes are recorded bits 0-3 O subsequent non-zero bits before and 0; if the number of child nodes of that node is O, the node is a leaf node (end of said codeword), simultaneous recording and leaf nodes corresponding to the codeword syntax element values.

该多叉树中一个节点的内容,如图1所示,包括其子节点个数,子节点指针或语法元素值(如果是叶子节点,则没有子节点指针,如果不是叶子节点,则没有语法元素值); The contents of a multi-branch tree node, as shown in FIG. 1, including the number of its child node, the child node pointer or a syntax element value (if it is a leaf node, there is no child node pointer, if not a leaf node, there is no grammatical element value);

上述基于O前缀码的多叉树是利用H. 264/AVC标准中所规定的码表来生成的,其具体生成方法包括:首先对多叉树进行初始化(即初始化为仅含一个子节点个数为O的根节点的树), Based on the above-described multi-O prefix tree is to use a code table H. 264 / AVC standard as to generate a predetermined, the specific generating method comprising: a first multi-tree is initialized (i.e., initialized to contain only one child node O number of the root node of the tree),

并设置变量E,其值为1或0;再利用该树来生成基于O前缀码的多叉树,具体包括以下步骤: Setting a variable E, which is 1 or 0; re-use of the tree is generated based on multiple O prefix tree, includes the following steps:

1) 置树的根节点为当前节点,读取码表中的一个码字,设置比特位指针p指向码字的第 1) opposite the root of the tree to the current node, reads a code word table, the pointer p set points to the first bit of the codeword

一个比特位,如码表结束则转到5); A bit, such as 5 to the end of the code table);

2) 指针P所指的位置读取该码字的N个比特位,直到读取到的比特位值为1或者N4或者码字结束,移动指针P到下一个将要读取得比特位,并判断指针P是否到了码字的结束,如果 2) the position of the read pointer P of the N bits of the codeword until the read bit value of 1 or N4 or stop codewords, move the pointer P to the next bit to be read to obtain, and determines whether the pointer P to the end of the codeword, if

码字已结束,则变量E置1,否则置0;如果读取到的比特位串中有l,则转到3);如果读取到的比特位串中没有l,则转到4); The code word has been completed, the variable E is set to 1, 0 otherwise; l if the read bit string, go to 3); if the read bit string l no, go to 4) ;

53〉判断当前节点的第N个子节点是否存在,如不存在,则建立相应子节点,判断当前节点的字节点个数是否小于N,如小于N,则修改当前节点的子节点个数为N,并移动当前节点到它的第N个子节点。 53> N th is determined whether the current node is present, such does not exist, establish the appropriate child node, determining the number of bytes is less than the current node point N, such as less than N, then modify the number of child nodes of the current node is N, and it moves the current node to the first node N sub. 如果E4,则设置当前节点为叶子节点,将对应得视频语法元素信息存储在该节点中,结束当前码字的转换,转到l);如果E-0,则转到2); If E4, leaf node is set as the current node, corresponding syntax elements obtained video information stored in the node, the end of the conversion of the current codeword to L); if E-0, go to 2);

4) 断当前节点的第N+1个子节点是否存在,如不存在,则建立相应得子节点,判断当前节点的子节点个数是否小于N+1,如小于N+1,则修改当前节点的子节点个数为N+1,并移动当前节点到它的第N+1个子节点。 4) N ​​+ 1-th node off the current node exists, if not present, to give the corresponding child node is established, determines the number of child nodes of the current node is less than N + 1, such as less than N + 1, the current node is modified the number of child nodes N + 1, and moves the current node to its first child node N + 1. 如果则设置当前节点为叶子节点,并将对应得视频语法元素信息存储在该节点中,结束当前码字的转换,转到l);如果E-0,则转到2)。 Is set if the current node is a leaf node, and the corresponding syntax elements obtained video information stored in the node, the end of the conversion of the current codeword to L); if E-0, go to 2).

5) 基于O前缀码的多叉树的构造结束。 5) construction of a multi-O prefix tree based on end.

基于O前缀码的多叉树构造完成后,在以后的解码过程中,就不需要参照H. 264/AVC标准中的码表进行解码,只需要参照基于O前缀码的多叉树即可解码,这样可以避兔复杂的匹配过程。 After multiple O prefix tree structure is completed based on, in the subsequent decoding process, it is necessary to refer to the code table H. 264 / AVC standard is decoded, only the reference code based on multi-O prefix tree can be decoded so the rabbit can avoid complex matching process.

根据上述生成的基于O前缀码的多叉树对码流进行变长码解码,具体包括以下步骤- The generation of O prefix tree plurality of variable-length code stream to code decoding, based on the particular comprising the steps of -

1) 设置所述多叉树的根节点为当前节点,设置比特位指针P指向下一个将要读取的码流比特位,如果码流结束,则转到6); 1) Set the multi-tree root node as the current node, the next set bit stream pointer P points to a bit to be read, if the end of the stream, go to 6);

2) 取当前节点的子节点数N,令NNl,设置子节点计数K,且1(=0; 2) take the number of children of the current node N, so NNl, provided the child node count K, and 1 (= 0;

3) 果码流结束,则表示码流错误,转到6);否则,读取该指针P指向的码流比特位,令K-K+l,指针P移到下一个将要读取得比特位,读取的码流比特位如果值为l,则转到4);如果值为0,则转到5); 3) If the end of the stream, then stream error, go to 6); otherwise, the bit stream read pointer to point P, so that K-K + l, the pointer P moves a bit to be read to obtain , the read bit stream if the value l, the go 4); if the value is 0, then go to 5);

4) 设置当前节点的第K个子节点为当前节点,判断当前节点是否为叶节点,如果是,则 4) Set the current node to a first child node of the current node K is determined whether the current node is a leaf node, if so,

读取存储在该节点中的视频语法元素信息,并转到l);如果不是叶节点,则转到2); Reads the stored video syntax element information in the node, and go to L); if not a leaf node, go to 2);

5) 令NN-1,如果N-0,则令K-K+1,并转到4);否则转到3); 5) Order NN-1, if the N-0, then let K-K + 1, and go to 4); otherwise, go to 3);

6) 结束当前码流的解码。 6) the end of the decoding of the current code stream. 这样就完成了参照基于O前缀码的多叉树对H. 264/AVC的残差块码流的解码。 This completes the decoding of the H. 264 / AVC residual block code stream based on a multi-tree with reference to the O prefix.

以下通过实施例对本发明所提出的一种根据CAVLC码表的基于O前缀码的多叉树解码方法进行详细说明。 The following examples of the present invention, one kind of the proposed method of decoding a multi-tree O prefix described in detail based on the code table according to CAVLC.

本实施例采用的基于O前缀码的多叉树,在每个节点中采用一个域来存储该节点的子节点数,子节点的取值范围为0-4,其中O代表叶子节点。 Example Based on the present embodiment of the multi-O prefix tree, each node employed in a field to store the number of children of the node, the child node is in the range 0-4, where O represents leaf node.

图2是本实施例解码中语法元素totaLzeros(重排序列中最后一个非0系数前0的个数) 所参照的CAVLC码表,其中码表第一列表示解码得到的语法元素total一zeros的值,码表的第二列到第八列表示码流中可能存在的码字,同一行中的码字和该行第一列中的语法元素值对应,根据已经解码得到的不同的TotalCoeff (重排序列中非0系数的个数)值从不同的列中选取码字进行解码。 FIG 2 is a decoding syntax element present embodiment totaLzeros embodiment (last column reordering before a non-0 coefficient number 0) is referred to CAVLC code table, wherein the first column represents the code table obtained by decoding a syntax element of total zeros of value, the second column to the eighth column represents the code table codeword stream may be present, corresponding codeword in the same row and first column of the syntax element row values ​​have been decoded different TotalCoeff of ( retraining sequence number of nonzero coefficients) value of a codeword selected from a different column decode.

本实施例对图2中CAVLC码表的第一列转换得到的基于0前缀码的多叉树,如图3所示。 This embodiment of the first column of FIG. 2 CAVLC conversion code table based on the obtained plurality of prefix tree 0, as shown in FIG. 点,第三个子节点和第四个子节点。 Point, third and fourth child node child node. 每个节点旁边的比特串表示该节点记录的某个码字中的一段比特位串,叶子节点旁边的比特串对应于其记录的一个完整的码字。 Section of a bit string code word next to each node indicates that the node record in the bit string, the bit string next leaf node corresponds to a complete codeword recorded thereon.

本实施例对一段比特流为000011的码字进行解码,是参照图3中的基于0前缀码的多叉树中相应部分,如图3所示。 Some embodiments of the present embodiment decodes the bit stream of the codeword 000011, it is based on 3 0 the prefix tree in multiple respective portions shown in Figure 3. Referring to FIG. 其解码方法包括:读取根节点中的子节点个数,值为4,读取比特流,由于前三位都没有值为l的比特位,所以读取子节点数减一位比特,即3比特,并把当前节点移动到根节点的第4个子节点;读取当前节点中的子节点个数,值为4,读取比特流,由于第二位为值为l的比特位,所以读取2比特,并设置当前节点的第2个子节点为当前节点;读取当前节点中的子节点个数,值为4,读取比特流,由于第一位为值为l的比特位,所以只读取l比特,并设置当前节点的第l个子节点为当前节点;读取当前节点中的子节点个数,值为O,故该码字解码结束,得到total一zeros值为7。 Decoding method comprising: reading the number of child nodes of the root node, a value of 4, the read bit stream, since not all the first three bits of the value l, the read sub-nodes minus one bit, i.e. 3 bits, and the current node moves to the fourth child of the root node; reading the number of children of the current node, a value of 4, the bit stream is read, since the bit value of the second bit is l, so read 2 bits, and set the second child of the current node as the current node; read the number of child nodes of the current node, a value of 4, the bit stream is read, due to a first bit value of l, Therefore, read only bits l, l and sets the first child of the current node as the current node; read the number of child nodes of the current node, a value of O, it is the end of the code word decoding, to give a total value of seven zeros.

Claims (2)

1、一种基于零前缀码的变长码解码方法,其特征在于,该方法包括:生成多个基于0前缀码的多叉树,根据该多叉树对码流进行变长码解码;所述的基于0前缀码的多叉树的结构包括:由一个根节点及其多级节点构成的0前缀码字比特序列,下级节点是其上级节点的子节点;其中,根节点只记录其子节点的个数,其它各级节点除记录其子节点的个数外,还记录所述码字序列的比特位,所述子节点记录的比特位是其上级节点记录的比特位及后续的比特位,每个节点最多存在4个子节点,各子节点分别记录后续的非零比特位及其前的0-3个0的比特位;如果该节点的子节点个数为0,该节点为叶子节点,叶子节点同时记录和码字对应的语法元素值;所述根据生成的基于0前缀码的多叉树对码流进行变长码解码,具体包括以下步骤:1)设置所述多叉树的根节点为当前 1, a variable-length code decoding method based on a zero prefix code, characterized in that, the method comprising: generating a plurality of multi-prefix 0 based tree, variable-length code decoding of the code stream based on the multi-tree; the based on said plurality of prefix codes 0 tree structure comprising: a prefix word bits 0, root node and a lower node by a multi-stage configuration node is a child node to its parent node; wherein the sub-root node which records only the number of nodes, other nodes at all levels except the number of child nodes recorded, further recording bits of the codeword sequence, said child nodes recording bit is bit and subsequent bits of its parent node records position, the presence of up to 4 per node child nodes, child nodes are recorded 0-3 bits and subsequent bits before the non-zero 0; if the number of children of the node is 0, the node is a leaf node, leaf nodes and simultaneously recording a codeword corresponding to the value of syntax element; the generated based on the prefix 0 tree plurality of variable-length code stream to code decoding, includes the following steps: 1) providing the plurality tree the root node for the current 节点,设置比特位指针P指向下一个将要读取的码流比特位,如果码流结束,则转到6);2)读取当前节点的子节点数N,令N=N-1,设置子节点计数K,且K=0;3)如果码流结束,则表示码流错误,转到6);否则,读取该指针P指向的码流比特位,令K=K+1,指针P移到下一个将要读取的比特位,读取的码流比特位如果值为1,则转到4);如果值为0,则转到5);4)设置当前节点的第K个子节点为当前节点,判断当前节点是否为叶子节点,如果是,则读取存储在该节点中的视频语法元素信息,并转到1);如果不是叶子节点,则转到2);5)令N=N-1,如果N=0,则令K=K+1,并转到4);否则转到3);6)结束当前码流的解码。 Node, setting a bit stream bit pointer P points to the next bit to be read, if the end of the stream, go to 6); 2) reads the number of children of the current node N, so that N = N-1, is provided child node count K, and K = 0; 3) If the stream ends, it indicates an error code stream, go to 6); otherwise, the bit stream read pointer to point P, so that K = K + 1, the pointer P moved to a next bit to be read, the read bit stream value of 1, then go to 4); if the value is 0, then go to 5); 4) sets the first child of the current node K node as the current node, it is determined whether the current node is a leaf node, if it is, the video syntax element information stored in the node is read, and go to 1); if not a leaf node, go to 2); 5) order N = N-1, if N = 0, then let K = K + 1, and go to 4); otherwise, go to 3); 6) the end of the decoding of the current code stream.
2、 如权利要求l所述的方法,其特征在于,所述基于O前缀码的多叉树的生成方法, 该方法首先对多叉树初始化为仅含一个子节点个数为O的根节点的初始化树,并设置变量E,其值为1或0;再利用该初始化树来生成基于O前缀码的多叉树,具体包括以下步骤:11) 设置树的根节点为当前节点,读取码表中的一个码字,设置比特位指针p指向码字的第一个比特位,如码表结束则转到15);12) 从指针P所指的位置读取该码字的N个比特位,直到读取到的比特位值为1或者^3 或者码字结束,移动指针P到下一个将要读取的比特位,并判断指针P是否到了码字的结束,如果码字己结束,则变量E置1,否则置0;如果读取到的比特位串中有l,则转到13);如果读取到的比特位串中没有l,则转到14);13) 判断当前节点的第N个子节点是否存在,如不存在,则建立相应子节点,判断当前节点 2. A method according to claim l, characterized in that the method for generating the multi-tree based on the O prefix code, the method first multi-tree is initialized to contain only one sub-node number of the root node is O tree initialization, and sets the variable E, which is 1 or 0; re-initialize the tree by using the prefix code is generated based on multiple O tree, comprises the steps of: 11) setting the current node is the root node of the tree, reading a codeword table, set bit pointer p pointing to the first codeword bit, go to the end of the code table as 15); 12) to read N words from the code position pointer P bits until the read bit value of 1 or 3 ^ or code word end bit move the pointer P to the next to be read, and determines whether the pointer P to the end of the codeword, if the codeword ends hexyl , the variable E is set to 1, 0 otherwise; l if the read bit stream, then go to 13); if the read bit string l no, go to 14); 13) Analyzing N th current node exists, if not exist, create corresponding child node, the current node is determined 子节点个数是否小于N,如小于N,则修改当前节点的子节点个数为N,并移动当前节点到它的第N个子节点;如果E4,则设置当前节点为叶子节点,将对应的视频语法元素信息存储在该节点中,结束当前码字的转换,转到ll);如果EO,则转到12);14) 判断当前节点的第N+1个子节点是否存在,如不存在,则建立相应的子节点,判断当前节点的子节点个数是否小于N+1,如小于N+1,则修改当前节点的子节点个数为N+1, 并移动当前节点到它的第N+1个子节点;如果E4设置当前节点为叶子节点,并将对应的视频语法元素信息存储在该节点中,结束当前码字的转换,转到ll);如果EO,则转到12);15) 基于O前缀码的多叉树的构造结束。 The number of child nodes is less than N, such as less than N, then modify the number of child nodes of the current node is N, and moves the current node to its first child node N; if E4, it sets the current node is a leaf node, the corresponding video syntax element information stored in the node, the end of the conversion of the current codeword to LL); if EO, go to 12); 14) determines a first N + 1 th current node exists, if not present, the establishment of the respective sub-nodes, the current node determines the number of child nodes is less than N + 1, such as less than N + 1, then modify the number of child nodes of the current node is N + 1, and moved to its first current node N +1 child node; E4 set if the current node is a leaf node and the corresponding syntax elements of the video information stored in the node, the end of the conversion of the current codeword to LL); if EO, go to 12); 15 ) tree structure based on multi-O prefix ends.
CN 200710064445 2007-03-16 2007-03-16 Variable-length code decoding method based on zero-prefix code 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 CN101022554A (en) 2007-08-22
CN100527847C true CN100527847C (en) 2009-08-12

Family

ID=38710183

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 200710064445 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)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101739603B1 (en) * 2009-08-20 2017-05-24 톰슨 라이센싱 Method and apparatus for reusing tree structures to encode and decode binary sets
CN104661033B (en) * 2009-12-10 2018-02-06 Sk电信有限公司 Use the decoding apparatus of tree structure
CN104579567B (en) * 2015-01-08 2018-10-12 无锡清华信息科学与技术国家实验室物联网技术中心 The coding method of inverse path and device

Also Published As

Publication number Publication date
CN101022554A (en) 2007-08-22

Similar Documents

Publication Publication Date Title
US6894628B2 (en) Apparatus and methods for entropy-encoding or entropy-decoding using an initialization of context variables
EP1487113B1 (en) Coding and decoding of transformation coefficients in image or video coders
CN101800898B (en) Coding device and method
CN101637028B (en) Image information coding device and coding method
JP5128820B2 (en) Coding method of skip macroblock of video image
CN101542926B (en) System and method for scalable encoding and decoding of multimedia data using multiple layers
CN101507280B (en) Methods and apparatus for reduced resolution partitioning
KR101741296B1 (en) Entropy encoding and decoding scheme
US6771824B1 (en) Adaptive variable length decoding method
US7932843B2 (en) Parallel CABAC decoding for video decompression
CN101415121B (en) Self-adapting method and apparatus for forecasting frame
US6917310B2 (en) Video decoder and encoder transcoder to and from re-orderable format
CN100555877C (en) Variable length encoding method and device
CN101542911B (en) Memory efficient adaptive block coding
US7135997B2 (en) Method and apparatus for CAVLC decoding
CN101411197B (en) Methods and systems for refinement coefficient coding in video compression
US20030085822A1 (en) High performance memory efficient variable-length coding decoder
CN101031086B (en) Video encoding method and apparatus and video decoding method and apparatus
CN101243611B (en) Efficient coding and decoding of transform blocks
CN100579235C (en) Content adaption based arithmetic decoding system and device
CN101578769B (en) Memory efficient coding of variable length codes
US5999111A (en) Variable length encoding/decoding apparatus using re-association of symbol-codeword for variable length code table
US20080063375A1 (en) Data-file storage, particularly for MPEG format files
JP2008527902A (en) Adaptive entropy coding and decoding method and apparatus for stretchable coding
US8004431B2 (en) Fast parsing of variable-to-fixed-length codes

Legal Events

Date Code Title Description
C06 Publication
C10 Request of examination as to substance
C14 Granted
C17 Cessation of patent right