Summary of the invention
The purpose of this invention is to provide a kind of whole-frame error concealment method based on adaptive block sizes, can solve in the mobile video monitor when frame of video is lost, there is obvious blocking artifact in existing frame of video error concealment method reconstructed image and can't recovers the shortcoming of careful motion, can be the user higher objective quality and subjective vision effect is provided, and overcome the bigger distortion of problem first kind of existing method can produce to(for) the moving region, second kind of existing method covered the relatively poor problem of effect to the video sequence of non-uniform movement or irregular movement, and the overlap problem and the occlusion issue of the third existing method generation.
To achieve these goals, the invention provides a kind of whole-frame error concealment method based on adaptive block sizes, comprise the steps: that (1) is according to the former frame of lost frames and the type of coding of next frame, and all the outer pushing blocks of the 4x4 piece of the 4x4 piece of the 4x4 of described former frame piece and next frame described former frame when being extrapolated to described lost frames respectively and area and all the outer pushing blocks of described next frame and the area of described lost frames overlapping region of described lost frames overlapping region, select forward or backward movement vector extrapolation direction; (2) will be in former frame or next frame be in the adjacent neighborhood macro block in the macro block space of same position and be extrapolated to the described macro block of losing along the motion vector extrapolation direction of selecting with the macro block of losing of lost frames, obtain the macro block of extrapolating, according to extrapolation macro block and the area of described number of losing the macro block overlapping region, overlapping region and the close degree between the extrapolation macroblock motion vector, selection 16x16 piece size is covered or is that the described macro block of losing is covered or skipped to 4 8x8 piece sizes with the described macroblock partitions of losing.
In one embodiment of the invention, described step (1) is specially: (11) are intracoded frame, when next frame is inter-frame encoding frame, choose backward motion vector extrapolation direction when the former frame of lost frames; (12) former frame when lost frames is inter-frame encoding frame, when next frame is intracoded frame, chooses forward motion vector extrapolation direction; (13) former frame when lost frames be inter-frame encoding frame, when next frame is inter-frame encoding frame, respectively the 4x4 piece of the 4x4 piece of former frame and next frame is lost 4x4 piece according to what self movable information was extrapolated to described lost frames, add up all the outer pushing blocks of described former frame and area and all the outer pushing blocks of described next frame and the area of described lost frames overlapping region of described lost frames overlapping region, determine motion vector extrapolation direction according to the former frame or the next frame of maximum overlapping region area correspondence.
In another embodiment of the present invention, selecting in the described step (2) 16x16 piece size to cover or will describedly lose macroblock partitions is that 4 8x8 piece sizes are covered or skipped the described macro block of losing and are specially: (21) are one, when overlapping region area maximum is zero, skip the described macro block of losing when the overlapping region; (22) when the overlapping region be that one, overlapping region area maximum are during greater than the first macro block threshold values, the described macro block of losing is covered with 16x16 piece size, and the described motion vector of losing macro block is the motion vector of the extrapolation macro block of maximum overlapping region area correspondence; (23) when the overlapping region be a plurality of, a plurality of overlapping regions area sum is greater than the second macro block threshold values, and when the motion vector of all extrapolation macro blocks is close, the described macro block of losing is covered described weighted average of losing the motion vector of macro block for the motion vector of all extrapolation macro blocks with 16x16 piece size; (24) when the overlapping region be a plurality of, a plurality of overlapping regions area sum is greater than the second macro block threshold values, and the motion vector of all extrapolation macro blocks is that 4 8x8 pieces are covered respectively with the described macroblock partitions of losing when not close.
In another embodiment of the present invention, described method also comprises: (3) lose 8x8 piece for what cover by 8x8 piece size, the adjacent neighborhood 8x8 piece of 8x8 block space that will be in same position in former frame or next frame with it is extrapolated to the described 8x8 of losing piece along the motion vector extrapolation direction of selecting, 8x8 piece obtains extrapolating, according to extrapolation 8x8 piece and described number of losing 8x8 piece overlapping region, close degree between the area of overlapping region and the extrapolation 8x8 block motion vector is selected 8x8 piece size to cover or the described 8x8 of losing piece further is divided into 4 4x4 piece sizes and is covered or skip the sub-piece of the described 8x8 of losing.
In an embodiment more of the present invention, select in the described step (3) 8x8 piece size to cover or will the described 8x8 of losing piece further be divided into 4 4x4 piece sizes to cover or skip the described 8x8 of losing piece and be specially: (31) are one, when overlapping region area maximum is zero, skip the sub-piece of the described 8x8 of losing when the overlapping region; (32) when the overlapping region be that one, overlapping region area maximum are during greater than a 8x8 piece threshold values, the described 8x8 of losing piece is covered with 8x8 piece size, and the motion vector of the described 8x8 of losing piece is the motion vector of the extrapolation 8x8 piece of maximum overlapping region area correspondence; (33) when the overlapping region be a plurality of, a plurality of overlapping regions area sum is during greater than the 2nd 8x8 piece threshold values, and when the motion vector of all extrapolation 8x8 pieces is close, the described 8x8 of losing piece is covered described weighted average of losing the motion vector of 8x8 piece for all extrapolation 8x8 block motion vectors with 8x8 piece size; (34) when the overlapping region be a plurality of, a plurality of overlapping regions area sum is greater than the second macro block threshold values, and the motion vector of all extrapolation 8x8 pieces is divided into 4 4x4 pieces with the described 8x8 of losing piece and covers respectively when not close.
In another embodiment of the present invention, described method also comprises: (4) lose 4x4 piece for what cover by 4x4 piece size, the adjacent neighborhood 4x4 piece of 8x8 block space that will be in same position in former frame or next frame with it is extrapolated to the described 4x4 of losing piece along the motion vector extrapolation direction of selecting, 4x4 piece obtains extrapolating, according to extrapolation 4x4 piece and described number of losing 4x4 piece overlapping region, close degree between the area of overlapping region and the extrapolation 4x4 block motion vector selects 4x4 piece size to cover or skip the described 4x4 of losing piece.
In an embodiment more of the present invention, select 4x4 piece size to cover or skip the described 4x4 of losing piece in the described step (4) and be specially: (41) are one, when overlapping region area maximum is zero, skip the described 4x4 of losing piece when the overlapping region; (42) when the overlapping region be that one, overlapping region area maximum are during greater than a 4x4 piece threshold values, the described 4x4 of losing piece is covered with 4x4 piece size, and the motion vector of the described 4x4 of losing piece is the motion vector of the extrapolation 4x4 piece of maximum overlapping region area correspondence; (43) when the overlapping region be a plurality of, a plurality of overlapping regions area sum is greater than the 2nd 4x4 piece threshold values, and when the motion vector of all extrapolation 4x4 pieces is close, the described 4x4 of losing piece is covered described weighted average of losing the motion vector of 4x4 piece for all extrapolation 4x4 block motion vectors with 4x4 piece size; (44) when the overlapping region be a plurality of, a plurality of overlapping regions area sum is greater than the 2nd 4x4 piece threshold values, and the motion vector of all extrapolation 4x4 pieces is skipped the described 4x4 of losing piece when not close.
In another embodiment of the present invention, described motion vector determining step close and that motion vector is not close is specially: when the difference between two motion vectors when presetting threshold values, two motion vectors are close; When the difference between two motion vectors is not less than when presetting threshold values, two motion vectors are not close.
In an embodiment more of the present invention, described method also comprises: (5) are for described losing macro block, lose 8x8 piece or losing 4x4 piece of skipping, lose macro block, lose 8x8 piece or lose the motion vector of 4x4 piece according to what recover to cover, utilize the capable error concealment of border matching process.
In another embodiment of the present invention, described step (5) is specially: (51) form candidate set with mean value vector and median vector, the zero vector of the motion vector of neighborhood piece in the motion vector of neighborhood piece in the mean value vector of the motion vector of the motion vector of former frame neighborhood piece, former frame neighborhood piece and median vector, the present frame covered, the present frame covered; (52) each motion vector that described candidate vector is concentrated is lost the replacement block of piece with the reference block conduct of this motion vector points, and calculates the difference of the boundary pixel of neighborhood piece in the boundary pixel of described replacement block and the present frame; (53) motion vector with the boundary pixel difference minimum of the boundary pixel of replacement block and neighborhood piece is defined as losing the motion vector of piece the best, obtains motion compensation block by this motion vector in reference frame,, thus the error concealment of losing piece finished.。
Compared with prior art, the whole-frame error concealment method that the present invention is based on adaptive block sizes has following advantage:
1) adopt adaptive block sizes to carry out error concealment to all video sequences, can recover to have the video of careful motion feature, when reconstructed image, can alleviate blocking artifact, efficient recovery can be arranged, can obtain the objective and subjective effect of better quality the frame of video of losing;
2) suppressed the error code diffusion effectively;
3) computational complexity is moderate, has practicality widely.
4) can overcome first kind of existing method can produce the problem of bigger distortion, second kind of existing method for the moving region video sequence of non-uniform movement or irregular movement is covered overlap problem and the occlusion issue that the relatively poor problem of effect and the third existing method produce.
By following description also in conjunction with the accompanying drawings, it is more clear that the present invention will become, and these accompanying drawings are used to explain embodiments of the invention.
Embodiment
With reference now to accompanying drawing, describe embodiments of the invention, the similar elements label is represented similar elements in the accompanying drawing.
Fig. 2 is that present embodiment is based on macro block, 8x8 piece and 4x4 piece location diagram in the whole-frame error concealment method of adaptive block sizes.As shown in Figure 2, f
nExpression lost frames n, it is by macro block
Form each
macro block
Comprise 4 8x8 pieces
, each 8x8 piece
Comprise 4 4x4 pieces
Wherein, i
16And j
16Identified macro block
At frame f
nIn be the coordinate of unit with the macro block, i
8And j
8Identified 8x8 piece
At frame f
nIn be the coordinate of unit with 8x8 piece, i
4And j
4Identified 4x4 piece
At frame f
nIn be the coordinate of unit with 4x4 piece.Macro block
, 8x8 piece
With 4x4 piece
Motion vector be expressed as respectively
With
The following describes the whole-frame error concealment method of present embodiment based on adaptive block sizes.As Fig. 1, described method comprises the steps:
Step S1 is when putting in order LOF, according to lost frames f
nFormer frame f
N-1With next frame f
N+1Type of coding, and described former frame f
N-14x4 piece
With next frame f
N+14x4 piece
Be extrapolated to described lost frames f respectively
nShi Suoshu former frame f
N-1All outer pushing blocks and described lost frames f
nThe area of overlapping region and described next frame f
N+1All outer pushing blocks and described lost frames f
nThe area of overlapping region is selected forward or backward movement vector extrapolation direction.For video sequence, former frame f
N-1With next frame f
N+1With lost frames f
nDegree of correlation and incomplete same, particularly when scene changes, lost frames f
nOften only stronger with wherein a frame correlation, for guaranteeing the continuity of motion, need choose when covering and lost frames f
nThe frame that correlation is stronger carries out the motion vector extrapolation, and this step S1 selects and lost frames f earlier
nThe former frame f that correlation is stronger
N-1Or next frame f
N+1, and then determine to select the forward motion vector extrapolation (with former frame f
N-1Be extrapolated to lost frames f
n) or backward motion vector extrapolation (with next frame f
N+1Be extrapolated to lost frames f
n).Following step is that forward motion vector extrapolation direction is an example with selected motion vector extrapolation direction, provide the performing step of present embodiment adaptive block sizes whole-frame error concealment, motion vector extrapolation direction be the adaptive block sizes whole-frame error concealment performing step of backward motion vector extrapolation direction during with forward motion vector extrapolation direction to cover step similar, no longer repetition.
Step S2 is as Fig. 4, for lost frames f
nLose macro block
, will be at former frame f
N-1In be in the macro block of same position with it
The neighborhood macro block in space adjacent (adjacent up and down)
The motion vector extrapolation direction selected along step S1 is extrapolated to the described macro block of losing
, obtain the macro block of extrapolating
(
neighborhood macro block
16 affiliated 4x4 pieces
Extrapolation 4x4 piece
(frame of broken lines shown in Fig. 4 the right) constitutes the neighborhood macro block
The extrapolation macro block
, the extrapolation macro block
Motion vector be extrapolation 4x4 piece
The motion vector weighted average), according to the neighborhood macro block
The extrapolation macro block
With the described macro block of losing
The area of the number of overlapping region (the oblique line frame table shows the overlapping region), overlapping region and extrapolation macro block
Close degree between the motion vector selects 16x16 piece size to cover or with the described macro block of losing
Be divided into 4 8x8 piece sizes and cover or skip the described macro block of losing
Step S3, as Fig. 5, for step S2 selected lose 8x8 piece by what 8x8 piece size was covered
, will be at former frame f
N-1In be in the 8x8 piece of same position with it
The neighborhood 8x8 piece in space adjacent (adjacent up and down)
The motion vector extrapolation direction of selecting along step S1 is extrapolated to the described 8x8 of losing piece
, 8x8 piece obtains extrapolating
(neighborhood 8x8
piece
4 affiliated 4x4 pieces
Extrapolation 4x4 piece
(frame of broken lines shown in Fig. 5 the right) constitutes neighborhood 8x8 piece
Extrapolation 8x8 piece
, extrapolation 8x8 piece
Motion vector be extrapolation 4x4 piece
The motion vector weighted average), according to neighborhood 8x8 piece
Extrapolation 8x8 piece
With the described 8x8 piece of losing
The area of the number of overlapping region (the oblique line frame table shows the overlapping region), overlapping region and extrapolation 8x8 piece
Close degree between the motion vector selects 8x8 piece size to cover or with the described 8x8 of losing piece
Further be divided into 4 4x4 piece sizes and cover or skip the described 8x8 of losing piece
Step S4, as Fig. 6, for step S3 selected lose 4x4 piece by what 4x4 piece size was covered
, will be at former frame f
N-1In be in the 4x4 piece of same position with it
The neighborhood 4x4 piece in space adjacent (adjacent up and down)
The motion vector extrapolation direction selected along step S1 is extrapolated to the described 4x4 of losing piece
, 4x4 piece obtains extrapolating
(frame of broken lines shown in Fig. 6 the right) is according to neighborhood 4x4 piece
Extrapolation 4x4 piece
With the described 4x4 piece of losing
The area of the number of overlapping region (the oblique line frame table shows the overlapping region), overlapping region and extrapolation 4x4 piece
Close degree between the motion vector selects 4x4 piece size to cover or skip the described 4x4 of losing piece
As shown from the above technical solution, present embodiment has following advantage based on the whole-frame error concealment method of adaptive block sizes:
1) to all video sequence, characteristics self adaptation according to video sequence adopts 16x16 piece size, 8x8 piece size and 4x4 piece size to carry out error concealment, can recover to have the video of careful motion feature, when reconstructed image, can alleviate blocking artifact, to the frame of video of losing efficient recovery can be arranged, can obtain the objective and subjective effect of better quality;
2) owing to recovered lost frames effectively, therefore, the recovery value that the frame of video after the lost frames can make full use of lost frames carries out decoding and rebuilding, has avoided the influence of lost frames to subsequent frame, thereby has suppressed the error code diffusion effectively;
3) computational complexity is moderate, has practicality widely;
4) owing to avoided adopting the deficiency of fixed block size restoration motion vector at the different video sequence, therefore can accurately recover to lose the operation vector of piece, can overcome first kind of existing method and can produce the problem of bigger distortion, second kind of existing method for the moving region video sequence of non-uniform movement or irregular movement is covered overlap problem and the occlusion issue that the relatively poor problem of effect and the third existing method produce.
Preferably, described step S1 is specially:
Step S11 is as lost frames f
nFormer frame f
N-1Be intracoded frame, next frame f
N+1(has only next frame f this moment during for inter-frame encoding frame
N+1Movable information can with), choose backward motion vector extrapolation direction; Former frame f
N-1Interior neighborhood 4x4 piece
Step S12 is as lost frames f
nFormer frame f
N-1Be inter-frame encoding frame, next frame f
N+1(has only former frame f this moment during for intracoded frame
nMovable information can with), choose forward motion vector extrapolation direction;
Step S13 is as lost frames f
nFormer frame f
N-1Be inter-frame encoding frame, next frame f
N+1(this moment former frame f during for inter-frame encoding frame
N-1With next frame f
N+1Movable information all available), shown in Fig. 3 a and Fig. 3 b, respectively with former frame f
N-1In 4x4 piece
With next frame f
N+1In 4x4 piece
Movable information according to self is extrapolated to lost frames f
nLose the 4x4 block
, 4x4 piece obtains extrapolating
(frame of broken lines shown in Fig. 3 a and Fig. 3 b the right) adds up described former frame f
N-1All outer pushing blocks and described lost frames f
nArea of overlapping region (the oblique line frame table among Fig. 3 a and Fig. 3 b shows the overlapping region) and described next frame f
N+1All outer pushing blocks and described lost frames f
nThe area of overlapping region, the former frame f of maximum overlapping region area correspondence
N-1Or next frame f
N+1For with lost frames f
nThe frame that degree of correlation is higher is determined motion vector extrapolation direction, even described former frame f according to the higher frame of degree of correlation
N-1All outer pushing blocks and described lost frames f
nThe area of overlapping region is greater than described next frame f
N+1All outer pushing blocks and described lost frames f
nThe area of overlapping region, then described former frame f
N-1For with lost frames f
nThe frame that degree of correlation is higher is selected forward motion vector extrapolation direction this moment, otherwise selects backward motion vector extrapolation direction (among Fig. 3 a and Fig. 3 b, arrow is represented motion vector, frame of broken lines representative extrapolation 4x4 piece).
Note, as lost frames f
nFormer frame f
N-1Be intracoded frame, next frame f
N+1During for intracoded frame, the probability that this situation takes place is minimum, does not therefore consider.
Wherein, among the described step S2, select 16x16 piece size to cover or with the described macro block of losing
Be divided into 4 8x8 piece sizes and cover or skip the described macro block of losing
Be specially:
Step S21 is when the overlapping region is that one, overlapping region area maximum (show and lose macro block when being zero
With all extrapolation macro blocks
Equal zero lap zone), skip the described macro block of losing
Step S22 is when the overlapping region is that one, overlapping region area maximum are greater than the first macro block threshold values
In time, (shows and loses macro block
Similar with the movement locus of one of them extrapolation macro block), with the described macro block of losing
Cover the described macro block of losing with 16x16 piece size
Motion vector be the motion vector of the extrapolation macro block of maximum overlapping region area correspondence;
Step S23, when the overlapping region is a plurality of, a plurality of overlapping regions area sum is greater than the second macro block threshold values
(wherein,
), and the motion vector of all extrapolation macro blocks is when close, with the described macro block of losing
Cover the described macro block of losing with 16x16 piece size
Motion vector be the weighted average of motion vector of all extrapolation macro blocks;
Step S24, when the overlapping region is a plurality of, a plurality of overlapping regions area sum is greater than the second macro block threshold values
, and the motion vector of all extrapolation macro blocks (shows and loses macro block when not close
Comprise a plurality of motion of objects), with the described macro block of losing
Being divided into 4 8x8 piece sizes covers respectively.
Wherein, among the described step S3, select to lose the 8x8 piece
Size or with the described 8x8 piece of losing
Further be divided into 4 4x4 piece sizes and cover or skip the described 8x8 of losing piece
Be specially:
Step S31 is when the overlapping region is one, when overlapping region area maximum is zero, skips the described 8x8 of losing piece
Step S32 is when the overlapping region is that one, overlapping region area maximum are greater than a 8x8 piece threshold values
In time, (shows and loses 8x8 piece
Similar with the movement locus of one of them extrapolation 8x8 piece), with the described 8x8 piece of losing
Cover the described 8x8 piece of losing with 8x8 piece size
Motion vector be the motion vector of the extrapolation 8x8 piece of maximum overlapping region area correspondence;
Step S33, when the overlapping region is a plurality of, a plurality of overlapping regions area sum is greater than the 2nd 8x8 piece threshold values
(wherein,
), and the motion vector of all extrapolation 8x8 pieces is when close, with the described 8x8 piece of losing
Cover the described 8x8 piece of losing with 8x8 piece size
Motion vector is the weighted average of all extrapolation 8x8 block motion vectors;
Step S34, when the overlapping region is a plurality of, a plurality of overlapping regions area sum is greater than the second macro block threshold values
, and the motion vector of all extrapolation 8x8 pieces (shows and loses 8x8 piece when not close
Comprise a plurality of motion of objects), with the described 8x8 piece of losing
Being divided into 4 4x4 pieces covers respectively.
Wherein, among the described step S4, select 4x4 piece to cover or skip the described 4x4 of losing piece
Be specially:
Step S41 is when the overlapping region is one, when overlapping region area maximum is zero, skips the described 4x4 of losing piece
Step S42 is when the overlapping region is that one, overlapping region area maximum are greater than a 4x4 piece threshold values
In time, (shows and loses 4x4 piece
Similar with the movement locus of one of them extrapolation 4x4 piece), with the described 4x4 piece of losing
Cover the described 4x4 piece of losing with 4x4 piece size
Motion vector be the motion vector of the extrapolation 4x4 piece of maximum overlapping region area correspondence;
Step S43, when the overlapping region is a plurality of, a plurality of overlapping regions area sum is greater than the 2nd 4x4 piece threshold values
(wherein,
), and the motion vector of all extrapolation 4x4 pieces is when close, with the described 4x4 piece of losing
Cover the described 4x4 piece of losing with 4x4 piece size
Motion vector be the weighted average of all extrapolation 4x4 block motion vectors;
Step S44, when the overlapping region is a plurality of, a plurality of overlapping regions area sum is greater than the 2nd 4x4 piece threshold values
, and the motion vector of all extrapolation 4x4 pieces (shows the described 4x4 of losing piece when not close
Comprise a plurality of motion of objects), skip the described 4x4 of losing piece
Wherein, described motion vector is close is specially with the not close determining step of motion vector:
When the difference between two motion vectors when presetting threshold values, two motion vectors are close;
When the difference between two motion vectors is not less than when presetting threshold values, two motion vectors are not close.
In addition, this method also comprises step:
Step S5, to above-mentioned steps S21, what S31 and S41 skipped processing loses macro block, 8x8 piece and 4x4 piece, according to the movable information of losing macro block, 4x4 piece, 8x8 piece that has recovered, utilize the border matching process to carry out error concealment, smooth connection with macroblock boundaries, 8x8 piece or the 4x4 piece place of guarantee recovering image is specially:
Step S51 forms candidate set with mean value vector and median vector, the zero vector of the motion vector of neighborhood piece in the motion vector of neighborhood piece in the mean value vector of the motion vector of the motion vector of former frame neighborhood piece, former frame neighborhood piece and median vector, the present frame covered, the present frame covered;
Step S52 to each motion vector that described candidate vector is concentrated, loses the replacement block of piece with the reference block conduct of this motion vector points, and calculates the difference of the boundary pixel of neighborhood piece in the boundary pixel of described replacement block and the present frame;
Step S53, boundary pixel difference based on adjacent block is more little, the theory that image pixel is level and smooth more, the motion vector of the boundary pixel difference minimum of the boundary pixel of replacement block and neighborhood piece is defined as losing the motion vector of piece the best, after obtaining losing the motion vector of piece, obtain motion compensation block by this motion vector in reference frame, the compensation replacement block is the recovery value of losing piece, thereby finishes the error concealment of losing piece.
As from the foregoing, this method is extrapolated to lost frames with the 4x4 piece of consecutive frame, adds up the area of all extrapolation 4x4 pieces and lost frames overlapping regions, and in conjunction with the type of coding of consecutive frame, selects the suitable motion vector direction of extrapolating.For losing macro block, the movable information of consecutive frame is extrapolated to along selected direction loses macro block, according to the close degree of extrapolation macro block, select 16x16 piece size or be that the processing of losing macro block is covered or skipped to 4 8x8 piece sizes macroblock partitions with size of losing the macro block overlapping region and extrapolation macroblock motion vector.For 8x8 piece, in like manner can select 8x8 piece size or 8x8 piece further is divided into 4 4x4 piece sizes to cover or skip the processing of losing 8x8 piece.For losing 4x4 piece, in like manner can select 4x4 piece size to cover or skip the processing of losing 4x4 piece.
After selecting suitable macro block, 8x8 piece, 4x4 piece size, obtain corresponding motion vector, be compensated replacement block according to this motion vector then in reference frame, the compensation replacement block is the recovery value of losing piece, thereby finishes losing the error concealment of piece.
For the macro block of skipping in the said process, 8x8 piece, 4x4 piece, according to the movable information of the 4x4 piece that recovers to cover, 8x8 piece or macro block and adopt the external boundary matching algorithm to cover.
Above invention has been described in conjunction with most preferred embodiment, but the present invention is not limited to the embodiment of above announcement, and should contain various modification, equivalent combinations of carrying out according to essence of the present invention.