[go: up one dir, main page]

CN101370138B - A Decoding Method of H.264 Standard CAVLC Residual Coefficients - Google Patents

A Decoding Method of H.264 Standard CAVLC Residual Coefficients Download PDF

Info

Publication number
CN101370138B
CN101370138B CN 200710120442 CN200710120442A CN101370138B CN 101370138 B CN101370138 B CN 101370138B CN 200710120442 CN200710120442 CN 200710120442 CN 200710120442 A CN200710120442 A CN 200710120442A CN 101370138 B CN101370138 B CN 101370138B
Authority
CN
China
Prior art keywords
coefficients
decoding
code table
index
coefficient
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.)
Active
Application number
CN 200710120442
Other languages
Chinese (zh)
Other versions
CN101370138A (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.)
XFusion Digital Technologies Co Ltd
Original Assignee
Institute of Computing Technology of CAS
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 Institute of Computing Technology of CAS filed Critical Institute of Computing Technology of CAS
Priority to CN 200710120442 priority Critical patent/CN101370138B/en
Publication of CN101370138A publication Critical patent/CN101370138A/en
Application granted granted Critical
Publication of CN101370138B publication Critical patent/CN101370138B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

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

Abstract

本发明公开了一种H.264上下文自适应编码残差系数的解码方法,包含以下步骤:首先根据设计的一种三维码表,解码非零系数的数目和拖尾系数数目的二元组;再解码拖尾系数的符号位;然后解码非拖尾的非零系数的幅值;最后解码最后一个非零系数前0的数目和每个非零系数前0的个数。其中的非零系数的数目和拖尾系数数目的二元组解码,根据三维码表,通过预取特定比特位数,至多进行一次比较就可以确定码字信息位长度,进而确定二元组内容。其中的非零系数的数目和拖尾系数数目的二元组解码和非拖尾的非零系数的幅值解码采用每次读取两个字节的方法取得前导0的个数。本方法可以有效提高CAVLC码流的解码速度。

Figure 200710120442

The invention discloses a decoding method for H.264 context adaptive coding residual coefficients, comprising the following steps: firstly, according to a designed three-dimensional code table, decoding the binary group of the number of non-zero coefficients and the number of trailing coefficients; Then decode the sign bit of the trailing coefficient; then decode the magnitude of the non-tailing non-zero coefficient; finally decode the number of zeros before the last non-zero coefficient and the number of zeros before each non-zero coefficient. Among them, the number of non-zero coefficients and the number of trailing coefficients are decoded. According to the three-dimensional code table, by prefetching a specific number of bits, the length of the codeword information bit can be determined by at most one comparison, and then the content of the two-tuple can be determined. . Among them, the binary group decoding of the number of non-zero coefficients and the number of tailing coefficients and the amplitude decoding of non-tailing non-zero coefficients adopt the method of reading two bytes at a time to obtain the number of leading 0s. The method can effectively improve the decoding speed of the CAVLC code stream.

Figure 200710120442

Description

一种H.264标准CAVLC残差系数的解码方法 A decoding method of H.264 standard CAVLC residual coefficient

技术领域technical field

本发明涉及视频及图像编解码的领域,特别涉及一种H.264的上下文自适应变长编码(CAVLC)残差系数的解码方法。 The invention relates to the field of video and image coding and decoding, in particular to a decoding method of H.264 context adaptive variable length coding (CAVLC) residual coefficients. the

背景技术Background technique

最新国际视频编码标准H.264规定其熵编码可以采用CAVLC或者上下文自适应的算术编码(CABAC),其中,CAVLC的效率比MPEG-1、MPEG-2标准中采用的变长编码提高许多,而计算复杂度比CABAC低了许多,在编码效率和复杂度之间取得了很好的折中,H.264协议标准特别推荐在面向视频监控、视频会议等基本层应用中采用该技术。这些应用要求码流实时解码,而在CAVLC中,对不同语法元素采用不同的解码方法:对宏块类型、运动矢量等采用直接或间接的指数哥伦布码进行解码,而残差系数的解码由于需要对编码中产生的所有码字逐一解析,比较复杂从而速度较低。码字具体包含非零系数的数目和拖尾系数数目的二元组coeff_token<TotalCoeff,TrailingOnes>、拖尾系数的符号位、非拖尾的非零系数的幅值、最后一个非零系数前0的数目和每个非零系数前0的个数。 The latest international video coding standard H.264 stipulates that its entropy coding can adopt CAVLC or context-adaptive arithmetic coding (CABAC). The computational complexity is much lower than that of CABAC, and it has achieved a good compromise between coding efficiency and complexity. The H.264 protocol standard especially recommends this technology for basic layer applications such as video surveillance and video conferencing. These applications require real-time decoding of code streams, and in CAVLC, different decoding methods are used for different syntax elements: direct or indirect exponential Golomb codes are used for decoding macroblock types, motion vectors, etc., and the decoding of residual coefficients is due to the need Analyzing all the codewords generated in the encoding one by one is more complicated and the speed is lower. The codeword specifically includes the number of non-zero coefficients and the number of trailing coefficients, the binary group coeff_token<TotalCoeff, TrailingOnes>, the sign bit of the trailing coefficient, the magnitude of the non-zero coefficient of the non-tailing coefficient, and 0 before the last non-zero coefficient and the number of leading zeros for each nonzero coefficient. the

残差系数解码时间主要消耗在非零系数的数目以及拖尾系数的数目的二元组的解码上,该码字的解码不仅需要进行码表切换,更主要的是受H.264协议标准提供的一维码表限制,在码字解析过程中,需要逐比特读入码字,每读入一个比特就要在码表中遍历,以判定已经读入的部分是否为一个有效码字,直到已经读入的比特串能够与码表中某个码字匹配为止,从而导致在解码过程中需要反复进行读操作和比较操作,效率很低。 The residual coefficient decoding time is mainly consumed in the decoding of the binary group of the number of non-zero coefficients and the number of trailing coefficients. The decoding of the codeword not only needs to switch the code table, but also is mainly provided by the H.264 protocol standard. Due to the limitation of the one-dimensional code table, in the code word parsing process, it is necessary to read the code word bit by bit. Every time a bit is read, it must be traversed in the code table to determine whether the part that has been read is a valid code word, until Until the read-in bit string can match a certain code word in the code table, the reading operation and comparison operation need to be repeated in the decoding process, and the efficiency is very low. the

对于非拖尾的非零系数的幅值解码,前导0的个数的确定也消耗了大量时间,因为只能逐比特判断是否为0,直到读到1为止。 For the amplitude decoding of non-tailing non-zero coefficients, the determination of the number of leading 0s also consumes a lot of time, because it can only be judged bit by bit whether it is 0, until 1 is read. the

鉴于以上问题,CAVLC算法自2003年确定采用之后,已经出现了一些实现方案。文献1(Hsiu-Cheng Chang,Chien-Chang Lin and Jiun-In Guo,“A Novel Low-Cost High-Performance VLSI Architecture for MPEG-4AVC/H.264 CAVLC Decoding”,Proc.ISCAS 2005,pp.6110-6113,23-26 May 2005)公开了CAVLC解码的VLSI(Very Large Scale Integration,超大规模集成)设计,文献2(Xing Qin,Xiaolang Yan,“A memory and Speed EfficientCAVLC Decoder”,Proc.VCIP 2005,pp.1418-1426,Jul.2005)公开了一个可编程的VLSI设计,文献3(清华大学申请的专利“一种基于上下文自适应变长解码的方法”,公开号200610041780.X)在此基础上提出了一种存储要求更低、速度更快的面向集成电路的CAVLC解码设计方法。以上各方法都是针对CAVLC的集成电路设计而提出的,依赖于集成电路设计这一平台,并不适用于通用CPU或者DSP等平台上的软件实现。文献4(韩国C&S技术有限公司申请的专利“用于快速上下文自适应可变长编码的H.264解码方法”,公开号200610002800.2)公开了一种三维码表,可用于CAVLC软件解码实现。然而,此方法无论内存开销,还是运算量都比较大,从而运算速度较慢,存在进一步优化的可能。 In view of the above problems, since the CAVLC algorithm was adopted in 2003, some implementation schemes have appeared. Document 1 (Hsiu-Cheng Chang, Chien-Chang Lin and Jiun-In Guo, "A Novel Low-Cost High-Performance VLSI Architecture for MPEG-4AVC/H.264 CAVLC Decoding", Proc.ISCAS 2005, pp.6110- 6113, 23-26 May 2005) disclosed the VLSI (Very Large Scale Integration) design of CAVLC decoding, document 2 (Xing Qin, Xiaolang Yan, "A memory and Speed Efficient CAVLC Decoder", Proc.VCIP 2005, pp .1418-1426, Jul.2005) discloses a programmable VLSI design, document 3 (Patent "A Method Based on Context-Adaptive Variable Length Decoding" applied by Tsinghua University, Publication No. 200610041780.X) based on this A design method of IC-oriented CAVLC decoding with lower storage requirements and faster speed is proposed. The above methods are all proposed for the integrated circuit design of CAVLC, rely on the integrated circuit design platform, and are not suitable for software implementation on platforms such as general-purpose CPUs or DSPs. Document 4 (Patent "H.264 Decoding Method for Fast Context-Adaptive Variable Length Coding", Publication No. 200610002800.2, filed by Korea C&S Technology Co., Ltd.) discloses a three-dimensional code table, which can be used for CAVLC software decoding. However, this method has a relatively large memory overhead and a large amount of calculation, so the calculation speed is relatively slow, and there is a possibility of further optimization. the

同时,以上文献都是针对早期版本的码表进行优化设计,在最新的H.264标准中,对原有码表进行调整,还特别增加了nC==-2的码表。本发明针对新H.264协议标准制定的码表设计了CAVLC解码方法。 At the same time, the above documents are optimized for the early version of the code table. In the latest H.264 standard, the original code table is adjusted, and a code table with nC==-2 is added in particular. The invention designs a CAVLC decoding method aiming at the code table formulated by the new H.264 protocol standard. the

发明内容Contents of the invention

本发明的目的对现有解码方法所存在运算量较大,运算速度较慢的问题予以改进,提供一种高效率的上下文自适应编码系数的可编程解码方法。 The object of the present invention is to improve the problems of large amount of computation and slow computation speed in the existing decoding method, and to provide a high-efficiency programmable decoding method of context-adaptive coding coefficients. the

为实现上述目的,根据本发明的一个方面,提供了一种H.264标准CAVLC残差系数的解码方法,在对残差系数进行由高频向低频的Z字形扫描之后,对所有码字顺序逐一解析,包括下列步骤: In order to achieve the above object, according to one aspect of the present invention, a decoding method of the H.264 standard CAVLC residual coefficient is provided. Analyze one by one, including the following steps:

基于码表解码非零系数的数目和拖尾系数数目的二元组,其中码表包含前导0的个数、信息位长度和信息的三维参量,不同信息位长度对应按照所述信息位长度读取的信息; The number of non-zero coefficients and the number of trailing coefficients are decoded based on the code table, wherein the code table includes the number of leading 0s, the length of the information bit and the three-dimensional parameters of the information, and the length of different information bits corresponds to the reading according to the length of the information bit retrieved information;

解码拖尾系数的符号位; Decode the sign bit of the trailing coefficient;

解码非拖尾的非零系数的幅值; Decode the magnitude of non-smearing non-zero coefficients;

解码最后一个非零系数前0的数目; Decode the number of zeros before the last non-zero coefficient;

解码每个非零系数前0的个数。 Decodes the number of leading zeros for each nonzero coefficient. the

根据本发明的另一方面,基于码表的非零系数的数目和拖尾系数数目的二元组解码进一步包含下列步骤: According to another aspect of the present invention, the binary group decoding based on the number of the non-zero coefficients of the code table and the number of trailing coefficients further comprises the following steps:

按照H.264标准规定计算nC,根据nC选择码表; Calculate nC according to the H.264 standard, and select the code table according to nC;

读取前导0的个数; Read the number of leading 0s;

根据选择的码表和前导0的个数,读取信息位,确定非零系数的数目和拖尾系数数目的二元组信息。 According to the selected code table and the number of leading 0s, the information bits are read to determine the binary group information of the number of non-zero coefficients and the number of trailing coefficients. the

根据本发明的再一方面,读取前导0个数进一步包含以下步骤: According to another aspect of the present invention, reading the number of leading 0s further comprises the following steps:

读取2个字节码流; Read 2 bytecode streams;

在此2个字节码流中读取值为1的最高位数,则之前的位数即为前导0个数。 Read the highest number of digits whose value is 1 in the two bytecode streams, then the previous digits are the number of leading 0s. the

本发明的优点在于有效减少了读码流操作次数;有效减少了码表存储空间;有效减少了码字匹配次数,对于非零系数的数目以及拖尾系数的数目二元组至多进行一次匹配,大部分情况下不需要匹配就可确定码字,提高了码流的解码速度。 The present invention has the advantages of effectively reducing the number of operations for reading code streams; effectively reducing the code table storage space; effectively reducing the number of codeword matching times, and performing at most one match for the number of non-zero coefficients and the number of trailing coefficients. In most cases, the codeword can be determined without matching, which improves the decoding speed of the code stream. the

附图说明Description of drawings

以下,结合附图来详细说明本发明的实施例,其中: Below, describe embodiment of the present invention in detail in conjunction with accompanying drawing, wherein:

图1残差系数编码采用的反向Z字形扫描。 Figure 1 shows the reverse zigzag scan used in residual coefficient coding. the

图2nC与nA、nB的位置关系。 Figure 2 The positional relationship between nC and nA and nB. the

图3H.264协议标准中用于编码的码表。 Figure 3 The code table used for encoding in the H.264 protocol standard. the

图4指数哥伦布码码字构造方法。 Figure 4 shows the codeword construction method of the Exponential Golomb code. the

图5用于非零系数的数目以及拖尾系数的数目二元组(0=<nC<2)解码的码表。 FIG. 5 is a code table for decoding the number of non-zero coefficients and the number of trailing coefficients (0=<nC<2). the

图6用于非零系数的数目以及拖尾系数的数目二元组(2=<nC<4)解码的码表。 FIG. 6 is a code table for decoding the number of non-zero coefficients and the number of trailing coefficients (2=<nC<4). the

图7用于非零系数的数目以及拖尾系数的数目二元组(4=<nC<8)解码的码表。 FIG. 7 is a code table for decoding the number of non-zero coefficients and the number of trailing coefficients (4=<nC<8). the

图8用于非零系数的数目以及拖尾系数的数目二元组(8=<nC)解码的码表。 FIG. 8 is a code table for decoding the number of non-zero coefficients and the number of trailing coefficients (8=<nC). the

图9用于非零系数的数目以及拖尾系数的数目二元组(nC==-1)解码的码表。 Fig. 9 is a code table for the decoding of the number of non-zero coefficients and the number of trailing coefficients (nC==-1) tuples. the

图10用于非零系数的数目以及拖尾系数的数目二元组(nC==-2)解码的码表。 Fig. 10 is a code table for the decoding of the number of non-zero coefficients and the number of trailing coefficients 2-tuple (nC==-2). the

图11非零系数的数目以及拖尾系数的数目二元组解码流程图。 Fig. 11 is a flow chart of decoding a binary group of the number of non-zero coefficients and the number of trailing coefficients. the

图12另一个非零系数的数目以及拖尾系数的数目二元组解码流程 图。 Fig. 12 is another non-zero coefficient number and the number binary group decoding flow chart of the trailing coefficient. the

具体实施方式Detailed ways

基于H.264协议标准的上下文的自适应变长编码的残差系数解码过程是一个复杂的过程,在对残差系数进行由高频向低频的反向Z字形扫描(如图1所示)之后,对所有码字逐一解析。现有的解码方法通常包含如下步骤: The decoding process of the residual coefficient of adaptive variable length coding based on the context of the H.264 protocol standard is a complex process, and the residual coefficient is scanned in reverse zigzag from high frequency to low frequency (as shown in Figure 1) After that, all codewords are analyzed one by one. Existing decoding methods usually include the following steps:

第一步:对非零系数的数目以及拖尾系数数目的二元组进行解码,其中,拖尾系数数目,具体是指由低频向高频扫描得到的一维系数矩阵中非0,绝对值为1的连续系数个数。拖尾系数数目最大为3,超过3个的±1系数视作普通系数,解码方式采用每个非零系数前0的个数解码的方式。 Step 1: Decode the binary group of the number of non-zero coefficients and the number of trailing coefficients, where the number of trailing coefficients specifically refers to the non-zero, absolute value in the one-dimensional coefficient matrix obtained by scanning from low frequency to high frequency The number of consecutive coefficients of 1. The maximum number of trailing coefficients is 3, and more than 3 ±1 coefficients are regarded as ordinary coefficients, and the decoding method adopts the decoding method of the number of 0s before each non-zero coefficient. the

具体解码步骤包含: The specific decoding steps include:

(1)根据上下文选择码表:非零系数的数目以及拖尾系数的数目二元组解码所使用码表的选择需要根据周围块残差系数的分布情况,取决于nC的取值。nC的具体计算步骤如下:如果是色度DC系数解码,则4:2:0格式时nC=-1,4:2:2格式时nC=-2,4:4:4格式时nC=0;否则,nC根据上边块系数个数nA和左边块的系数个数nB来计算(nA、nB、nC位置关系如图2所示):如果nA和nB都可用,则nC=(nA+nB+1)/2;否则,如果nA可用,则nC=nA,如果nB可用,则nC=nB,否则nC=0。非零系数的数目以及拖尾系数的数目二元组解码H.264标准码表如图3所示; (1) Select the code table according to the context: the number of non-zero coefficients and the number of trailing coefficients The selection of the code table used for binary decoding needs to be based on the distribution of the residual coefficients of the surrounding blocks and depends on the value of nC. The specific calculation steps of nC are as follows: if the chroma DC coefficient is decoded, nC=-1 in 4:2:0 format, nC=-2 in 4:2:2 format, nC=0 in 4:4:4 format ; Otherwise, nC calculates according to the coefficient number nA of the upper side block and the coefficient number nB of the left block (nA, nB, nC position relation as shown in Figure 2): if nA and nB are all available, then nC=(nA+nB +1)/2; otherwise, nC=nA if nA is available, nC=nB if nB is available, otherwise nC=0. The number of non-zero coefficients and the number of trailing coefficients are as shown in Figure 3 for decoding the H.264 standard code table;

(2)逐比特位读取码流,直到已经读入的比特串能够与码表中某个码字匹配;取出这个码字对应的非零系数的数目和拖尾系数的数目内容。 (2) Read the code stream bit by bit until the read-in bit string can match a certain code word in the code table; take out the number of non-zero coefficients and the number of tailing coefficients corresponding to this code word. the

第二步:对拖尾系数的符号位解码,每个符号解码1位,根据正负分别解码为0或1。 Step 2: Decode the sign bit of the trailing coefficient, decode 1 bit for each sign, and decode it as 0 or 1 according to the sign. the

第三步:按照扫描顺序对非拖尾的非零系数的幅值使用映射的指数哥伦布码解码,这是一种结构化的解码方式,码字构造方式如图4所示,具体步骤包括: Step 3: Use the mapped Exponential Columbus code to decode the magnitude of the non-tailing non-zero coefficients according to the scanning order. This is a structured decoding method. The codeword construction method is shown in Figure 4. The specific steps include:

(1)读取前导0的个数:逐比特位读取,如果为0,则继续读取下一比特;如果为1,则进行下一步骤; (1) Read the number of leading 0s: read bit by bit, if it is 0, continue to read the next bit; if it is 1, proceed to the next step;

(2)计算非拖尾的非零系数的幅值 (2) Calculate the magnitude of the non-zero coefficient of non-tailing

Figure 358212DEST_PATH_GA20189018200710120442X01D00021
Figure 358212DEST_PATH_GA20189018200710120442X01D00021

其中信息部分是码表(如图4所示)内码字中代表幅值的部分,其长度等于前导0位数,Ceil表示向上取整函数。 Wherein the information part is the part representing the amplitude in the code word in the code table (as shown in Figure 4), its length is equal to the leading 0 digits, and Ceil represents an upward rounding function. the

第四步:对最后一个非零系数前0的数目使用自适应的码表进行解码; Step 4: Use an adaptive code table to decode the number of zeros before the last non-zero coefficient;

第五步:根据已编码信息自适应选择码表,对每个非零系数前0的个数进行解码。 Step 5: adaptively select a code table according to the coded information, and decode the number of 0s before each non-zero coefficient. the

从上述解码过程可以看出,由于非零系数的数目以及拖尾系数的数目二元组解码过程涉及到的逐比特位读取和码字比较的操作非常多,会导致解码速度严重降低。此解码过程中存在的缺陷本质上是由H.264标准码表的一维特性决定的。为此,本发明设计了一种新的码表,利用前导0位数、信息位长度以及信息部分三维参量设计了三维码表,由此可直接确定非零系数的数目以及拖尾系数的数目二元组。 It can be seen from the above decoding process that due to the number of non-zero coefficients and the number of trailing coefficients, the binary decoding process involves a lot of bit-by-bit reading and codeword comparison operations, which will lead to a serious decrease in decoding speed. The defects in the decoding process are essentially determined by the one-dimensional characteristic of the H.264 standard code table. For this reason, the present invention has designed a kind of new code table, utilizes leading 0 digits, information bit length and information part three-dimensional parameter to design three-dimensional code table, can directly determine the number of non-zero coefficient and the number of trailing coefficient thus Two-tuple. the

具体地,针对非零系数的数目以及拖尾系数的数目二元组解码本发明设计了基于码字特征的三维码表。通过对图3中H.264标准码表的观察,分割为0=<nC<2、2=<nC<4、4=<nC<8、nC>=8、nC==-1和nC==-2共6个码表。针对这六个码表,分别进行重组,构建如图5、图6、图7、图8、图9和图10所示的六个三维表。码表中留空部分表示没有对应的码字。在本发明码表中,确定上下文及前导0个数之后,信息位的长度最多只有两种,长度数值最多相差1,这对于压缩码字的保存空间非常有效,利用这一点可以有效压缩存储空间。在解码过程中,如果前导0的个数对应的信息位长度有两种,则首先考虑长度大的情况,读入相应位的数,在能与码表匹配时,则确定为该信息位长度;在不能与码表匹配时,则认为信息位为长度小的情况。特别的,当nC>=8时(如图8所示),码表是定长的,无须进行多次比较就可获得码字,本发明将其前导0长度直接置为0,后面6位全部视为信息位。 Specifically, the present invention designs a three-dimensional code table based on codeword features for decoding the binary group of the number of non-zero coefficients and the number of trailing coefficients. By observing the H.264 standard code table in Figure 3, it is divided into 0=<nC<2, 2=<nC<4, 4=<nC<8, nC>=8, nC==-1 and nC= =-2 There are 6 code tables in total. For these six code tables, reorganize them respectively to construct six three-dimensional tables as shown in Fig. 5, Fig. 6, Fig. 7, Fig. 8, Fig. 9 and Fig. 10. A blank portion in the code table indicates that there is no corresponding code word. In the code table of the present invention, after the context and the number of leading 0s are determined, there are at most two lengths of information bits, and the difference between the length values is at most 1, which is very effective for the storage space of compressed codewords, and the storage space can be effectively compressed by using this point . In the decoding process, if there are two types of information bit lengths corresponding to the number of leading 0s, first consider the case of a large length, read in the number of corresponding bits, and determine the information bit length when it can match the code table ; When it cannot be matched with the code table, it is considered that the information bit has a small length. Especially, when nC>=8 (as shown in Figure 8), the code table is fixed-length, and codewords can be obtained without multiple comparisons. The present invention directly sets the length of its leading 0 to 0, and the following 6 bits All are treated as information bits. the

在码表中,信息既可以是非零系数的数目以及拖尾系数的数目二元组的索引index,也可以直接是非零系数的数目以及拖尾系数的数目二元组具体内容,前者可以减少码表所占空间,但是需要根据索引计算非零系数的数目以及拖尾系数的数目二元组,后者则可以直接获得所需元素值。可根据不同平台资源的限制,选择其中之一。如果在码表中存放索引,按照如下方式计算非零系数的数目以及拖尾系数的数目二元组: In the code table, the information can be the index index of the binary group of the number of non-zero coefficients and the number of trailing coefficients, or directly the specific content of the binary group of the number of non-zero coefficients and the number of trailing coefficients. The former can reduce the code The space occupied by the table, but the number of non-zero coefficients and the number of trailing coefficients need to be calculated according to the index, and the latter can directly obtain the required element value. You can choose one of them according to the resource constraints of different platforms. If the index is stored in the code table, the number of non-zero coefficients and the number of trailing coefficients are calculated as follows:

如果(index<6){ if (index<6) {

  如果(index!=0)那么index+=3; If (index!=0) then index+=3;

  如果(index>=3)那么index+=2; If (index>=3) then index+=2;

  TotalCoeff=(index>>2)&3; TotalCoeff=(index>>2)&3;

  TrailingOnes=index&3; TrailingOnes=index&3;

}

否则{ else {

  TotalCoeff=3+(index-6)/4; TotalCoeff=3+(index-6)/4;

  TrailingOnes=(index-6)&3; TrailingOnes=(index-6)&3;

}

为了在非零系数的数目以及拖尾系数的数目二元组和非拖尾的非零系数的幅值解码过程中减少获取前导0个数所需时间,本发明设计了一种快速取得前导0个数的方案。考虑到前导0最长可达12比特位,同时尽可能减少读码流的次数,在读取前导0位数操作时,每次读取2个字节长度。此外许多特定平台有专门指令实现这一功能,充分利用这些指令就可以进一步降低读取前导0位数所需周期。 In order to reduce the time required to obtain the number of leading 0s during the decoding process of the number of non-zero coefficients and the number of trailing coefficients and the magnitude of non-tailing non-zero coefficients, the present invention designs a method for quickly obtaining leading 0s. number of programs. Considering that the leading 0 can be as long as 12 bits, and at the same time reduce the number of reading code streams as much as possible, when reading the leading 0 digits, read 2 bytes each time. In addition, many specific platforms have special instructions to implement this function, and making full use of these instructions can further reduce the cycle required to read the leading 0 digits. the

在上述三维码表和快速取得前导0的个数的方案的基础上,本发明提出一种H.264标准CAVLC残差系数的解码方法,具体步骤如下: On the basis of the above-mentioned three-dimensional code table and the scheme for quickly obtaining the number of leading 0s, the present invention proposes a decoding method of the H.264 standard CAVLC residual coefficient, and the specific steps are as follows:

1、非零系数的数目以及拖尾系数的数目二元组解码: 1. Two-tuple decoding of the number of non-zero coefficients and the number of trailing coefficients:

假设,当前码流指向“00000000010110110...”。 Assume that the current code stream points to "00000000010110110...". the

第一:根据上下文选择码表 First: Select the code table according to the context

按照H.264标准规定计算nC,根据nC确定应选用的码表。假设nC=1,那么此时非零系数的数目以及拖尾系数的数目二元组解码对应的码表应该选择对应于0=<nC<2的码表(图5)。 Calculate nC according to the H.264 standard, and determine the code table that should be selected according to nC. Assuming nC=1, the code table corresponding to the binary group decoding of the number of non-zero coefficients and the number of trailing coefficients should select the code table corresponding to 0=<nC<2 (FIG. 5). the

第二,读取前导0的个数 Second, read the number of leading 0s

从码流当前位置开始读取前导0的个数。方法如下:读取2个字节的码流,然后读取值为1的最高位数,之前的位数即为前导0的个数。本例中,读入“0000000001011011”,前导0的个数为9。 Read the number of leading 0s from the current position of the code stream. The method is as follows: read the code stream of 2 bytes, and then read the highest digit whose value is 1, and the previous digit is the number of leading 0s. In this example, "0000000001011011" is read in, and the number of leading 0s is 9. the

第三,读取信息位,确定非零系数的数目以及拖尾系数的数目二元组信息 Third, read the information bits to determine the number of non-zero coefficients and the number of trailing coefficients. Two-tuple information

根据选择的码表和前导0的个数,确定可能信息位长度,并通过移位方法读取。本例中,可确定信息位长度为4,通过移位方式读入4比特“1011”。二进制“1011”对应十进制11。如果码表中直接存放非零系数的数目以及拖尾系数的数目二元组内容,则直接获得拖尾系数的数目为0, 非零系数的数目为7(如图11所示);如果表中存放的是码字的索引,则可获得22,据此计算获得拖尾系数的数目为0,非零系数的数目为7(如图12所示)。 According to the selected code table and the number of leading 0s, determine the possible information bit length, and read it through the shift method. In this example, it can be determined that the information bit length is 4, and 4 bits "1011" are read in by shifting. Binary "1011" corresponds to decimal 11. If the number of non-zero coefficients and the number binary group content of trailing coefficients are directly stored in the code table, then directly obtaining the number of trailing coefficients is 0, and the number of non-zero coefficients is 7 (as shown in Figure 11); if the table Stored in is the index of the codeword, then 22 can be obtained, and the number of trailing coefficients obtained by calculation is 0, and the number of non-zero coefficients is 7 (as shown in FIG. 12 ). the

2、拖尾系数的符号位解码,根据码字0或1分别解码为正负; 2. The sign bit of the trailing coefficient is decoded, and it is decoded as positive or negative according to the code word 0 or 1;

3、非拖尾的非零系数的幅值解码 3. Amplitude decoding of non-smearing non-zero coefficients

假设,当前码流指向“000101101101100101111001...”。 Assume that the current code stream points to "000101101101100101111001...". the

第一步,读取前导0的个数 The first step is to read the number of leading 0s

从码流当前位置开始读取前导0的个数。方法如下:读取2个字节的码流,然后读取值为1的最高位数,之前的位数即为前导0的个数。本例中,读入“0001011011011001”,前导0的个数为3。 Read the number of leading 0s from the current position of the code stream. The method is as follows: read the code stream of 2 bytes, and then read the highest digit whose value is 1, and the previous digit is the number of leading 0s. In this example, "0001011011011001" is read in, and the number of leading 0s is 3. the

第二步,计算非拖尾的非零系数的幅值 The second step is to calculate the magnitude of the non-zero coefficient of non-tailing

Figure G071C0442X20070910D000071
Figure G071C0442X20070910D000071

4、解码反向扫描的第一个非零系数; 4. Decode the first non-zero coefficient of the reverse scan;

5、解码每个非零系数前0的个数。 5. Decode the number of zeros before each non-zero coefficient. the

Claims (5)

1. the coding/decoding method of standard context adaptive variable length coding (CAVLC) residual error coefficient H.264 comprises the following steps:
Residual error coefficient is carried out by the zigzag scanning of high frequency to low frequency;
Based on the number of code table decoding nonzero coefficient and two tuples of hangover number of coefficients, wherein, described code table comprises standard code table is H.264 cut apart six code tables that obtain according to 0=<nC<2,2=<nC<4,4=<nC<8, nC>=8, nC==-1 and nC==-2; Described code table comprises three-dimensional parameter: leading 0 number, information bit length and information, described code table is the also corresponding information bit information that reads according to information bit length under different information bit length, when information bit length is identical, can correctly find the number and the hangover number of coefficients information of nonzero coefficient; This step further comprises:
A, calculate nC, select described code table according to nC according to standard code H.264;
B, read leading 0 number;
C, according to code table of selecting and leading 0 number, read information bit, determine the number of nonzero coefficient and the binary group information of hangover number of coefficients;
The sign bit of decoding hangover coefficient;
The decode amplitude of nonzero coefficient of non-hangover;
The decode number of last nonzero coefficient preceding 0;
The decode number of each nonzero coefficient preceding 0.
2. the method for claim 1 is characterized in that described information is the number of nonzero coefficient and two tuples of hangover number of coefficients.
3. the method for claim 1 is characterized in that described information is the index value of two tuples of the number of nonzero coefficient and the number of coefficients of trailing, and can calculate described two tuples according to this value, and concrete computational process is as follows:
(if index<6) {
=0) index+=3 so;
If (index>=3) are index+=2 so;
TotalCoeff=(index>>2)&3;
TrailingOnes=index&3;
}
Otherwise
TotalCoeff=3+(index-6)/4;
TrailingOnes=(index-6)&3;
}
Wherein, index is described index value, and TotalCoeff is that the number and the TrailingOnes of described nonzero coefficient is described hangover number of coefficients.
4. the method for claim 1 is characterized in that the amplitude of the nonzero coefficient of the non-hangover of described decoding further comprises the following step:
Read leading 0 number;
Calculate the amplitude of the nonzero coefficient of non-hangover according to leading 0 number that reads.
5. method as claimed in claim 4 is characterized in that described leading 0 the number of reading further comprises following steps:
Read 2 byte code streams;
Read value is 1 highest order number in these 2 byte code streams, and then Zhi Qian figure place is leading 0 number.
CN 200710120442 2007-08-17 2007-08-17 A Decoding Method of H.264 Standard CAVLC Residual Coefficients Active CN101370138B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 200710120442 CN101370138B (en) 2007-08-17 2007-08-17 A Decoding Method of H.264 Standard CAVLC Residual Coefficients

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 200710120442 CN101370138B (en) 2007-08-17 2007-08-17 A Decoding Method of H.264 Standard CAVLC Residual Coefficients

Publications (2)

Publication Number Publication Date
CN101370138A CN101370138A (en) 2009-02-18
CN101370138B true CN101370138B (en) 2011-02-09

Family

ID=40413722

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 200710120442 Active CN101370138B (en) 2007-08-17 2007-08-17 A Decoding Method of H.264 Standard CAVLC Residual Coefficients

Country Status (1)

Country Link
CN (1) CN101370138B (en)

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101873496B (en) * 2010-05-24 2012-02-29 杭州海康威视软件有限公司 Context-based self-adaption variable length decoding method and device of H.264
CN102547260B (en) * 2010-12-22 2014-11-19 联芯科技有限公司 Decoding method of adaptive variable length coding based on context and system thereof
CN102355578B (en) * 2011-05-25 2016-12-07 深圳市云宙多媒体技术有限公司 A kind of entropy decoding method, device
CN102710937B (en) * 2011-06-02 2014-08-20 龙芯中科技术有限公司 Entropy decoding device and method for realizing CAVLC (context-based adaptive variable length coding) of H.246
CN102263960B (en) * 2011-08-15 2013-11-27 复旦大学 A Fast Method for Decoding CAVLC Non-zero Coefficient Amplitude
GB2496201A (en) * 2011-11-07 2013-05-08 Sony Corp Context adaptive data encoding and decoding
RU2628130C2 (en) * 2011-12-28 2017-08-15 Шарп Кабусики Кайся Arithmetic decoding device, image decoding device and arithmetic coding device
CN103384329A (en) * 2013-05-07 2013-11-06 广东工业大学 CAVLC decoding method based on no code table lookup
CN103414897B (en) * 2013-07-31 2016-05-18 北京蛙视通信技术股份有限公司 To method and the device of the decoding of video image entropy
CN107438181B (en) * 2016-05-27 2019-12-06 贰陆陆(深圳)游戏开发有限公司 audio and video processing method and device

Also Published As

Publication number Publication date
CN101370138A (en) 2009-02-18

Similar Documents

Publication Publication Date Title
CN101370138B (en) A Decoding Method of H.264 Standard CAVLC Residual Coefficients
CN1312938C (en) Improved variable length decoder
TWI658702B (en) Data encoding and decoding
US7817864B2 (en) Coding apparatus and decoding apparatus
US7411529B2 (en) Method of decoding bin values using pipeline architecture and decoding device therefor
US7365660B2 (en) Method and device for decoding syntax element in CABAC decoder
CN1787384B (en) Decoding method and device, and encoding method and device
CN106101727A (en) Context-based adaptive binary arithmetic coding method and device
CN101175210B (en) Entropy decoding method and device used for decoding video estimation residual error coefficient
WO2012159301A1 (en) Method, device and medium for video entropy encoding and entropy decoding
JP2013526140A (en) Adaptive binarization for arithmetic coding
CN103746706B (en) Test data compression based on double distance of swimming alternate coded and decompression method
US7345601B2 (en) Variable length coding algorithm for multiple coding modes
CN100440979C (en) Context-based adaptive two-dimensional variable-length decoding method and device
US10070127B2 (en) Method and apparatus for arithmetic coding and termination
Kim et al. High speed decoding of context-based adaptive binary arithmetic codes using most probable symbol prediction
CN103746704B (en) Test data of chip transmission methods based on double distance of swimming alternate coded
CN118450131A (en) Method and device for decoding data of variable-length codes containing multiple coding parameters in fixed-length code units
CN100546200C (en) Method, decoder, system and apparatus for decoding variable length codewords from a bitstream
CN101093998B (en) Decoding method and device
CN110545437A (en) Coefficient encoding, decoding method, electronic device and medium
US7193541B2 (en) Representation of sign in encoding scheme
CN102238381B (en) Image coding method and device for accelerating runlength coding
CN101267559A (en) General entropy decoding method and device for video decoder
CN101106721A (en) An encoding and decoding device and related coder

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
ASS Succession or assignment of patent right

Owner name: HUAWEI TECHNOLOGY CO., LTD.

Free format text: FORMER OWNER: INSTITUTE OF COMPUTING TECHNOLOGY, CHINESE ACADEMY OF SCIENCES

Effective date: 20140218

COR Change of bibliographic data

Free format text: CORRECT: ADDRESS; FROM: 100080 HAIDIAN, BEIJING TO: 518129 SHENZHEN, GUANGDONG PROVINCE

TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20140218

Address after: 518129 Bantian HUAWEI headquarters office building, Longgang District, Guangdong, Shenzhen

Patentee after: HUAWEI TECHNOLOGIES Co.,Ltd.

Address before: 100080 Haidian District, Zhongguancun Academy of Sciences, South Road, No. 6, No.

Patentee before: Institute of Computing Technology, Chinese Academy of Sciences

TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20211227

Address after: 450046 Floor 9, building 1, Zhengshang Boya Plaza, Longzihu wisdom Island, Zhengdong New Area, Zhengzhou City, Henan Province

Patentee after: xFusion Digital Technologies Co., Ltd.

Address before: 518129 Bantian HUAWEI headquarters office building, Longgang District, Guangdong, Shenzhen

Patentee before: HUAWEI TECHNOLOGIES Co.,Ltd.