Embodiment
In order to make those skilled in the art person understand the scheme of the embodiment of the invention better, the embodiment of the invention is done further to specify below in conjunction with accompanying drawing and execution mode.
At first, the basic principle of CAVLC Code And Decode in the prior art is done brief account.
CAVLC is used for 4 * 4 residual error data is encoded, and the scope of nonzero coefficient number is 0~16, and hangover coefficient number scope is 0~3.If ± 1 number greater than 3, then has only last three to be regarded as the hangover coefficient, remaining is regarded as common nonzero coefficient.To the nonzero coefficient number with the hangover coefficient number coding through the realization of tabling look-up, coding form is the form in the standard agreement, and is different with the decoding table lattice.It is available to have 5 coding forms, and nC selects form according to nonzero coefficient number predicted value.
For example, 4 * 4 residual error data are: 0,3,0,1 ,-1 ,-1,0,1,0,0,0,0,0,0,0,0, to these 4 * 4 residual error data following syntax elements of need encoding:
A, nonzero coefficient number n umcoeff are 5 in this example; Hangover coefficient number numtrailingones, this example is 3; The coding code table (Fig. 1 only shows the partial content of form) of the standard agreement that Fig. 1 uses when being coding nonzero coefficient number and hangover coefficient number; Suppose nC=0, then looking into the code stream that this table can get after numcoeff=5 and the numtrailingones=3 corresponding codes is 0000100;
B, coding three hangovers coefficient (-1 in this example ,-1,1) and nonzero coefficient amplitude Levels (3,1 in this example) except the hangover coefficient;
The number TotalZeros of c, last nonzero coefficient leading zero of encoding is 3 in this example;
The number RunBefore of d, each nonzero coefficient leading zero of encoding
CAVLC decoding is the reverse procedure of coding, need from code stream, parse each syntax elements of coding, according to come out 4 * 4 residual error data of these syntax elements reconstruct.The decoding also be to the coding code table the process of oppositely tabling look-up, for example, know encoding code stream 0000100 after, tabling look-up and can getting the nonzero coefficient number is 5, the hangover coefficient number be 3.Other syntax elements of decoding also are similarly, can obtain the preceding residual error data of encoding after having resolved all sentence structurees.
Can compare repeatedly with the code stream of coding code table after in decode procedure, reading code stream; Finding just can table look-up behind the matching value obtains the value of syntax elements; But this analytic method efficient is extremely low, and the code table space is also very big, is not suitable for being applied in the embedded device; Therefore need to design again the decoding code table and improve analyzing efficiency, reduce the code table space.
To above-mentioned deficiency, the inventor is through finding the statistics of code table code word rule, H.264 in a lot of code tables of CAVLC decoding have common characteristics, promptly its code word is many 0, and its code word is less in the number of bits of first 1 back.Therefore, embodiment of the invention CAVLC coding/decoding method and system are based on company's zero number of code word; At first obtain the number leadingzeros of initial company zero; The table of looking into a n bit again just can pass through table lookup operation, obtains the value of syntax elements, and said n is the bit number of first 1 back.
Further, divide into groups based on connecting the zero number for the design of code table, be divided into one group with connecting the identical code word of zero number, every group code word is further distinguished through the n Bit data of first 1 back.Therefore, in decode procedure, can at first obtain company's zero number of code word,, read the data of n bit then, further find code word concrete in this group, can obtain the value of syntax elements based on this group that finds the code word place.
Further; Because the CAVLC decoding is based on company's zero number of code word; In decode procedure, need read company's zero number of code word times without number, therefore in embodiments of the present invention, also can obtain company's zero number of code word through hardware mode; Improve the speed of the company's zero number that obtains code word, promote decoding efficiency.
As shown in Figure 2, be the flow chart of embodiment of the invention CAVLC coding/decoding method, comprise following basic step:
Step 201 is obtained the code stream that needs decoding.
Step 202 is confirmed the nonzero coefficient number predicted value nC in the said code stream.
The value of nC gets based on the nonzero coefficient number n A in current block left side and the nonzero coefficient number n B calculating of current block upside.If current block left side and last lateral mass are all available, then nC=(nA+nB+1)>>1; If one of current block left side and last lateral mass are available, then nC equals nA or nB; If current block left side and last lateral mass are all unavailable, then nC equals 0.
Step 203 is searched the first decoding code table of setting up in advance according to said predicted value nC, obtains nonzero coefficient number and hangover coefficient number in the said code stream, and the said first decoding code table is the decoding code table that comprises nonzero coefficient number and hangover coefficient number.
Step 204, if said nonzero coefficient number greater than 0, and said hangover coefficient number is greater than 0, then the decoding hangover connects the symbol of 1 coefficient.
If it is complete 0 that the nonzero coefficient number, then shows code word smaller or equal to 0, do not need to carry out again other decode procedures this moment; Equally, if the hangover coefficient number then shows the coefficient that do not trail smaller or equal to 0, therefore, the hangover of also just need not decoding has connected the symbol of 1 coefficient.
When the decoding hangover connects the symbol of 1 coefficient, can confirm the symbol of coefficient 1 through the Bit data that directly reads in the code stream, if the Bit data that reads is 1, represent that then the symbol of coefficient 1 is "-"; If the Bit data that reads is 0, represent that then the symbol of coefficient 1 is "+".
Step 205; If said nonzero coefficient number is less than the maximum of nonzero coefficient number; Then search the second decoding code table of setting up in advance according to said nonzero coefficient number; Obtain total number of last nonzero coefficient preceding 0 in the said code stream, the said second decoding code table is the decoding code table that comprises total number of last nonzero coefficient preceding 0.
Step 206, the number of other nonzero coefficients preceding 0 in the said code stream of decoding.
If the nonzero coefficient number is more than or equal to the maximum of nonzero coefficient number, promptly 16, then showing in the said code stream does not have 0, therefore, just need not to carry out above-mentioned steps 205 and step 206 yet.
Need to prove, between above-mentioned steps 204 and step 205, also can further may further comprise the steps: other nonzero coefficient amplitudes of decoding.Concrete decode procedure can adopt the mode identical with prior art.
The embodiment of the invention needs to set up in advance the decoding code table that corresponding each sentence structure is resolved when carrying out the CAVLC decoding, the promptly foregoing first decoding code table, the second decoding code table, the 3rd decoding code table.To specify the method for building up of the code table of respectively decoding below.
Analyze the form of coding nonzero coefficient number shown in Figure 1 and the standard agreement of hangover during coefficient number, can find following characteristics: its code word is many 0, and Dalian zero number is 14, and first 1 back has only three bits at most.Therefore,, can set up a nonzero coefficient number and hangover coefficient number decoding code table,, be referred to as the first decoding code table for the ease of describing based on these characteristics.Search the said first decoding code table according to bit stream data, obtain decoded two syntax elements information: nonzero coefficient number, hangover coefficient number, obtain the code stream length of first 1 back simultaneously, be used for mobile code stream bit pointers.
Setting up said first decoding during code table; At first code word is divided into groups based on connecting the zero number; Be divided into one group with connecting the identical code word of zero number, every group code word is further distinguished code word concrete in this group through the n Bit data of first 1 back, can obtain the value of syntax elements.
Be the design process of example explanation nonzero coefficient number and hangover coefficient number decoding code table with 0<=nC<2 (nC is a nonzero coefficient number predicted value) below, detailed process is following:
At first, will connect the identical code stream of zero number according to standard code code table shown in Figure 1 and be divided into one group, obtain:
Connecting the zero number and be 0 code stream has 1, is code stream " 1 ";
Connecting the zero number and be 1 code stream has 1, is code stream " 01 ";
Connecting the zero number and be 2 code stream has 1, is code stream " 001 ";
Connecting the zero number and be 3 code stream has 3, is respectively code stream " 000101 ", " 000100 ", " 00011 ";
Connecting the zero number and be 4 code stream has 3, is respectively code stream " 0000101 ", " 000011 ", " 0000100 ";
Connecting the zero number and be 5 code stream has 3, is respectively code stream " 00000111 ", " 00000110 ", " 00000101 ";
Connecting the zero number and be 6 code stream has 3, is respectively code stream " 000000111 ", " 000000110 ", " 000000101 ";
Connecting the zero number and be 7 code stream has 2, is respectively code stream " 0000000111 ", " 0000000110 ";
Connecting the zero number and be 8 code stream has 1, is respectively code stream " 00000000111 ";
Can find out that by above-mentioned each group code stream first of these code streams 1 back has only two bits of data at most, therefore when even the zero number is identical, utilizes the two bits of data of first 1 back in the code stream can distinguish concrete code stream.
For example, connecting the zero number and be 4 code stream has 3, is respectively " 0000101 ", " 000011 ", " 0000100 ", has confirmed to connect the zero number during parsing and be the two bits of data that reads first 1 back in the code stream after 4 again.
If the two bits of data of first 1 back of reading is 0; Then be expressed as code stream " 0000100 "; Can know that by coding code table shown in Figure 1 hangover coefficient number and nonzero coefficient number that it is corresponding are respectively 3 and 5; The code stream length of first 1 back is 2 (this value is not the syntax elements of standard, only is in order when resolving, to move the code stream pointer, can to design in the nonzero coefficient number is decoded code table with the hangover coefficient number yet);
If the two bits of data of first 1 back of reading is 1, then be expressed as code stream " 0000101 ", can know that by coding code table shown in Figure 1 hangover coefficient number and nonzero coefficient number that it is corresponding are respectively 2 and 3, the code stream length of first 1 back is 2;
If the two bits of data of first 1 back of reading is 2 or 3; Then be expressed as code stream " 000011 " (this code stream first 1 the back is actual has only 1 Bit data; Second 1 Bit data is unknown; Therefore the two bits of data of reading is 2 or 3 all to represent this code stream), hangover coefficient number and nonzero coefficient number that it is corresponding are respectively 4 and 3, and the code stream length of first 1 back is 1.
Therefore, when connecting the zero number and be 4 the nonzero coefficient number of design and hangover coefficient number decoding code table for 2,5,3}; 2,3,2}, { 1; 4,3}, { 1,4; 3}}, wherein, three values in each set are represented code stream length, nonzero coefficient number and the hangover coefficient number of first 1 back in the code stream respectively.Such as, { 2,5,3} representes that code stream length is 2, and the nonzero coefficient number is 5, and the hangover coefficient number is 3.
According to above-mentioned thought, can design to the nonzero coefficient number of nC under different value condition and hangover coefficient number decoding code table, the promptly said first decoding code table.
In order to make whole decoding code table keep alignment,, in this decoding code table, can also comprise some repetition values or invalid filling value so that when tabling look-up, calculate to more convenient and quicker the code table index value.For example, when even the zero number is n (0=<n<=8), directly n is moved to left 2 (promptly taking advantage of 4) group that can obtain belonging to:
{
0,0,0}, 0,0,0}, 0,0,0}, and 0,0,0}, // even the zero number is 0 o'clock
0,1,1}, 0,1,1}, 0,1,1}, and 0,1,1}, // even the zero number is 1 o'clock
0,2,2}, 0,2,2}, 0,2,2}, and 0,2,2}, // even the zero number is 2 o'clock
2,2,1}, 2,1,0}, 1,3,3}, and 1,3,3}, // even the zero number is 3 o'clock
2,5,3}, 2,3,2}, 1,4,3}, and 1,4,3}, // even the zero number is 4 o'clock
100 ,-100 ,-100}, 2,4,2}, 2,3,1}, and 2,2,0}, // even the zero number is 5 o'clock ,-100 expressions can not
This situation appears
100 ,-100 ,-100}, 2,5,2}, 2,4,1}, and 2,3,0}, // even the zero number is 6 o'clock
100 ,-100 ,-100}, 100 ,-100 ,-100}, 2,5,1}, and 2,4,0}, // even the zero number is 7 o'clock
100 ,-100 ,-100}, 100 ,-100 ,-100}, 100 ,-100 ,-100}, and 2,5,0}, // even the zero number is 8
The time
}
In embodiments of the present invention, can design the said second decoding code table based on connecting the zero number equally.
As shown in Figure 3, be the standard code code table when the coding nonzero coefficient is total number of 0 before 1 to 7 o'clock last nonzero coefficient (below represent with TotalZeros) in the prior art.
Based on above-mentioned standard code code table shown in Figure 3, (the 3rd row in the form shown in Figure 3) be example to equal 2 with nonzero coefficient below, specify the TotalZeros that decodes the decoding code table design process, detailed process is following:
At first, need find out the maximum Maxnum_LeadingZeros that connects the zero number in this case, when nonzero coefficient is 2, observe coding code table shown in Figure 3 and can know Maxnum_LeadingZeros=6.
Secondly, be divided into one group, when nonzero coefficient is 2, divide into groups as follows connecting the identical code stream of zero number:
Connecting the zero number and be 0 code stream has 4, is respectively " 111 ", " 110 ", " 101 ", " 100 ";
Connecting the zero number and be 1 code stream has 3, is respectively " 011 ", " 0101 ", " 0100 ";
Connecting the zero number and be 2 code stream has 2, is respectively " 0011 ", " 0010 ";
Connecting the zero number and be 3 code stream has 2, is respectively " 00011 ", " 00010 ";
Connecting the zero number and be 4 code stream has 2, is respectively " 000011 ", " 000010 ";
Connecting the zero number and be 5 code stream has 1, is respectively " 000001 ";
Connecting the zero number and be 6 code stream has 1, is respectively " 000000 ".
Can find out that by above-mentioned each group code stream first 1 back has only dibit (complete zero situation special processing) at most, therefore, when even the zero number is identical, can distinguish concrete code stream with the two bits of data of first 1 back.For example, the decoding code table when connecting the zero number and be 0 for 2,3}, 2,2}, 2,1}, 2,0}.Wherein, comprise two values in each set, there is two bits of data back, first " 1 " of first value representation; Second value is TotalZeors, such as, { 2; There are two bits of data, second value representation TotalZeors=3 in first 1 back of first value representation among the 3}.
Design at last when nonzero coefficient be that the decoding code table of 2 TotalZeros is following:
{
2,3}, 2,2}, 2,1}, and 2,0}, // even the zero number is 0 o'clock
2,6}, 2,5}, 1,4}, and 1,4}, // even the zero number is 1 o'clock
1,8}, 1,8}, 1,7}, and 1,7}, // even the zero number is 2 o'clock
1,10}, 1,10}, 1,9}, and 1,9}, // even the zero number is 3 o'clock
1,12}, 1,12}, 1,11}, and 1,11}, // even the zero number is 4 o'clock
0,13}, 0,13}, 0,13}, and 0,13}, // even the zero number is 5 o'clock
0,14}, 0,14}, 0,14}, and 0,14}, // even the zero number is 6 o'clock
}
Need to prove; Observing coding code table shown in Figure 3 can know; Complete zero situation, nonzero coefficient is arranged when being 2; Read this moment and may occur connecting the zero number when code stream connects zero and counts, therefore in decode procedure, need count Maxnum_LeadingZeros and control with Dalian zero greater than 6 situation, in the decode procedure if the company's of parsing zero number makes it equal 6 greater than 6.
According to above-mentioned principle, can design the decoding code table of TotalZeros when nonzero coefficient is different value, and it is combined, can generate the decoding code table of total number of last nonzero coefficient preceding 0, the promptly foregoing second decoding code table.
Need to prove; The decoding code table size of TotalZeros is different when nonzero coefficient is got different value; Therefore can design a skew code table TotalZerosTable_indexoffset [15] in addition; This code table is an index value with the nonzero coefficient number, the content that obtains of tabling look-up be nonzero coefficient when getting this value TotalZeros decoding code table at the deviation post of total code table.
In addition; The Dalian zero array of code stream is combined among the code table Maxnum_LeadingZerosTable [15] in the time of can also the nonzero coefficient number being got different value; This code table is an index value with the nonzero coefficient number, and the content that obtains of tabling look-up is the Dalian zero number of nonzero coefficient code stream when getting this value.
In embodiments of the present invention, can set up said the 3rd decoding code table based on connecting the zero number equally.
As shown in Figure 4, be the standard code code table of the number of coding some nonzero coefficients preceding 0 in the prior art.
Can know by coding code book shown in Figure 4, have only when zeroleft greater than 6 the time code stream length greater than 3, therefore can be only to code stream length smaller or equal to 3 code stream design code tabulation sign indicating number; Before code stream length can be found out some nonzero coefficients greater than 3 the time value of 0 number RunBefore with connect the zero number relation one to one arranged; Be that RunBefore=connects zero number+4, therefore adopt calculation mode can obtain the value of RunBefore in this case.
Be the design process of example explanation RunBefore decoding code table with zeroleft greater than 6 below.
Decoding can directly be read the tribit data during RunBefore from code stream, be value and the code stream length value that index is tabled look-up and obtained RunBefore with the size of these tribit data, if when the value that obtains RunBefore of tabling look-up was 7 (this value is equivalent to a special mark, can set a value arbitrarily), then obtains code stream and connects the zero number, and the value of RunBefore equals company's zero number and adds 4; Corresponding code table is: and 7,0}, 6,3}, and 5,3}; 4,3}, 3,3}, { 2; 3}, and 1,3}, 0,3}.
According to above-mentioned principle, can design the decoding code table of RunBefore, promptly foregoing the 3rd decoding code table, whole code table is following:
VLCtab2?RunBeforeTable_vlc[]=
{//{run_before,len},run_before?table
1,1}, 1,1}, 1,1}, and 1,1}, 0,1}, and 0,1}, 0,1}, and 0,1}, //zeroleft equals at 1 o'clock
2,2}, 2,2}, 1,2}, and 1,2}, 0,1}, and 0,1}, 0,1}, and 0,1}, //zeroleft equals at 2 o'clock
3,2}, 3,2}, 2,2}, and 2,2}, 1,2}, and 1,2}, 0,2}, and 0,2}, //zeroleft equals at 3 o'clock
4,3}, 3,3}, 2,2}, and 2,2}, 1,2}, and 1,2}, 0,2}, and 0,2}, //zeroleft equals at 4 o'clock
5,3}, 4,3}, 3,3}, and 2,3}, 1,2}, and 1,2}, 0,2}, and 0,2}, //zeroleft equals at 5 o'clock
1,3}, 2,3}, 4,3}, and 3,3}, 6,3}, and 5,3}, 0,2}, and 0,2}, //zeroleft equals at 6 o'clock
7,0}, 6,3}, 5,3}, and 4,3}, 3,3}, and 2,3}, 1,3}, and 0,3} //zeroleft is greater than 6 o'clock
};
In embodiments of the present invention, the gross space of required decoding code table is: 360+312+240+128+72+734+48+112+12+64=2082words.
All decoding code tables are explained in table 1:
Table 1
Concrete code table designs as follows:
VLCtab1?CoeffTokenTable_vlcN[]=
{//{len,numcoeffs,trallingones},0<=nC<2
{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},
{0,1,1},{0,1,1},{0,1,1},{0,1,1},{0,1,1},{0,1,1},{0,1,1},{0,1,1},
{0,2,2},{0,2,2},{0,2,2},{0,2,2},{0,2,2},{0,2,2},{0,2,2},{0,2,2},
{2,2,1},{2,2,1},{2,1,0},{2,1,0},{1,3,3},{1,3,3},{1,3,3},{1,3,3},
{2,5,3},{2,5,3},{2,3,2},{2,3,2},{1,4,3},{1,4,3},{1,4,3},{1,4,3},
{2,6,3},{2,6,3},{2,4,2},{2,4,2},{2,3,1},{2,3,1},{2,2,0},{2,2,0},
{2,7,3},{2,7,3},{2,5,2},{2,5,2},{2,4,1},{2,4,1},{2,3,0},{2,3,0},
{2,8,3},{2,8,3},{2,6,2},{2,6,2},{2,5,1},{2,5,1},{2,4,0},{2,4,0},
{2,9,3},{2,9,3},{2,7,2},{2,7,2},{2,6,1},{2,6,1},{2,5,0},{2,5,0},
{3,8,0},{3,9,2},{3,8,1},{3,7,0},{3,10,3},{3,8,2},{3,7,1},{3,6,0},
{3,12,3},{3,11,2},{3,10,1},{3,10,0},{3,11,3},{3,10,2},{3,9,1},{3,9,0},
{3,14,3},{3,13,2},{3,12,1},{3,12,0},{3,13,3},{3,12,2},{3,11,1},{3,11,0},
{3,16,3},{3,15,2},{3,15,1},{3,14,0},{3,15,3},{3,14,2},{3,14,1},{3,13,0},
{2,16,0},{2,16,0},{2,16,2},{2,16,2},{2,16,1},{2,16,1},{2,15,0},{2,15,0},
{0,13,1},{0,13,1},{0,13,1},{0,13,1},{0,13,1},{0,13,1},{0,13,1},{0,13,1},
{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},
//{len,numcoeffs,trallingones},2<=nC<4
{1,1,1},{1,1,1},{1,1,1},{1,1,1},{1,0,0},{1,0,0},{1,0,0},{1,0,0},
{2,4,3},{2,4,3},{2,3,3},{2,3,3},{1,2,2},{1,2,2},{1,2,2},{1,2,2},
{3,6,3},{3,3,2},{3,3,1},{3,1,0},{2,5,3},{2,5,3},{2,2,1},{2,2,1},
{2,7,3},{2,7,3},{2,4,2},{2,4,2},{2,4,1},{2,4,1},{2,2,0},{2,2,0},
{2,8,3},{2,8,3},{2,5,2},{2,5,2},{2,5,1},{2,5,1},{2,3,0},{2,3,0},
{2,5,0},{2,5,0},{2,6,2},{2,6,2},{2,6,1},{2,6,1},{2,4,0},{2,4,0},
{2,9,3},{2,9,3},{2,7,2},{2,7,2},{2,7,1},{2,7,1},{2,6,0},{2,6,0},
{3,11,3},{3,9,2},{3,9,1},{3,8,0},{3,10,3},{3,8,2},{3,8,1},{3,7,0},
{3,11,0},{3,11,2},{3,11,1},{3,10,0},{3,12,3},{3,10,2},{3,10,1},{3,9,0},
{3,14,3},{3,13,2},{3,13,1},{3,13,0},{3,13,3},{3,12,2},{3,12,1},{3,12,0},
{3,15,1},{3,15,0},{3,15,2},{3,14,1},{2,14,2},{2,14,2},{2,14,0},{2,14,0},
{2,16,3},{2,16,3},{2,16,2},{2,16,2},{2,16,1},{2,16,1},{2,16,0},{2,16,0},
{0,15,3},{0,15,3},{0,15,3},{0,15,3},{0,15,3},{0,15,3},{0,15,3},{0,15,3},
{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},
{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},
{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},
//{len,numcoeffs,trallingones},4<=nC<8
{3,7,3},{3,6,3},{3,5,3},{3,4,3},{3,3,3},{3,2,2},{3,1,1},{3,0,0},
{3,5,1},{3,5,2},{3,4,1},{3,4,2},{3,3,1},{3,8,3},{3,3,2},{3,2,1},
{3,3,0},{3,7,2},{3,7,1},{3,2,0},{3,9,3},{3,6,2},{3,6,1},{3,1,0},
{3,7,0},{3,6,0},{3,9,2},{3,5,0},{3,10,3},{3,8,2},{3,8,1},{3,4,0},
{3,12,3},{3,11,2},{3,10,1},{3,9,0},{3,11,3},{3,10,2},{3,9,1},{3,8,0},
{3,12,0},{3,13,2},{3,12,1},{3,11,0},{3,13,3},{3,12,2},{3,11,1},{3,10,0},
{3,15,1},{3,14,0},{3,14,3},{3,14,2},{3,14,1},{3,13,0},{2,13,1},{2,13,1},
{2,16,1},{2,16,1},{2,15,0},{2,15,0},{2,15,3},{2,15,3},{2,15,2},{2,15,2},
{1,16,3},{1,16,3},{1,16,3},{1,16,3},{1,16,2},{1,16,2},{1,16,2},{1,16,2},
{0,16,0},{0,16,0},{0,16,0},{0,16,0},{0,16,0},{0,16,0},{0,16,0},{0,16,0}
};
VLCtab2?CoeffTokenTable_vlc3[]=
{//{numcoeffs,trallingones},Chroma?DC,nC=-1
{1,1},{1,1},{1,1},{1,1},
{0,0},{0,0},{0,0},{0,0},
{2,2},{2,2},{2,2},{2,2},
{2,0},{3,3},{2,1},{1,0},
{4,0},{4,0},{3,0},{3,0},
{3,2},{3,2},{3,1},{3,1},
{4,2},{4,2},{4,1},{4,1},
{4,3},{4,3},{4,3},{4,3}
};
const?INT16?CoeffTokenTable_vlc3_len[8]=
{//{len},Chroma?DC,nC=-1
0,0,0,2,1,1,1,0
};
VLCtab2?CoeffTokenTable_vlc4[]=
{//{numcoeffs,trallingones},8<=nC,len=6
{1,0},{1,1},{-1,-1},{0,0},
{2,0},{2,1},{2,2},{-1,-1},
{3,0},{3,1},{3,2},{3,3},
{4,0},{4,1},{4,2},{4,3},
{5,0},{5,1},{5,2},{5,3},
{6,0},{6,1},{6,2},{6,3},
{7,0},{7,1},{7,2},{7,3},
{8,0},{8,1},{8,2},{8,3},
{9,0},{9,1},{9,2},{9,3},
{10,0},{10,1},{10,2},{10,3},
{11,0},{11,1},{11,2},{11,3},
{12,0},{12,1},{12,2},{12,3},
{13,0},{13,1},{13,2},{13,3},
{14,0},{14,1},{14,2},{14,3},
{15,0},{15,1},{15,2},{15,3},
{16,0},{16,1},{16,2},{16,3}
};
VLCtab2?TotalZerosTable[]=
{//{len,totalzeros},total_zeros?table
{0,0},{0,0},{0,0},{0,0},{1,2},{1,2},{1,1},{1,1},{1,4},{1,4},{1,3},{1,3},
{1,6},{1,6},{1,5},{1,5},{1,8},{1,8},{1,7},{1,7},{1,10},{1,10},{1,9},{1,9},
{1,12},{1,12},{1,11},{1,11},{1,14},{1,14},{1,13},{1,13},{1,15},{1,15},{1,15},{1,15},
{2,3},{2,2},{2,1},{2,0},{2,6},{2,5},{1,4},{1,4},{1,8},{1,8},{1,7},{1,7},
{1,10},{1,10},{1,9},{1,9},{1,12},{1,12},{1,11},{1,11},{0,13},{0,13},{0,13},{0,13},
{0,14},{0,14},{0,14},{0,14},{2,6},{2,3},{2,2},{2,1},{2,4},{2,0},{1,7},{1,7},
{1,8},{1,8},{1,5},{1,5},{1,10},{1,10},{1,9},{1,9},{0,12},{0,12},{0,12},{0,12},
{0,11},{0,11},{0,11},{0,11},{0,13},{0,13},{0,13},{0,13},{2,6},{2,5},{2,4},{2,1},
{2,3},{2,2},{1,8},{1,8},{1,9},{1,9},{1,7},{1,7},{1,10},{1,10},{1,0},{1,0},
{0,11},{0,11},{0,11},{0,11},{0,12},{0,12},{0,12},{0,12},{2,6},{2,5},{2,4},{2,3},
{2,1},{2,0},{1,7},{1,7},{1,8},{1,8},{1,2},{1,2},{0,10},{0,10},{0,10},{0,10},
{0,9},{0,9},{0,9},{0,9},{0,11},{0,11},{0,11},{0,11},{2,5},{2,4},{2,3},{2,2},
{1,7},{1,7},{1,6},{1,6},{0,9},{0,9},{0,9},{0,9},{0,8},{0,8},{0,8},{0,8},
{0,1},{0,1},{0,1},{0,1},{0,0},{0,0},{0,0},{0,0},{0,10},{0,10},{0,10},{0,10},
{2,3},{2,2},{1,5},{1,5},{1,6},{1,6},{1,4},{1,4},{0,8},{0,8},{0,8},{0,8},
{0,7},{0,7},{0,7},{0,7},{0,1},{0,1},{0,1},{0,1},{0,0},{0,0},{0,0},{0,0},
{0,9},{0,9},{0,9},{0,9},{1,5},{1,5},{1,4},{1,4},{1,6},{1,6},{1,3},{1,3},
{0,7},{0,7},{0,7},{0,7},{0,1},{0,1},{0,1},{0,1},{0,2},{0,2},{0,2},{0,2},
{0,0},{0,0},{0,0},{0,0},{0,8},{0,8},{0,8},{0,8},{1,4},{1,4},{1,3},{1,3},
{0,6},{0,6},{0,6},{0,6},{0,5},{0,5},{0,5},{0,5},{0,2},{0,2},{0,2},{0,2},
{0,7},{0,7},{0,7},{0,7},{0,0},{0,0},{0,0},{0,0},{0,1},{0,1},{0,1},{0,1},
{1,4},{1,4},{1,3},{1,3},{0,5},{0,5},{0,5},{0,5},{0,2},{0,2},{0,2},{0,2},
{0,6},{0,6},{0,6},{0,6},{0,0},{0,0},{0,0},{0,0},{0,1},{0,1},{0,1},{0,1},
{0,4},{0,4},{0,4},{0,4},{1,3},{1,3},{1,5},{1,5},{0,2},{0,2},{0,2},{0,2},
{0,1},{0,1},{0,1},{0,1},{0,0},{0,0},{0,0},{0,0},{0,3},{0,3},{0,3},{0,3},
{0,2},{0,2},{0,2},{0,2},{0,4},{0,4},{0,4},{0,4},{0,1},{0,1},{0,1},{0,1},
{0,0},{0,0},{0,0},{0,0},{0,2},{0,2},{0,2},{0,2},{0,3},{0,3},{0,3},{0,3},
{0,1},{0,1},{0,1},{0,1},{0,0},{0,0},{0,0},{0,0},{0,2},{0,2},{0,2},{0,2},
{0,1},{0,1},{0,1},{0,1},{0,0},{0,0},{0,0},{0,0},{0,1},{0,1},{0,1},{0,1},
{0,0},{0,0},{0,0},{0,0}
};
const?INT16?Maxnum_LeadingZerosTable[15]=
{//total_zeros?table
8,6,6,5,5,
6,6,6,6,5,
4,4,3,2,1
};
const?INT16?TotalZerosTable_indexoffset[15]=
{
0,36,64,92,116,
140,168,196,224,252,
276,296,316,332,344
};
VLCtab2?TotalZerosChromaDCTable_vlc[]=
{//{len,totalzeros},total_zeros?table,Chroma?DC
{3,3},{3,2},{2,1},{2,1},{1,0},{1,0},{1,0},{1,0},
{2,2},{2,2},{2,1},{2,1},{1,0},{1,0},{1,0},{1,0},
{1,1},{1,1},{1,1},{1,1},{1,0},{1,0},{1,0},{1,0}
};
VLCtab2?RunBeforeTable_vlc[]=
{//{run_before,len},run_before?table
{1,1},{1,1},{1,1},{1,1},{0,1},{0,1},{0,1},{0,1},
{2,2},{2,2},{1,2},{1,2},{0,1},{0,1},{0,1},{0,1},
{3,2},{3,2},{2,2},{2,2},{1,2},{1,2},{0,2},{0,2},
{4,3},{3,3},{2,2},{2,2},{1,2},{1,2},{0,2},{0,2},
{5,3},{4,3},{3,3},{2,3},{1,2},{1,2},{0,2},{0,2},
{1,3},{2,3},{4,3},{3,3},{6,3},{5,3},{0,2},{0,2},
{7,0},{6,3},{5,3},{4,3},{3,3},{2,3},{1,3},{0,3}
};
const?INT16?TrailingOnes_Index[]=
{//-100:just?for?efficiency,invalid?value
0,0,0,-100,0,-1,-1,-100,0,-1,-2,-100
};
const?INT16?TrailingOnes_Table[]=
{//-100:just?for?efficiency,invalid?value
1,1,1,-100,-1,-1,-1,-100,-100,-100,-100,-100,-100,-100,-100,-100,
1,1,1,-100,1,-1,-1,-100,-1,1,1,-100,-1,-1,-1,-100,
1,1,1,-100,1,1,-1,-100,1,-1,1,-100,1,-1,-1,-100,
-1,1,1,-100,-1,1,-1,-100,-1,-1,1,-100,-1,-1,-1,-100
};
Based on the above-mentioned code table of respectively decoding, the detailed process in the face of each syntax elements of decoding in the embodiment of the invention is elaborated down.
As shown in Figure 5, be the flow chart of decoding nonzero coefficient number and hangover coefficient number in the embodiment of the invention, may further comprise the steps:
Judge the scope of the nonzero coefficient number predicted value nC that confirms, according to the different values of nC, nonzero coefficient number NumCoeff and hangover coefficient number TrailingOnes are decoded then.
(1) under 0<=nC<2,2<=nC<4, these three kinds of situation of 4<=nC<8; Tribit data computation according to connecting first 1 back in zero number and the said code stream in the code stream goes out the code table index; Search corresponding decoding code table and obtain NumCoeff and TrailingOnes, specific as follows:
A) NumCoeff and the TrailingOnes of decoding 0<=nC<2 o'clock
Can know that according to standard code code table shown in Figure 1 the longest even zero number is 14 in the code stream at this moment, and first 1 back have only three bits.Therefore; When decoding; Obtain company's zero number and three Bit datas of first 1 back in the code stream; Calculate the code table index value according to connecting zero number and said three Bit datas, searching decoding code table CoeffTokenTable_vlcN can obtain: code stream length, NumCoeff and the TrailingOnes of first 1 back in the said code stream.
Corresponding 0<=nC<2 o'clock NumCoeff and the decoding code table space of TrailingOnes are: 15 * 8 * 3=360words.
B) NumCoeff and the TrailingOnes of decoding 2<=nC<4 o'clock
Can know that according to standard code code table shown in Figure 1 the longest even zero number is 12 in the code stream at this moment, and first 1 back have only three Bit datas.Therefore; When decoding; Obtain company's zero number and three bits of first 1 back in the code stream; Calculate the code table index value according to connecting zero number and said three Bit datas, searching decoding code table CoeffTokenTable_vlcN can obtain: code stream length, NumCoeff and the TrailingOnes of first 1 back in the said code stream.
Corresponding 2<=nC<4 o'clock NumCoeff and the decoding code table space of TrailingOnes are: 13 * 8 * 3=312words.
C) NumCoeff and the TrailingOnes of decoding 4<=nC<8 o'clock
Can know that according to standard code code table shown in Figure 1 the longest even zero number is 9 in the code stream at this moment, and first 1 back have only three Bit datas.Therefore; When decoding; Obtain company's zero number of code stream and three Bit datas of first 1 back; Calculate the code table index value according to connecting zero number and said three Bit datas, the CoeffTokenTable_vlcN that tables look-up can obtain: code stream length, NumCoeff and the TrailingOnes of first 1 back in the said code stream.
Corresponding 4<=nC<8 o'clock NumCoeff and the decoding code table space of TrailingOnes are: 10 * 8 * 3=240words.
(2) under the situation when 8<=nC, this moment, code stream length was fixed as 6 bits, therefore directly read 6 Bit datas as the code table index.
Only comprise nonzero coefficient number and hangover coefficient number among the decoding code table CoeffTokenTable_vlc4 to this situation; Therefore; Directly from said code stream, read in 6 bits; As index value, scope is 0~63 with its numerical value, and the CoeffTokenTable_vlc4 that tables look-up can obtain NumCoeff and TrailingOnes.
NumCoeff during correspondence 8<=nC and the decoding code table space of TrailingOnes are: 64 * 2=128words.
NumCoeff and TrailingOnes when (3) decoding nC=-1 (colourity DC)
In this case, calculate the code table index, search corresponding decoding code table and obtain NumCoeff and TrailingOnes according to the two bits of data that connects first 1 back in zero number and the said code stream in the code stream,
Can know according to standard code code table shown in Figure 1; The longest even zero number is 7 in the code stream at this moment; First 1 back has only two bits at most, and code length with connect the zero number relation one to one arranged, be example with preceding 5 code streams " 01 ", " 000111 ", " 1 ", " 000100 ", " 000110 " when the nC=-1 among Fig. 1; Their corresponding company's zero numbers are respectively 1,3,0,3,3; The code stream length of first " 1 " back is respectively 0,2,0,2,2, and promptly when even the zero number was got certain value, the code stream length of first " 1 " back was a fixed value.Therefore can set up two code tables: the value in code table is the code stream length (can table look-up as index with company's zero number) of first 1 back, and the code table space is 8; Value in another code table is nonzero coefficient number and hangover coefficient number, and the code table space is 64words.
Therefore, when decoding, at first obtain the company's zero number in the code stream, read two bits of first 1 back then.Obtain the code stream length of first 1 back in the code stream according to connecting the zero number CoeffTokenTable_vlc3_len that tables look-up; Calculate another code table index value according to connecting the zero number with the two bits of data that reads, the CoeffTokenTable_vlc3 that tables look-up can obtain NumCoeff and TrailingOnes.
NumCoeff during correspondence nC=-1 and the decoding code table space of TrailingOnes are: 8+64=72words.
Need to prove, when code stream connects the zero number and is 7, belong to complete zero situation, need special processing.Because in this case, connecting the zero number is at most 7, therefore judges whether greater than 7 behind the company's of having read zero number, if make it equal 7 greater than 7.
As shown in Figure 6, be the flow chart of total number TotalZeros of decoding last nonzero coefficient preceding 0 in the embodiment of the invention.
Step 601, the nonzero coefficient number that obtains according to decoding are searched the standard code code table and are obtained corresponding Dalian zero number, and confirm the code table deviant according to said nonzero coefficient number;
Step 602 reads and connects two Bit datas that zero is counted leadingzeros and first 1 back in the code stream;
Step 603 judges that the said zero that connects counts leadingzeros whether greater than said Dalian zero number; If then execution in step 604; Otherwise, execution in step 605;
Step 604, the company's zero that reads are counted leadingzeros and are set to said Dalian zero number;
Step 605 is according to said code table deviant, saidly connect that zero is counted leadingzeros and said two bits of data calculates the code table index;
Step 606 according to said code table index search decoding code table TotalZerosTable [704], obtains total number of last nonzero coefficient preceding 0 in the said code stream.
Based on above-mentioned decode procedure, the concrete condition of the TotalZeros when TotalZeros during below to the non-colourity DC of decoding and decoding colourity DC describes.
TotalZeros when (1) decoding non-colourity DC (DC coefficient)
At first, obtain two data according to the nonzero coefficient number TotalCoeff that obtained: one is the corresponding Dalian zero number (according to the statistics of the code word in the standard code code table is obtained) of this nonzero coefficient number; Another is that the deviation post of the corresponding some code words of this nonzero coefficient number in the decoding look-up table is above-mentioned code table deviant, and this deviation post TotalZerosTable_indexoffset that tables look-up can obtain.Can know that according to the standard code code table first 1 back has only two bits at most; Therefore the company's zero number that obtains code stream reads two Bit datas of first 1 back afterwards; Then; The code table deviant of having confirmed according to said two bits of data and front and connect the zero number and calculate the code table index value is found practical codeword lengths and TotalZeros, the successfully end of decode from table TotalZerosTable.
The decoding code table space of TotalZeros during corresponding non-colourity DC is: 352 * 2=704words.
Because decoding needs, and can also set up two code tables, that is:
The digital table of Dalian zero Maxnum_LeadingZerosTable and the TotalZeros code table TotalZerosTable_indexoffset that squints.
Need to prove that in this case, complete zero situation can appear in a lot of code streams, needs special processing.Concrete processing procedure is following:
Because the value among the digital table of the Dalian zero Maxnum_LeadingZerosTable is nonzero coefficient number TotalCoeff when getting different value Dalian zero number; Therefore; Behind the company's of having read zero numerical value, judge this value whether greater than the corresponding Dalian zero numerical value of this code table, if greater than then making this value equal corresponding Dalian zero numerical value in the code table.
The squint gross space of code table TotalZerosTable_indexoffset of the digital table of Dalian zero Maxnum_LeadingZerosTable and TotalZeros is: 30words.
TotalZeros when (2) decoding colourity DC
In this case, code stream length is all smaller or equal to 3 bits.From code stream, read the tribit data, calculate the code table index value together with the front nonzero coefficient number that obtains of having decoded, from code table TotalZerosChromaDCTable_vlc, find practical codeword lengths and TotalZeros according to the tribit data that obtain.
The space of code table TotalZerosChromaDCTable_vlc is: 3 * 8 * 2=48words.
As shown in Figure 7, be the flow chart of the number of decoding some nonzero coefficients preceding 0 in the embodiment of the invention.
In this decode procedure, total number TotalZeros of last nonzero coefficient preceding 0 that need obtain and the number RunBefore that a nonzero coefficient number decoder obtains some nonzero coefficients preceding 0 according to decoding before.
According to the characteristics of standard code code table, divide code length smaller or equal to 3 with greater than 3 two kinds of situation analysis.In embodiments of the present invention, only to code length smaller or equal to 3 partial design decoding code table, code length uses Calculation Method to decode greater than 3 situation.For code length smaller or equal to 3 situation; At first from code stream, read the tribit data; Number zerosleft according to residue 0 before its numerical value and known this nonzero coefficient calculates code table index value (i.e. the 3rd index value); Look into decoding code table RunBeforeTable_vlc, obtain the practical codeword lengths of code stream and the number RunBefore of this nonzero coefficient preceding 0.
This process may further comprise the steps:
Step 701 is provided with variable zerosleft, and said zerosleft represents total number of the preceding residue 0 of other nonzero coefficient; Its initial value is total number Totalzeros of last nonzero coefficient preceding 0, i.e. zerosleft=Totalzeros, and; Variable i is set; Said i represents the sequence number of nonzero coefficient number in the code stream, the nonzero coefficient number n umcoeff-1 that its initial value obtains for decoding before, i.e. i=numcoeff-1;
Step 702 judges whether zerosleft>0 and i>0; If then execution in step 703; Otherwise expression finishes to 0 individual number decoder before all nonzero coefficients, the end decode procedure;
Step 703 reads the tribit data in the code stream;
Step 704 is according to said zeroleft and the tribit data computation code table index that reads;
Step 705 is looked into decoding code table RunBeforeTable_vlc according to the code table index that obtains, and obtains the number RunBefore of i nonzero coefficient preceding 0;
Step 706 judges whether the number RunBefore of the nonzero coefficient preceding 0 that obtains equaled for 7 (this value is equivalent to a special mark, can set a particular value arbitrarily); If then execution in step 707; Otherwise, execution in step 709;
Step 707 reads and connects zero in the code stream and count leadingzeros;
Step 708 is confirmed the number RunBefore=leadingzeros+4 of i nonzero coefficient preceding 0;
Step 709 is provided with zerosleft-=runbefore, and i--, promptly obtains next nonzero coefficient;
=0 and i!=0; If then show and also need continue decoding, execution in step 703; Otherwise showing has decoded to 0 number before all nonzero coefficients finishes, and finishes decode procedure.
It is thus clear that embodiment of the invention CAVLC coding/decoding method connects the zero number based on code stream the decoding code table is divided into groups again, and the realization of tabling look-up has also been adopted in the parsing of part nonzero coefficient.Through testing authentication, the method analyzing efficiency of the embodiment of the invention has promoted about 1 times than prior art, and memory space has also reduced a lot, can well be applied in the embedded hardware design of Platform.
Compare with the coding/decoding method of prior art, the difference be mainly reflected in following some:
1. processing speed
Prior art is when decoding to video code flow; Be the data that directly read fixed bit according to statistical probability; Need a large amount of auxiliary judgment to accomplish decoding; Nonzero coefficient decoder module prior art such as maximum consuming time in existing version needs 13 judgements at every turn, and the method for the embodiment of the invention only needs 4 judgements, has greatly promoted decoding efficiency; In addition, the method for the embodiment of the invention has designed code table again according to the code word characteristics, has also adopted the realization of tabling look-up during the decoding of hangover coefficient, has reduced by 3 judgements, has promoted decoding efficiency.Under identical test environment, having tested resolution respectively is the parsing time of qcif (176 * 144), cif (352 * 288), qvga (320 * 240) code stream CAVLC module; Utilize the method for the embodiment of the invention; The parsing time of the CAVLC of three kinds of code streams is respectively 50%, 47.6%, 51.5% of prior art, and visual efficiency has promoted about 1 times.
2. memory space
Prior art need be stored the code table element of 3208words; And the method for the embodiment of the invention only need be stored the code table element of 2082words; Reduced the memory space about 2Kbytes; This is significant for limited embedded device space, can be applied in well in the embedded device of video decode H.264.
One of ordinary skill in the art will appreciate that all or part of step that realizes in the foregoing description method is to instruct relevant hardware to accomplish through program; Described program can be stored in the computer read/write memory medium; Described storage medium, as: ROM/RAM, magnetic disc, CD etc.
Correspondingly, the embodiment of the invention also provides a kind of CAVLC decode system, and is as shown in Figure 8, is the structural representation of embodiment of the invention CAVLC decode system.
In this embodiment, said system comprises:
Code stream acquiring unit 801 is used to obtain the code stream of needs decoding;
Computing unit 802 is used for confirming the nonzero coefficient number predicted value nC of said code stream;
First decoding unit 803; Be used for searching the first decoding code table of setting up in advance according to said predicted value nC; Obtain nonzero coefficient number and hangover coefficient number in the said code stream, the said first decoding code table is the decoding code table that comprises nonzero coefficient number and hangover coefficient number;
First judging unit 804 whether be used to judge said nonzero coefficient number greater than 0, and whether said hangover coefficient number is greater than 0;
Symbol resolution unit 805 is used in the said nonzero coefficient number of said first judgment unit judges greater than 0, and said hangover coefficient number is greater than 0 o'clock, and the decoding hangover connects the symbol of 1 coefficient;
Second judging unit 806 is used to judge that said nonzero coefficient number is whether less than the maximum of nonzero coefficient number;
Second decoding unit 807; Be used in the said nonzero coefficient number of said second judgment unit judges during less than the maximum of nonzero coefficient number; Search the second decoding code table of setting up in advance according to said nonzero coefficient number; Obtain total number of last nonzero coefficient preceding 0 in the said code stream, the said second decoding code table is the decoding code table that comprises total number of last nonzero coefficient preceding 0;
The 3rd decoding unit 808 is used for according to 0 total number and said nonzero coefficient number before said last nonzero coefficient, the number of other nonzero coefficients preceding 0 in the said code stream of decoding.
In embodiments of the present invention; Said system also can further comprise: the first decoding code table is set up unit (not shown); Company's zero number of each code word of standard code when being used for based on coding nonzero coefficient number and hangover coefficient number divides into groups to code stream, is divided into one group with connecting the identical code word of zero number; And according to the dibit or the tribit data (definite) of first 1 back in company's zero number of each group code stream and this group code stream according to nC value; Set up the said first decoding code table, comprise in the said first decoding code table: the code stream length of first 1 back, nonzero coefficient number, hangover coefficient number in the code stream.
Correspondingly, said first decoding unit 803 comprises:
First coefficient decoding subelement is used for said predicted value 0<=nC<8 o'clock, according to the company's zero number of first 1 front in the said code stream and tribit data computation first index value of first 1 back; And search the said first decoding code table according to said first index value, obtain the code stream length, nonzero coefficient number of first 1 back in the said code stream and the coefficient number of trailing;
Second coefficient decoding subelement is used for when said predicted value 8<=nC, confirming that said code stream length is fixed as 6; And search the said first decoding code table according to the corresponding code word of said code stream, obtain nonzero coefficient number and hangover coefficient number in the said code stream;
Tertiary system number decoder subelement is used for when said predicted value nC=-1, then searches the said first decoding code table according to company's zero number of first 1 front in the said code stream, obtains the code stream length of first 1 back in the said code stream; And according in the said code stream first 1 the back two bits of data search said first the decoding code table, obtain in the said code stream the nonzero coefficient number with the hangover coefficient number.
In embodiments of the present invention; Said system also can further comprise: the second decoding code table is set up unit (not shown); Be used for code stream being divided into groups, be divided into one group connecting the identical code word of zero number based on company's zero number of each code word of standard code of total number of 0 before last nonzero coefficient of coding; And according to the two bits of data of first 1 back in company's zero number of each group code stream and this group code stream; Set up the said second decoding code table; Comprise in the said second decoding code table: the bit number of first 1 back in the code stream, total number of last nonzero coefficient preceding 0.
Correspondingly, said second decoding unit 807 comprises:
The index value computation subunit, the two bits of data that is used for connecting according to said nonzero coefficient number, said code stream zero number and first 1 back is calculated second index value;
The decoding subelement is searched the said second decoding code table according to said second index value, obtains total number of last nonzero coefficient preceding 0 in the said code stream.
In embodiments of the present invention; Said system also can further comprise: the 3rd decoding code table is set up unit (not shown); Be used for setting up the 3rd decoding code table to code stream length smaller or equal to 3 code stream, said the 3rd decoding code table is the decoding code table of length value that comprises number and the said code stream of other nonzero coefficients preceding 0;
Said the 3rd decoding unit 808 comprises:
The decoding subelement of tabling look-up; Be used for length at said code stream smaller or equal to 3 o'clock; Total number according to residue 0 before the tribit data in the said code stream and this nonzero coefficient is calculated the 3rd index value; And search said the 3rd decoding code table according to said the 3rd index value, obtain the number of code stream length and said other nonzero coefficients preceding 0;
The computes decoded subelement is used for before said other nonzero coefficients total number of 0 greater than 6 and the tribit data that read when being predetermined value, obtains company's zero number of said code stream, and the said zero number that connects is added 4 as 0 number before said other nonzero coefficients.
Need to prove that embodiment of the invention CAVLC decode system is not limited in the said structure form, other distressed structures can also be arranged, describe no longer one by one at this.
Embodiment of the invention CAVLC decode system connects the zero number based on code stream the decoding code table is divided into groups again, and the realization of tabling look-up has also been adopted in the decoding of most of syntax elements.The present invention has not only saved the memory space of decoding code table greatly, and has improved decoding efficiency effectively, can be advantageously applied in the embedded device of video decode H.264.
Each embodiment in this specification all adopts the mode of going forward one by one to describe, and identical similar part is mutually referring to getting final product between each embodiment, and each embodiment stresses all is the difference with other embodiment.Especially, for system embodiment, because it is basically similar in appearance to method embodiment, so describe fairly simplely, relevant part gets final product referring to the part explanation of method embodiment.System embodiment described above only is schematic; Wherein said unit as the separating component explanation can or can not be physically to separate also; The parts that show as the unit can be or can not be physical locations also; Promptly can be positioned at a place, perhaps also can be distributed on a plurality of NEs.Can realize the purpose of present embodiment scheme according to the needs selection some or all of module wherein of reality.Those of ordinary skills promptly can understand and implement under the situation of not paying creative work.
The embodiment of the invention can be used in numerous general or special purpose computingasystem environment or the configuration.For example: personal computer, server computer, handheld device or portable set, plate equipment, multicomputer system, the system based on microprocessor, set top box, programmable consumer-elcetronics devices, network PC, minicom, mainframe computer, comprise DCE of above any system or equipment or the like.
The embodiment of the invention can be described in the general context of the computer executable instructions of being carried out by computer, for example program module.Usually, program module comprises the routine carrying out particular task or realize particular abstract, program, object, assembly, data structure or the like.Also can in DCE, put into practice the application, in these DCEs, by through communication network connected teleprocessing equipment execute the task.In DCE, program module can be arranged in this locality and the remote computer storage medium that comprises memory device.
More than the embodiment of the invention has been carried out detailed introduction, used embodiment among this paper the present invention set forth, the explanation of above embodiment just is used for help understanding method and apparatus of the present invention; Simultaneously, for one of ordinary skill in the art, according to thought of the present invention, the part that on embodiment and range of application, all can change, in sum, this description should not be construed as limitation of the present invention.