Summary of the invention
For solving the problems of the technologies described above, the embodiment of the invention provide a kind of H.264 based on context-adaptive variable length decoding method and device, improving the decoding efficiency of CAVLD in the video decoding process H.264, and reduce memory source and take, technical solution of the present invention is as follows:
A kind of H.264 based on the context-adaptive variable length decoding method, comprising:
In advance according to the structure of standard code table H.264 fast resolving look-up table, wherein, corresponding to row of described H.264 standard code table, described fast resolving look-up table is based on the number of the preceding zero setting of each code word, form a section by the code word of identical preposition zero number; With the value of zero setting before the code word being removed the remaining several code words in back index, arrange from small to large according to code word in the section as the section bias internal; There is the section of identical preceding zero setting to arrange from small to large according to the number of preceding zero setting;
According to the number of zero setting before the code word to be resolved, obtain described code word to be resolved and in described fast resolving look-up table, search index;
According to the described index of searching, in described fast resolving look-up table, search the syntax element value that obtains described code word to be resolved; Described syntax element value is used to carry out inverse quantization, inverse transformation and prediction addition to be handled, and obtains the decoded video output image.
Preferably, described basis in advance is standard code table structure fast resolving look-up table H.264, comprising:
H.264 in the standard code table, with a code word unit of classifying as, the code word that in the row preposition number of zeros is equated is divided into one group at each, each group constitutes three grades of code tables; And to the code word in described three grades of code tables according to from small to large sequence arrangement;
Add up the number of code word in each three grades of code table, obtain three grades of maximum number of codewords max_code_num that code table comprises of number of codewords, other three grades of code tables are expanded, make its number of codewords equal max_code_num;
With the preposition number of zeros in each three grades of code table is keyword, three grades of code tables after the described expansion are arranged from front to back according to the ascending order of preposition number of zeros, obtain a secondary code table, and according to described H.264 standard code table, obtain the syntax element value of described each code word correspondence of secondary code table, obtain secondary and resolve look-up table;
All code word row at described H.264 standard code table obtain secondary respectively and resolve look-up table, all secondarys are resolved look-up table merge, and obtain the fast resolving look-up table.
Preferably, described number according to zero setting before the code word to be resolved obtains described code word to be resolved and search index in described fast resolving look-up table, comprising:
According to resolving input value, determine corresponding secondary parsing look-up table at described fast resolving look-up table;
Obtain the preposition 0 number prefix_zero_num of code word to be resolved, prefix_zero_num be multiply by this secondary resolve max_code_num value in look-up table, obtain this code word in secondary is resolved look-up table in the middle of be offset idx2;
With the code word to be resolved prefix_zero_num+1 position that moves to left, the preceding several bit that get remaining code word as this code word at three grades of skew idx3 that resolve in the look-up tables;
With idx2 and idx3 addition, obtain the final deviant idx4 of code word to be resolved in the secondary code table.
Preferably, described according to the described index of searching, in described fast resolving look-up table, search the syntax element value that obtains described code word to be resolved, comprising:
According to the described index of searching, determine that secondary is resolved look-up table and secondary is resolved the pairing list item of code word to be resolved in the look-up table;
Described list item is read the corresponding syntax element value of acquisition.
A kind of H.264 based on context-adaptive variable length decoding device, comprising:
Fast resolving look-up table structural unit, be used in advance according to standard code table structure fast resolving look-up table H.264, wherein, corresponding to row of described H.264 standard code table, described fast resolving look-up table is based on the number of the preceding zero setting of each code word, form a section by the code word of identical preposition zero number; With the value of zero setting before the code word being removed the remaining several code words in back index, arrange from small to large according to code word in the section as the section bias internal; There is the section of identical preceding zero setting to arrange from small to large according to the number of preceding zero setting;
Search index and obtain the unit, be used for number, obtain described code word to be resolved and in described fast resolving look-up table, search index according to zero setting before the code word to be resolved;
Resolution unit is used for searching the syntax element value that obtains described code word to be resolved according to the described index of searching in described fast resolving look-up table; Described syntax element value is used to carry out inverse quantization, inverse transformation and prediction addition to be handled, and obtains the decoded video output image.
Preferably,, described fast resolving look-up table structural unit comprises:
Three grades of code table constructor unit are used at each standard code table H.264, with a code word unit of classifying as, the code word that in the row preposition number of zeros is equated are divided into one group, and each group constitutes three grades of code tables; And to the code word in described three grades of code tables according to from small to large sequence arrangement;
Three grades of code tables expand subelement, are used for adding up the number of each three grades of code table code word, obtain three grades of maximum number of codewords max_code_num that code table comprises of number of codewords, and other three grades of code tables are expanded, and make its number of codewords equal max_code_num;
Secondary is resolved look-up table constructor unit, the preposition number of zeros that is used for each three grades of code table is a keyword, three grades of code tables after the described expansion are arranged from front to back according to the ascending order of preposition number of zeros, obtain a secondary code table, and according to described H.264 standard code table, obtain the syntax element value of described each code word correspondence of secondary code table, obtain secondary and resolve look-up table;
One-level is resolved look-up table constructor unit, is used for secondary that all code words row to described H.264 standard code table obtain respectively and resolves look-up table and merge, and obtains the fast resolving look-up table.
Preferably, the described index of searching obtains the unit, comprising:
First index obtains subelement, is used for determining corresponding secondary parsing look-up table according to resolving input value at described fast resolving look-up table;
Second index obtains subelement, be used to obtain the preposition 0 number prefix_zero_num of code word to be resolved, prefix_zero_num be multiply by this secondary resolves max_code_num value in look-up table, obtain this code word in secondary is resolved look-up table in the middle of be offset idx2;
The 3rd index obtains subelement, is used for the code word to be resolved prefix_zero_num+1 position that moves to left, the preceding several bit that get remaining code word as this code word at three grades of skew idx3 that resolve in the look-up tables;
The 4th index obtains subelement, is used for idx2 and idx3 addition, obtains the final deviant idx4 of code word to be resolved in the secondary code table.
Preferably, described resolution unit comprises:
Determine subelement, be used for, determine that secondary is resolved look-up table and secondary is resolved the pairing list item of code word to be resolved in the look-up table according to the described index of searching;
Syntax element value obtains subelement, is used for described list item is read the corresponding syntax element value of acquisition.
The technical scheme that the embodiment of the invention provided, on the basis of the CAVLD standard code table that standard H.264 provides, re-construct the fast resolving look-up table, when the fast resolving look-up table is inquired about, with syntactic element, the code word of the needs in the decode procedure, and the codewords indexes that obtains by simple computation just can obtain the analytic value of corresponding code word as input by once tabling look-up, with existing query criteria H.264 the method for code table compare, the efficient of CAVLD is effectively promoted.In addition, because therefore the data volume that comprised of fast resolving look-up table, uses scheme provided by the present invention less than the data volume of canonical reference code table H.264, also can effectively save taking of memory source in the CAVLD process.
Embodiment
In order to make those skilled in the art person understand technical scheme among the present invention better, below in conjunction with the accompanying drawing in the embodiment of the invention, technical scheme in the embodiment of the invention is clearly and completely described, obviously, described embodiment only is the present invention's part embodiment, rather than whole embodiment.Based on the embodiment among the present invention, those of ordinary skills should belong to the scope of protection of the invention not making the every other embodiment that is obtained under the creative work prerequisite.
At first a kind of CAVLD method H.264 provided by the invention is described:
In advance according to the structure of standard code table H.264 fast resolving look-up table, wherein, corresponding to row of described H.264 standard code table, described fast resolving look-up table is based on the number of the preceding zero setting of each code word, form a section by the code word of identical preposition zero number; With the value of zero setting before the code word being removed the remaining several code words in back index, arrange from small to large according to code word in the section as the section bias internal; There is the section of identical preceding zero setting to arrange from small to large according to the number of preceding zero setting;
Referring to shown in Figure 2, according to the fast resolving look-up table of above-mentioned structure, CAVLD method provided by the present invention may further comprise the steps:
S101 according to the number of zero setting before the code word to be resolved, obtains described code word to be resolved and search index in described fast resolving look-up table;
S102 according to the described index of searching, searches the syntax element value that obtains described code word to be resolved in described fast resolving look-up table;
Wherein, as shown in Figure 1, resulting syntax element value is used for carrying out inverse quantization, inverse transformation and prediction addition at follow-up H.264 decode procedure to be handled, and obtains the decoded video output image.
To be described in further detail fast resolving look-up table building method of the present invention and corresponding coding/decoding method below:
Figure 3 shows that fast resolving look-up table building method flow chart of the present invention, may further comprise the steps:
S100a H.264 in the standard code table, with a code word unit of classifying as, is divided into one group with the code word that in the row preposition number of zeros is equated at each, and each group constitutes three grades of code tables; And to the code word in described three grades of code tables according to from small to large sequence arrangement;
Wherein, the preposition number of zeros of code word is meant that from left to right first of a code word is the number of 0bit position on the left side of 1 bit, and for example: code word 111 preposition number of zeros are 0; The preposition number of zeros of code word 00011 is 3.
S100b adds up the number of code word in each three grades of code table, obtains three grades of maximum number of codewords max_code_num that code table comprises of number of codewords, and other three grades of code tables are expanded, and makes its number of codewords equal max_code_num;
S100c, with the preposition number of zeros in each three grades of code table is keyword, three grades of code tables after the described expansion are arranged from front to back according to the ascending order of preposition number of zeros, obtain a secondary code table, and according to standard code table H.264, obtain the syntax element value of described each code word correspondence of secondary code table, obtain secondary and resolve look-up table;
S100d at all code words row of standard code table H.264, carries out above-mentioned S100a-S100c respectively and obtains secondary and resolve look-up table, all secondarys is resolved look-up table merge, and constitutes an one-level parsing look-up table, fast resolving look-up table promptly of the present invention.
Figure 4 shows that code word to be resolved of the present invention searches index preparation method flow chart, may further comprise the steps:
S101a according to resolving input value, determines corresponding secondary parsing look-up table at described fast resolving look-up table;
Certain input value during with parsing as this first index of code word to be resolved idx1, is resolved the secondary that finds the code word place in the look-up table by this value in one-level and is resolved look-up table;
S101b obtains the preposition 0 number prefix_zero_num of code word to be resolved, prefix_zero_num be multiply by this secondary resolve max_code_num value in look-up table, obtain this code word in secondary is resolved look-up table in the middle of be offset idx2;
Wherein, the idx2 that is calculated three grades of this code word place first addresss of resolving look-up tables just.
S101c, with the code word to be resolved prefix_zero_num+1 position that moves to left, the preceding several bit that get remaining code word as this code word at three grades of skew idx3 that resolve in the look-up tables;
S101d with idx2 and idx3 addition, obtains the final deviant idx4 of code word to be resolved in the secondary code table.
Figure 5 shows that the syntax element value method flow diagram of searching of the present invention, may further comprise the steps:
S102a according to searching index, determines that secondary is resolved look-up table and secondary is resolved the pairing list item of code word to be resolved in the look-up table;
S102b reads the corresponding syntax element value of acquisition to described list item.
In the middle of decode procedure H.264, a module very important also very consuming time is exactly entropy decoder module (CAVLD), for the code stream of encoding out with CAVLC, in the identifying code that H.264 normal structure provides, the shared time of entropy decoder module accounts for about 48% of overall decode time greatly, and the parsing of transform coefficient magnitude tabulation has taken most times of resolving, and therefore the optimization to transform coefficient magnitude tabulation parsing part will improve decoding speed greatly.
The technical scheme that the embodiment of the invention provided, on the basis of the CAVLD standard code table that standard H.264 provides, re-construct the fast resolving look-up table, when the fast resolving look-up table is inquired about, with syntactic element, the code word of the needs in the decode procedure, and the codewords indexes that obtains by simple computation just can obtain the analytic value of corresponding code word as input by once tabling look-up, with existing query criteria H.264 the method for code table compare, the efficient of CAVLD is effectively promoted.In addition, because therefore the data volume that comprised of fast resolving look-up table, uses scheme provided by the present invention less than the data volume of canonical reference code table H.264, also can effectively save taking of memory source in the CAVLD process.
Below in conjunction with a concrete example, H.264 CAVLD method of the present invention is described, syntactic element with the code word of resolving coeff_token (coefficient characterization value) is an example, and table 1 is depicted as the element T otalcoeff (non-zero transform coefficient sum) of the parsing coeff_token that provides in the standard H.264 and primary standard code table mapping toTotalCoeff (coeff_token) the and TrailingOnes (coeff_token) of TrailingOnes (the conversion coefficient quantity of trailing):
Table 1
For ease of describing, below choose these row of nC==-1 and come the present invention program is described:
At first construct the fast resolving look-up table, method is as follows:
1) in original code table, with this code word unit of classifying as of nC==-1, the code word that in the row preceding zero setting is equated is divided into one group, be called three grades of code tables.In these row of nC==-1, by grouping, obtain 8 three grades of code tables, group number is 0 to 7, and is as shown in table 2:
Group number |
Preposition zero number |
Code word |
??0 |
??0 |
??1 |
??1 |
??1 |
??01 |
??2 |
??2 |
??001 |
??3 |
??3 |
??0001?11??0001?00??0001?10??0001?01 |
??4 |
??4 |
??0000?11??0000?10 |
??5 |
??5 |
??0000?011??0000?010 |
??6 |
??6 |
??0000?0011??0000?0010 |
??7 |
??7 |
??0000?000 |
Table 2
2) in three grades of code tables, code word is arranged from front to back according to order from small to large, obtains table 3:
Group number |
Preposition zero number |
Code word |
??0 |
??0 |
??1 |
??1 |
??1 |
??01 |
??2 |
??2 |
??001 |
??3 |
??3 |
??0001?00??0001?01??0001?10??0001?11 |
??4 |
??4 |
??0000?10??0000?11 |
??5 |
??5 |
??0000?010??0000?011 |
??6 |
??6 |
??0000?0010??0000?0011 |
??7 |
??7 |
??0000?000 |
Table 3
3) add up the quantity of code word in each three grades of code table, find out three grades of maximum number of codewords that code table comprises of code word, be designated as max_code_num.Can draw max_code_num=4 by table 4;
Three grades of code table sequence numbers |
Preposition zero number |
Code word |
Three grades of code table inner code word numbers |
??0 |
??0 |
??1 |
??1 |
??1 |
??1 |
??01 |
??1 |
??2 |
??2 |
??001 |
??1 |
??3 |
??3 |
??0001?00??0001?01??0001?10??0001?11 |
??4 |
Three grades of code table sequence numbers |
Preposition zero number |
Code word |
Three grades of code table inner code word numbers |
??4 |
??4 |
??0000?10??0000?11 |
??2 |
??5 |
??5 |
??0000?010??0000?011 |
??2 |
??6 |
??6 |
??0000?0010??0000?0011 |
??2 |
??7 |
??7 |
??0000?000 |
??1 |
Table 4
4) if the number of codewords in other three grades of code tables expands other three grades of code tables less than max_code_num in should being listed as, make it equal max_code_num.Because except sequence number was three grades of code tables of 3, number of codewords contained in other three grades of code tables was all less than 4, so will the code table of other groups be expanded in table 4; The principle that expands is that every group number of codewords is extended to max_code_num code word.Concrete grammar is as follows:
A. at first zero setting before all of each code word in these three grades of code tables of max_code_num is removed, remained code table substantially.
B. wait that current the preceding zero setting of expanding the code table code word removes, obtain the residue code table of current code table, after the code word of the residue code table of current code table, add 0 and 1 of suitable figure place then, make that to add the code word that remainder codewords after the figure place and basis remain in the code table identical;
C. for the remainder codewords after expanding is added on the preceding zero setting of removing in the b step, so just obtained final expansion code word.
Below with sequence number in the his-and-hers watches 4 be 2,5 three grades of code tables be extended for example:
A. be that code word in three grades of code tables of 3 goes preposition 0 to handle at first to sequence number:
Sequence number is 3 code table |
Remove the residue code table after preposition 0 |
?0001?00?0001?01?0001?10?0001?11 |
?1?00?1?01?1?10?1?11 |
B. for 3 grades of code tables 2, comprise a list item 001, zero setting 00 before removing, remainder codewords is 1;
For 3 grades of code tables 5, comprise two list items 0,000 010,0,000 011, zero setting 00000 before removing, remainder codewords is 10,11
In order to make remainder codewords identical with residue some in the code table,
Remainder codewords 1 back to 3 grades of code tables 2 adds 00,01,10,11 respectively, and just this table is extended for 4 code words by a code word, obtain at last with the residue code epiphase of three grades of code tables 3 with 100,101,110,111.
Remainder codewords 10 back to 3 grades of code tables 5 adds 0 and 1, and remainder codewords 11 backs add 0 and 1, that is to say that each code word in this table is extended for two code words, obtain at last with the residue code epiphase of three grades of code tables 3 together 100,101,110,111.
C. add the preceding zero setting of removing:
The expansion result that 3 grades of code tables 2 obtain at last is: 00100,00101,00110,00111;
The expansion result that 3 grades of code tables 5 obtain at last is: 0,000 0100,0,000 0101,0,000 0110,0,000 0111.
5) three grades of code tables after all are expanded are foundation with the number of the preceding zero setting in each three grades of code table, sort according to little the arrangement from front to back to big order, constitute a secondary code table, and are as shown in table 5:
Three grades of code table sequence numbers |
Preposition zero number |
Expand the back code word |
Three grades of code table inner code word numbers |
??0 |
??0 |
??100??101??110??111 |
??4 |
??1 |
??1 |
??0100??0101??0110??0111 |
??4 |
??2 |
??2 |
??00100??00101??00110??00111 |
??4 |
??3 |
??3 |
??0001?00??0001?01??0001?10??0001?11 |
??4 |
??4 |
??4 |
??00001?00??00001?01??00001?10??00001?11 |
??4 |
??5 |
??5 |
??000001?00??000001?01??000001?10??000001?11 |
??4 |
Three grades of code table sequence numbers |
Preposition zero number |
Expand the back code word |
Three grades of code table inner code word numbers |
??6 |
??6 |
??0000001?00??0000001?01??0000001?10??0000001?11 |
??4 |
??7 |
??7 |
??00000001?00??00000001?01??00000001?10??00000001?11 |
??4 |
Table 5
6) resolve look-up table according to the code word sequential configuration secondary in the secondary code table,, comprise the syntactic element that needs are resolved in the list item for list item of each code word structure.For current look-up table, each code word need parse TrailingOnes and these two syntactic elements of TotalCoeff, therefore according to standard scale, obtain the TrailingOnes and the TotalCoeff syntax element value of each code word correspondence of secondary code table, obtain secondary as shown in table 6 and resolve look-up table:
Three grades of code table sequence numbers |
Preposition zero number |
Expand the back code word |
??TrailingOnes |
??TotalCoeff |
0 |
??0 |
??100??101??110??111 |
??1??1??1??1 |
??1??1??1??1 |
??1 |
??1 |
??0100??0101??0110??0111 |
??0??0??0??0 |
??0??0??0??0 |
??2 |
??2 |
??00100??00101??00110??00111 |
??2??2??2??2 |
??2??2??2??2 |
??3 |
??3 |
??0001?00??0001?01??0001?10??0001?11 |
??0??3??1??0 |
??2??3??2??1 |
Three grades of code table sequence numbers |
Preposition zero number |
Expand the back code word |
??TrailingOnes |
??TotalCoeff |
??4 |
??4 |
??00001?00??00001?01??00001?10??00001?11 |
??0??0??0??0 |
??4??4??3??3 |
??5 |
??5 |
??000001?00??000001?01??000001?10??000001?11 |
??2??2??1??1 |
??3??3??3??3 |
??6 |
??6 |
??0000001?00??0000001?01??0000001?10??0000001?11 |
??2??2??1??1 |
??4??4??4??4 |
??7 |
??7 |
??00000001?00??00000001?01??00000001?10??00000001?11 |
??3??3??3??3 |
??4??4??4??4 |
Table 6
Secondary shown in the table 6 is resolved look-up table, can be expressed as a following two-dimensional array:
BYTE?H.264DEC_coeff_token_chormaDC[][4]=
{
1,1}, // 1,1, code word 1|XX
{1,1},
{1,1},
{1,1},
0,0}, // 0,0, code word 01|XX
{0,0},
{0,0},
{0,0},
2,2}, // 2,2, code word 001|XX
{2,2},
{2,2},
{2,2},
0,2}, // 0,2, code word 0,001 00
3,3}, // 3,3, code word 0,001 01
1,2}, // 1,2, code word 0,001 10
0,1}, // 0,1, code word 0,001 11
0,4}, // 0,4, code word 0,000 10
{0,4},
0,3}, // 0,3, code word 0,000 11
{0,3},
2,3}, // 2,3, code word 0,000 010
{2,3},
1,3}, // 1,3, code word 0,000 011
{1,3},
2,4}, // 2,4, code word 0,000 0010
{2,4},
1,4}, // 1,4, code word 0,000 0011
{1,4},
3,4}, // 3,4, code word 0,000 000
{3,4},
{3,4},
{3,4},
};
7) above-mentioned steps 1)-6) secondary of nC==-1 these row that constructed the primary standard code table of the element T otalcoeff that resolves coeff_token and TrailingOnes resolves look-up table.Repeat above-mentioned steps, construct secondary respectively for other code word row of table 1 and resolve look-up table.Then all secondarys are resolved look-up table and merge, just can obtain final one-level and resolve look-up table.
On the basis of the fast resolving look-up table of above-mentioned structure, be example with nc==-1, be that 001xx and code word are 0,001 11 to be that example comes corresponding coding/decoding method is described with code word to be resolved:
The first step: obtain code word and in resolving look-up table, search index
In the resolving of TrailingOnes and TotalCoeff, code word code stream to be resolved and corresponding nC value as input, are determined that by calculating its step of idx in look-up table is as follows:
1), resolve the secondary parsing look-up table that finds the code word place in the look-up table for H.264DEC_coeff_token_chormaDC[in one-level by this value owing to be input as nc==-1] [4]; Be equivalent to find nc==-1 pairing row in the primary standard code table.
2) calculate the preposition zero number of each code word.
The preceding zero setting prefix_zero_num=2 of 001xx;
0,001 11 preceding zero setting prefix_zero_num=3.
3) calculate middle offset index.
Skew idx2=prefix_zero_num*max_code_num=2*4=8 in the middle of the 001xx;
Skew idx2=prefix_zero_num*max_code_num=3*4=12 in the middle of 0,001 11.
4) this place is owing to have 4 list items in each three grades parsing look-up tables, so each code word is moved to left behind the prefix_zero_num+1 position, get preceding two bit of remaining code word, these two bit are become 10 system numerical value by Binary Conversion, as the skew idx3s of this code word in three grades of parsing look-up tables.
001xx by above operation after, idx3 is binary number XX, is 0,1 in metric span, 2,3;
0,001 11 by after the above operation, and idx3 is that binary number 11 is a decimal number 3.
5), obtain the final deviant idx4 of this code word in the secondary code table with idx2 and idx3 addition;
The idx4=8+idx3 of 001xx, its span of idx3 is 8,9,10,11
0,001 11 idx4=12+3=15
The 3rd step: the obtaining of the corresponding syntax element value of code word:
1) H.264DEC_coeff_token_chormaDC[] in [2] table, by
H.264DEC_coeff_token_chormaDC[idx4] obtain the pairing list item of code word.
2) H.264DEC_coeff_token_chormaDC[idx4] [0] gets access to TrailingOnes, H.264DEC_coeff_token_chormaDC[idx4] [1] get access to TotalCoeff.
For example:
For 001xx:
By tabling look-up
H.264DEC_coeff_token_chormaDC[8] [0] or
H.264DEC_coeff_token_chormaDC[9] [0] or
H.264DEC_coeff_token_chormaDC[10] [0] or
H.264DEC_coeff_token_chormaDC[11] [0] or
Obtain TrailingOnes=2
By tabling look-up
H.264DEC_coeff_token_chormaDC[8] [1] or
H.264DEC_coeff_token_chormaDC[9] [1] or
H.264DEC_coeff_token_chormaDC[10] [1] or
H.264DEC_coeff_token_chormaDC[11] [1] or
TotalCoeff=2
For 0,001 11:
By tabling look-up H.264DEC_coeff_token_chormaDC[15] [0]
Obtain TrailingOnes=2
Table look-up H.264DEC_coeff_token_chormaDC[15] [1]
Obtain TotalCoeff=2
Can see, as long as calculate by simple, obtain just can obtaining needed syntax element value after the idx of each syntactic element in resolving look-up table by once searching, this method is compared with the analytical algorithm that normal structure provides, significantly reduced the judgement number of times and searched number of times, improved decoding speed greatly, from above-mentioned example, can also see, the look-up table that the fast resolving of neotectonics is searched us only has the 64byte size, has saved memory source effectively and has taken.It will be understood by those skilled in the art that; said method is equally applicable in CAVLD the parsing to syntactic elements such as level_prefix (amplitude prefix), total_zero (total number of zeros), run_before (before the nonzero coefficient null number) continuously, and these also should be within protection scope of the present invention.
Corresponding to top method embodiment, the present invention also provide a kind of H.264 based on context-adaptive variable length decoding device, referring to shown in Figure 6, this device comprises:
Fast resolving look-up table structural unit 600, be used in advance according to standard code table structure fast resolving look-up table H.264, wherein, corresponding to row of described H.264 standard code table, described fast resolving look-up table is based on the number of the preceding zero setting of each code word, form a section by the code word of identical preposition zero number; With the value of zero setting before the code word being removed the remaining several code words in back index, arrange from small to large according to code word in the section as the section bias internal; There is the section of identical preceding zero setting to arrange from small to large according to the number of preceding zero setting;
Search index and obtain unit 610, be used for number, obtain described code word to be resolved and in described fast resolving look-up table, search index according to zero setting before the code word to be resolved;
Resolution unit 620 is used for searching the syntax element value that obtains described code word to be resolved according to the described index of searching in described fast resolving look-up table; Described syntax element value is used to carry out inverse quantization, inverse transformation and prediction addition to be handled, and obtains the decoded video output image.
Referring to shown in Figure 7, described fast resolving look-up table structural unit 600 can comprise:
601 3 grades of code table constructor unit are used at each standard code table H.264, with a code word unit of classifying as, the code word that in the row preposition number of zeros is equated are divided into one group, and each group constitutes three grades of code tables; And to the code word in described three grades of code tables according to from small to large sequence arrangement;
602 3 grades of code tables expand subelement, be used for adding up the number of each three grades of code table code word, obtain three grades of maximum number of codewords max_code_num that code table comprises of number of codewords, other three grades of code tables are expanded, make its number of codewords equal max_code_num;
603 secondarys are resolved look-up table constructor unit, the preposition number of zeros that is used for each three grades of code table is a keyword, three grades of code tables after the described expansion are arranged from front to back according to the ascending order of preposition number of zeros, obtain a secondary code table, and according to described H.264 standard code table, obtain the syntax element value of described each code word correspondence of secondary code table, obtain secondary and resolve look-up table;
604 one-levels are resolved look-up table constructor unit, are used for secondary that all code words row to described H.264 standard code table obtain respectively and resolve look-up table and merge, and obtain the fast resolving look-up table.
Referring to shown in Figure 8, the described index of searching obtains unit 610, can comprise:
First index obtains subelement 611, is used for determining corresponding secondary parsing look-up table according to resolving input value at described fast resolving look-up table;
Second index obtains subelement 612, be used to obtain the preposition 0 number prefix_zero_num of code word to be resolved, prefix_zero_num be multiply by this secondary resolves max_code_num value in look-up table, obtain this code word in secondary is resolved look-up table in the middle of be offset idx2;
The 3rd index obtains subelement 613, is used for the code word to be resolved prefix_zero_num+1 position that moves to left, the preceding several bit that get remaining code word as this code word at three grades of skew idx3 that resolve in the look-up tables;
The 4th index obtains subelement 614, is used for idx2 and idx3 addition, obtains the final deviant idx4 of code word to be resolved in the secondary code table.
Referring to shown in Figure 9, described resolution unit 620 can comprise:
Determine subelement 621, be used for, determine that secondary is resolved look-up table and secondary is resolved the pairing list item of code word to be resolved in the look-up table according to the described index of searching;
Syntax element value obtains subelement 622, is used for described list item is read the corresponding syntax element value of acquisition.
For the convenience of describing, be divided into various unit with function when describing above the device and describe respectively.Certainly, when enforcement is of the present invention, can in same or a plurality of softwares and/or hardware, realize the function of each unit.
As seen through the above description of the embodiments, those skilled in the art can be well understood to the present invention and can realize by the mode that software adds essential general hardware platform.Based on such understanding, the part that technical scheme of the present invention contributes to prior art in essence in other words can embody with the form of software product, this computer software product can be stored in the storage medium, as ROM/RAM, magnetic disc, CD etc., comprise that some instructions are with so that a computer equipment (can be a personal computer, server, the perhaps network equipment etc.) carry out the described method of some part of each embodiment of the present invention or embodiment.
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 difference with other embodiment.Especially, for device embodiment, because it is substantially similar in appearance to method embodiment, so describe fairly simplely, relevant part gets final product referring to the part explanation of method embodiment.Device 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 network element.Can select wherein some or all of module to realize the purpose of present embodiment scheme according to the actual needs.Those of ordinary skills promptly can understand and implement under the situation of not paying creative work.
The above only is the specific embodiment of the present invention; should be pointed out that for those skilled in the art, under the prerequisite that does not break away from the principle of the invention; can also make some improvements and modifications, these improvements and modifications also should be considered as protection scope of the present invention.