Summary of the invention
The embodiment of the invention provides a kind of frame rate control method, can improve the flexibility of frame per second control.
The embodiment of the invention provides a kind of frame per second control device, can improve the flexibility of frame per second control.
Below the technical scheme that provides for the embodiment of the invention:
A kind of frame rate control method, this method comprises:
The frame per second controlled flag of step a, generation preseting length;
Step b, with the enable flag set starting point as described frame per second controlled flag;
Step c, with the frame losing set at interval the mark in the described frame per second controlled flag be set to abandon mark, and other marks are set to retention marker;
Steps d, read the enable flag of described frame per second controlled flag, if described enable flag is for enabling, execution in step e then, otherwise return steps d;
The mark in the frame per second controlled flag is read in step e, circulation, if current being labeled as of reading in the frame per second controlled flag abandons mark, then abandons the present frame images acquired, otherwise keeps the present frame images acquired.
Described step c further is provided with the frame losing number and subtracts 1 difference after divided by the frame losing number with frame per second controlled flag length as frame losing at interval; If frame per second controlled flag length comprises the integer quotient and the remainder divided by the result of frame losing number, then frame per second controlled flag length is deducted the merchant that obtains divided by the frame losing number behind the described remainder at interval as frame losing.
A kind of frame per second control device, this device comprises:
First module is used to generate the frame per second controlled flag of preseting length;
Second module is used for the enable flag that will the set starting point as described frame per second controlled flag;
Three module, be used for the frame losing set at interval the mark of described frame per second controlled flag be set to abandon mark, and other marks are set to retention marker;
Four module is used to read the enable flag of described frame per second controlled flag, if described enable flag for enabling, then by the 5th resume module, otherwise continues to read the enable flag of described frame per second controlled flag;
The 5th module is used for circulating and reads the mark of described frame per second controlled flag, if current being labeled as of reading in the frame per second controlled flag abandons mark, then abandons the present frame images acquired, otherwise keeps the present frame images acquired.
Described three module further subtracts 1 difference after divided by the frame losing number that is provided with as frame losing at interval with frame per second controlled flag length; If frame per second controlled flag length comprises the integer quotient and the remainder divided by the result of frame losing number, then frame per second controlled flag length is deducted the merchant who obtains divided by the frame losing number behind the described remainder and subtract 1 more at interval as frame losing.
From technique scheme as can be seen, frame rate control method that the embodiment of the invention provides and device, employing is read the mode of frame per second controlled flag and is controlled frame losing flexibly, do not need the frame of video that buffer memory in time do not handle and wait for that the frame of video of described buffer memory handles, therefore, can improve the flexibility of frame per second control, also reduce the time-delay in the Video processing.
Embodiment
For making the purpose, technical solutions and advantages of the present invention express clearlyer, the present invention is further described in more detail below in conjunction with drawings and the specific embodiments.
First embodiment:
The flow chart of the frame rate control method that Fig. 1 provides for the embodiment of the invention.As shown in Figure 1:
Step 101: generate the frame per second controlled flag and in described frame per second controlled flag, the frame losing mark is set.
This step can adopt mode one realization:
Generate the frame per second controlled flag of preseting length.
In the frame per second controlled flag that generates, be set to abandon mark with the mark in the described frame per second controlled flag of setting in frame losing interval.
This step can also adopt mode two realizations:
Generate the frame per second controlled flag of preseting length.
With the enable flag set starting point as described frame per second controlled flag.
Be set to abandon mark with the mark in the described frame per second controlled flag of setting in frame losing interval.
Step 102: the frame per second controlled flag that read step 101 generates if current being labeled as of reading abandons mark, then abandons the present frame images acquired in the frame per second controlled flag.
If step 101 employing mode one realizes that in this step, the frame per second controlled flag that described read step 101 generates can realize in the following ways:
Begin to highest order from the lowest order of frame per second controlled flag, the mark in the frame per second controlled flag is read in circulation; Perhaps the highest order from the frame per second controlled flag begins to lowest order, and the mark in the frame per second controlled flag is read in circulation.
If step 101 employing mode two realizes that in this step, the frame per second controlled flag that described read step 101 generates can realize in the following ways:
Read the enable flag of described frame per second controlled flag, if described enable flag then reads other mark in the frame per second controlled flag for enabling, otherwise, return the step of the enable flag that reads described frame per second controlled flag.
In addition, if the current mark that in the frame per second controlled flag, reads be not abandon mark neither enable flag, then this method may further include: keep the present frame images acquired.
Second embodiment:
The flow chart of the frame rate control method that Fig. 2 provides for the embodiment of the invention.As shown in Figure 2:
Step 201: the frame per second controlled flag that generates preseting length.
Step 202: with the enable flag set starting point as described frame per second controlled flag.
In actual applications, this step also can be omitted.For example, enable flag can be set, if read the frame losing mark then abandon the present frame images acquired, if realize not frame losing, can be 0 with the length setting of frame per second controlled flag then, perhaps frame losing is set at 0 at interval.Like this, just realized the function of enable flag.
Step 203: be set to abandon mark with the mark in the described frame per second controlled flag of setting in frame losing interval, other mark is set to retention marker.
In this step, the described mark that abandons can adopt multiple mode to realize, for example character, binary number or character string, or the like.With the simplest binary digit is example, is 30 if set the length of frame per second controlled flag, and frame losing is spaced apart 4, supposes that step 201 with the frame per second controlled flag of the binary form of generation is:
111111111111111111111111111111。
In the present embodiment, set 0 and be the frame losing mark, 1 is retention marker.4 in length is 30 frame per second controlled flag, the frame losing mark is set at interval with the frame losing set.The result is set is:
111101111011110111101111011110。
Wherein, the position of frame losing mark can be chosen flexibly, if satisfy every 41 be provided with one 0 just passable.For example, be provided with the result also can for: 101111011110111101111011110111, perhaps be: 011110111101111011110111101111, or the like.
In addition,, also the frame losing number can be set, adopt mathematical computations promptly can draw frame losing at interval, frame losing interval=frame per second controlled flag length/frame losing number-1 if be inconvenient to be provided with frame losing in advance at interval.For example, the length that the frame per second controlled flag is set is 30, and the frame losing number is 6, and so, frame losing is spaced apart: 30/60-1=4.
When the aliquant frame losing number of the length of the frame per second controlled flag that is provided with, the result who obtains after being divided by comprises quotient and the remainder, in this case, can be earlier as frame losing at interval with the merchant, the length of frame per second controlled flag is deducted the length of remainder as new frame per second controlled flag, in new frame per second controlled flag, the frame losing mark is set at interval according to new frame per second controlled flag length and described frame losing again.After this, a remaining remainder retention marker is inserted between per two frame losing marks successively.
Still the frame per second controlled flag with binary form is an example, suppose that the frame per second controlled flag length of setting is 34, the frame losing number is 6,34/6=5 surpluss 4, so can be with 34-4=30 as new frame per second controlled flag, use 30/6-1=4 at interval again, in described length is 30 frame per second controlled flag as frame losing, every 4 frames a frame losing mark is set, the result is identical with above-mentioned situation:
101111011110111101111011110111。
But present frame per second controlled flag length is 30, so need remaining 4 retention marker " 1 ", evenly inserts this length and be 30 frame per second controlled flag.Be specifically as follows: after each frame losing mark, insert a retention marker successively, perhaps be, between per two frame losing marks, insert a retention marker successively.
The result of the final frame per second controlled flag of setting can for:
1011111011111011111011111011110111。
Like this, just make the frame losing mark in the frame per second controlled flag distribute equably as far as possible.
Step 204: read the enable flag of frame per second controlled flag starting point, if described enable flag is for enabling, then execution in step 205, otherwise, return step 204.
In the present embodiment, described enable flag can be a binary digit, and for example, if enable flag is changed to 1, then expression enables, if enable flag is changed to 0, then represents disable.
If omitted step 202, then this step also can be omitted, directly execution in step 205.
Step 205: begin to highest order from the lowest order of frame per second controlled flag, the mark in the frame per second controlled flag is read in circulation, if being labeled as of reading abandons mark, then execution in step 206, otherwise execution in step 207.
In the present embodiment, suppose that described frame per second controlled flag is:
111101111011110111101111011110。
In the step, when receiving images acquired, begin until highest order reads the mark the frame per second controlled flag,, judge that then being labeled as of reading abandons mark, execution in step 206 if read 0 from the lowest order of frame per second controlled flag; If read 1, then judge read be labeled as retention marker, execution in step 207.
By with frame losing mark mean allocation in the frame per second controlled flag, frame per second can be controlled at a state relatively stably.
Read after 30 marks of described frame per second controlled flag, returned the step that begins to read the mark the frame per second controlled flag from the lowest order of frame per second controlled flag up to highest order.
In addition, also can adopt to begin to circulate and read mark the frame per second controlled flag to the mode of lowest order from the highest order of frame per second controlled flag.
Step 206: abandon the present frame images acquired, process ends.
Step 207: keep the present frame images acquired.
The embodiment of the invention also provides a kind of frame per second control device, with embodiment the frame per second control device that the embodiment of the invention provides is described in further detail below.
The 3rd embodiment:
The structure chart of the frame per second control device that Fig. 3 provides for the embodiment of the invention.As shown in Figure 3:
The frame per second control device that the embodiment of the invention provides comprises: configuration module 301 and control module 302.
Configuration module 301 is used for generating the frame per second controlled flag and in described frame per second controlled flag the frame losing mark is set, and described frame per second controlled flag is sent to control module 302.
Wherein, configuration module 301 comprises: generation module 3011 and distribution module 3012.
Generation module 3011 is used to generate the frame per second controlled flag of preseting length, and the frame per second controlled flag that generates is sent to distribution module 3012.
Distribution module 3012 is used to receive the frame per second controlled flag from generation module 3011, is set to abandon mark with the mark in the described frame per second controlled flag of setting in frame losing interval, and described frame per second controlled flag is sent to control module 302.
In addition, distribution module 3021 can be further used for after the frame per second controlled flag that receives from generation module 3011, earlier with the enable flag set first place as described frame per second controlled flag, be set to abandon mark with the mark in the described frame per second controlled flag of setting in frame losing interval again, described frame per second controlled flag is sent to control module 302.
Control module 302 is used to receive images acquired and from the frame per second controlled flag of configuration module 301, reads described frame per second controlled flag, if current being labeled as of reading in the frame per second controlled flag abandons mark, then abandons the present frame images acquired.
Control module 302 can be further used for receiving the frame per second controlled flag that comprises enable flag from distribution module 3021, after receiving described frame per second controlled flag, read the enable flag of described frame per second controlled flag first place earlier, if described enable flag is for enabling, then read described frame per second controlled flag and being labeled as of reading and abandon the present frame images acquired when abandoning mark, if described enable flag is a disable, then receive the frame per second controlled flag that comprises enable flag again from distribution module 3021.
Control module 302 comprises: read module 3021 and processing module 3022.
Read module 3021 is used to receive the frame per second controlled flag from configuration module 301, read the mark in the described frame per second controlled flag, if being labeled as of reading in described frame per second controlled flag abandons mark, then send and abandon message, otherwise send reservation message to processing module 3022 to processing module 3022.
Processing module 3022 is used to receive message and the images acquired from read module 3021, if receive the message that abandons from read module, then abandon the present frame images acquired,, then keep the present frame images acquired if receive reservation message from read module.
From technique scheme as can be seen, frame rate control method that the embodiment of the invention provides and device, employing is read the mode of frame per second controlled flag and is controlled frame losing flexibly, do not need the frame of video that buffer memory in time do not handle and wait for that the frame of video of described buffer memory handles, therefore, can improve the flexibility of frame per second control, also reduce the time-delay in the Video processing.
In addition, control frame per second, do not need to do the calculating and the modification of large amount of complex, saved the disposal ability resource, and processing method is simple according to reading the frame per second controlled flag.
In sum, more than be preferred embodiment of the present invention only, be not to be used to limit protection scope of the present invention.Within the spirit and principles in the present invention all, any modification of being done, be equal to replacement, improvement etc., all should be included within protection scope of the present invention.