Summary of the invention
The purpose of the embodiment of the invention is to propose a kind of motion-vector prediction coding method, is intended to solve prior art in the low bit-rate video compression, and becoming more meticulous of data processing unit brought the increase of motion vector, causes the increase problem of code check.
A kind of motion-vector prediction coding method of the embodiment of the invention is achieved in that described method comprises:
Obtain motion vector (mv) through current block behind the motion prediction;
Structure is used for the set of candidate motion vectors of motion-vector prediction coding;
From set of candidate motion vectors, choose optimal motion vector predictor (mv
Best);
Ask for the motion vector difference (mvd) of current block motion vector and described optimal motion vector predictor.
Preferably, step is asked for and is also comprised step after the motion vector difference of current block motion vector and described optimal motion vector predictor:
At coding side motion vector is carried out analog codec, to obtain the optimal motion vector analogue value (mv
Dec).
Preferably, step is asked for and is also comprised step after the motion vector difference of current block motion vector and described optimal motion vector predictor:
(mvd) is sent to decoding end through the entropy coding module coding with described motion vector difference.
Second purpose of the embodiment of the invention is to propose a kind of motion-vector prediction code device, and described device comprises:
The motion vector acquisition module is used to obtain the motion vector through current block behind the motion prediction;
Set of candidate motion vectors makes up module, is used to make up the set of candidate motion vectors that is used for the motion-vector prediction coding; Be specially: the motion vector mv that chooses the contiguous piece in the current block left side
A, the motion vector mv of piece directly over the current block
B, the upper right square of current block motion vector mv
C, the current block motion vectors mv that uses the H264 method to obtain
H264, present frame former frame same position piece motion vector mv
D, the reference block that points to of current block motion vector mv motion vector mv
E, constitute set of candidate motion vectors
[mv
AMv
BMv
CMv
H264Mv
DMv
E], each candidate motion vector all has its certain location sequence number in set of candidate motion vectors;
The optimal motion vector predictor is chosen module, is used for choosing the optimal motion vector predictor from set of candidate motion vectors, and it comprises motion-vector prediction difference bit number computing module, motion vector difference selection module;
Motion-vector prediction difference bit number computing module is used for the bit number R (mv-mv of calculation code motion-vector prediction difference needs
P), wherein, mv
P∈ [mv
AMv
BMv
CMv
H264Mv
DMv
E], wherein mv is the current block motion vector, mv
PBe the predicted value of motion vector, mv
PValue in described set of candidate motion vectors, select;
The motion vector difference bit number is selected module, is used for selecting to make encoding motion vector difference bit number R (mv-mv
P) minimum motion vector predictor mv
PBe optimal motion vector predictor mv
Best
Motion vector difference is asked for module, is used to ask for current block motion vector mv and described optimal motion vector predictor mv
BestMotion vector difference mvd, mvd=mv-mv
Best
Preferably, described device further comprises:
The motion vector difference sending module is used for described motion vector difference mvd is sent to decoding end through the entropy coding module coding.
Preferably, described device further comprises:
The analog codec module is asked for module with described motion vector difference and is linked to each other, and is used at coding side motion vector being carried out analog codec, to obtain the optimal motion vector analogue value.
The 3rd purpose of the embodiment of the invention is to propose a kind of motion-vector prediction coding/decoding method, and described method comprises:
Received code end transmitted stream data;
Detect in the bit stream data that receives and whether comprise the position number of motion vector in set of candidate motion vectors;
According to whether comprising the motion vector position number in the bit stream data, decoding in different ways.
, described " according to whether comprising the motion vector position number in the bit stream data, adopting different modes to decode " is specially:
When comprising described position number in the described bit stream data, according to described motion vector position number, from the concentrated optimal motion vector predictor mv that obtains of motion vector candidates
Best, further decoding is calculated goes out current block motion vector mv, wherein, and mvd=mv-mv
Best
When not comprising described position number in the described bit stream data, the motion vector difference mvd that receives decoded calculates the current block motion vector, wherein, and mvd=mv-mv
Best
The 4th purpose of the embodiment of the invention is to propose a kind of motion-vector prediction decoding device, and described device comprises:
Data reception module is used for received code end transmitted stream data, and described bit stream data comprises motion vector difference and/or motion vector position number;
Motion vector position number detection module, whether the bit stream data that is used for detecting reception comprises the motion vector position number, and described motion vector position number is the certain location sequence number of candidate motion vector in set of candidate motion vectors;
Decoder module is used for when bit stream data does not comprise the position number of motion vector, and the motion vector difference that receives is decoded calculates the current block motion vector; Also be used for when bit stream data comprises the motion vector position number, according to described motion vector position number, concentrate from motion vector candidates and to obtain the optimal motion vector predictor, further decoding is calculated goes out the current block motion vector.
The 5th purpose of the embodiment of the invention is to propose a kind of motion-vector prediction coding/decoding system,, described system comprises described motion-vector prediction code device and described motion-vector prediction decoding device.
Beneficial effect of the present invention
The embodiment of the invention is by making up a cover motion vector analog codec module at coding side, select the predicted value of motion vector more accurately by the room and time correlation, reduce the code check of encoding motion vector difference, the compressing motion vector data reduce the code check of exporting more subtly.
Embodiment
In order to make purpose of the present invention, technical scheme and advantage clearer, below in conjunction with drawings and Examples, the present invention is further elaborated, for convenience of explanation, only show the part relevant with the embodiment of the invention.Should be appreciated that the specific embodiment that this place is described, only be used to explain the present invention, not in order to restriction the present invention.
The embodiment of the invention is by making up a cover motion vector analog codec module at coding side, select the predicted value of motion vector more accurately by the room and time correlation, reduce the code check of encoding motion vector difference, the compressing motion vector data reduce the code check of exporting more subtly.
Embodiment one
Fig. 1 is a kind of motion-vector prediction coding method of embodiment of the invention flow chart, said method comprising the steps of:
S101 obtains the motion vector mv through current block behind the motion prediction;
S102 makes up the set of candidate motion vectors that is used for the motion-vector prediction coding;
Described " structure is used for the set of candidate motion vectors of motion-vector prediction coding " concrete grammar is: the motion vector mv that chooses the contiguous piece in the current block left side
A, the motion vector mv of piece directly over the current block
B, the upper right square of current block motion vector mv
C, the current block motion vectors mv that uses the H264 method to obtain
H264, present frame former frame same position piece motion vector mv
D, the reference block that points to of current block motion vector mv motion vector mv
E, constitute set of candidate motion vectors
[mv
AMv
BMv
CMv
H264Mv
DMv
E], each candidate motion vector all has its certain location sequence number in set of candidate motion vectors, for example: mv
APosition number in set of candidate motion vectors can be 1, mv
DPosition number in set of candidate motion vectors can be 5.
Being illustrated in figure 3 as the current block of enumerating is positioned at the 1st of present frame and is listed as the candidate motion vector location drawing of k when capable.As shown in Figure 3, the motion vector of current block is mv, and the motion vector of current block left side block is mv
A, the motion vector of piece is mv directly over the current block
B, the motion vector of the upper right square of current block is mv
CThe motion vector of present frame former frame same position (the 1st be listed as k capable) piece is mv
D, the motion vector of the reference block that current block motion vector mv points to is mv
E
S103 chooses optimal motion vector predictor mv from set of candidate motion vectors
Best
Describedly " choose optimal motion vector predictor mv
Best" concrete grammar as follows:
S1031, the bit number R (mv-mv that calculation code motion-vector prediction difference needs
P);
Wherein, mv
P∈ [mv
AMv
BMv
CMv
H264Mv
DMv
E], wherein mv is the current block motion vector, mv
PBe the predicted value of motion vector, mv
PValue in described set of candidate motion vectors, select.
S1032 selects to make encoding motion vector difference bit number R (mv-mv
P) minimum motion vector predictor mv
PBe optimal motion vector predictor mv
Best
S104 asks for current block motion vector mv and described optimal motion vector predictor mv
BestMotion vector difference mvd, mvd=mv-mv
Best
S106 is sent to decoding end with described motion vector difference mvd through the entropy coding module coding.
The embodiment of the invention is selected the predicted value of motion vector more accurately by the room and time correlation, has reduced the code check of encoding motion vector difference.
In order to reduce the code check that transmitting moving vector prediction pattern needs further, after step S104, also can increase following steps:
S105 carries out analog codec at coding side to motion vector, to obtain the optimal motion vector analogue value;
Fig. 2 is that described coding side carries out analog codec to motion vector, to obtain the method flow diagram of the optimal motion vector analogue value;
Described " motion vector being carried out analog codec, to obtain the optimal motion vector analogue value " concrete grammar is:
S1051 selects motion vector predictor mv successively from described set of candidate motion vectors
P
S1052 makes up interim motion vector mvi, mvi=mvd+mvp;
S1053 obtains current reconstructed image blocks of data Y
R, Y
R=Z
R+ X
R
Wherein:
Z
RBe the prediction data of current block image, it carries out motion compensation by described interim motion vector mvi and obtains;
X
RBe residual error data, it carries out motion compensation by current block motion vector mv and obtains.
S1054 makes up coefficient of variation E
d
Wherein,
(i j) is the reconstructed image data of the capable j row of i, current reconstructed image piece to y
Data Y
RIn the upper left corner first data be initial point, with y (0,0) expression, m and n are the length of current block and wide;
Y (i ,-1) represents current reconstructed image blocks of data Y
RThe left side one columns certificate, wherein the value of i from 0 to n-1;
Y (1, j) Biao Shi current reconstructed image blocks of data Y
RThe top data line, wherein the value of j from 1 to m-1;
S1055 selects to make coefficient of variation E
dMinimum motion vector predictor mv
PBe the decoding optimal motion vector analogue value mv that simulates
Dec
If described optimal motion vector analogue value mv
DecEqual optimal motion vector predictor mv
Dest, at known mvd and mv
BestSituation under, decoding end can be directly according to formula mvd=mv-mv in when decoding
BestDraw the motion vector mv of current block, then coding side need not increase the description that indicates the position number of optimal motion vector predictor in set of candidate motion vectors in output code flow;
If described optimal motion vector analogue value mv
DecBe not equal to optimal motion vector predictor mv
Best, decoding end can't correctly be selected optimal motion vector predictor mv
Best, then coding side need increase in output code flow and indicates optimal motion vector predictor mv
BestThe description of the position number in set of candidate motion vectors; Decoding end is obtained optimal motion vector predictor mv according to described position number
BestAt known mvd and mv
BestSituation under, thereby further according to formula mvd=mv-mv
BestDraw the motion vector mv of current block.
The embodiment of the invention proposes a kind of motion-vector prediction coding method, select the predicted value of motion vector more accurately by the room and time correlation, reduce the code check of encoding motion vector difference, the compressing motion vector data reduce the code check of exporting more subtly.
Embodiment two
Fig. 4 is a kind of motion-vector prediction code device of embodiment of the invention structural representation, and described motion-vector prediction code device comprises:
The motion vector acquisition module is used to obtain the motion vector through current block behind the motion prediction;
Set of candidate motion vectors makes up module, is used to make up the set of candidate motion vectors that is used for the motion-vector prediction coding; Be specially: the motion vector mv that chooses the contiguous piece in the current block left side
A, the motion vector mv of piece directly over the current block
B, the upper right square of current block motion vector mv
C, the current block motion vectors mv that uses the H264 method to obtain
H264, present frame former frame same position piece motion vector mv
D, the reference block that points to of current block motion vector mv motion vector mv
E, constitute set of candidate motion vectors [mv
AMv
BMv
CMv
H264Mv
DMv
E], each candidate motion vector all has its certain location sequence number in set of candidate motion vectors.
The optimal motion vector predictor is chosen module, is used for choosing the optimal motion vector predictor from set of candidate motion vectors, and it comprises motion-vector prediction difference bit number computing module, motion vector difference selection module;
Motion-vector prediction difference bit number computing module is used for the bit number R (mv-mv of calculation code motion-vector prediction difference needs
P), wherein, mv
P∈ [mv
AMv
BMv
CMv
H264Mv
DMv
E], wherein mv is the current block motion vector, mv
PBe the predicted value of motion vector, mv
PValue in described set of candidate motion vectors, select;
The motion vector difference bit number is selected module, is used for selecting to make encoding motion vector difference bit number R (mv-mv
P) minimum motion vector predictor mv
PBe optimal motion vector predictor mv
Best
Motion vector difference is asked for module, is used to ask for current block motion vector mv and described optimal motion vector predictor mv
BestMotion vector difference mvd, mvd=mv-mv
Best
Further, described motion-vector prediction code device also can comprise:
The motion vector difference sending module is used for described motion vector difference mvd is sent to decoding end through the entropy coding module coding;
Further, described motion-vector prediction code device can also comprise the analog codec module, is the concrete modular structure schematic diagram of described analog codec module as described in Figure 5.
The analog codec module is asked for module with described motion vector difference and is linked to each other, and is used at coding side motion vector being carried out analog codec, to obtain the optimal motion vector analogue value;
Described analog codec module comprises that further motion vector predictor is chosen module, motion vector structure module, reconstructed image blocks of data acquisition module, coefficient of variation make up module temporarily, the optimal motion vector analogue value is chosen module, optimal motion vector position sequence number writing module;
Motion vector predictor is chosen module, is used for selecting motion vector predictor mv from described set of candidate motion vectors successively
P
Interim motion vector makes up module, is used to make up interim motion vector mvi, mvi=mvd+mvp; Wherein mvd is the motion vector difference of current block motion vector and described optimal motion vector predictor, mvd=mv-mv
Best
Reconstructed image blocks of data acquisition module is used to obtain current reconstructed image blocks of data Y
R, Y
R=Z
R+ X
R
Wherein: Z
RBe the prediction data of current block image, it carries out motion compensation by described interim motion vector mvi and obtains;
X
RBe residual error data, it carries out motion compensation by current block motion vector mv and obtains.Coefficient of variation makes up module, is used to ask structure coefficient of variation E
d
Wherein,
(i j) is the reconstructed image data of the capable j row of i, current reconstructed image blocks of data Y to y
RIn the upper left corner first data be initial point, with y (0,0) expression, m and n are the length of current block and wide;
Y (i ,-1) represents current reconstructed image blocks of data Y
RThe left side one columns certificate, wherein the value of i from 0 to n-1;
Y (1, j) Biao Shi current reconstructed image blocks of data Y
RThe top data line, wherein the value of j from 1 to m-1;
The optimal motion vector analogue value is chosen module, is used for selecting to make coefficient of variation E
dMinimum motion vector predictor mv
PBe the decoding optimal motion vector analogue value mv that simulates
Dec
Optimal motion vector position sequence number writing module is if be used for as described optimal motion vector analogue value mv
DecBe not equal to optimal motion vector predictor mv
Best, increase indicates optimal motion vector predictor mv in output code flow
BestThe description of the position number in set of candidate motion vectors.
The embodiment of the invention is selected the predicted value of motion vector more accurately by the room and time correlation, reduces the code check of encoding motion vector difference, and compressing motion vector data more subtly reduce the code check of output.
Embodiment three
Figure 6 shows that a kind of motion-vector prediction coding/decoding method of embodiment of the invention flow chart, described method comprises:
S601, received code end transmitted stream data;
S602 detects in the bit stream data that receives whether comprise the motion vector position number, is then to enter step S603, otherwise enters step S604
Described motion vector position number is the certain location sequence number of candidate motion vector in set of candidate motion vectors;
S603 is according to described motion vector position number, from the concentrated optimal motion vector predictor mv that obtains of motion vector candidates
Best, further decoding is calculated goes out current block motion vector mv;
Wherein, mvd=mv-mv
Best
S604, the motion vector difference mvd that receives decoded calculates the current block motion vector;
Wherein, mvd=mv-mv
Best
Described bit stream data comprises motion vector difference mvd and/or motion vector position number;
Described set of candidate motion vectors is made up by coding side, is specially: the motion vector mv that chooses the contiguous piece in the current block left side
A, the motion vector mv of piece directly over the current block
B, the upper right square of current block motion vector mv
C, the current block motion vectors mv that uses the H264 method to obtain
H264, present frame former frame same position piece motion vector mv
D, the reference block that points to of current block motion vector mv motion vector mv
E, constitute set of candidate motion vectors [mv
AMv
BMv
CMv
H264Mv
DMv
E], each candidate motion vector all has its certain location sequence number in set of candidate motion vectors, and described motion vector collection is safeguarded jointly by coding side and decoding end;
Described motion vector position number is the certain location sequence number of candidate motion vector in set of candidate motion vectors.
Embodiment four
Fig. 7 is a kind of motion-vector prediction decoding device of embodiment of the invention structural representation.
Described motion-vector prediction decoding device comprises data reception module, motion vector position number detection module, decoder module;
Data reception module is used for received code end transmitted stream data, and described bit stream data comprises motion vector difference and/or motion vector position number;
Motion vector position number detection module, whether the bit stream data that is used for detecting reception comprises the motion vector position number, and described motion vector position number is the certain location sequence number of candidate motion vector in set of candidate motion vectors;
Decoder module is used for when bit stream data does not comprise the position number of motion vector, and the motion vector difference that receives is decoded calculates the current block motion vector; Also be used for when bit stream data comprises the motion vector position number, according to described motion vector position number, concentrate from motion vector candidates and to obtain the optimal motion vector predictor, further decoding is calculated goes out the current block motion vector.
Described set of candidate motion vectors is made up by coding side, is specially: the motion vector mv that chooses the contiguous piece in the current block left side
A, the motion vector mv of piece directly over the current block
B, the upper right square of current block motion vector mv
C, the current block motion vectors mv that uses the H264 method to obtain
H264, present frame former frame same position piece motion vector mv
D, the reference block that points to of current block motion vector mv motion vector mv
E, constitute set of candidate motion vectors [mv
AMv
BMv
CMv
H264Mv
DMv
E], each candidate motion vector all has its certain location sequence number in set of candidate motion vectors, and described motion vector collection is safeguarded jointly by coding side and decoding end;
Described motion vector position number is the certain location sequence number of candidate motion vector in set of candidate motion vectors.
Implement five
Fig. 8 is a kind of motion-vector prediction coding/decoding system of embodiment of the invention structural representation, and described system comprises motion-vector prediction code device, motion-vector prediction decoding device.
Described motion-vector prediction code device comprises:
The motion vector acquisition module is used to obtain the motion vector through current block behind the motion prediction;
Set of candidate motion vectors makes up module, is used to make up the set of candidate motion vectors that is used for the motion-vector prediction coding; Be specially: the motion vector mv that chooses the contiguous piece in the current block left side
A, the motion vector mv of piece directly over the current block
B, the upper right square of current block motion vector mv
C, the current block motion vectors mv that uses the H264 method to obtain
H264, present frame former frame same position piece motion vector mv
D, the reference block that points to of current block motion vector mv motion vector mv
E, constitute set of candidate motion vectors [mv
AMv
BMv
CMv
H264Mv
DMv
E], each candidate motion vector all has its certain location sequence number in set of candidate motion vectors;
The optimal motion vector predictor is chosen module, is used for choosing the optimal motion vector predictor from set of candidate motion vectors, and it comprises motion-vector prediction difference bit number computing module, motion vector difference selection module;
Motion-vector prediction difference bit number computing module is used for the bit number R (mv-mv of calculation code motion-vector prediction difference needs
P), wherein, mv
P∈ [mv
AMv
BMv
CMv
H264Mv
DMv
E], wherein mv is the current block motion vector, mv
PBe the predicted value of motion vector, mv
PValue in described set of candidate motion vectors, select;
The motion vector difference bit number is selected module, is used for selecting to make encoding motion vector difference bit number R (mv-mv
P) minimum motion vector predictor mv
PBe optimal motion vector predictor mv
Best
Motion vector difference is asked for module, is used to ask for current block motion vector mv and described optimal motion vector predictor mv
BestMotion vector difference mvd, mvd=mv-mv
Best
Further, described motion-vector prediction code device also can comprise:
The motion vector difference sending module is used for described motion vector difference mvd is sent to decoding end through the entropy coding module coding;
Further, described motion-vector prediction code device can also comprise the analog codec module, is the concrete modular structure schematic diagram of described analog codec module as described in Figure 5.
The analog codec module is asked for module with described motion vector difference and is linked to each other, and is used at coding side motion vector being carried out analog codec, to obtain the optimal motion vector analogue value;
Described analog codec module comprises that further motion vector predictor is chosen module, motion vector structure module, reconstructed image blocks of data acquisition module, coefficient of variation make up module temporarily, the optimal motion vector analogue value is chosen module, optimal motion vector position sequence number writing module.
Motion vector predictor is chosen module, is used for selecting motion vector predictor mv from described set of candidate motion vectors successively
P
Interim motion vector makes up module, is used to make up interim motion vector mvi, mvi=mvd+mvp; Wherein mvd is the motion vector difference of current block motion vector and described optimal motion vector predictor, mvd=mv-mv
Best
Reconstructed image blocks of data acquisition module is used to obtain current reconstructed image blocks of data Y
R, Y
R=Z
R+ X
R
Wherein: Z
RBe the prediction data of current block image, it carries out motion compensation by described interim motion vector mvi and obtains;
X
RBe residual error data, it carries out motion compensation by current block motion vector mv and obtains.Coefficient of variation makes up module, is used to ask structure coefficient of variation E
d
Wherein,
(i j) is the reconstructed image data of the capable j row of i, current reconstructed image blocks of data Y to y
RIn the upper left corner first data be initial point, with y (0,0) expression, m and n are the length of current block and wide;
Y (i ,-1) represents current reconstructed image blocks of data Y
RThe left side one columns certificate, wherein the value of i from 0 to n-1;
Y (1, j) Biao Shi current reconstructed image blocks of data Y
RThe top data line, wherein the value of j from 1 to m-1;
The optimal motion vector analogue value is chosen module, is used for selecting to make coefficient of variation E
dMinimum motion vector predictor mv
PBe the decoding optimal motion vector analogue value mv that simulates
Dec
Optimal motion vector position sequence number writing module is if be used for as described optimal motion vector analogue value mv
DecBe not equal to optimal motion vector predictor mv
Best, increase indicates optimal motion vector predictor mv in output code flow
BestThe description of the position number in set of candidate motion vectors.
Described motion-vector prediction decoding device comprises data reception module, motion vector position number detection module, decoder module;
Data reception module is used for received code end transmitted stream data, and described bit stream data comprises motion vector difference and/or motion vector position number;
Motion vector position number detection module, whether the bit stream data that is used for detecting reception comprises the motion vector position number, and described motion vector position number is the certain location sequence number of candidate motion vector in set of candidate motion vectors;
Decoder module is used for when bit stream data does not comprise the position number of motion vector, and the motion vector difference that receives is decoded calculates the current block motion vector; Also be used for when bit stream data comprises the motion vector position number, according to described motion vector position number, concentrate from motion vector candidates and to obtain the optimal motion vector predictor, further decoding is calculated goes out the current block motion vector.
Described set of candidate motion vectors is made up by coding side, is specially: the motion vector mv that chooses the contiguous piece in the current block left side
A, the motion vector mv of piece directly over the current block
B, the upper right square of current block motion vector mv
C, the current block motion vectors mv that uses the H264 method to obtain
H264, present frame former frame same position piece motion vector mv
D, the reference block that points to of current block motion vector mv motion vector mv
E, constitute set of candidate motion vectors [mv
AMv
BMv
CMv
H264Mv
DMv
E], each candidate motion vector all has its certain location sequence number in set of candidate motion vectors, and described motion vector collection is safeguarded jointly by coding side and decoding end;
Described motion vector position number is the certain location sequence number of candidate motion vector in set of candidate motion vectors.
The embodiment of the invention is selected the predicted value of motion vector more accurately by the room and time correlation, reduces the code check of encoding motion vector difference, and compressing motion vector data more subtly reduce the code check of output.
Those having ordinary skill in the art will appreciate that, all or part of step in realization the foregoing description method can be finished by the program command related hardware, described program can be stored in the computer read/write memory medium, and described storage medium can be ROM, RAM, disk, CD etc.
The above only is preferred embodiment of the present invention, not in order to restriction the present invention, all any modifications of being done within the spirit and principles in the present invention, is equal to and replaces and improvement etc., all should be included within protection scope of the present invention.