A kind of method of video macro block pattern encoding
Technical field
The present invention relates to field of multimedia communication, relate in particular to a kind of method of video macro block pattern encoding.
Technical background
Existing video image compression standard MPEG-1, MPEG-2, MPEG-4, H.261, H.263, H.264 all be based on dct transform, what wherein H.264 adopt with MPEG-4 AVC is the integer transform method that performance approaches DCT, and its general processing block frame as shown in Figure 1.
Entropy coding method wherein mainly comprises variable-length encoding and arithmetic coding method, for example, in H.264, the entropy coding method of employing has three kinds: general variable length encoding method UVLC, based on the variable length encoding method CAVLC of context relation (context-based) with based on the arithmetic coding method CABAC of context relation.
H.264 the UVLC entropy coding method that is adopted is the Exp-Golomb entropy coding method
[1], basic thought is: as identifier, the number of " 0 " of " 1 " front is identical with the information digit of " 1 " back with " 1 ".
The version of code word " Codeword " is:
[M zeros][1][INFO]
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 Codenum value:
M=log2(Codenum+1)
Length=2M+1
INFO=Codenum+1-2
M
In decoding end, decode code word sequence number Codenum 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)Codenum=2
M+INFO-1。
No matter be coding side or decoding end, if code word sequence number Codenum is 0, then INFO and M are 0, and vice versa.
The corresponding relation of code word sequence number Codenum and code word Codeword is as shown in table 1.
Code word sequence number Codenum and code word Codeword corresponding relation among the table 1H.264
Codenum |
codeword |
0 |
1 |
1 |
010 |
2 |
011 |
3 |
00100 |
4 |
00101 |
5 |
00110 |
6 |
00111 |
7 |
0001000 |
8 |
0001001 |
9 |
0001010 |
10 |
0001011 |
11 |
0001100 |
12 |
0001101 |
13 |
0001110 |
14 |
0001111 |
15 |
000010000 |
16 |
000010001 |
…… |
When adopting the UVLC method that CBP is encoded, at first to determine the mapping relations of CBP to Codenum.H.264 the mapping relations of middle CBP and Codenum are as shown in table 2.
The mapping relations of H.264 middle CBP of table 2 and Codenum
Codenum |
coded_bloek_pattern |
|
Intra_4×4 |
Inter |
0 |
47 |
0 |
1 |
31 |
16 |
2 |
15 |
1 |
3 |
0 |
2 |
4 |
23 |
4 |
5 |
27 |
8 |
6 |
29 |
32 |
7 |
30 |
3 |
8 |
7 |
5 |
9 |
11 |
10 |
10 |
13 |
12 |
11 |
14 |
15 |
12 |
39 |
47 |
13 |
43 |
7 |
14 |
45 |
11 |
15 |
46 |
13 |
16 |
16 |
14 |
17 |
3 |
6 |
18 |
5 |
9 |
19 |
10 |
31 |
20 |
12 |
35 |
21 |
19 |
37 |
22 |
21 |
42 |
23 |
26 |
44 |
24 |
28 |
33 |
25 |
35 |
34 |
26 |
37 |
36 |
27 |
42 |
40 |
28 |
44 |
39 |
29 |
1 |
43 |
30 |
2 |
45 |
31 |
4 |
46 |
32 |
8 |
17 |
33 |
17 |
18 |
34 |
18 |
20 |
35 |
20 |
24 |
36 |
24 |
19 |
37 |
6 |
21 |
38 |
9 |
26 |
39 |
22 |
28 |
40 |
25 |
23 |
41 |
32 |
27 |
42 |
33 |
29 |
43 |
34 |
30 |
44 |
36 |
22 |
45 |
40 |
25 |
46 |
38 |
38 |
47 |
41 |
41 |
In the UVLC entropy coding method that H.264 adopts, CBP is based on to the mapping method of Codenum that 4 * 4 conversion consider.For other conversion, do not consider fully.
Summary of the invention
Purpose of the present invention is exactly to propose a kind of new coded system, can carry out encoding based on the macro block mode coding CBP of 8 * 8 or 4 * 4 conversion based on general variable-length encoding.
For this reason, the present invention adopts following technical scheme.
A kind of method of video macro block pattern encoding is characterized in that the value of described macro block mode coding CBP is 6 nonnegative integers, wherein high two corresponding to chrominance block, low four corresponding to luminance block;
Described method comprises:
Video image is carried out piecemeal, be divided into several macro blocks;
Determine that macro block mode is encoded to the mapping mode of code word sequence number, this mapping mode comprises the corresponding relation of code word sequence number and intra-frame encoding mode and interframe encoding mode;
Finish the coding of the macro block mode coding CBP of general variable-length encoding according to this corresponding relation.
Described mapping mode is the conversion based on 8 * 8 or 4 * 4.
Described conversion corresponding relation is:
Codenum |
CBP XXXXXX (543210) |
Intra-frame encoding mode |
Interframe encoding mode |
0 |
63 |
0 |
1 |
15 |
15 |
2 |
31 |
63 |
3 |
47 |
31 |
4 |
0 |
16 |
5 |
14 |
32 |
6 |
13 |
47 |
7 |
11 |
13 |
8 |
7 |
14 |
9 |
5 |
11 |
10 |
10 |
12 |
11 |
8 |
5 |
12 |
12 |
10 |
13 |
61 |
7 |
14 |
4 |
48 |
15 |
55 |
3 |
16 |
1 |
2 |
17 |
2 |
8 |
18 |
59 |
4 |
19 |
3 |
1 |
20 |
62 |
61 |
21 |
9 |
55 |
22 |
6 |
59 |
23 |
29 |
62 |
24 |
45 |
29 |
25 |
51 |
27 |
26 |
23 |
23 |
27 |
39 |
19 |
28 |
27 |
30 |
29 |
46 |
28 |
30 |
53 |
9 |
31 |
30 |
6 |
32 |
43 |
60 |
33 |
37 |
21 |
34 |
60 |
44 |
35 |
16 |
26 |
36 |
21 |
51 |
37 |
28 |
35 |
38 |
19 |
18 |
39 |
35 |
20 |
40 |
42 |
24 |
41 |
26 |
53 |
42 |
44 |
17 |
43 |
32 |
37 |
44 |
58 |
39 |
45 |
24 |
45 |
46 |
20 |
58 |
47 |
17 |
43 |
48 |
18 |
42 |
49 |
48 |
46 |
50 |
22 |
36 |
51 |
33 |
33 |
52 |
25 |
34 |
53 |
49 |
40 |
54 |
40 |
52 |
55 |
36 |
49 |
56 |
34 |
50 |
57 |
50 |
56 |
58 |
52 |
25 |
59 |
54 |
22 |
60 |
41 |
54 |
61 |
56 |
57 |
62 |
38 |
41 |
63 |
57 |
38 |
Perhaps described conversion corresponding relation is:
Codenum |
CBP XXXXXX (543210) |
Intra-frame encoding mode |
Interframe encoding mode |
0 |
63 |
0 |
1 |
31 |
4 |
2 |
15 |
8 |
3 |
47 |
1 |
4 |
0 |
2 |
5 |
61 |
15 |
6 |
55 |
12 |
7 |
59 |
5 |
8 |
51 |
10 |
9 |
62 |
3 |
10 |
14 |
16 |
11 |
12 |
13 |
12 |
13 |
14 |
13 |
7 |
32 |
14 |
60 |
7 |
15 |
11 |
11 |
16 |
29 |
9 |
17 |
3 |
6 |
18 |
16 |
63 |
19 |
30 |
31 |
20 |
23 |
47 |
21 |
53 |
48 |
22 |
10 |
20 |
23 |
27 |
17 |
24 |
32 |
24 |
25 |
28 |
18 |
26 |
8 |
21 |
27 |
1 |
36 |
28 |
48 |
33 |
29 |
4 |
40 |
30 |
2 |
34 |
31 |
5 |
26 |
32 |
19 |
37 |
33 |
58 |
19 |
34 |
46 |
28 |
35 |
21 |
42 |
36 |
39 |
29 |
37 |
43 |
23 |
38 |
26 |
27 |
39 |
49 |
30 |
40 |
45 |
44 |
41 |
17 |
53 |
42 |
44 |
46 |
43 |
35 |
62 |
44 |
6 |
35 |
45 |
9 |
58 |
46 |
52 |
61 |
47 |
24 |
45 |
48 |
50 |
39 |
49 |
56 |
43 |
50 |
18 |
55 |
51 |
20 |
59 |
52 |
42 |
49 |
53 |
37 |
60 |
54 |
25 |
52 |
55 |
36 |
50 |
56 |
33 |
56 |
57 |
57 |
51 |
58 |
22 |
25 |
59 |
54 |
22 |
60 |
40 |
38 |
61 |
34 |
41 |
62 |
38 |
57 |
63 |
41 |
54 |
Coding method of the present invention is based on that the CBP characteristic of some exemplary video sequences draws, thereby can reflect the statistical property of CBP better, has coding efficiency preferably.
Description of drawings
Fig. 1 is based on the video compression framework schematic diagram of DCT in the prior art;
Fig. 2 is 8 * 8 the schematic diagram that puts in order in 16 * 16 macro blocks in the embodiment of the invention.
Embodiment
Below in conjunction with the specific embodiment of the present invention is described.
The present invention has provided a kind of CBP that encodes based on UVLC to the Codenum mapping method, is suitable for the video-frequency compression method based on 8 * 8 or 4 * 4 conversion.Wherein the value XXXXXX (543210) of macro block mode coding CBP is 6 nonnegative integers, be according in 16 * 16 macro blocks shown in Figure 28 * 8 put in order and calculate, high two corresponding to chrominance block, low four corresponding to luminance block.If the n position is 1, illustrate that then these pairing 8 * 8 have at least one summation about non-zero DCT conversion coefficient, if the n position is 0, illustrate that then these all pairing 8 * 8 dct transform coefficients all are zero.
Provide two kinds of CBP below to the Codenum mapping method
The mapping relations of table 3CBP and CodeNum
Codenum |
CBP XXXXXX (543210) |
Intra-frame encoding mode |
Interframe encoding mode |
0 |
63 |
0 |
1 |
15 |
15 |
2 |
31 |
63 |
3 |
47 |
31 |
4 |
0 |
16 |
5 |
14 |
32 |
6 |
13 |
47 |
7 |
11 |
13 |
8 |
7 |
14 |
9 |
5 |
11 |
10 |
10 |
12 |
11 |
8 |
5 |
12 |
12 |
10 |
13 |
61 |
7 |
14 |
4 |
48 |
15 |
55 |
3 |
16 |
1 |
2 |
17 |
2 |
8 |
18 |
59 |
4 |
19 |
3 |
1 |
20 |
62 |
61 |
21 |
9 |
55 |
22 |
6 |
59 |
23 |
29 |
62 |
24 |
45 |
29 |
25 |
51 |
27 |
26 |
23 |
23 |
27 |
39 |
19 |
28 |
27 |
30 |
29 |
46 |
28 |
30 |
53 |
9 |
31 |
30 |
6 |
32 |
43 |
60 |
38 |
19 |
18 |
39 |
35 |
20 |
40 |
42 |
24 |
41 |
26 |
53 |
42 |
44 |
17 |
43 |
32 |
37 |
44 |
58 |
39 |
45 |
24 |
45 |
46 |
20 |
58 |
47 |
17 |
43 |
48 |
18 |
42 |
49 |
48 |
46 |
50 |
22 |
36 |
51 |
33 |
33 |
52 |
25 |
34 |
53 |
49 |
40 |
54 |
40 |
52 |
55 |
36 |
49 |
56 |
34 |
50 |
57 |
50 |
56 |
58 |
52 |
25 |
59 |
54 |
22 |
60 |
41 |
54 |
61 |
56 |
57 |
62 |
38 |
41 |
63 |
57 |
38 |
The mapping relations of table 4CBP and CodeNum
Codenum |
CBP XXXXXX (543210) |
Intra-frame encoding mode |
Interframe encoding mode |
0 |
63 |
0 |
1 |
31 |
4 |
2 |
15 |
8 |
3 |
47 |
1 |
4 |
0 |
2 |
5 |
61 |
15 |
6 |
55 |
12 |
7 |
59 |
5 |
8 |
51 |
10 |
9 |
62 |
3 |
10 |
14 |
16 |
11 |
12 |
13 |
12 |
13 |
14 |
13 |
7 |
32 |
14 |
60 |
7 |
15 |
11 |
11 |
16 |
29 |
9 |
17 |
3 |
6 |
18 |
16 |
63 |
19 |
30 |
31 |
20 |
23 |
47 |
21 |
53 |
48 |
22 |
10 |
20 |
23 |
27 |
17 |
24 |
32 |
24 |
25 |
28 |
18 |
26 |
8 |
21 |
27 |
1 |
36 |
28 |
48 |
33 |
29 |
4 |
40 |
30 |
2 |
34 |
31 |
5 |
26 |
32 |
19 |
37 |
33 |
58 |
19 |
34 |
46 |
28 |
35 |
21 |
42 |
36 |
39 |
29 |
37 |
43 |
23 |
38 |
26 |
27 |
39 |
49 |
30 |
40 |
45 |
44 |
41 |
17 |
53 |
42 |
44 |
46 |
43 |
35 |
62 |
44 |
6 |
35 |
45 |
9 |
58 |
46 |
52 |
61 |
47 |
24 |
45 |
48 |
50 |
39 |
49 |
56 |
43 |
50 |
18 |
55 |
51 |
20 |
59 |
52 |
42 |
49 |
53 |
37 |
60 |
54 |
25 |
52 |
55 |
36 |
50 |
56 |
33 |
56 |
57 |
57 |
51 |
58 |
22 |
25 |
59 |
54 |
22 |
60 |
40 |
38 |
61 |
34 |
41 |
62 |
38 |
57 |
63 |
41 |
54 |
The given CBP of the present invention is not limited to the pairing UVLC coding method of table 1 to the Codenum mapping method, also can be applied to other UVLC coding method, as the asymmetrical UVLC coding method of the front and back information digit of flag bit 1.
The CBP that encodes based on UVLC of the present invention is at the CBP encoded question based on 8 * 8 or 4 * 4 transform methods to the Codehum mapping method.
CBP based on UVLC coding of the present invention is to the Codenum mapping method, is based on that the CBP characteristic of some exemplary video sequences draws, thereby can reflect the statistical property of CBP better, has coding efficiency preferably.
The above; only for the preferable embodiment of the present invention, but protection scope of the present invention is not limited thereto, and anyly is familiar with those skilled in the art in the technical scope that the present invention discloses; the variation that can expect easily or replacement all should be encompassed within protection scope of the present invention.Therefore, protection scope of the present invention should be as the criterion with the protection range of claims.