Background technology
In computer, the communications field, information transmits through coding, and a kind of height of antijamming capability of coded system directly influences the quality that information transmits.Existing video image code compression standard MPEG-1, MPEG-2, MPEG-4, H.261, H.263, H.264 wait and all be based on discrete digital cosine transform (DCT), what wherein H.264 adopt with MPEG-4 AVC standard is the integer transform method that performance approaches DCT, its general processing procedure is: when image transmits, transmitting terminal is inputted video image at first, carry out estimation and motion compensation after this image is divided into concrete dot matrix, carry out DCT conversion and quantification treatment then, the view data of described quantification treatment is carried out entropy coding, the data code flow that forms after encoding is sent to receiving terminal, carries out the entropy decoding by receiving terminal, re-quantization is handled, the operations such as motion compensation of DCT inverse transformation obtain decoded video image.In the said process, described entropy coding method mainly comprises variable-length encoding and arithmetic coding method, for example, in standard H.264, the entropy coding method of employing has three kinds: general variable length encoding method (UVLC), based on contextual variable length encoding method (CAVLC) with based on contextual arithmetic coding method (CABAC).Wherein, the basic thought of the UVLC entropy coding method that H.264 standard adopted is: for the code word that will transmit (Codeword), its version is:
[M zeros] [1] [INFO] or [M ones] [0] [INFO]; Wherein Zhong Jian " 1 " or " 0 " are identifier, and [M zeros] or [the M ones] of identifier front are leading character, and [INFO] of identifier back is the information symbol.
In said structure, suppose to use " 1 " as identifier, the number of " 0 " of " 1 " front is identical with the information digit of " 1 " back.In standard H.264, code word and code word sequence number (code_num) have relation one to one, with reference to following table 1:
The corresponding relation of table 1 code_num and Codeword
code_num | Codeword |
0 1 2 3 | 1 010 011 00100 |
4 5 6 7 8 9 10 11 12 13 14 15 16 | 00101 00110 00111 0001000 0001001 0001010 0001011 0001100 0001101 0001110 0001111 000010000 000010001 |
… …… …… …… …… …
At coding side,, calculate the number of " 0 " of identifier " 1 " front and the information INFO value of identifier " 1 " back by the following method for given code word sequence number code_num value:
M=log
2(code_num+1)
INFO=code_num+1-2
M;
In decoding end, decode code word sequence number code_num value by the following method:
(1) read " 0 " symbol of identifier " 1 " and front, the number of establishing the symbol of reading " 0 " is M.
(2) read the M position information of identifier " 1 " back, make its value be INFO.
(3)code_num=2
M+INFO-1。
No matter be coding side or decoding end, if code word sequence number code_num is 0, then INFO and M are 0, and vice versa.
Above-mentioned code word has figure place symmetry characteristics, promptly the information digit of the number of " 0 " of identifier " 1 " front and back as many, information bit accounts for the proportion less than 50% of whole codeword.Owing to concerning a code word, if the code word of identifier " 1 " front is made mistakes then can not be correctly decoded, so the number of " 0 " of identifier " 1 " front has too much caused the reduction of UVLC entropy coding error-resilient performance and code efficiency.
Summary of the invention
In order to improve in the video coding process based on the code efficiency of UVLC entropy coding method and to improve error-resilient performance, the present invention proposes a kind of method for video coding and corresponding video encoding/decoding method thereof, use said method to carry out the information coding, the figure place of the leading character of identifier front and the information of back symbol is inequality.
For this reason, method for video coding provided by the invention comprises:
Need to determine the code word sequence number code_num of the information correspondence of coding transmission;
Calculate the figure place M of leading character of identifier front and the information symbol INFO of identifier back according to described code word sequence number, if code_num is less than 2
m-1, then:
M=log
2(code_num+1);
INFO=code_num+1-2
M;
Otherwise:
M=log
2(code_num+2
m+n-2
m+1)-n;
INFO=code_num+2
m+n-2
m+1-2
M+n;
Wherein, m 〉=0, n 〉=1; M is figure place from the initial leading character with figure place asymmetric property of identifier front, and n is the absolute value that figure place M and the information of identifier back of the leading character of identifier front accords with INFO figure place difference;
Determine leading character according to described figure place M, leading character, identifier and information symbol INFO are formed coding codeword.
Based on aforementioned calculation, described method also comprises: according to following formula compute codeword length L ength, be beneficial to carry out encoding and decoding:
If code_num is less than 2
m-1, then,
Length=2M+1;
Otherwise,
Length=2M+n+1。
Calculating M that adopts with above-mentioned method for video coding and INFO mode corresponding video encoding/decoding method, comprising:
(1) reads the leading character figure place M of identifier front;
(2) if M<m, then,
Read the M position information of identifier back, make its value be INFO;
Otherwise,
Read the M+n position information of identifier back, make its value be INFO;
(3) if M<m, then,
code_num=2
M+INFO-1;
Otherwise,
code_num=INFO-2
m+n+2
m-1+2
M+n。
Determine to want the information of coding transmission according to gained code word sequence number code_num.
For said method, described identifier is binary one or " 0 ", and when described identifier was " 1 ", described leading character was M position " 0 ", and when described identifier was " 0 ", described leading character was M position " 1 ".
Because the entropy coding based on UVLC of the present invention has the asymmetrical characteristic of figure place, the number of the leading character symbol of identifier front and the information digit of identifier back can be inequality, the symbol figure place of leading character is lacked than the information digit of identifier back, make in whole coded data, information bit is occupied bigger proportion, this not only makes the present invention have higher code efficiency, can also reduce the leading character probability of errors, therefore, compare with figure place symmetry UVLC entropy coding method, entropy coding method of the present invention has better error-resilient performance.
Embodiment
The present invention proposes in a kind of new video coding process entropy coding method based on UVLC, if identifier adopts " 1 ", then the information digit of the number of " 0 " of identifier " 1 " front and " 1 " back can be inequality, for example, the number of " 0 " of identifier " 1 " front lacks 1 than the information digit of 1 back, below discusses and mainly carries out at this situation.Basic thought is: use " 1 " as identifier, in all code words " codeword ", the number of " 0 " of " 1 " front is lacked the n position than the information digit of " 1 " back, perhaps, in the part code word " codeword ", the number of " 0 " of " 1 " front is lacked the n position than the information digit of " 1 " back.Owing to concerning a code word, then can not be correctly decoded, can reduce probability of errors so reduce the number of " 0 " of identifier " 1 " front, thereby have better error-resilient performance if the code word of identifier " 1 " front is made mistakes.If as identifier, then the symbol of identifier front is " 1 " with " 0 ", other process is the same, below analyzes all at discussing as identifier with " 1 ".
The present invention is for all code word situations with figure place asymmetric property, can suppose that the number of " 0 " of identifier " 1 " front is lacked n than the information digit of " 1 " back, then has following general description mode:
The version of code word " Codeword " is:
[M zeros][1][INFO];
Based on the said structure form, first kind of scheme of the present invention is that at coding side, all code words all have the figure place asymmetric property.Need at first to determine the code word sequence number code_num of the code word correspondence of coding transmission,, calculate the number M of " 0 " of identifier " 1 " front and the information INFO value of identifier " 1 " back by the following method for given code word sequence number code_num value:
M=log
2(code_num+2
n)-n;
Length=2M+n+1;
INFO=code_num+2
n-2
M+n;
Wherein, n is the absolute value of the information symbol INFO figure place difference of the figure place M of leading character of identifier front and identifier back, and n 〉=1;
At last, determine leading character according to described figure place M, i.e. M position " 0 " forms coding with leading character, identifier " 1 " and information symbol INFO.
Code length Length is for helping carrying out encoding and decoding.
With the corresponding entropy decoding method of above-mentioned entropy coding method, comprise the steps:
At first from the code stream that receives, read the leading character figure place M of identifier front;
Read the M+n position information of identifier back, make its value be INFO;
Compute codeword sequence number code_num according to the following equation:
code_num=2
M+n+INFO-2
n;
Determine to want the information of coding transmission at last according to described code word sequence number code_num.
Be the embodiment that the code word " Codeword " of [M zeros] [1] [INFO] illustrates such scheme with version below:
Example 1:n=1.At coding side,, calculate the number M of " 0 " of identifier " 1 " front and the information INFO value of identifier " 1 " back by the following method for given code word sequence number code_num value:
M=log
2(code_num+2)-1。
Length=2(M+1)。
INFO=code_num+2-2
M+1
In decoding end, decode code word sequence number code_num value by the following method:
(1) read " 0 " symbol of identifier " 1 " and front, the number of establishing the symbol of reading " 0 " is M.
(2) read the M+1 position information of identifier " 1 " back, make its value be INFO.
(3)code_num=2
M+1+INFO-2
Code word sequence number code_num that obtains thus and the corresponding relation of code word Codeword are as shown in table 2.
Table 2 code word sequence number code_num and code word Codeword corresponding relation
code_num | Codeword (H.264 standard) | Codeword (the present invention) |
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | 1 010 011 00100 00101 00110 00111 0001000 0001001 0001010 0001011 0001100 0001101 0001110 0001111 000010000 000010001 000010010 000010011 000010100 000010101 000010110 000010111 000011000 000011001 000011010 000011011 000011100 000011101 | 10 11 0100 0101 0110 0111 001000 001001 001010 001011 001100 001101 001110 001111 00010000 00010001 00010010 00010011 00010100 00010101 00010110 00010111 00011000 00011001 00011010 00011011 00011100 00011101 00011110 |
29 30 31 32 | 000011110 000011111 00000100000 00000100001 | 00011111 0000100000 0000100001 0000100010 |
… …
Example 2:n=2.At coding side,, calculate the number M of " 0 " of identifier " 1 " front and the information INFO value of identifier " 1 " back by the following method for given code word sequence number code_num value:
M=log
2(code_num+4)-2。
Length=2(M+I)+1。
INFO=code_num+4-2
M+2
In decoding end, decode code word sequence number code_num value by the following method:
(1) read " 0 " symbol of identifier " 1 " and front, the number of establishing the symbol of reading " 0 " is M.
(2) read the M+2 position information of identifier " 1 " back, make its value be INFO.
(3)code_num=2
M+2+INFO-4
The corresponding relation of code word sequence number code_num and code word Codeword is as shown in table 3.
Table 3 code word sequence number code_num and code word Codeword corresponding relation
code_num | Codeword (H.264 standard) | Codeword (the present invention) |
0 1 2 3 4 5 6 7 8 9 10 | 1 010 011 00100 00101 00110 00111 0001000 0001001 0001010 0001011 | 100 101 110 111 01000 01001 01010 01011 01100 01101 01110 |
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | 0001100 0001101 0001110 0001111 000010000 000010001 000010010 000010011 000010100 000010101 000010110 000010111 000011000 000011001 000011010 000011011 000011100 000011101 000011110 000011111 00000100000 00000100001 | 01111 0010000 0010001 0010010 0010011 0010100 0010101 0010110 0010111 0011000 0011001 0011010 0011011 0011100 0011101 0011110 0011111 000100000 000100001 000100010 000100011 000100100 |
… …
Second kind of scheme of the present invention be, from a certain code word sequence number, the code word of back all has the asymmetrical characteristic of figure place, and the code word of front all has the characteristic of figure place symmetry.At coding side, need at first to determine the code word sequence number code_num of the information correspondence of coding transmission; For given code word sequence number code_num value, calculate the number M of " 0 " of identifier " 1 " front and the information INFO value of identifier " 1 " back by the following method:
If (code_num<2
m-1), then,
M=log
2(code_num+1);
Length=2M+1;
INFO=code_num+1-2
M;
Otherwise,
M=log
2(code_num+2
m+n-2
m+1)-n;
Length=2M+n+1;
INFO=code_num+2
m+n-2
m+1-2
M+n。
Wherein, m 〉=0, n 〉=1; M is figure place from the initial leading character with figure place asymmetric property of identifier front, and n is the absolute value that figure place M and the information of identifier back of the leading character of identifier front accords with INFO figure place difference; That is to say that the number of " 0 " of identifier " 1 " front is that the code word of m begins all have the figure place asymmetric property, and the number of establishing " 0 " of identifier " 1 " front is lacked n than the information digit of " 1 " back.
At last, determine described identifier, and determine the number of leading character " 0 " that with leading character, promptly M " 0 ", identifier " 1 " and information symbol INFO form and encode according to described figure place M.
Calculate above-mentioned code length Length, purpose is to help to carry out encoding and decoding.
With above-mentioned second kind of corresponding entropy decoding method of the described entropy coding method of scheme, comprise the steps:
In decoding end, (1) reads the leading character figure place M of identifier front;
(2) if M<m, then,
Read the M position information of identifier back, make its value be INFO;
Otherwise,
Read the M+n position information of identifier back, make its value be INFO;
(3) if M<m, then,
code_num=2
M+INFO-1;
Otherwise
code_num=INFO-2
m+n+2
m-1+2
M+n。
The embodiment (the association class PASCAL is described) of above-mentioned second kind of scheme is described for the code word " Codeword " of [M zeros] [1] [INFO] with version below:
Example 3:n=1, m=1.At coding side,, calculate the number M of " 0 " of identifier " 1 " front and the information INFO value of identifier " 1 " back by the following method for given code word sequence number code_num value:
if(code_num==0)
{M=0,INFO=0,Length=1。}
else
{M=log
2(code_num+3)-1.
Length=2(M+1).
INFO=code_num+3-2
M+1};
In decoding end, decode code word sequence number code_num value by the following method:
(1) read " 0 " symbol of identifier " 1 " and front, the number of establishing the symbol of reading " 0 " is M.
(2)if(M≠0)
Read the M+1 position information of identifier " 1 " back, make its value be INFO.
(3)if(M==0)
code_num=0
else
code_num=2
M+1+INFO-3;
The corresponding relation of code word sequence number code_num and code word Codeword is as shown in table 4.
Table 4 code word sequence number code_num and code word Codeword corresponding relation
code_num | Codeword (H.264 standard) | Codeword (the present invention) |
0 1 2 3 4 5 6 7 8 9 | 1 010 011 00100 00101 00110 00111 0001000 0001001 0001010 | 1 0100 0101 0110 0111 001000 001001 001010 001011 001100 |
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | 0001011 0001100 0001101 0001110 0001111 000010000 000010001 000010010 000010011 000010100 000010101 000010110 000010111 000011000 000011001 000011010 000011011 000011100 000011101 000011110 000011111 00000100000 00000100001 | 001101 001110 001111 00010000 00010001 00010010 00010011 00010100 00010101 00010110 00010111 00011000 00011001 00011010 00011011 00011100 00011101 00011110 00011111 0000100000 0000100001 0000100010 0000100011 |
… …
Example 4:n=1, m=2.At coding side,, calculate the number M of " 0 " of identifier " 1 " front and the information INFO value of identifier " 1 " back by the following method for given code word sequence number code_num value:
if(code_num<=2)
{M=log
2(code_num+1)
Length=2M+1
INFO=code_num+1-2
M}else{M=log
2(code_num+5)-1
Length=2(M+1)
INF0=code_num+5-2
M+1}
In decoding end, decode code word sequence number code_num value by the following method:
(1) read " 0 " symbol of identifier " 1 " and front, the number of establishing the symbol of reading " 0 " is M.
(2)if(M<=1)
Read the M position information of identifier " 1 " back, make its value be INFO.
else
Read the M+1 position information of identifier " 1 " back, make its value be INFO.
(3)if(M<=1)
code_num=2
M+INFO-1
else
code_num=2
M+1+INFO-5
The corresponding relation of code word sequence number code_num and code word Codeword is as shown in table 5.
Table 5 code word sequence number code_num and code word Codeword corresponding relation
code_num | Codeword (H.264 standard) | Codeword (the present invention) |
0 1 2 3 4 5 6 7 8 9 10 | 1 010 011 00100 00101 00110 00111 0001000 0001001 0001010 0001011 | 1 010 011 001000 001001 001010 001011 001100 001101 001110 001111 |
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | 0001100 0001101 0001110 0001111 000010000 000010001 000010010 000010011 000010100 000010101 000010110 000010111 000011000 000011001 000011010 000011011 000011100 000011101 000011110 000011111 00000100000 00000100001 | 00010000 00010001 00010010 00010011 00010100 00010101 00010110 00010111 00011000 00011001 00011010 00011011 00011100 00011101 00011110 00011111 0000100000 0000100001 0000100010 0000100011 0000100100 0000100101 |
… …
The above only is several concrete execution mode 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 method for the invention, can also make other multiple execution mode that is fit to own demand.