Summary of the invention
Technical problem to be solved by this invention is, at the deficiencies in the prior art, motion-vector prediction generates in a kind of video image method and device thereof are proposed, solve because macro block (mb) type is various and the variable MV that causes of block size generates complicated problems, make the generative process of motion-vector prediction simple, control logic is clear, and is simple for structure, is convenient to software and hardware and realizes.
Another technical problem to be solved by this invention is, at the deficiencies in the prior art, motion-vector prediction generating apparatus in a kind of video image is proposed, it is many to be used for solving prior art motion-vector prediction generate pattern, control is complicated, the structure irregularity, adjacent states correlation complexity is unfavorable for the problem that hardware is realized and is difficult to expand.
The objective of the invention is to realize by the following technical solutions:
The method that motion-vector prediction generates in a kind of video image comprises the steps:
Step 1, initialization, master control module are tabled look-up according to the type of current macro and are obtained the whole control word of corresponding macro block;
Step 2, master control module read corresponding sub-block control word in the whole control word of this macro block, according to the content of current control word, if carry out spatial domain prediction, execution in step three according to the numerical value in the sub-piece number of the macro block register; If carry out time domain prediction, execution in step four; If be the access copy mode, then execution in step five;
Step 3, carry out spatial domain prediction by the spatial domain prediction module and handle, derive the prediction MV numerical value of current block; Execution in step six;
Step 4, carry out time domain prediction by the time domain prediction module and handle, derive the prediction MV numerical value of current block; Execution in step six;
Step 5, employing access copy mode generate the MV of current block, and the MV of current macro is (0,0) vector; Execution in step seven;
Step 6, judge whether to exist the vector residual error according to the content of current control word, if any, carrying out read group total, promptly final MV is prediction MV and vector residual error sum; As do not have, carry out next step;
Step 7, judge that whether current sub-block is last of macro block, if, finish the generation of current macro MV and handle, if not, the numerical value in the sub-piece number of the macro block register adds 1, execution in step two.
Described control word comprises at least: Direct Model time domain prediction (Direct), symmetric pattern time domain prediction (Symmetric), MVD information (Read_MVD), spatial domain prediction (MV_Pred), wherein, Direct Model time domain prediction (Direct) is used for expression and carries out the processing of Direct Model time domain prediction, whether carries out described operation with 1 bit representation;
Symmetric pattern time domain prediction (Symmetric) is used for expression and carries out the processing of symmetric pattern time domain prediction, whether carries out described operation with 1 bit representation;
MVD information (Read_MVD) is used for expression and whether reads MVD information, is used to represent whether carry out described operation with 1;
Spatial domain prediction (MV_Pred) is used for expression and carries out spatial domain prediction and handle, and wherein, whether carries out this operation with 2 bit representations, and operate once when carrying out this operation or front and back to each once.
Method of the present invention makes that by the whole control word of macro block is set the prediction generative process of motion vector is simple, and control logic is clear, and is simple for structure, is convenient to software and hardware and realizes.
The present invention also provides the device that motion-vector prediction generates in a kind of video image, and this device comprises master control module, spatial domain prediction module, time domain prediction module, access copy module; Wherein,
Described master control inside modules is preserved the whole control of all types of macro blocks word table, described master control module analysis current macro type, obtain the control word of current macro by tabling look-up, to spatial domain prediction module or time domain prediction module or access copy module or its combination transmitting control commands, and handle the motion vector that generates video image according to the content of control word according to above each module return information;
The control command that described spatial domain prediction module is sent according to the master control module is carried out corresponding spatial domain prediction and is handled, and the prediction MV that will obtain sends to the master control module;
The control command that described time domain prediction module is sent according to the master control module is carried out corresponding time domain prediction and is handled, and the prediction MV that will obtain sends to the master control module;
The control command that access copy module is sent according to the master control module is carried out the access copy process, and the MV that obtains is sent to the master control module.
This device can also increase the respective handling module according to actual conditions, or each submodule of front is increased function.In the corresponding processing module of increase or in to each submodule increase function of front, increase or revise the control field of the macro block integral body control word table of master control inside modules preservation, the master control module is finished the processing module of increase or the controlled function of each submodule increase function according to the meaning of the respective field of control word in the whole control of this macro block word table.
In the present invention, each module in this device is come whole the driving by state machine, drives each module work according to method flow, and wherein, each module is made of the prior art module.
Apparatus structure provided by the invention is regular, control is simple, the correlation of adjacent states is simple, and,, can increase corresponding processing module by increasing or revise the control field of control word in the control table, can carry out the function expansion easily, and each submodule is relatively independent, does not influence it and independently operates.
Embodiment
The present invention is described in further detail (is example with AVSVideo 1.0 coding standards) below in conjunction with specific embodiment and accompanying drawing:
The invention provides method and device thereof that a kind of novel motion-vector prediction that is used for video decode generates, its purpose is the mode with control word, module by regular unanimity realizes that the prediction of motion vector generates, the motion-vector prediction generate pattern is many in the existing main flow video coding of solution, control is complicated, is unfavorable for hard-wired problem.
Six big classes below macro block (mb) type has in AVS 1.0:
In following table, to the reference key numbering of reference picture, being numbered-1 expression did not have reference picture before and after reff/refb represented respectively, and 0 represents the nearest of reference picture and present image, and 1 secondly, and 3 presentation videos distance farthest; Vecf_x/y and vecb_x/y represent x and the y numerical value of front and back to MV respectively.
1.Intra Mode (frame mode, I/P/B)
reff | -1 | refb | -1 |
vecf_x | 0 | vecb_x | 0 |
vecf_y | 0 | vecb_y | 0 |
The interior frame by frame coding of frame mode is handled macro block, does not have MV, does not need to carry out predicted operation, does not also have MVD information, and sub-piece can be 16 * 16,8 * 8.
2, Direct Mode (Direct Model, B)
A) Spatial Direct (spatial domain Direct Model)
reff | 0 | refb | 0 |
vecf_x | mvpf_x | vecb_x | mvpb_x |
vecf_y | mvpf_y | vecb_y | mvpb_y |
When corresponding blocks was intraframe coding, Direct Model was not because not with reference to MV, handle and become the spatial domain mode when back.Because need sagittal MV, need carry out twice spatial domain prediction operation of forward-backward algorithm this moment, but not have MVD information, sub-piece can be 16 * 16,8 * 8.Mvpf_x/y and mvpb_x/y represent x and the y numerical value of front and back to prediction MV respectively.
B) Temporal Direct (time domain direct mode)
reff |
0 |
refb |
0 |
vecf_x |
scalf_x |
vecb_x |
scalb_x |
vecf_y |
scalf_y |
vecb_y |
scalb_y |
Time domain direct mode is derived front and back to MV by distance between computing block by its proportionate relationship, does not have MVD information, but need carry out the proportional zoom calculating of time domain, and sub-piece can be 16 * 16,8 * 8.Scalf_x/y and scalb_x/y represent x and the y numerical value of front and back to convergent-divergent MV respectively.
3, Forward Mode (forward mode, P/B)
reff | ref_frame | refb | -1 |
vecf_x | mvdf_x+mvp_x | vecb_x | 0 |
vecf_y | mvdf_y+mvp_y | vecb_y | 0 |
When forward mode is handled the forward direction reference picture index number from code stream and MVD information obtain (ref_frame) together, carry out spatial domain prediction and handle the back and obtain prediction MV (mvp_x/y), obtain final forward direction MV after adding vector residual error (mvdf_x/y).There is not the back this moment to MV.Sub-piece can be 16 * 16,16 * 8,8 * 16 and 8 * 8.
4, Symmetric Mode (symmetric pattern, B)
reff | ref_frame | refb | ~ref_frame |
vecf_x | mvdf_x+mvp_x | vecb_x | scalb_x |
vecf_y | mvdf_y+mvp_y | vecb_y | scalb_y |
When symmetric pattern is handled the forward direction reference picture index number from code stream and MVD information obtain (ref_frame) together, carry out spatial domain prediction and handle the back and obtain prediction MV (mvp_x/y), obtain final forward direction MV after adding vector residual error (mvdf_x/y).The back is obtained by the ref_frame negate to reference picture index number, but the back need carry out time domain prediction to MV and handle, between computing block after the distance in proportion relation obtain the MV (scalb_x/y) of final convergent-divergent.Sub-piece can be 16 * 16,16 * 8,8 * 16 and 8 * 8.
5, (back is to pattern, B) for Backward Mode
reff | -1 | refb | Ref_frame |
vecf_x | 0 | vecb_x | mvdb_x+mvp_x |
vecf_y | 0 | vecb_y | mvdb_y+mvp_y |
The back when mode treatment after to reference picture index number from code stream and MVD information obtain (ref_frame) together, carry out spatial domain prediction and handle the back and obtain prediction MV (mvp_x/y), add obtain after the vector residual error (mvdb_x/y) final back to MV.There is not forward direction MV this moment.Sub-piece can be 16 * 16,16 * 8,8 * 16 and 8 * 8.
6, Skip Mode (skip mode, P)
A) Zero Motion (zero motion)
reff | 0 | refb | -1 |
vecf_x | 0 | vecb_x | 0 |
vecf_y | 0 | vecb_y | 0 |
The zero motion skip mode of P image is the access copy mode, does not need to carry out predicted operation, does not also have MVD information, and forward direction MV is (0,0).There is not the back this moment to MV.Sub-block size is 16 * 16.
B) nonZero Motion (motion is arranged)
reff | 0 | refb | -1 |
vecf_x | mvp_x | vecb_x | 0 |
vecf_y | mvp_y | vecb_y | 0 |
The skip mode of P image need carry out the spatial domain prediction operation, but does not have MVD information, and forward direction MV is prediction MV (mvp_x/y).There is not the back this moment to MV.Sub-block size is 16 * 16.
In view of the defective of conventional method to the MV generating run, the present invention extracts the common ground of the MV generating mode of various macro block (mb) type correspondences, construct a simple master control module according to these co-operate, control each peripheral certain functional modules with whole control word and finish required function.
The generative process of described control word is as follows:
Step 1, analysis MV prediction generate the various situations of the different sub-pieces combinations with macro block of the variety of way of handling, and list the detailed process that their are operated;
The similarities and differences that combinations thereof is handled is found out in step 2, analysis, operational processes is resolved into the module of each function singleness;
Step 3, the similar module of pooling function are built into all functional modules the processing framework of an integral body according to its processing order;
Step 4, with in the processing procedure values of moving of the various operative combination in step 1 Unified frame in the step 3; Different operative combination is not that each functional module all needs action according to its concrete demand of handling;
The operating position of step 5, whole each functional module of statistics according to whether using the control bit of setting this module, is used if exist repeatedly, then needs more control bits to represent;
Step 6, set whole control word; The all functions module is arranged in the whole control word by processing order, and, sets the bit wide and the meaning of each module each field in whole control word successively according to the result of step 5.
Concrete generative process is as follows:
For the P image of AVS 1.0 and the analysis of B image M V generating run as shown in Table 1 and Table 2:
The MV generating run is analyzed in the table 1.P image
|
mb_type |
Read_MVD |
MV_Pred |
opt_nums |
Skip mode |
P_Skip_ ZeroMotion |
(0) |
16×16 |
|
|
0 |
P_Skip_ Motion |
16×16 |
|
① |
1 |
Forward mode |
P_16×16 |
(1) |
16×16 |
① |
② |
2 |
P_16×8 |
(2) |
16×8 |
① ③ |
② ④ |
4 |
P_8×16 |
(3) |
8×16 |
① ③ |
② ④ |
4 |
|
P_8×8 P_8×8ref0 |
(4) (5) |
8×8 |
① ③ ⑤ ⑦ |
② ④ ⑥ ⑧ |
8 |
Frame mode |
I_8×8 |
(6) |
16×16 |
|
|
0 |
Table 1 is the MV generating run analysis signal of P image.The macro block tupe is shown in first tabulation.Secondary series is represented the various combinations of macro block (mb) type and macroblock partitions, and for example the forward mode of P images is represented in P_16 * 8, and block size is 16 * 8, and type number is 2.Read_MVD represents whether the operation of reading MVD information needs, and MV_Pred represents the operation of MV spatial domain prediction, and opt_nums represents to handle total number of operations of these macro block needs.The process of the numeral operation in the circle.Be example with P_16 * 8 equally, because this macro block is divided into up and down 16 * 8 two sub-pieces, each sub-piece needs to handle respectively, and forward mode need read MVD and spatial domain prediction operation, and so total number of operations is 4, order of operation as 1. 2. 3. 4. shown in.
The MV generating run is analyzed (removing B_8 * 8) in the table 2-1.B image
| mb_type | Direct | Forward | Symmetric | Backward | opt_ nums |
Read_MVD | MV_Pred | Read_MVD | MV_Pred |
16×16 Direct | B_Direct (Spatial) | (0) | | | ① | | | ② | 2 |
B_Direct (Temporal) | ①② ③④ | | | | | | 4 |
16×16 | B_Fwd | (1) | | ① | ② | | | | 2 |
B_Bck | (2) | | | | | ① | ② | 2 |
B_Sym | (3) | | ① | ② | ③ | | | 3 |
16×8 8×16 | B_Fwd_Fwd | (4/5) | | ① ③ | ② ④ | | | | 4 |
B_Bck_Bck | (6/7) | | | | | ① ③ | ② ④ | 4 |
B_Fwd_Bck | (8/9) | | ① | ② | | ③ | ④ | 4 |
B_Bck_Fwd | (10/11) | | ③ | ④ | | ① | ② | 4 |
B_Fwd_Sym | (12/13) | | ① ③ | ② ④ | ⑤ | | | 5 |
B_Bck_Sym | (14/15) | | ③ | ④ | ⑤ | ① | ② | 5 |
B_Sym_Fwd | (16/17) | | ① ④ | ② ⑤ | ③ | | | 5 |
B_Sym_Bck | (18/19) | | ① | ② | ③ | ④ | ⑤ | 5 |
B_Sym_Sym | (20/21) | | ① ④ | ② ⑤ | ③ ⑥ | | | 6 |
Intra | I_8×8 | (23) | | | | | | | 0 |
The MV generating run is analyzed (B_8 * 8) in the table 2-2.B image
| subblock_type | Direct | Forward | Symmetric | Backward | opt_ nums |
Read_MVD | MV_Pred | Read_MVD | MV_Pred |
8×8 | SB_Direct (Spatial) | (0) | | | ① | | | ② | 2 |
SB_Direct (Temperal) | (0) | ① | | | | | | 1 |
SB_Fwd | (1) | | ① | ② | | | | 2 |
SB_Bck | (2) | | | | | ① | ② | 2 |
SB_Sym | (3) | | ① | ② | ③ | | | 3 |
Table 2 is MV generating run analysis signals of B image, and the implication and the table 1 of each list item are similar, and table 2-1 is the analysis of removing outer other all types of operations in B_8 * 8 in the B image, and table 2-2 is the analysis of B_8 in the B image * 8 type operations.The dividing mode of macro block is shown in first tabulation.Secondary series is represented macro block (mb) type and corresponding types numbering thereof.Direct represents the processing of Direct Model time domain prediction, and Symmmetric represents the processing of symmetric pattern time domain prediction.Read_MVD represents to read the operation of MVD information, and MV_Pred represents the operation of MV spatial domain prediction, is divided into forward direction and back to different disposal.Opt_nums represents to handle total number of operations of these macro block needs.The process of the numeral operation in the circle.With B_Bck_Sym is example, and the piece dividing mode can be 16 * 8 or 8 * 16, and the different sub-piece processing orders of dividing are inequality, but their processing method is similar.Because macro block is divided into two sub-pieces, first sub-piece reads MVD information earlier, and does the back to spatial domain prediction, and obtains the MV of this sub-piece, as 1. 2. shown in; Second sub-piece reads MVD information earlier, and does the forward direction spatial domain prediction, do again the back to the symmetric pattern time domain prediction, as 3. 4. 5. shown in, the front and back that so just obtain second sub-piece are to MV.Processing and other macro block (mb) type of B image of B_8 * 8 types are similar, but 48 * 8 each sub-pieces of sub-piece can any be operated by five kinds of modes shown in the table 2-2, and the mode of combination is a lot, so only list the processing mode of sub-piece.
Can see from top tabular analysis, in whole AVS 1.0 standards, though macro block (mb) type with and the combination of sub-block size, on the whole in fact the prediction generating run of MV has only 5 kinds of processing modes, be respectively: Direct Model time domain prediction (Direct), symmetric pattern time domain prediction (Symmetric) reads MVD information (Read_MVD), spatial domain prediction (MV_Pred) and access copy mode (do not need predicted operation, do not have MVD information).Its actual treatment of combination of different macro block (mb) types and sub-block size is aforesaid operations to be made up according to certain order carry out.According to these information, can make up 5 following control words (4 fields):
Direct |
Read_MVD | MV_Pred |
Symmetric | |
4 |
3 |
2 |
1 |
0 |
Wherein, whether Direct/Read_MVD/Symmetric carries out this operation with a bit representation respectively, and whether MV_Pred carries out the spatial domain prediction operation with two bit representations, if be to operate once, still front and back to each once.For access copy mode control word is 0_0_00_0, does not promptly carry out other operation.
Reanalyse the process that the MV prediction generates according to the definition of control word, can obtain table 3 and table 4-1 and table 4-2.Wherein, cnt_stage represents stage of handling, i.e. the processing of a corresponding sub-piece of each stage, and the control word of same macro block different phase is different.
Control word during table 3.P image M V generates
| mb_type | cnt_Stage | Direct | Read_MVD | MV_Pred | Symmetric | Controller Word | |
0 | 1 | 2 | 3 |
Skip | P_Skip_ ZeroMotion | (0) | √ | | | | | | | | 0_0_00_0 |
P_Skip_ Motion | (0) | √ | | | | | | ① | | 0_0_01_0 |
Forward | P_16×16 | (1) | √ | | | | | ① | ② | | 0_1_01_0 |
P_16×8 P_8×16 | (2) (3) | √ | | | | | ① | ② | | 0_1_01_0 |
| √ | | | | ③ | ④ | | 0_1_01_0 |
P_8×8 | (4) | √ | | | | | ① | ② | | 0_1_01_0 |
| √ | | | | ③ | ④ | | 0_1_01_0 |
| | √ | | | ⑤ | ⑥ | | 0_1_01_0 |
| | | √ | | ⑦ | ⑧ | | 0_1_01_0 |
Intra | I_8×8 | (5) | √ | | | | | | | | 0_0_00_0 |
Control word (removing B_8 * 8) during table 4-1.B image M V generates
| mb_type | cnt_Stage | Direct | Read_MVD | MV_Pred | Symmetric | Controller Word | |
0 | 1 | 2 | 3 |
16×16 Direct | B_Direct (Spatial) | (0) | √ | | | | | | ①② | | 0_0_10_0 |
B_Direct (Temporal) | (0) | √ | | | | ① | | | | 1_0_00_0 |
| √ | | | ② | | | | 1_0_00_0 |
| | √ | | ③ | | | | 1_0_00_0 |
| | | √ | ④ | | | | 1_0_00_0 |
16×16 | B_Fwd | (1) | √ | | | | | ① | ② | | 0_1_01_0 |
B_Bck | (2) | √ | | | | | ① | ③ | | 0_1_01_0 |
B_Sym | (3) | √ | | | | | ① | ② | ③ | 0_1_01_1 |
16×8 8×16 | B_Fwd_Fwd | (4/5) | √ | | | | | ① | ② | | 0_1_01_0 |
B_Bck_Bck | (6/7) |
B_Fwd_Bck | (8/9) | | √ | | | | ③ | ④ | | 0_1_01_0 |
B_Bck_Fwd | (10/11) |
B_Fwd_Sym | (12/13) | √ | | | | | ① | ② | | 0_1_01_0 |
B_Bck_Sym | (14/15) | | √ | | | | ③ | ④ | ⑤ | 0_1_01_1 |
B_Sym_Fwd | (16/17) | √ | | | | | ① | ② | ③ | 0_1_01_1 |
B_Sym_Bck | (18/19) | | √ | | | | ④ | ⑤ | | 0_1_01_0 |
B_Sym_Sym | (20/21) | √ | | | | | ① | ② | ③ | 0_1_01_1 |
| √ | | | | ④ | ⑤ | ⑥ | 0_1_01_1 |
Intra |
I_8×8 |
(23) |
|
|
|
|
|
|
|
|
0_0_00_0 |
Control word (B_8 * 8) during table 4-2.B image M V generates
| subblock_type | cnt_Stage | Direct | Read_MVD | MV_Pred | Symmetric | Controller Word | |
0 | 1 | 2 | 3 |
8×8 | SB_Direct (Spatial) | (0) | | | | | | | ①② | | 0_0_10_0 |
SB_Direct (Temperal) | (0) | | | | | ① | | | | 1_0_00_0 |
SB_Fwd | (1) | | | | | | ① | ② | | 0_1_01_0 |
SB_Bck | (2) | | | | | | ① | ② | | 0_1_01_0 |
SB_Sym | (3) | | | | | | ① | ② | ③ | 0_1_01_1 |
Be example equally with B_Bck_Sym, the phase I control word of its processing is 0_1_01_0, promptly reads MVD and carries out a spatial domain prediction processing, and prediction MV obtains the back to MV of first sub-piece after adding MVD; The second stage control word is 0_1_01_1, promptly reads MVD and carries out spatial domain prediction and handle, and prediction MV adds the forward direction MV that obtains this sub-piece behind the MVD, carries out the time domain prediction of symmetric pattern then and handles, and obtains the back to MV.
Control word in further analytical table 3 and the table 4, in fact the operation of each functional module has only 6 kinds of compound modes, and they are respectively:
1) 0_0_00_0: the access copy mode, no predicted operation does not have MVD information.
This processing mode below macro block (mb) type and block size combination in exist.
Macro block (mb) type |
Block size |
P_Skip_ZeroMotion(0) P_Intra(0) B_Intra(0) |
[16×16] |
It handles signal as shown in Figure 5.
2) 0_0_01_0: only carry out spatial domain prediction one time, no MVD information.
Macro block (mb) type | Block size |
P_Skip_Motion(0) | [16×16] |
It handles signal as shown in Figure 6.
3) 0_0_10_0: carry out front and back to 2 spatial domain predictions, no MVD information.
Macro block (mb) type | Block size |
B_Direct_Spatial(0) | [16×16/8×8] |
It handles signal as shown in Figure 7.
4) 0_1_01_0: after reading MVD information, carry out
spatial domain prediction 1 time, summation obtains final MV.
Macro block (mb) type | Block size |
P_16×16(0) | [16×16] |
P_16×8(0) P_16×8(1) P_8×16(0) P_8×16(1) | [16×8/8×16] |
P_8×8(0) P_8×8(1) P_8×8(2) P_8×8(3) | [8×8] |
| |
B_Fwd(0) B_Bck(0) | [16×16] |
B_Fwd_Fwd(0) B_Fwd_Fwd(1) B_Bck_Bck(0) B_Bck_Bck(1) | [16×8/8×16] |
B_Fwd_Bck(0) B_Fwd_Bck(1) B_Bck_Fwd(0) B_Bck_Fwd(1) | [16×8/8×16] |
B_Fwd_Sym(0) B_Bck_Sym(1) B_Sym_Fwd(1) B_Sym_Bck(1) | [16×8/8×16] |
| |
SB_Fwd SB_Bck | [8×8] |
It handles signal as shown in Figure 8.
5) processing mode 0_1_01_1: read MVD and carry out spatial domain prediction and 4) is identical, but the back generates by symmetrical time domain prediction to MV.
Macro block (mb) type |
Block size |
B_Sym(0) |
[16×16] |
B_Fwd_Sym(1) B_Bck_Sym(0) B_Sym_Fwd(0) B_Sym_Bck(0) |
[16×8/8×16] |
B_Sym_Sym(0) B_Sym_Sym(1) |
[16×8/8×16] |
|
|
SB_Sym |
[8×8] |
It handles signal as shown in Figure 9.
6) 1_0_00_0: the Direct Model time domain prediction, derive sagittal MV.
Macro block (mb) type | Block size |
B_Direct_Temporal(0) B_Direct_Temporal(1) | |
B_Direct_Temporal(2) B_Direct_Temporal(3) | [8×8] |
SB_Direct | |
It handles signal as shown in figure 10.
After classification is handled,, can obtain whole processing framework, as shown in figure 11 in conjunction with 6 kinds of modes of operation.The processing framework of this integral body is made up of 6 states, and its meaning is as follows:
MV_Gen_IDLE | Wait for that MV prediction generating run begins |
MV_Gen_ReadMVD | Read MVD information |
MV_Gen_Prediction | Carry out spatial domain prediction, may need to carry out front and back to totally 2 times |
MV_Gen_Symmetric | The symmetric pattern time domain prediction is handled |
MV_Gen_End | Current block is finished dealing with |
MV_Gen_Direct | The Direct Model time domain prediction is handled |
Can see that from the diagram of 6 kinds of top processing modes they all are the combinations of certain part of general frame.Like this in the processing framework of mode unification to an integral body that various MV predictions are generated.
From the integrated operation schematic diagram can corresponding conversion when hardware is realized state machine commonly used represent.Therefore contrast entire block diagram, the prediction generating run unification of MV can be arrived the major state machine of 9 states shown in Figure 12, the meaning of each state sees Table 5.
9 states of table 5 major state machine
Blk_Begin | Master control begins |
Read_MVD | Read MVD and reference frame number information |
MV_Pred_1 | Spatial domain prediction operation 1 |
MV_Addition | The calculating of mvp+mvd |
MV_Pred_2 | Spatial domain prediction operation 2 |
MV_Sym | The operation of time domain symmetric pattern |
MV_Dirt | The time domain direct mode operation |
Load_Store | The access copy function |
Blk_End | Master control finishes |
By simplifying the major state machine, the module that is implemented in separately of 3 kinds of processing modes is carried out, have and encapsulate characteristic preferably, overall structure is very clear, and each intermodule interface is succinct.The change of single mode can not influence the running of other modules.
In the present invention, all macro blocks are all handled by 48 * 8 sub-pieces, and described four sub-pieces are seen the order of last four sub-piece shown in Figure 1 in proper order, and putting in order of its sub-piece is the order of raster scan output.So whole control word is made up of 4 parts.The composition of each sub-control word is as shown in table 6, and it is formed by 9, can be divided into 6 fields.The meaning of each field sees Table 7.
Table 6. control word is formed table
LoadorStore | Direct | ReadMVD | MvPredictor | Symmetric | Prediction Direction |
8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
5 middle (promptly 2~6) are identical with the definition of front, and the meaning of these 4 fields is also consistent.Two supplemental field are, Prediction Direction field is represented the direction predicted, as forward direction, the back to, still two-way, the incompatible 00 expression forward direction of seeing of this two hyte wherein, 01 expression back to, 10 expressions are two-way, in the 11 expression frames; The high bit representation of LoadorStore field is to preserve/read the MV data, wherein, is to represent to preserve the MV data at 0 o'clock, is that the MV data are read in 1 expression, and the position that low bit representation MV deposits/reads is to represent to be stored in 0 position at 0 o'clock, is that 1 expression is stored in 1 position.
The meaning of each all value of field of table 7 pair control word is explained.
Each field meaning of table 7. control
word
| 0 | 1 | 2 | 3 |
LoadorStore | 2 | Be stored in 0 position | Be stored in 1 position | Take out from 0 position | Take out from 1 position |
Direct |
| 1 | Inoperation | Direct mode operation | | |
ReadMVD |
| 1 | Inoperation | Read MVD information | | |
MvPredictor |
| 2 | Inoperation | Spatial domain prediction once | The spatial domain prediction front and back to each once | |
Symmetric | 1 | Inoperation | The symmetric pattern operation | | |
P8dir |
| 2 | Forward direction | The back to | Two-way | In the frame |
By the analysis of front and the definition of control word, can further analyze and generate the control word table that the MV prediction generates under all situations among the AVS 1.0, be shown in Table 8.
The control word table that the MV prediction generates among the table 8.AVS 1.0
P_picture | | 3 | 2 | 1 | 0 |
P_Skip_ZeroMotion | (0) | 10_0_0_00_0_00 | 10_0_0_00_0_00 | 10_0_0_00_0_00 | 00_0_0_00_0_00 |
P_Skip_Motion | (0) | 10_0_0_00_0_00 | 10_0_0_00_0_00 | 10_0_0_00_0_00 | 00_0_0_01_0_00 |
P_16×16 | (1) | 10_0_0_00_0_00 | 10_0_0_00_0_00 | 10_0_0_00_0_00 | 00_0_1_01_0_00 |
P_16×8 | (2) | 11_0_0_00_0_00 | 01_0_1_01_0_00 | 10_0_0_00_0_00 | 00_0_1_01_0_00 |
P_8×16 | (3) | 11_0_0_00_0_00 | 10_0_0_00_0_00 | 01_0_1_01_0_00 | 00_0_1_01_0_00 |
P_8×8 | (4) | 00_0_1_01_0_00 | 00_0_1_01_0_00 | 00_0_1_01_0_00 | 00_0_1_01_0_00 |
P_Intra | (5) | 10_0_0_00_0_11 | 10_0_0_00_0_11 | 10_0_0_00_0_11 | 00_0_0_00_0_11 |
B_picture | | 3 | 2 | 1 | 0 |
B_Direct_Spatial | (32) | 10_0_0_00_0_10 | 10_0_0_00_0_10 | 10_0_0_00_0_10 | 00_0_0_10_0_10 |
B_Direct_Temporal | (32) | 00_1_0_00_0_10 | 00_1_0_00_0_10 | 00_1_0_00_0_10 | 00_1_0_00_0_10 |
B_Fwd_16×16 | (33) | 10_0_0_00_0_00 | 10_0_0_00_0_00 | 10_0_0_00_0_00 | 00_0_1_01_0_00 |
B_Bck_16×16 | (34) | 10_0_0_00_0_01 | 10_0_0_00_0_01 | 10_0_0_00_0_01 | 00_0_1_01_0_01 |
B_Sym_16×16 | (35) | 10_0_0_00_0_10 | 10_0_0_00_0_10 | 10_0_0_00_0_10 | 00_0_1_01_1_10 |
B_Fwd_Fwd_16×8 | (36) | 11_0_0_00_0_00 | 01_0_1_01_0_00 | 10_0_0_00_0_00 | 00_0_1_01_0_00 |
B_Fwd_Fwd_8×16 | (37) | 11_0_0_00_0_00 | 10_0_0_00_0_00 | 01_0_1_01_0_00 | 00_0_1_01_0_00 |
B_Bck_Bck_16×8 | (38) | 11_0_0_00_0_01 | 01_0_1_01_0_01 | 10_0_0_00_0_01 | 00_0_1_01_0_01 |
B_Bck_Bck_8×16 | (39) | 11_0_0_00_0_01 | 10_0_0_00_0_01 | 01_0_1_01_0_01 | 00_0_1_01_0_01 |
B_Fwd_Bck_16×8 | (40) | 11_0_0_00_0_01 | 01_0_1_01_0_01 | 10_0_0_00_0_00 | 00_0_1_01_0_00 |
B_Fwd_Bck_8×16 | (41) | 11_0_0_00_0_01 | 10_0_0_00_0_00 | 01_0_1_01_0_01 | 00_0_1_01_0_00 |
B_Bck_Fwd_16×8 | (42) | 11_0_0_00_0_00 | 01_0_1_01_0_00 | 10_0_0_00_0_01 | 00_0_1_01_0_01 |
B_Bck_Fwd_8×16 | (43) | 11_0_0_00_0_00 | 10_0_0_00_0_01 | 01_0_1_01_0_00 | 00_0_1_01_0_01 |
B_Fwd_Sym_16×8 | (44) | 11_0_0_00_0_10 | 01_0_1_01_1_10 | 10_0_0_00_0_00 | 00_0_1_01_0_00 |
B_Fwd_Sym_8×16 | (45) | 11_0_0_00_0_10 | 10_0_0_00_0_00 | 01_0_1_01_1_10 | 00_0_1_01_0_00 |
B_Bck_Sym_16×8 | (46) | 11_0_0_00_0_10 | 01_0_1_01_1_10 | 10_0_0_00_0_01 | 00_0_1_01_0_01 |
B_Bck_Sym_8×16 | (47) | 11_0_0_00_0_10 | 10_0_0_00_0_01 | 01_0_1_01_1_10 | 00_0_1_01_0_01 |
B_Sym_Fwd_16×8 | (48) | 11_0_0_00_0_00 | 01_0_1_01_0_00 | 10_0_0_00_0_10 | 00_0_1_01_1_10 |
B_Sym_Fwd_8×16 | (49) | 11_0_0_00_0_00 | 10_0_0_00_0_10 | 01_0_1_01_0_00 | 00_0_1_01_1_10 |
B_Sym_Bck_16×8 | (50) | 11_0_0_00_0_01 | 01_0_1_01_0_01 | 10_0_0_00_0_10 | 00_0_1_01_1_10 |
B_Sym_Bck_8×16 | (51) | 11_0_0_00_0_01 | 10_0_0_00_0_10 | 01_0_1_01_0_01 | 00_0_1_01_1_10 |
B_Sym_Sym_16×8 | (52) | 11_0_0_00_0_10 | 01_0_1_01_1_10 | 10_0_0_00_0_10 | 00_0_1_01_1_10 |
B_Sym_Sym_8×16 | (53) | 11_0_0_00_0_10 | 10_0_0_00_0_10 | 01_0_1_01_1_10 | 00_0_1_01_1_10 |
B_Intra | (55) | 10_0_0_00_0_11 | 10_0_0_00_0_11 | 10_0_0_00_0_11 | 00_0_0_00_0_11 |
| | | | | |
B_8×8 | (54) | | | | |
SB_Direct_Spatial | (0) | | | | 00_0_0_10_0_10 |
SB_Direct_Temporal | (0) | | | | 00_1_0_00_0_10 |
SB_Fwd | (1) | | | | 00_0_1_01_0_00 |
SB_Bck | (2) | | | | 00_0_1_01_0_01 |
SB_Sym | (3) | 00_0_1_01_1_10 | | | |
The whole control word of all macro block (mb) types all is made up of 4 little control words, and each little control word is responsible for the processing of one 8 * 8 sub-piece.All macro blocks all need to carry out 4 times at host state machine to be handled, promptly 4 the processing stage, the processing stage numbering see Table shown in 8 gauge outfits 0,1,2 and 3.Handle according to dividing sub-piece merely because the different dividing mode of macro block can make, the number of processes of each macro block is inequality.For example 16 * 8 macro blocks only need produce 2 MV, and 16 * 16 macro blocks only need 1 MV to represent.Advantage processing stage that unification being 4 is to make all macro block operations all to be undertaken by the mode of unanimity, all exports by 4 sub-pieces.Because the piece minimum of AVS 1.0 is 8 * 8,, does each macro block (mb) type so can being transformed on 8 * 8 corresponding sub-pieces.
Be that the control word of B_Bck_Sym_16 * 8 illustrates whole control procedure with macro block (mb) type 46 below.
Macro block (mb) type is B_Bck_Sym_16 * 8, and its processing is to be that first macro block reads MVD information earlier to Blk_0 by 16 * 8, then does the back to time domain prediction, obtains final MV information after the addition.Because 16 * 8 sub-pieces are made up of level two 8 * 8 (Blk_0 and Blk_1), the required MV of Blk_1 is identical with Blk_0, gets final product so preserve the final MV of Blk_0 so that Blk_1 takes this moment.Do not need when being Blk_1 to recomputate, the MV that only need reach the Blk_0 preservation gets final product.The processing of Blk_2 and the sub-piece of Blk_3 as can be known in like manner, different is that Blk_2 is a symmetric pattern, it need carry out extra symmetric pattern time domain prediction and obtain the back to MV information.Pass through the control word of each sub-piece like this, as can be known the processing mode in each step.Detailed process is referring to Figure 12, and concrete steps are as follows:
Step 10, initialization master control module at first, making the numerical value in the sub-piece number of the macro block register is 0, and the master control module is tabled look-up according to the type of current macro and is obtained the whole control word of corresponding macro block, and described whole control word is as shown in table 9:
The control word of table 9.B_Sym_Bck_16 * 8
| mbtype | Blk_3 | Blk_2 | Blk_1 | Blk_0 |
B_Bck_Sym_16×8 | (46) | 11_0_0_00_0_10 | 01_0_1_01_1_10 | 10_0_0_00_0_01 | 00_0_1_01_0_01 |
Step 11, according to the numerical value in the sub-piece number of the macro block register, read the control word of sub-piece corresponding in the whole control word of this macro block, if numerical value is 0, corresponding sub-piece is Blk_0, execution in step 100 is as Figure 13, if numerical value is 1, corresponding sub-piece is Blk_1, and execution in step 200 is as Figure 14; If numerical value is 2, corresponding sub-piece is Blk_2, and execution in step 300 is as Figure 15; If numerical value is 3, corresponding sub-piece is Blk_3, execution in step 400, and except that the position difference of fetching data, other is operated with shown in Figure 14;
Step 12, master control module judge whether the numerical value in the sub-piece number of the macro block register is 3, if if be 3, finish the generation of current macro MV and handle, MV according to raster scan order output generation, if not, the numerical value in the sub-piece number of the macro block register adds 1, execution in step 11;
Step 100, as can be known according to the content (01_0_1_01_0_01) of control word, need read the MVD data, do once the back to spatial domain prediction, it is final back to MV that mvd adds that mvp generates, and what will generate afterwards is stored in 0 position to MV, so the master control module sends the control information of back to spatial domain prediction to the spatial domain prediction module;
Step 101, spatial domain prediction module receive the control command that the master control module sends, and carry out the back and handle to spatial domain prediction, and the prediction MV that will produce promptly go up mvp and send it back the master control module;
Step 102, master control module read the MVD data, carry out the read group total of mvd and mvp, generate final back to MV, and will generate afterwards be stored in 0 position of buffering area, execution in step 12 to MV;
Step 200, according to the content of the control word (11_0_0_00_0_01) of sub-piece Blk_1 as can be known, the front and back that need take out this sub-piece from 0 position be to MV, the prediction direction of this piece be the back to, the master control module sends control information to access copy module;
Step 201, access copy module obtain the MV of current block, execution in step 12 from 0 position;
Step 300, according to the content of the control word (00_0_1_01_1_10) of sub-piece Blk_2 as can be known reads the MVD data, does the forward direction spatial domain prediction one time, and mvd adds that mvp generates forward direction MV, does time domain symmetric pattern time domain prediction then, generates thereafter to MV; There is 1 position of buffering area in the front and back that will generate to MV at last, so the master control module sends the control information of forward direction spatial domain prediction to the spatial domain prediction module;
The control command that step 301, spatial domain prediction module send according to the master control module is carried out the forward direction spatial domain prediction and is handled, and the prediction MV that will produce promptly goes up mvp and sends it back the master control module;
Step 302, master control module read the MVD data, carry out the read group total of mvd and mvp, generate forward direction MV, and send the control command of symmetric pattern time domain prediction to the time domain prediction module;
Step 303, time domain prediction module receive the control command that the master control module sends, and carry out the processing of symmetric pattern time domain prediction, and the front and back that will generate send it back the master control module to MV;
Step 304, master control module deposit front and back in the front and back that will generate and have 1 position of buffering area, execution in step 12 to MV to MV;
Step 400, as can be known according to the content of the control word (10_0_0_00_0_10) of sub-piece Blk_3, the front and back that need take out this sub-piece from 1 position are to MV, and the prediction direction of this piece is two-way, and the master control module sends control information to access copy module;
Step 401, access copy module obtain the front and back of current block to MV from 1 position; Execution in step 12;
Can see that from this example by whole control word, MV prediction generation module can generate the MV data of whole macro block on request, and no longer needs other control information.Can export all 4 required MV data processing stage of by 4.The processing stage that all macro block (mb) types all being unified 4, export in turn according to raster scan order.
The present invention also comprises the device that motion-vector prediction generates in a kind of video image, as shown in figure 16, comprises master control module, spatial domain prediction module, time domain prediction module, access copy module; Wherein,
Described master control inside modules is preserved the whole control of all types of macro blocks word table, described master control module analysis current macro type, obtain the control word of current macro by tabling look-up, to spatial domain prediction module or time domain prediction module or access copy module or its combination transmitting control commands, and handle the motion vector that generates video image according to the content of control word according to above each module return information;
The control command that described spatial domain prediction module is sent according to the master control module is carried out corresponding spatial domain prediction and is handled, and the prediction MV that will obtain sends to the master control module;
The control command that described time domain prediction module is sent according to the master control module is carried out corresponding time domain prediction and is handled, and the prediction MV that will obtain sends to the master control module;
The control command that access copy module is sent according to the master control module is carried out the access copy process, and the MV that obtains is sent to the master control module.
The control command that described spatial domain prediction module is sent according to the master control module is carried out forward direction or back to a spatial domain prediction, or front and back are to each spatial domain prediction.
Described time domain prediction module comprises Direct Model time domain prediction module or symmetric pattern time domain prediction module or its combination, the control command control Direct Model time domain prediction module that described time domain prediction module is sent according to the master control module that receives is carried out the Direct Model time domain prediction, or control symmetric pattern time domain prediction module is carried out the symmetric pattern time domain prediction.
Come whole each module that drives by state machine.Each functional part is made of the prior art module.
Annexation between each module as shown in figure 17.Master controller is responsible for the analysis generation of status word among the figure, by other each module of host state machine running control.The spatial domain prediction module is responsible for the spatial domain prediction operation, controls by wir_mvp, from " MvPredictor " field acquisition of control word.The time domain prediction module is finished the time domain prediction operation, wherein wir_direct control Direct Model work (obtaining from " Direct " field), wir_sym control symmetric pattern work (obtaining from " Symmetric " field).Access copy module is preserved two MV numerical value, shown in 0/1, by wir_ldorst control (obtaining from " LoadorStore " field).MVD FIFO reads MVD and reference frame number information (obtaining from " ReadMVD " field) by wir_readmvd control.The MVP addition that the MVD information that it obtains is sent into MV summation module and the output of spatial domain prediction module obtains final MV numerical value.If symmetric pattern, then this forward direction MV import into the symmetric pattern processing module generate the back to the MV data.All final MV data all output to outside other module from access copy module.
As from the foregoing, method of the present invention and device design are succinct, and control flow is clear, the complexity when having simplified greatly by control word that software and hardware is handled, but and extended attribute preferably arranged.By as can be known to the technical solution of the present invention analysis, this method in handling for video decode complicated MV prediction generate and handle and can both effectively work, it is simple for structure, is easy to software and hardware and realizes, particularly is convenient to hardware and realizes.
It should be noted last that, above embodiment is only unrestricted in order to technical scheme of the present invention to be described, although the present invention is had been described in detail with reference to preferred embodiment, those of ordinary skill in the art is to be understood that, can make amendment or be equal to replacement technical scheme of the present invention, and not breaking away from the spirit and scope of technical solution of the present invention, it all should be encompassed in the middle of the claim scope of the present invention.