Embodiment
For making purpose of the present invention, technical scheme and advantage clearer, below with reference to the accompanying drawing embodiment that develops simultaneously, the present invention is described in more detail.
The embodiment of the invention mainly is to utilize the frame of video that receives is analyzed, and according to the result who analyzes the frame of video that receives is carried out discard processing, to reach the purpose of frame per second control.Carry out frame per second control by the method for frame losing, can handle frame per second flexibly, and guarantee the real-time of processing, control operation is simple, and versatility is good, and consumption of natural resource is few.
Below, will introduce the concrete structure of the frame per second control device of the embodiment of the invention in detail;
Fig. 1 is the exemplary block diagram of the frame per second control device of the embodiment of the invention.
As shown in Figure 1, the frame per second control device of the embodiment of the invention comprises: input module 101 and frame losing control module 102.
Wherein, input module 101 is used for the receiver, video frame, and the frame of video that receives is exported to frame losing control module 102.
Frame losing control module 102 is used to receive the frame of video of input module 101 outputs, according to predefined frame losing processing parameter, selects the frame of video that need abandon from the frame of video that receives; The frame of video that described needs are abandoned discards, the frame of video that output does not abandon.
Wherein predefined frame losing processing parameter can be: represent that a frame losing operates the frame losing number of the quantity of the frame losing circulation number of quantity of frame of required reference and the frame that frame losing action need of expression is lost, then frame losing control module 102 is used for selecting the frame of video that needs abandon according to the frame losing circulation number and the frame losing number that set in advance from the frame of video that receives.
Specifically, the concrete structure of described frame losing control module 102 can comprise as shown in Figure 2: similitude comparing unit 201, frame losing selected cell 202 and frame losing processing unit 203.
Wherein, similitude comparing unit 201 is used to receive the frame of video that input module 101 sends, and the frame of video that receives is carried out similitude relatively, the similitude amount of the frame of video that obtains.
Frame losing selected cell 202 is used to receive the similitude amount of the frame of video that similitude comparing unit 201 sends, similitude amount according to described frame of video, from with the frame of video of described frame losing circulation number equal number, select the frame of video that the needs with described frame losing number equal number abandon.
Frame losing processing unit 203 is used for the frame of video that the needs that frame losing selected cell 202 is selected abandon is discarded, the frame of video that output does not abandon.
Wherein, similitude comparing unit 201 can be that described each frame of video that receives and its former frame are carried out similitude relatively, obtain the similitude amount of described frame of video, if described frame of video is first frame of video that receives, then the similitude amount of this first frame of video is set to the interior minimum value of span of described similitude amount.Can certainly set that first frame is fixing not to be abandoned.
Perhaps, similitude comparing unit 201 also can carry out similitude relatively with described each frame of video that receives and a frame thereafter, obtain the similitude amount of described frame of video, if described frame of video is last frame of video that receives, then the similitude amount of this last frame of video is set to the interior maximum of span of described similitude amount.Certainly, also can set last frame fixedly abandons.
Certainly, similitude relatively can also be every frame relatively, repeats no more here.
In addition, frame losing selected cell 202 can be from the frame of video of described frame losing circulation number equal number, select with described frame losing number equal number, the frame of video of similitude amount maximum, the frame of video that abandons as needs.
Selecting the big frame of video of similitude amount as the frame of video that needs abandon, is in order to guarantee the continuity of video image when the frame losing, to be unlikely to occur the chattering of video image as far as possible, reduces the problem that the quality of frame losing rear video image descends.
Certainly, more than be preferred embodiment to the processing of frame losing, can also adopt the method for frame losing at random or fixedly frame losing to carry out frame per second control, carry out frame per second control if adopt the method for frame losing at random, the concrete structure of so described frame losing control module can comprise as shown in Figure 3: frame losing unit 301 and frame losing processing unit 302 at random.
Wherein, frame losing unit 301 is used to receive the frame of video that input module 101 sends at random, according to frame losing circulation number that sets in advance and frame losing number, from that receive and frame of video described frame losing circulation number equal number, select the frame of video that abandons at random with the needs of described frame losing number equal number.
The frame of video that the frame of video that frame losing processing unit 302 is used for receiving needs to abandon discards, the frame of video that output does not abandon.
It is similar to adopt the fixing method of frame losing to carry out the method for frame per second control, only needs the frame of video of selection fixed position to abandon and gets final product, and repeats no more here.
Introduce the frame per second control device of the embodiment of the invention above, will introduce the frame rate control method of the embodiment of the invention in detail below.
Fig. 4 is the overall exemplary process diagram of the frame rate control method of the embodiment of the invention.As shown in Figure 4, this flow process specifically comprises the steps:
Step 401 according to predefined frame losing processing parameter, is selected the frame of video that need abandon from the frame of video that receives.
Predefined frame losing processing parameter can comprise that frame losing of expression operates the frame losing number of the quantity of the frame losing circulation number of quantity of frame of required reference and the frame that frame losing action need of expression is lost.According to predefined frame losing processing parameter, from the frame of video that receives, select the frame of video that need abandon, from the frame of video that receives, select the frame of video that needs abandon according to the frame losing circulation number and the frame losing number that set in advance exactly.
Such as frame losing circulation number is set is 7, and the frame losing number is 3, just represents that frame losing operation will be selected 3 frame of video from 7 frame of video that receive be the frame of video that need abandon.If the frame losing number is set to 0, then expression does not need frame losing, the operation that need not select.Certainly, frame losing circulation number is set to 0, also do not need can represent frame losing.In addition, can also be with the number of retention frame, as the frame losing parameter, the frame losing number that circulates is deducted the number of retention frame, can represent the number of the frame that need lose.The set-up mode of frame losing processing parameter can be a lot, and to abandon what frame of video in what frame of video just passable so long as can express.
Step 402, the frame of video that needs are abandoned discards, the frame of video that output does not abandon.
The frame of video that 3 needs selecting in the step 401 are abandoned discards, with remaining 4 frames output, reach the purpose of control frame per second, for example be originally per second 28 frames, after passing through the processing of frame losing so, will become per second 16 frames, be 4 if frame losing circulation number is set, the frame losing number is 2, and the frame per second after then handling will become per second 14 frames.
In the above step 401, the concrete grammar of selecting the frame of video that needs abandon according to the frame losing circulation number that sets in advance and frame losing number from the frame of video that receives is:
The frame of video that receives is carried out similitude relatively, according to the similitude amount of the frame of video that relatively obtains, from the frame of video of described frame losing circulation number equal number, select the frame of video that the needs with described frame losing number equal number abandon.Perhaps, adopt the mode of selecting at random, select the frame of video that need abandon at random.Perhaps, adopt the fixedly selection mode of frame losing, be set to 7 such as frame losing circulation number, the frame losing number is set to 3, and so fixedly the method for frame losing is exactly according to the sequencing that receives, and fixes with the 2nd, 4,6 frames the frame of video that abandons as needs.
Wherein, the concrete grammar of similitude comparison can be: each frame of video that will receive and its former frame are carried out similitude relatively, obtain the similitude amount of described frame of video, if described frame of video is first frame of video that receives, then the similitude amount of this first frame of video is set to the interior minimum value of span of described similitude amount.Certainly, can set also that first frame is fixing not to be abandoned.Wherein, the similitude amount can adopt the quantized versions of percentage, and span is 0%~100%, also can adopt numeral or alphabetical form, and concrete quantification manner and span are any.
Perhaps, described each frame of video that receives and a frame are thereafter carried out similitude relatively, obtain the similitude amount of described frame of video.If described frame of video is last frame of video that receives, then the similitude amount of this last frame of video is set to the interior maximum of span of described similitude amount.Certainly, also can set last frame fixedly abandons.If carry out similitude relatively, so, just need not first frame has been done independent processing with the frame of back.
In addition, from with the frame of video of described frame losing circulation number equal number, select the frame of video that the needs with described frame losing number equal number abandon, be from the frame of video of described frame losing circulation number equal number, selection and described frame losing number equal number, the frame of video of similitude amount maximum, the frame of video that abandons as needs.
Suppose that frame losing circulation number is set to 7, the frame losing number is set to 3, concrete selection course can be: the similitude amount of 7 frame of video that similitude is relatively drawn sorts earlier, concrete ordering can be used arbitrarily, and sort method sorts, such as ordering from big to small, ordering from small to large is chosen as the frame of video that need abandon with coming preceding 3 frame of video, if then will come back 3 frame of video and be chosen as the frame of video that need abandon.
Selecting the big frame of video of similitude amount as the frame of video that needs abandon, is in order to guarantee the continuity of video image when the frame losing, to be unlikely to occur the chattering of video image, reduce the problem of frame losing rear video image quality decrease as far as possible.
Give a concrete illustration, be set to 7 such as frame losing circulation number, the frame losing number is set to 3, the similitude of frame of video relatively in, the similitude amount of the frame of video that obtains is respectively: frame frame1 is 88%, frame2 is 79%, frame3 is 98%, and frame4 is 96%, and frame5 is 86%, frame6 is 93%, and frame7 is 64%.
According to similitude amount ordering, obtain ranking results and be:
frame3>frame4>frame6>frame?1>frame5>frame2>frame7。
Be provided with according to the frame losing number, frame3, frame4, frame6 be chosen as the frame of video that need abandon; Frame1, frame5, frame2, frame7 are retained.
If in the similitude amount of the frame of video that compares, there is the similitude amount of two or more frame of video identical, then can be according to the setting of frame losing number, the frame of video that any selection need abandon, also be set to 7 with frame losing circulation number, the frame losing number is set to 3 and is example, and as follows such as the similitude amount of frame of video: frame1 is 88%, frame2 is 88%, frame3 is 98%, and frame4 is 96%, and frame5 is 86%, frame6 is 73%, and frame7 is 64%.
Pai Xu result is frame3>frame4>frame1=frame2>frame5>frame6>frame7 so.
Because need lose 3 frames, so can in frame1 and frame2, select a frame of video that abandons as needs, another reservation arbitrarily.
Below for a specific example, suppose that frame losing circulation number is set to 7, the frame losing number is set to 3, concrete frame per second control flow as shown in Figure 5, Fig. 5 is the particular flow sheet of the frame rate control method of the embodiment of the invention.
Step 501 judges whether the frame losing number that sets in advance is 0.
If the frame losing number that is provided with is 0, then do not operate, directly finish, if not 0, then enter the selection flow process of frame losing, execution in step 502.
Step 502, the receiver, video frame.
Step 503 judges that whether the frame of video receive is first frame in all frame of video that receive, if then execution in step 505, otherwise execution in step 504.
Step 504 is carried out similitude relatively with frame of video and its former frame of receiving, obtains the similitude amount of this frame.
Step 505, the similitude amount that frame of video is set is 0%.
Step 506 according to the size of similitude amount, sorts to 7 frame of video that receive.
Step 507, the result according to ordering selects wherein 3 frame of video that frame of video abandons as needs of similitude amount maximum.
Step 508, the frame of video that the needs of selecting are abandoned discards, process ends.
Abandon 3 frame of video that needs abandon selecting, with 4 frame of video outputs that keep.
In the above step 505, the similitude amount has adopted the form of percentage, no matter what quantized versions is the similitude amount adopt, as long as the similitude amount of this frame is made as the minimum value that can get in the quantized versions of employing.
By the above embodiments as seen, of the present invention this according to predefined frame losing processing parameter, from the frame of video that receives, select the frame of video that need abandon; The frame of video that described needs are abandoned discards, the frame rate control method and the device of the frame of video that output does not abandon, carry out the control of frame per second by frame losing, the frame of video that can't in time be handled discards, rather than wait for and handling again in the time of to handle, need not buffer memory multitude of video frame, therefore can not produce very big processing delay, and handle time-delay and can not accumulate.In addition, the frame rate control method of the embodiment of the invention and device need not the frame of video that receives is made amendment, so the consumption of resource are very little, and processing procedure is simple, and control realizes easily flexibly.And, relatively carry out the selection of frame losing by similitude, the problem that the video image quality that can avoid frame losing to cause to a great extent descends.
Institute is understood that; the above is a better embodiment of the present invention only, and is not intended to limit the scope of the invention, and is within the spirit and principles in the present invention all; any modification of being made, be equal to replacement, improvement etc., all should be included within protection scope of the present invention.