Background technology
Need carry out the video standard conversion when digital video signal of different frame rates is changed each other, for solving the contradiction of different video standard room frame rate, transfer algorithm is particularly important on the frame rate.Its major function is to come interpolation to generate the frame of intermediary movements state according to two frames or multiframe digital video image, thereby brings up to new display screen refresh rate to the frame rate of original video source.
Transfer algorithm mainly is divided into two types on the frame rate.One type is to utilize already present frame of video directly to carry out linear combination to come interpolation to generate middle new frame.Its main feature is the motion conditions that does not have object in the considered frame; When object of which movement amplitude in the frame is big; With the direct linear combination of two frames and the quality of the new frame that interpolation obtains can become very poor, the moving object edge is prone to blooming, especially when the intraframe motion object disappear or frame in during the new moving object of appearance; Owing in consecutive frame, do not have corresponding informance, these adjacent two frame linearity interpolation can be caused serious fuzzy distortion.
Another kind of is the motion compensated interpolation algorithm, promptly earlier obtains level and smooth motion vector through estimation, and then utilizes the motion vector that obtains to carry out motion compensation and come interpolation to generate new frame.Realization based on the motion compensated interpolation algorithm has two main processes: estimation and motion compensation.As present frame, its adjacent former frame is a reference frame to an optional frame in video flowing (remove first frame and in the end a frame).Its basic thought of estimation is the macro block that present frame and reference frame is divided into many non-overlapping copies; And all pixels are all done identical translation in the supposition macro block; In present frame, selecting some macro blocks is current macro; Then in reference frame in certain hunting zone according to certain matching criterior find out with present frame in the most similar piece of this macro block, i.e. match block.Method for the corresponding optimum Match macro block of search current macro in reference frame mainly can be divided into full-search algorithm and various fast search algorithm.Full-search algorithm is that each pixel in the hunting zone is carried out matching operation, thereby obtains the motion vector of a global optimum, so full-search algorithm is the highest algorithm of search precision.
Summary of the invention
Defective to prior art exists the purpose of this invention is to provide a kind of digital video signal conversion method based on motion compensation.I.e. SAD through coupling macro block in macro block in the present frame relatively and the reference frame (Sum of Absolute Difference, absolute error with) value size adjusts that values of parameters changes present frame and reference frame generates proportion in the new frame in interpolation; And the performance of the interpolated frame of detection generation.
For achieving the above object, the present invention adopts following technical scheme:
A kind of digital video signal conversion method based on motion compensation, implementation step is following:
1) carry out the digital video signal source changed on the frame rate for needs, signal processing technology is general, and what handle is its YUV color space, rather than the RGB color space; This be because RGB require three independently vision signal transmit simultaneously, and for YUV signal, Y representes luminance signal; U, V represent carrier chrominance signal; The covariance in the Y of each pixel, U, three spaces of V is identical, if calculated the covariance of half-tone information Y, then can obtain the covariance in U, V space.So not only reduce the complexity of calculating, and made and need not transmit three road signals when signal transmits, only needed a transmission Y-signal to get final product.Therefore, before carrying out estimation and motion compensation, we want to convert image into yuv format from rgb format earlier.
2) adopt the method for estimating that matees based on piece, be divided into the macro block of many non-overlapping copies to each frame of moving image, and suppose that all pixels are done identical translation in each macro block, promptly have identical displacement, each macro block is calculated its motion vector separately; Search for the most similar macro block of each macro block as match block; Obtain more accurate and level and smooth motion vector, reduce the edge blurry phenomenon that motion compensated interpolation is brought.
3) present frame and reference frame are divided into the macro block of the 8*8 pixel of many non-overlapping copies; In reference frame, satisfy the corresponding coupling macro block of current macro of SAD matching criterior through all direction search method search, calculate then current macro motion vector and with the pixel absolute difference and the sad value of coupling macro block;
Wherein the SAD matching criterior is:
In the formula,
and
representes present frame and reference frame respectively;
is the size of the macro block of division;
is the displacement vector of each macro block.
The pixel definition of corresponding macro block is
in the interpolated frame; Wherein
;
;
;
is respectively the pixel of corresponding macro block in present frame and the reference frame; Sad value size through coupling macro block in macro block and the reference frame in the comparison present frame; Adjustment
, the value of
changes present frame and reference frame generates proportion in the new frame in interpolation:
If object of which movement is not obvious; The macro block motion is very little; This moment, sad value was very little; It is bigger that present frame generates in the new frame proportion in interpolation; Can regard the macro block of present frame as in the interpolated frame corresponding macro block; Get
this moment;
, then the pixel definition of corresponding macro block is
in the interpolated frame; If the object of which movement amplitude is big; Movement velocity is fast; The macro block motion is very big; This moment, sad value was very big; It is bigger that reference frame generates in the new frame proportion in interpolation; Get
this moment;
, then the pixel definition of corresponding macro block is
in the interpolated frame; If the object of which movement amplitude is between above two kinds of situation; The macro block motion is medium; Then according to the sad value size; Adjustment present frame and reference frame generate proportion in the new frame in interpolation; I.e. adjustment
; The value of
defines the pixel of corresponding macro block in the interpolated frame; When sad value increases from small to large gradually; Reduce the value of
gradually, the value that increases
gradually;
4) convert image into original rgb format by yuv format, the performance of the interpolated frame that detect to generate is carried out estimation and motion compensation process generation interpolated frame to present frame and reference frame; Then present frame and interpolated frame are carried out same estimation and motion compensation process once more and obtain new reference frame; The PSNR (Peak Signal to Noise Ratio, Y-PSNR) of the reference frame and the new reference frame of interpolation generation relatively estimates the performance of the movement compensating algorithm that is adopted; Work as PSNR>15; The interpolated frame that then generates meets the requirements, and < 15, the interpolated frame that then generates is undesirable as PSNR; Repeat step 1)-4), till meeting the requirements.
Wherein the PSNR computing formula is:
Wherein,
nFor transmitting the needed bit number of each pixel,
MSEBe mean square error.The PSNR value of calculating is high more, and video image that is then recovered out by this kind movement compensating algorithm and original video image are approaching more, and the performance of this movement compensating algorithm is good more.
The present invention has following outstanding advantage compared with prior art:
The motion amplitude of object has nothing in common with each other in the video flowing consecutive frame; Adopt single movement compensating algorithm of planting; Only better to the graphics performance of special exercise amplitude, for differ than greatly time corresponding with this kind algorithm of object of which movement amplitude in the frame, serious blooming can appear in object edge.The inventive method has been considered the movable information of object in these adjacent two frames, and the new frame that interpolation generates can reflect the movement locus of object in the frame well, and the new frame quality that interpolation generates is better, can effectively avoid single blurring effect that movement compensating algorithm brings of planting.The present invention can compare reference frame and pass through the PSNR of the new reference frame of interpolation generation, is used as estimating the standard of different motion backoff algorithm performance, thereby has got rid of the influence of motion estimation algorithm to the result, better compares the performance of different motion backoff algorithm.
Embodiment
Below in conjunction with accompanying drawing and embodiment the inventive method is further specified.
As shown in Figure 1, a kind of digital video signal conversion method based on motion compensation, implementation step is following:
1) carries out the digital video signal source changed on the frame rate for needs, convert image into yuv format from rgb format earlier; Conversion formula is:
RGB—>YUV:
2) adopt the method for estimating that matees based on piece, be divided into the macro block of many non-overlapping copies to each frame of moving image, and suppose that all pixels are done identical translation in each macro block, promptly have identical displacement, each macro block is calculated its motion vector separately; Search for the most similar macro block of each macro block as match block; Obtain more accurate and level and smooth motion vector, reduce the edge blurry phenomenon that motion compensated interpolation is brought.
3) present frame and reference frame are divided into the macro block of the 8*8 pixel of many non-overlapping copies; In reference frame, satisfy the corresponding coupling macro block of current macro of SAD matching criterior through all direction search method search, calculate then current macro motion vector and with the pixel absolute difference and the sad value of coupling macro block;
Wherein the SAD matching criterior is:
In the formula,
and
representes present frame and reference frame respectively;
is the size of the macro block of division;
is the displacement vector of each macro block.
The pixel definition of corresponding macro block is
in the interpolated frame; Wherein
;
;
;
is respectively the pixel of corresponding macro block in present frame and the reference frame; Sad value size through coupling macro block in macro block and the reference frame in the comparison present frame; Adjustment
, the value of
changes present frame and reference frame generates proportion in the new frame in interpolation:
If object of which movement is not obvious; The macro block motion is very little; This moment, sad value was very little; It is bigger that present frame generates in the new frame proportion in interpolation; Can regard the macro block of present frame as in the interpolated frame corresponding macro block; Get
this moment;
, then the pixel definition of corresponding macro block is
in the interpolated frame; If the object of which movement amplitude is big; Movement velocity is fast; The macro block motion is very big; This moment, sad value was very big; It is bigger that reference frame generates in the new frame proportion in interpolation; Get
this moment;
, then the pixel definition of corresponding macro block is
in the interpolated frame; If the object of which movement amplitude is between above two kinds of situation; The macro block motion is medium; Then according to the sad value size; Adjustment present frame and reference frame generate proportion in the new frame in interpolation; I.e. adjustment
; The value of
defines the pixel of corresponding macro block in the interpolated frame; When sad value increases from small to large gradually; Reduce the value of
gradually, the value that increases
gradually;
4) convert image into original rgb format by yuv format,
Conversion formula is:
YUV—>RGB:
The performance of the interpolated frame that detect to generate is carried out estimation and motion compensation process generation interpolated frame to present frame and reference frame, then present frame and interpolated frame is carried out same estimation and motion compensation process once more and obtains new reference frame; The Y-PSNR PSNR that compares the new reference frame of reference frame and interpolation generation; Estimate the performance of the movement compensating algorithm that is adopted, work as PSNR 15, the interpolated frame that then generates meets the requirements; As PSNR < 15; The interpolated frame that then generates is undesirable, repeats step 1)-4), till meeting the requirements.
Fig. 2 is a reference frame picture in the video flowing.It is the single simple operation that matees macro block in the present frame in macro block and the reference frame that the picture that Fig. 3 is a present frame after the single movement backoff algorithm is handled, interpolation generate macro block pixels in the new frame, and interpolation algorithm fails to adjust according to object of which movement situation in the frame.Fig. 4 is the picture of present frame after the inventive method is handled.Fig. 5 is the picture of present frame after the simple linear interpolation algorithm is handled, and adjacent two frame integral body in the video flowing is carried out linear interpolation generate new frame, and the graphical quality that the not motion conditions of object in the considered frame, so interpolation generates new frame is the poorest.Picture after the inventive method interpolation processing is as shown in Figure 4, and effect is fine, and is the most approaching with reference frame.
Fig. 6 is the Y-PSNR PSNR sketch map of image after the algorithm process that single movement backoff algorithm, simple linear interpolation algorithm and the inventive method propose.The PSNR sketch map shows that the signal to noise ratio that the inventive method interpolation generates new frame is higher than single movement backoff algorithm and simple linear interpolation algorithm, and the motion compensation process that the present invention proposes has certain superiority.This method has improved the accuracy of interpolation, the blurring effect of effectively having avoided interpolated frame to bring.