CN100589541C - A hardware resource self-adapted AVI file playing method - Google Patents
A hardware resource self-adapted AVI file playing method Download PDFInfo
- Publication number
- CN100589541C CN100589541C CN200710120073A CN200710120073A CN100589541C CN 100589541 C CN100589541 C CN 100589541C CN 200710120073 A CN200710120073 A CN 200710120073A CN 200710120073 A CN200710120073 A CN 200710120073A CN 100589541 C CN100589541 C CN 100589541C
- Authority
- CN
- China
- Prior art keywords
- file
- frame rate
- avi
- interruption frequency
- timer
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
- 238000000034 method Methods 0.000 title claims description 65
- 230000006978 adaptation Effects 0.000 claims description 35
- 230000003044 adaptive effect Effects 0.000 claims description 16
- 238000012360 testing method Methods 0.000 claims description 12
- 230000007613 environmental effect Effects 0.000 claims description 3
- 238000010586 diagram Methods 0.000 description 2
- 230000001186 cumulative effect Effects 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 230000007257 malfunction Effects 0.000 description 1
- 230000001360 synchronised effect Effects 0.000 description 1
Images
Abstract
The invention relates to an AVI file playing means, which is free from the limitations of AVI file playing frame rate and self-adapting to the hardware resources. The technical proposal in the invention includes the following steps: (1) measure the maximum CPU occupancy for AVI play timer interrupt processing; (2) set the safe play frame rate; (3) compare the AVI file play frame rate with the system safe play frame rate, if the AVI file play frame rate is less than the system safe play frame rate, then the timer interruption frequency is set as the AVI file play frame rate, if the AVI file play frame rate is greater than or equal to the system safe play frame rate, then the timer interruption frequency is set as the system safe play frame rate, and set self-adapting adjustment marks and conduct self-adapting operations; (4) after the self-adapting operation in step 3 is finished, play the AVI file according to the timer interruption frequency determined by the self-adapting operation.
Description
Technical field
The invention belongs to avi file player method field, especially a kind of adaptive avi file player method of hardware resource that is not subjected to the restriction of avi file play frame rate.
Background technology
Avi file for the MJPEG form, existing broadcast mechanism is to set the frequency of Timer (timer) Interrupt Process according to the play frame rate of avi file, owing to be subjected to the restriction of hardware handles ability all to set a support file play frame rate the highest, the avi file that surpasses this frame per second then can't be supported.When the frame per second of file surpasses maximumly when supporting the file play frame rate, system can not played file, if play by force then can cause system's cisco unity malfunction.Can not go to be concerned about the maximum file play frame rate of supporting of avi file because the general user does not understand yet, therefore bring broadcast surpassing the maximum file of file play frame rate of supporting sometimes, will influence the normal operation of system like this, influence user's use.
Summary of the invention
The purpose of this invention is to provide a kind of restriction of avi file play frame rate, adaptive avi file player method of hardware resource of not being subjected to.
The present invention adopts processing scheme to be: the adaptive avi file player method of hardware resource is characterized in that comprising the following steps:
(1) the mensuration system is used for the maximum CPU occupation rate that AVI plays the timer Interrupt Process;
(2) initialization system secure file play frame rate;
(3) compare the frame per second of AVI played file and the secure file play frame rate of system, if the play frame rate of avi file is less than the secure file play frame rate of system, then the timer interruption frequency is made as AVI played file frame per second, if the frame per second of AVI played file is more than or equal to the secure file play frame rate of system, then the timer interruption frequency is set to system safety file play frame rate, self adaptation adjustment sign is set, and carries out the self adaptation operation;
(4) behind the self adaptation EO described in the step (3), operate determined timer interruption frequency according to self adaptation and carry out the avi file broadcast.
Described system safety file play frame rate is the frame rate value in the preset range of maximum CPU occupation rate.
Described self adaptation operation comprises:
(1) starts timer and interrupt, begin to carry out the broadcast of avi file, start a long timer simultaneously and add up the time that avi file is play;
(2) according to the reproduction time of the record of long timer, and determine the MJPEG data that will show, normally show, write down the time that the number of display frame not writes down this Interrupt Process simultaneously according to the concordance list of file play frame rate and MJPEG;
(3) add up the continuous N time timer Interrupt Process time, calculate the occupation rate of CPU then;
(4) determine new timer interruption frequency according to the occupation rate of CPU, timer interruption frequency=played file frame per second * (maximum CPU occupation rate/current C PU occupation rate), the interruption frequency that calculates and the frame per second of AVI played file are compared, if greater than AVI played file frame per second, then the frame per second with the AVI played file is that interruption frequency is reset interruption frequency, if the interruption frequency of calculator is less than or equal to AVI played file frame per second, be that interruption frequency is provided with interruption frequency then, and begin to carry out timer interruption frequency adjustment process with the timer interruption frequency value that calculates;
(5) timer interruption frequency adjustment process is: according to step (4) timer interruption frequency calculated value as the timer interruption frequency, the statistics N continuous time timer Interrupt Process time, calculate the occupation rate of CPU then, if less than maximum CPU occupation rate, self adaptation then is set adjusts end mark, finish self adaptation adjustment operation, read file data by the fixing mode of frame per second played file, according to last definite interruption frequency played file; Otherwise the played file frame per second is subtracted 1, continue the CPU occupation rate that the test calculator interrupts according to new file play frame rate then, till the interruption frequency of determining good played file, finish self adaptation adjustment operation then.
The method that the mensuration system is used for the maximum CPU occupation rate of avi file broadcast timer Interrupt Process is at the system hardware platform, determine by playing test file, the occupation rate of CPU is the operation total time of the time of timer Interrupt Process divided by system, relatively draws system by test and is used for the maximum CPU occupation rate that avi file is play the timer Interrupt Process.
The preferred value of described system safety file play frame rate is the frame rate value in 50% scope of maximum CPU occupation rate the time.
Described system safety file play frame rate value is 4 or 6.
The number of times M of described continuous statistics timer Interrupt Process time and the preferred span of N are 4-10, and M=N.
The number of times M of described continuous statistics timer Interrupt Process time and the preferred value of N are that M and N are 5.
Described Play System hardware platform is the 868Demo platform.
Described avi file is the MJPEG file format.
Also comprise the following steps the user program operation environmental change, when causing the proportion that interrupts the consumption cpu resource to change thus, then need to carry out again the self adaptation operation.
Effect of the present invention is: the present invention adopts adaptive method to determine the maximum file play frame rate that current hardware platform can be supported, play for the maximum secure file play frame rate that the file that surpasses the highest support file play frame rate adopts system to support, come the cumulative time of recording played in the process of playing with a long Timer, calculate the video data of moment corresponding then according to frame per second, selectively show, adopt the method for constantly losing video data to realize the support of high frame per second file, can also guarantee simultaneously the synchronous of audio frequency and video, it is unrestricted adopting the play frame rate of the avi file of this method broadcast.
Owing to adopt the performance difference of the final cell phone platform of using of 868 chips bigger, be difficult to the maximum frame per second of playing the AVI support and unify restriction, so adopt this adaptive method to guarantee, on all platforms, utilize hardware resource to finish the playing function of the avi file of MJPEG form to greatest extent, and the play frame rate of avi file is unrestricted.
The present invention is described further below in conjunction with drawings and Examples.
Description of drawings
Fig. 1 is an avi file playing program block diagram of the present invention;
Fig. 2 is a self-adapting program block diagram of the present invention.
Embodiment
Embodiment 1:
Among Fig. 1, the adaptive avi file player method of hardware resource is characterized in that comprising the following steps:
(1) the mensuration system is used for the maximum CPU occupation rate that AVI plays the Timer Interrupt Process, the method that the mensuration system is used for the maximum CPU occupation rate of AVI broadcast Timer Interrupt Process is at the system hardware platform, as the 868Demo platform, utilize the method for playing test file to determine, the occupation rate of CPU is the operation total time of the time of Timer Interrupt Process divided by system, relatively draw system by test and be used for the maximum CPU occupation rate that AVI plays the Timer Interrupt Process, testing the maximum occupation rate that draws 868Demo platform normal conditions CPU in test is 80%.
(2) initialization system secure file play frame rate, described system safety file play frame rate are CPU occupation rate selected frame rate value in maximum CPU occupation rate 10% scope the time, and system safety file play frame rate value is 4.
(3) relatively the frame per second of avi file and the secure file play frame rate of system determine whether to be provided with self adaptation adjustment sign, if the frame per second of avi file less than the secure file play frame rate, then is made as the avi file frame per second with the Timer interruption frequency; If the frame per second of avi file is more than or equal to the secure file play frame rate, then the Timer interruption frequency is set to system safety file play frame rate, and self adaptation adjustment sign is set, and carries out the self adaptation operation, adjusts the timer interruption frequency.
(4) carrying out avi file according to the timer interruption frequency that is obtained in the step (3) plays.
Among Fig. 2, described self adaptation operation comprises:
(1) starts timer and interrupt, begin to carry out the broadcast of avi file, start a long timer simultaneously and add up the time that avi file is play.
(2) according to the reproduction time of the record of long Timer, and determine the MJPEG data that will show, normally show, write down the time that the number of display frame not writes down this Interrupt Process simultaneously according to the concordance list of file play frame rate and MJPEG;
(3) add up continuous 5 Timer Interrupt Process times, calculate the occupation rate of CPU then;
(4) determine new Timer interruption frequency according to the occupation rate of CPU, Timer interruption frequency=select at present frame per second * (maximum CPU occupation rate/current C PU occupation rate), the interruption frequency and the avi file play frame rate that calculate are compared, if greater than the avi file play frame rate, the interruption frequency of then resetting Timer is the avi file frame per second, and finish self adaptation and operate, otherwise the interruption frequency of resetting Timer is the new Timer interruption frequency value that calculates, and begins to carry out timer interruption frequency adjustment process;
(5) adjustment process of timer interruption frequency is: according to step (4) timer interruption frequency calculated value as the Timer interruption frequency, add up continuous 5 Timer Interrupt Process times again, calculate the CPU occupation rate then, if less than maximum CPU occupation rate, self adaptation then is set adjusts end mark, finish the self adaptation operation, read file data, according to the interruption frequency played file of last definite Timer in the self adaptation operating process by the fixing mode of interruption frequency played file; Otherwise the file play frame rate is subtracted 1, continue the CPU occupation rate that test Timer interrupts according to new file play frame rate then, till the interruption frequency of final definite good played file, finish the self adaptation operation then.
The user program operation environmental change when proportion that causes Timer to interrupt the consumption cpu resource thus changes, then needs to carry out again the self adaptation operation.
Embodiment 2:
Initialization system secure file play frame rate, described system safety file play frame rate are frame rate value selected in maximum CPU occupation rate 50% scope, and system safety file play frame rate value can be 6.
The self adaptation operation part comprises:
(1) starts Timer and interrupt, begin to carry out AVI and play, start the time that a long Timer adds up broadcast simultaneously;
(2) according to the reproduction time of the record of long Timer, and determine the MJPEG data that will show, normally show, write down the time that the number of display frame not writes down this Interrupt Process simultaneously according to the concordance list of file play frame rate and MJPEG;
(3) add up continuous 4 Timer Interrupt Process times, calculate the occupation rate of CPU then;
(4) determine new Timer interruption frequency according to the occupation rate of CPU, Timer interruption frequency=select at present frame per second * (maximum CPU occupation rate/current C PU occupation rate), the interruption frequency that calculates and the play frame rate of avi file are compared, if greater than the file play frame rate, the interruption frequency of then resetting is a file file play frame rate, finish the self adaptation operation, otherwise reset the calculated value that new interruption frequency is the timer interruption frequency, and begin to carry out timer interruption frequency adjustment process;
(5) adjustment process of timer interruption frequency is: according to the calculated value of timer interruption frequency in the step (4) as the Timer interruption frequency, add up continuous 4 Timer Interrupt Process times again, calculate the CPU occupation rate then, if less than maximum CPU occupation rate, self adaptation then is set adjusts end mark, finish the self adaptation operation, according to the last interruption frequency played file of determining in the self adaptation operating process; Otherwise file play frame rate numerical value is subtracted 1, continue the CPU occupation rate that test Timer interrupts according to new file play frame rate then, till the interruption frequency of final definite good played file, the self adaptation adjustment finishes.
The content of other parts is with embodiment 1.
Though embodiment 1 and embodiment 2, the numerical value that has provided two kinds of CPU occupation rates, system safety file play frame rate and added up Timer Interrupt Process time number of times continuously, need to prove, those skilled in the art, can select corresponding suitable quantitative value according to concrete performance, be not limited to the quantitative value that described embodiment provides.
Claims (9)
1, the adaptive avi file player method of hardware resource is characterized in that comprising the following steps:
(1) the mensuration system is used for the maximum CPU occupation rate that AVI plays the timer Interrupt Process;
(2) the secure file play frame rate of initialization system, the secure file play frame rate of described system are the frame rate value in the preset range of maximum CPU occupation rate;
(3) compare the play frame rate of avi file and the secure file play frame rate of system, if the play frame rate of avi file is less than the secure file play frame rate of system, then the timer interruption frequency is made as the play frame rate of avi file, if the play frame rate of avi file is more than or equal to the secure file play frame rate of system, then the timer interruption frequency is set to the secure file play frame rate of system, self adaptation adjustment sign is set, carries out the self adaptation operation;
(4) behind the self adaptation EO described in the step (3), operate determined timer interruption frequency according to self adaptation and carry out the avi file broadcast.
2, the adaptive avi file player method of hardware resource according to claim 1 is characterized in that described avi file is the MJPEG file format.
3, the adaptive avi file player method of hardware resource according to claim 2 is characterized in that described self adaptation operation comprises:
(1) starts timer and interrupt, begin to carry out the broadcast of avi file, start a long timer simultaneously and add up the time that avi file is play;
(2) according to the reproduction time of long timer record, and determine the MJPEG data that will show, normally show and write down the not number of display frame, the time of writing down this Interrupt Process simultaneously according to the concordance list of file play frame rate and played file MJPEG;
(3) add up the continuous N time timer Interrupt Process time, calculate the occupation rate of CPU then;
(4) determine new timer interruption frequency according to the occupation rate of CPU, the play frame rate * of timer interruption frequency=file (maximum CPU occupation rate/current C PU occupation rate), the interruption frequency that calculates and the play frame rate of avi file are compared, if play frame rate greater than avi file, then the play frame rate with avi file is that interruption frequency is reset interruption frequency, and finish self adaptation and operate, if the interruption frequency of timer is less than or equal to the play frame rate of avi file, then the calculated value with the timer interruption frequency is provided with interruption frequency as interruption frequency, and begins to carry out timer interruption frequency adjustment process;
(5) adjustment process of timer interruption frequency is: according to step (4) timer interruption frequency calculated value as the timer interruption frequency, the statistics N continuous time timer Interrupt Process time, calculate the occupation rate of CPU then, if the CPU occupation rate that calculates is less than maximum CPU occupation rate, self adaptation then is set adjusts end mark, finish the self adaptation operation, read file data by the fixing mode of interruption frequency played file, according to last definite interruption frequency played file; Otherwise the played file frame per second is subtracted 1, continue the CPU occupation rate that test timer interrupts according to new file play frame rate then, till the interruption frequency of determining good played file, finish the self adaptation operation then.
4, the adaptive avi file player method of hardware resource according to claim 3, it is characterized in that the mensuration system being used for avi file, to play the method for the maximum CPU occupation rate of timer Interrupt Process be at the system hardware platform, determine by playing test file, the occupation rate of CPU is the operation total time of the time of timer Interrupt Process divided by system, relatively draws system by test and is used for the maximum CPU occupation rate that avi file is play the timer Interrupt Process.
5, the adaptive avi file player method of hardware resource according to claim 4, the preferred value of secure file play frame rate that the it is characterized in that described system frame rate value in 50% scope of maximum CPU occupation rate the time.
6, the adaptive avi file player method of hardware resource according to claim 5 is characterized in that the secure file play frame rate value of described system is 4 or 6.
7, the adaptive avi file player method of hardware resource according to claim 6 is characterized in that the number of times M of described statistics continuous N time and N timer Interrupt Process time and the preferred span of N are 4-10, and M=N.
8, the adaptive avi file player method of hardware resource according to claim 7 is characterized in that the number of times M of described statistics continuous N time and N timer Interrupt Process time and the preferred value of N are that M and N are 5.
9, the adaptive avi file player method of hardware resource according to claim 8, it is characterized in that also comprising the following steps: the user program operation environmental change, when causing the proportion that interrupts the consumption cpu resource to change thus, then need to carry out again the self adaptation operation.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN200710120073A CN100589541C (en) | 2007-08-08 | 2007-08-08 | A hardware resource self-adapted AVI file playing method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN200710120073A CN100589541C (en) | 2007-08-08 | 2007-08-08 | A hardware resource self-adapted AVI file playing method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN101106683A CN101106683A (en) | 2008-01-16 |
CN100589541C true CN100589541C (en) | 2010-02-10 |
Family
ID=39000326
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN200710120073A Expired - Fee Related CN100589541C (en) | 2007-08-08 | 2007-08-08 | A hardware resource self-adapted AVI file playing method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN100589541C (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102096924B (en) * | 2010-11-18 | 2012-07-25 | 无锡中星微电子有限公司 | Method for adjusting detection frame rate |
CN102737681B (en) * | 2012-05-02 | 2015-02-04 | 中国联合网络通信集团有限公司 | Performance testing method and device of stream media player |
CN104461520B (en) * | 2014-11-25 | 2018-04-03 | 广州酷狗计算机科技有限公司 | The broadcasting frame frequency method of adjustment and device of animation |
CN106358000B (en) * | 2016-10-14 | 2020-08-07 | 上海小镜医疗器械有限公司 | Data transmission method, data processing method, data transmission system, data processing system, micro-vision instrument and electronic equipment |
-
2007
- 2007-08-08 CN CN200710120073A patent/CN100589541C/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
CN101106683A (en) | 2008-01-16 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106559679B (en) | The decoded method of video, server and mobile terminal | |
US9794605B2 (en) | Using time-stamped event entries to facilitate synchronizing data streams | |
US7568057B2 (en) | Method and apparatus for maintaining synchronization of audio in a computing system | |
US8775831B2 (en) | Using historic load profiles to dynamically adjust operating frequency and available power to a handheld multimedia device processor core | |
CN100589541C (en) | A hardware resource self-adapted AVI file playing method | |
KR20080006444A (en) | System and method for synchronizing video frames and audio frames | |
CN103379379B (en) | Streaming media buffer playing method and device | |
WO2007095272A3 (en) | Systems and methods for prioritizing mobile media player files | |
CN101167130A (en) | Stream data recording device, stream data recording/reproducing device, stream data reproduction device, stream data editing device, stream recording method, and stream reproducing method | |
MY151966A (en) | Playback apparatus and method, program, recording medium, data structure, and manufacturing method for recording medium | |
DE602004030836D1 (en) | A recording medium, a reproducing apparatus, a recording method, an integrated circuit, a program and a reproducing method | |
JP2005502921A5 (en) | ||
TW200723875A (en) | Playback apparatus and method, program, recording medium, data structure, and manufacturing method for recording medium | |
CN103686315A (en) | Synchronous audio and video playing method and device | |
EP1145744A3 (en) | Game system and computer readable storage medium therefor | |
TW200735928A (en) | Game device, control method thereof and information recording media | |
CN103442307A (en) | Method and device for playing video streaming media | |
JP2010211881A5 (en) | ||
CN114339257B (en) | Method and apparatus for decoding video file | |
CN102403007A (en) | Method and system for automatically recording songs | |
TW200630973A (en) | Apparatus and method for processing data, program and program recording medium, and data recording medium | |
CN101150729A (en) | Audio and video synchronization playing method | |
TWI632816B (en) | Continuous data delivery with energy conservation | |
CN104700830B (en) | A kind of sound end detecting method and device | |
CN103873891B (en) | TS streaming media file fast positioning method and system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
C17 | Cessation of patent right | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20100210 Termination date: 20120808 |