Summary of the invention
In view of this; Main purpose of the present invention is to provide a kind of time domain error hidden method and device of video image; Estimation of motion vectors to solve each erroneous macroblock that is occurred when image-region is made mistakes in flakes continuously in the prior art is inaccurate, and the discrepant problem of estimation of motion vectors result between each macro block.
For achieving the above object, technical scheme of the present invention is achieved in that
The invention provides a kind of time domain error hidden method of video image, said method comprises: confirm the zone errors that erroneous macroblock constituted of continuous distribution in the current frame image and the border of these zone errors; According to the borderline erroneous macroblock of determined said zone errors, confirm the motion vectors of said zone errors; According to the motion vectors of determined said zone errors, accomplish the error concealing of zone errors described in the current frame image; The employing error detection techniques is carried out Error detection and mark to the code stream of current frame image, finds said erroneous macroblock.
In such scheme; The zone errors of said definite current frame image and the border of these zone errors; Be specially: according to raster scan order; First erroneous macroblock that finds zone errors described in the current frame image and last erroneous macroblock, with the image-region between first erroneous macroblock that is found and last erroneous macroblock as zone errors; According to determined zone errors and first erroneous macroblock that is found and last erroneous macroblock, confirm the border of said zone errors.
In such scheme; Confirm the motion vectors of said zone errors; Be specially: if determined zone errors are not the Zone Full of current frame image; Then in the borderline adjacent erroneous macroblock that correct macro block arranged of said zone errors, obtain the wherein optimum prediction motion vector of each erroneous macroblock, the mean value of resulting each optimum prediction motion vector is confirmed as the motion vectors of said zone errors; If determined zone errors are the Zone Full of current frame image; Then obtain the mean value of the motion vector of all macro blocks in the former frame correct images adjacent, resulting mean value is confirmed as the motion vectors of said zone errors with current frame image.
In such scheme, the optimum prediction motion vector of said mistake in computation macro block specifically comprises: the motion vectors collection of setting up said erroneous macroblock; Each vector value that adopts said motion vectors to concentrate is successively obtained corresponding compensation macro block from the adjacent former frame image of current frame image, and calculate pairing compensation macro block of each vector value and said erroneous macroblock between similarity; The vector value that similarity is adopted when maximum is the optimum prediction motion vector of said erroneous macroblock.
In such scheme; Said motion vectors according to determined said zone errors; Accomplish the error concealing of zone errors described in the current frame image; Be specially: according to the motion vectors of determined said zone errors, from reference picture, obtain the compensation macro block, and by the corresponding erroneous macroblock of determined compensation macro block replacement.
In such scheme; After the error concealing of accomplishing zone errors described in the current frame image; Said method also comprises: confirm whether current frame image also has the zone errors of not hiding to reach or erroneous macroblock; If have, then accomplish all zone errors of hiding and or the error concealing of erroneous macroblock; Otherwise, the error concealing of end current frame image.
The present invention also provides a kind of hiding device of time domain error of realizing video image; Said device comprises definite unit, processing unit and hidden unit; Wherein: confirm the unit, be used for confirming the zone errors that all erroneous macroblock of current frame image are constituted and the border of these zone errors; Wherein, the employing error detection techniques is carried out Error detection and mark to the code stream of current frame image, finds said erroneous macroblock; Processing unit is used for confirming the motion vectors of said zone errors according to the borderline erroneous macroblock of the determined said zone errors in said definite unit; Hidden unit according to the motion vectors of determined said zone errors, is accomplished the error concealing of zone errors described in the current frame image.
In such scheme, said definite unit specifically comprises: search module, be used for searching first erroneous macroblock and last erroneous macroblock of current frame image; Determination module is used for confirming the zone errors and the border thereof of current frame image according to searching the lookup result of module.
In such scheme; Said processing unit comprises detection module, first determination module and second determination module; Wherein: detection module, whether be the Zone Full of current frame image, if said zone errors are not the Zone Fulls of current frame image if being used to detect said zone errors; Then start first determination module, otherwise start second determination module; First determination module; Be used to obtain the adjacent optimum prediction motion vector that all erroneous macroblock of correct macro block are arranged on the said zone errors border, and the mean value of resulting all optimum prediction motion vectors is confirmed as the motion vectors of said zone errors; Second determination module is used for obtaining the mean value of the motion vector of former frame correct images all macro blocks adjacent with current frame image, resulting mean value is confirmed as the motion vectors of said zone errors.
In such scheme, said hidden unit specifically is used for: according to the motion vectors of the determined said zone errors of said processing unit, from reference picture, obtain the compensation macro block, and by the corresponding erroneous macroblock of determined compensation macro block replacement.
In such scheme; Said device also comprises: detecting unit; Be used for confirming current frame image whether also have the zone errors hidden and or erroneous macroblock, if having then start said definite unit, processing unit and hidden unit, accomplish all zone errors of hiding and or the error concealing of erroneous macroblock; Otherwise do not start said definite unit, processing unit and hidden unit, finish the error concealing of current frame image.
Video image time domain error hidden method of the present invention and device; Utilize the time of decoded picture and the motion vectors of the zone errors that spatial coherence recovers image earlier; Utilize this motion vectors that each erroneous macroblock of whole zone errors is unified compensation then, no matter erroneous macroblock is discrete distribution or distributes in flakes continuously, can estimate the motion vector of each erroneous macroblock comparatively exactly; And reduced the difference of motion vector between each erroneous macroblock; Texture is continuous between each macro block of image after feasible the recovery, avoids occurring image offset and large tracts of land flower piece, and the subjectivity that can promote the user is greatly experienced.
Embodiment
Below in conjunction with accompanying drawing technical scheme of the present invention is elaborated.
The time domain error hidden method of video image of the present invention with reference to shown in Figure 1, mainly may further comprise the steps:
Step 101: confirm in the current frame image by the zone errors that erroneous macroblock constituted of continuous distribution and the border of these zone errors;
Step 102:, confirm the motion vectors of said zone errors according to the borderline erroneous macroblock of determined said zone errors;
Step 103:, accomplish the error concealing of zone errors described in the current frame image according to the motion vectors of determined said zone errors.
Wherein, confirm the zone errors and the border thereof of current frame image in thestep 101,, specifically can comprise with reference to shown in Figure 2:
Step 201: according to raster scan order; First erroneous macroblock that finds zone errors described in the current frame image and last erroneous macroblock, with the image-region between first erroneous macroblock that is found and last erroneous macroblock as zone errors;
Here, can adopt error detection techniques commonly used that the code stream of current frame image is carried out Error detection and mark, find erroneous macroblock.
Step 202:, confirm the border of said zone errors according to determined zone errors and first erroneous macroblock that is found and last erroneous macroblock.
Wherein, confirm the motion vectors of said zone errors in thestep 102, specifically can for:
If determined zone errors are not the Zone Full of current frame image; Then in borderline adjacent all erroneous macroblock that correct macro block arranged of said zone errors; Obtain the wherein optimum prediction motion vector of each erroneous macroblock, the mean value of resulting each optimum prediction motion vector is confirmed as the motion vectors of said zone errors;
If determined zone errors are the Zone Full of current frame image; Then obtain the mean value of the motion vector of all macro blocks in the former frame correct images adjacent, resulting mean value is confirmed as the motion vectors of said zone errors with current frame image.
Wherein, In thestep 103 according to the motion vectors of determined said zone errors; Accomplish the error concealing of zone errors described in the current frame image; Specifically can for: according to the motion vectors of determined said zone errors, from reference picture, obtain the compensation macro block, and determined compensation macro block replaced corresponding erroneous macroblock.
Wherein, obtaining the compensation macro block is specially: by the optimum prediction motion vector of each erroneous macroblock in the determined said zone errors, calculate the motion vectors of said zone errors; And from current frame image the adjacent former frame correct images, be that each erroneous macroblock in the said zone errors obtains said compensation macro block by this motion vectors.
Wherein, reference picture can for current frame image adjacent former frame correct images.
In addition; After the error concealing of accomplishing zone errors described in the current frame image; Said method also comprises: confirm whether current frame image also has the zone errors of not hiding to reach or erroneous macroblock; If had would accomplish not all zone errors of hiding and or the error concealing of erroneous macroblock, otherwise continue the next frame image is carried out error concealing.
Below in conjunction with Fig. 3 the concrete realization flow of time domain error hidden method of the present invention is elaborated.
With reference to Fig. 3, shown in Figure 4, the concrete implementation procedure of time domain error hidden method of the present invention comprises the steps:
Step 301: as shown in Figure 4 after current frame image decoding finishes in the video decoding process, press raster scan order, search first erroneous macroblock in the current frame image, if find then forward step 302 to; Otherwise finish the hiding processing of current frame image, continue decoding next frame image;
Here, all earlier image division is macro block one by one in existing all video codings, encodes one by one by macro block then.Raster scan order is exactly the macroblock encoding order, and this is the order that existing all video encoding standards are deferred in proper order, and is consistent with the scanning sequency of image, promptly from left to right, and from top to bottom.
Step 302: the erroneous macroblock that finds is designated as macro block A; And press raster scan order, and as shown in Figure 4, find macro block A first correct macro block afterwards erroneous macroblock before; This erroneous macroblock is designated as macro block B; Macro block A is the zone errors of current frame image to the image-region of macro block B, so far, has accomplished confirming of current frame image zone errors;
Wherein, if after macro block A, do not find correct macro block, then last macro block with current frame image is designated as macro block B.
Step 303: according to raster scan order; Find the macro block under the macro block A in the current frame image; Macro block before this macro block is designated as macro block C, and then as shown in Figure 4, macro block A is borderline erroneous macroblock in the determined zone errors to the erroneous macroblock between the macro block C;
Wherein, if press raster scan order, macro block C is positioned at after the macro block B or with macro block B and overlaps, and then mark macro block B macro block before is macro block C again.
Step 304: according to raster scan order, find the macro block directly over the macro block B, the macro block after this macro block is designated as macro block D; Then as shown in Figure 4; Macro block D is another borderline erroneous macroblock of said zone errors to the erroneous macroblock between the macro block B, so far, has confirmed the border of said zone errors;
Wherein, if press raster scan order, macro block D is positioned at before the macro block C or with macro block C and overlaps, and then mark macro block C macro block afterwards is macro block D again;
Step 305: judge whether macro block A is first macro block of current frame image, if forward step 307 to; Otherwise, forward step 306 to;
Step 306: computing macro block A continues step 308 to the adjacent optimum prediction motion vector that all erroneous macroblock of correct macro block are arranged between the macro block C successively;
Particularly, if macro block A is adjacent correct macro block arranged, then the process of the optimum prediction motion vector of computing macro block A is following:
A) set up the motion vectors collection of macro block A;
Wherein, With reference to shown in Figure 5, the motion vectors collection of macro block A comprises: in the median vector of the mean value vector of the motion vector of each correct macro block b~e that macro block A is adjacent, the motion vector of macro block b~e, the motion vector of macro block b~e, the reference picture with the median vector of the motion vector of the mean value vector of the motion vector of separately motion vector of adjacent macroblocks g~n of the motion vector of the macro block f of macro block A same position, macro block f, macro block f~n, macro block f~n.
B) each vector that adopts motion vectors to concentrate is successively obtained the compensation macro block from reference picture;
C) calculate obtained respectively compensate the similarity between macro block and the macro block A, the vector that is adopted during the similarity maximum is the optimum prediction motion vector of macro block A.
Wherein, similarity can represent that more greatly then similarity is more little for T with the absolute value sum T of the difference that compensates macro block each pixel of inner boundary and each respective pixel of macro block A external boundary, and the more little then similarity of T is big more.
In like manner,, have in all erroneous macroblock of correct macro block to adjacent between the macro block C, obtain the wherein optimum prediction motion vector of each erroneous macroblock at macro block A according to the aforementioned calculation process.
Step 307: judge that whether macro block B is last macro block of current frame image, if forward step 310 to, otherwise forwards step 306 to;
Step 308: have to adjacent between the macro block B in all erroneous macroblock of correct macro block at macro block D, calculate the wherein optimum prediction motion vector of each erroneous macroblock successively;
Here, computational process is identical with step 305, repeats no more at this.
Step 309: the mean value of resulting all optimum prediction motion vectors in calculation procedure 306 and the step 308 with the motion vectors of the mean value that calculates as zone errors, forwards step 311 to;
Step 310: calculate the mean value of the motion vector of all macro blocks in the adjacent former frame correct images of current frame image, with the mean value of the motion vector that calculates motion vectors as zone errors;
Step 311: to all erroneous macroblock in the current zone errors, adopt the motion vectors that obtains in step 309 or the step 310, from the adjacent former frame correct images of current frame image, obtain corresponding compensation macro block, replace each erroneous macroblock;
Step 312: search in the current frame image whether to also have the erroneous macroblock of hiding,, otherwise finish the flow process of current frame image error concealing, continue decoding next frame image if having then return step 302.
Zone errors as shown in Figure 4 are positioned at the situation at image middle part, and the process of accomplishing its time domain error concealing is following:
At first; In the video decoding process of image, code stream is carried out accordinging to method mentioned above after Error detection and the mark through adopting existing available error detection techniques; Confirm the zone errors of current frame image; As shown in Figure 4, determined zone errors are: according to raster scan order, erroneous macroblock A to the border between the erroneous macroblock C and erroneous macroblock D to the regional ACDB that the border surrounded between the erroneous macroblock B.
Secondly, confirm the motion vectors of zone errors ACDB, particularly, realize through following flow process:
Step S1: to erroneous macroblock A to the adjacent erroneous macroblock that correct macro block is arranged of N1 between the erroneous macroblock C; Adopt said method to calculate the optimum prediction motion vector of each erroneous macroblock successively; And according to following formula (1); Obtain the vector sum MV1={MV1x of the optimum prediction motion vector of this N1 erroneous macroblock, MV1y};
Wherein, MV1x, MV1y are respectively two components of resulting optimum prediction motion vector sum MV1, MV1xiAnd MV1yjBe respectively two components of the optimum prediction motion vector of single error macro block.
Step S3: to erroneous macroblock D to the adjacent erroneous macroblock that correct macro block is arranged of the N2 between the erroneous macroblock B; Adopt said method to calculate the optimum prediction motion vector of each erroneous macroblock; And calculate two component MV2x, the MV2y of the optimum movement vector sum MV2 of this N2 erroneous macroblock respectively; Obtain the optimum prediction motion vector sum MV2={MV2x of this N2 erroneous macroblock, MV2y};
Wherein, the concrete computational process of this step is identical with step S1, repeats no more at this;
Step S5:,, confirm the motion vectors MV={MVx of zone errors ACDB, MVy} according to following formula (2) and (3) by step S1 and the resultant optimum movement vector sum of step S3 MV1, MV2 and component thereof:
MVx=(MV1x+MV2x)/(N1+N2) (2)
MVy=(MV1y+MV2y)/(N1+N2) (3)
The 3rd; Motion vectors MV by zone errors ACDB obtains its corresponding compensation macro block for each erroneous macroblock from the reference picture of current frame image; And use each erroneous macroblock among the compensation macro block replacement zone errors ACDB that is obtained, accomplish the error concealing of zone errors ACDB in the current frame image.
At last; Behind the error concealing of accomplishing zone errors ACDB; Search current frame image and whether also have erroneous macroblock or the zone errors of not hiding,, adopt above-mentioned flow process to accomplish its error concealing if still have erroneous macroblock or the zone errors of not hiding; If no, then get into the error concealment process of next frame image.
Zone errors as shown in Figure 6 are positioned at the situation of image boundary, and the process of accomplishing its time domain error concealing is following:
At first, according to said method, confirm that the zone errors of current frame image are: according to raster scan order, erroneous macroblock A to the coboundary of erroneous macroblock C, the zone errors ACDB that lower boundary surrounded of the left margin erroneous macroblock B to the end of current frame image;
Secondly, confirm the motion vectors of zone errors ACDB, particularly, realize through following flow process:
Step S2: S1 is identical with above-mentioned steps;
Step S4: the optimum prediction motion vector MVb={MVbx of mistake in computation macro block B, MVby};
Step S6:, confirm the motion vectors MV={MVx of zone errors ACB, MVy} according to following formula (4) and (5):
MVx=(MV1x+MVbx)/(N1+1) (4)
MVy=(MV1y+MVby)/(N1+1) (5)
The 3rd, according to the motion vectors MV of zone errors ACDB, in the reference picture of current frame image, confirm the compensation macro block of each erroneous macroblock, and each erroneous macroblock among the replacement zone errors ACDB, the error concealing of zone errors ACDB in the completion current frame image.
At last, search current frame image and whether also have the zone errors of not hiding, all zone errors of not hiding are carried out error concealment process, accomplish the error concealing of current frame image.
For realizing said method, the present invention also provides a kind of hiding device of time domain error of realizing video image, and with reference to shown in Figure 7, said device comprisesconfirms unit 71, processingunit 72 and hiddenunit 73, wherein:
Confirm unit 71, be used for confirming the zone errors that all erroneous macroblock of current frame image are constituted and the border of these zone errors;
Processingunit 72 is used for confirming the motion vectors of said zone errors according to the borderline erroneous macroblock of saiddefinite unit 71 determined said zone errors;
Hidden unit 73 according to the motion vectors of saidprocessing unit 72 determined said zone errors, is accomplished the error concealing of zone errors described in the current frame image.
Wherein, confirmunit 71, specifically can comprise:
Search module 711, be used to search first erroneous macroblock and last erroneous macroblock of zone errors described in the current frame image;
Determination module 712 is used for confirming the zone errors and the border thereof of current frame image according to searching the lookup result of module.
Wherein, saidprocessing unit 72 can comprisedetection module 721,first determination module 722 andsecond determination module 723, wherein:
Detection module 721, whether be the Zone Full of current frame image, if said zone errors are not the Zone Fulls of current frame image, then start first determination module, otherwise start second determination module if being used to detect said zone errors;
First determination module 722; Be used to obtain the adjacent optimum prediction motion vector that all erroneous macroblock of correct macro block are arranged on the said zone errors border, and the mean value of resulting all optimum prediction motion vectors is confirmed as the motion vectors of said zone errors;
Second determination module 723 is used for obtaining the mean value of the motion vector of former frame correct images all macro blocks adjacent with current frame image, resulting mean value is confirmed as the motion vectors of said zone errors.
Wherein, hiddenunit 73 specifically is used for: according to the motion vectors of the determined said zone errors of said processing unit, from reference picture, obtain the compensation macro block, and by the corresponding erroneous macroblock of determined compensation macro block replacement.
Said device can also comprise: detectingunit 74; Be used for confirming whether current frame image also has the zone errors of not hiding to reach or erroneous macroblock; If have then start saiddefinite unit 71, processingunit 72 and hiddenunit 73, accomplish all zone errors of hiding and or the error concealing of erroneous macroblock; Otherwise do not start saiddefinite unit 71, processingunit 72 and hiddenunit 73, finish the error concealing of current frame image.
The above is merely preferred embodiment of the present invention, is not to be used to limit protection scope of the present invention, all any modifications of within spirit of the present invention and principle, being done, is equal to replacement and improvement etc., all should be included within protection scope of the present invention.