Summary of the invention
Technology of the present invention is dealt with problems and is: overcome the deficiencies in the prior art, a kind of file storage overlay method based on motion-vector is provided.Under the full situation of storage medium, this method can make useful history file keep long storage time.
Technical solution of the present invention is:
File storage overlay method based on motion-vector provided by the invention, first kind of technical scheme may further comprise the steps:
(1) in storage medium, sets up an index block that is used for storing judgment criteria, contain the motion-vector threshold values that the user sets in the described index block;
(2) in each file storage piece of storage medium, set up a header that is used for storing motion-vector statistical value in this document; During store video files, add up the quantity of motion-vector simultaneously, the motion-vector of adding up is counted in the header of current file storage block.
(3) check whether storage medium is enough to store the current video file,, then change step (6) over to if this moment, storage medium was enough to store the current video file; If this moment, storage medium was not enough to store the current video file, then change step (4) over to, continue step (5);
(4) read the motion-vector threshold values that the user sets, according to time sequencing, the motion-vector statistical value summation and the described motion-vector threshold values of each file storage piece the inside information are compared, if the motion-vector statistical value summation of this document storage block is less than described motion-vector threshold values, then delete this document storage block, no longer follow-up comparison;
(5) check this moment, whether storage medium was enough to store the current video file, if satisfy, then changed step (6) over to; If this moment, storage medium also was not enough to store the current video file, then cycling step (4) is enough to satisfy the preservation of current video file, execution in step (6) until storage medium; If storage medium also is not enough to store the current video file during loop ends, then jump out;
(6) storage current video file.
Further, comprise the time allocation table of storing current motion-vector statistical value in described each file storage build information of step (2), the motion-vector statistical information counts the corresponding time period of time allocation table by time of origin.
Preferably, described time allocation table is 24 hours allocation tables, and the data of storing in the table are the statistical value of motion-vector in current hour.
Second kind of technical scheme provided by the invention is on the basis of first kind of technical scheme, also comprises the time period preferred value that the user sets in the described index block of step (1); If storage medium is not enough to store the current video file, then read time period preferred value and motion-vector threshold values that the user sets, according to time sequencing, motion-vector statistical value and described motion-vector threshold values that should the time period in each file storage build information be compared, if the motion-vector statistical value of described time period is less than described motion-vector threshold values in this document storage block, then delete this document storage block, no longer follow-up comparison.
In these two kinds of technical schemes, storage medium also is not enough to store the current video file when finishing as if cycling step (4), then can select to carry out in the following steps any:
A, according to time sequencing, deletion time file storage piece the earliest is enough to satisfy the preservation of current video file until storage medium.
The motion-vector threshold values of setting in B, the described index block of set-up procedure (1) continues step (4) and subsequent operation.
Video file of the present invention can be a fixed size, also can be (according to the size of actual conditions decision video file) that differs in size.
The present invention compared with prior art has following advantage:
(1) the present invention is provided with index block in storage medium, and header is set for each video file storage piece, by the motion-vector threshold values comparison that user in the motion-vector statistical value summation of video file storage piece the inside information and the index block is set, whether decision deletes this video file storage piece, the present invention has intelligently compared to existing technology, can make useful history file keep long storage time under the full situation of storage medium.
(2) the present invention further is provided with the time period preferred value in index block, if storage medium is not enough to store the current video file, then read time period preferred value and motion-vector threshold values that the user sets, according to time sequencing, motion-vector statistical value and described motion-vector threshold values that should the time period in each file storage build information be compared, whether decision deletes this video file storage piece, this scheme has bigger dirigibility when covering existing file, can operate according to the time period preferred value that the user sets.
(3) motion-vector threshold values in the index block of the present invention and time period preferred value all can be on-the-fly modified by the user, have strengthened this method feasibility and dirigibility in practice.
(4) video file of the present invention both can be a fixed size, can be again sizing not, can be determined the size of video file by actual conditions.
Embodiment
Below with reference to accompanying drawing the specific embodiment of the present invention is described.
Embodiment one:
As shown in Figure 3, the file storage overlay method based on motion-vector may further comprise the steps:
(1) in storage medium, sets up an index block that is used for storing judgment criteria, contain the motion-vector threshold values that the user sets in the described index block.The user can on-the-fly modify the memory contents in this storage medium.
(2) in each file storage piece of storage medium, set up a header that is used for storing motion-vector statistical value in this document; During store video files, add up the quantity of motion-vector simultaneously, the motion-vector of adding up is counted in the header of current file storage block.
Each video file storage piece all has a header, is used for adding up the statistical value of motion-vector in this video blocks:
The statistical value of motion-vector in this video file of record in a, the header;
Adopt incremental manner when b, statistics motion-vector.
(3) check whether storage medium is enough to store the current video file,, then change step (6) over to if this moment, storage medium was enough to store the current video file; If this moment, storage medium was not enough to store the current video file, then change step (4) over to;
(4) read the motion-vector threshold values that the user sets, according to time sequencing, the motion-vector statistical value summation and the described motion-vector threshold values of each file storage piece the inside information are compared, if the motion-vector statistical value summation of this document storage block is less than described motion-vector threshold values, then delete this document storage block, no longer follow-up comparison continues step (5);
(5) check this moment, whether storage medium was enough to store the current video file, if satisfy, then changed step (6) over to; If this moment, storage medium also was not enough to store the current video file, then cycling step (4) is enough to satisfy the preservation of current video file, execution in step (6) until storage medium; If storage medium also is not enough to store the current video file during loop ends, then jump out;
(6) storage current video file.
Further, storage medium also is not enough to store the current video file when finishing as if cycling step (4), and then according to time sequencing, deletion time file storage piece the earliest is enough to satisfy the preservation of current video file until storage medium.
Perhaps, storage medium also is not enough to store the current video file when finishing as if cycling step (4), and then the motion-vector threshold values of setting in the described index block of set-up procedure (1) continues step (4) and subsequent operation.
Embodiment two:
Be on the basis of embodiment one, also comprise the time period preferred value that the user sets in the described index block of step (1); Also comprise the time allocation table of storing current motion-vector statistical value in described each file storage build information of step (2), the motion-vector statistical information counts the corresponding time period of time allocation table by time of origin, with 24 hours allocation tables was example, and the data of storing in the table are the statistical value of motion-vector in current hour.
As shown in Figure 3, based on the file storage overlay method of motion-vector, concrete steps comprise:
(1) in storage medium, sets up an index block that is used for storing judgment criteria,, contain the motion-vector threshold values of a, user's setting in the described index block, the time period preferred value that b, user set referring to Fig. 1.The user can on-the-fly modify the memory contents in this storage medium.
(2) in each file storage piece of storage medium, set up a header that is used for storing motion-vector statistical value in this document, referring to Fig. 2; During store video files, add up the quantity of motion-vector simultaneously, the motion-vector of statistics is counted in the header of current file storage block. also comprise the time allocation table of storing current motion-vector statistical value in each file storage build information, the motion-vector statistical information counts the corresponding time period of time allocation table by time of origin, with 24 hours allocation tables was example, and the data of storing in the table are the statistical value of motion-vector in current hour.
Each video file storage piece all has a header, is used for adding up the statistical value of motion-vector in this video blocks:
Can distinguish the motion-vector statistical value in a, the header in which period (1-24 hour);
B, motion-vector statistical value count the corresponding period by time of origin respectively;
Adopt incremental manner when c, statistics motion-vector.
(3) check whether storage medium is enough to store the current video file,, then change step (6) over to if this moment, storage medium was enough to store the current video file; If this moment, storage medium was not enough to store the current video file, then change step (4) over to;
(4) read time period preferred value and the motion-vector threshold values that the user sets, according to time sequencing, motion-vector statistical value and described motion-vector threshold values that should the time period in each file storage build information be compared, if the motion-vector statistical value of described time period is less than described motion-vector threshold values in this document storage block, then delete this document storage block, no longer follow-up comparison continues step (5);
(5) check this moment, whether storage medium was enough to store the current video file, if satisfy, then changed step (6) over to; If this moment, storage medium also was not enough to store the current video file, then cycling step (4) is enough to satisfy the preservation of current video file, execution in step (6) until storage medium; If storage medium also is not enough to store the current video file during loop ends, then jump out;
(6) storage current video file.
Further, storage medium also is not enough to store the current video file when finishing as if cycling step (4), and then according to time sequencing, deletion time file storage piece the earliest is enough to satisfy the preservation of current video file until storage medium.
Perhaps, storage medium also is not enough to store the current video file when finishing as if cycling step (4), and then the motion-vector threshold values of setting in the described index block of set-up procedure (1) continues step (4) and subsequent operation.
Video file among above-mentioned two embodiment (also claiming the video recording piece) both can be a fixed size, also can differ in size, and it is fixed that the big I of video file is come by actual conditions.
Influenced in storing process for fear of video file (video recording piece), the work of deletion video file (video recording piece) should be carried out before memory space inadequate.
The statistical work of motion-vector should trigger once behind the full video recording piece of every record, arranges the time that the statistics that practices every conceivable frugality is searched according to the size order of motion-vector statistical value.
The content that is not described in detail in the instructions of the present invention belongs to this area professional and technical personnel's known technology.
The above; it only is preferred embodiment of the present invention; be not that the present invention is done any pro forma restriction; every foundation technical spirit of the present invention all still belongs to the protection domain of technical solution of the present invention to any simple modification, equivalent variations and modification (as: technical scheme of embodiment one and embodiment two is combined the technical solution problem) that above embodiment did.