Term " first ", " second " in description and claims of this specification and above-mentioned accompanying drawing etc. are to be used to distinguishSimilar object, without for describing specific order or precedence.It should be appreciated that the term so used is in appropriate feelingsIt can be exchanged under condition, this is only to describe object used differentiation in description in embodiments of the invention to same alike resultMode.In addition, term " comprising " and " having " and their any deformation, it is intended that cover it is non-exclusive include, so as toProcess, method, system, product or equipment comprising a series of units are not necessarily limited to those units, but may include unclearOther units that ground is listed or for these processes, method, product or equipment inherently.
It is described in detail individually below.
One embodiment of the real time frame rate detection method of mobile device of the present invention, can include:When preset samplingBetween section timing when starting, obtain the pixel of the physics video memory of mobile device in the first frame according to preset sampling time intervalThe pixel value of pixel value and pixel in the second frame, above-mentioned first frame are the sampling time before above-mentioned sampling time intervalThe frame collected, the frame that above-mentioned second frame collects for the sampling time after above-mentioned sampling time interval;According to above-mentionedThe pixel value of the pixel of the pixel value of the pixel of one frame and above-mentioned second frame judges whether above-mentioned physics video memory changes;If so, the frame per second statistical value of above-mentioned mobile device is increased into a statistics step-length;Judge the timing duration of above-mentioned sampling time sectionWhether complete, if it is not, triggering obtains the physics video memory of mobile device in the first frame according to preset sampling time intervalThe pixel value of the pixel value of pixel and pixel in the second frame performs again;At the end of above-mentioned sampling time section timing,Above-mentioned frame per second statistical value is exported, the real-time frame of above-mentioned mobile device is obtained according to above-mentioned sampling time section and above-mentioned frame per second statistical valueRate.
Refer to shown in Fig. 1, the real time frame rate detection method for the mobile device that one embodiment of the invention provides, can wrapInclude:
101st, when preset sampling time section timing starts, mobile device is obtained according to preset sampling time intervalPhysics video memory is in the pixel value of the pixel of the first frame and the pixel value of pixel in the second frame.
Wherein, the frame that above-mentioned first frame collects for the sampling time before above-mentioned sampling time interval, above-mentioned secondThe frame that frame collects for the sampling time after above-mentioned sampling time interval.
In embodiments of the present invention, in order to accurately obtain the real time frame rate of mobile device, movement is being set every timeBefore standby real time frame rate is detected, sampling time section and sampling time interval, wherein sampling time can be pre-setSection refers to that selection is used for the period for calculating real time frame rate, can specifically be specified by user, naturally it is also possible to set by movementIt is standby to be set according to the hardware configuration performance of itself, for example, can be according to the speed and centre of the internal memory of mobile deviceManage device(CPU, Central Processing Unit)Frequency set, in addition can also be according to user generally to applicationThe timing statisticses section that sets is set when program carries out fluency test, as user can set sampling time section as 1 second(s),Or mobile device sets sampling time section as 1s according to the internal memory reading speed of oneself and CPU running frequency.Sampling timeInterval refers to the pixel value that the pixel time how long obtains a physics video memory present frame is spaced in sampling time section, adoptsSample time interval equally can specifically be specified by user, naturally it is also possible to by mobile device according to the hardware configuration performance of itselfTo set, for example, it can be set according to the speed of the internal memory of mobile device and CPU frequency, in addition can also basisStatistics number that user generally sets when carrying out fluency test to application program in the timing statisticses section that sets is set, such asUser can set sampling time section as 1s, count 50 times in 1s, then sampling time interval can be set as 20 milliseconds(ms),Or mobile device sets sampling time section according to the internal memory reading speed of oneself and CPU running frequency and united as 1s, in 1sMeter 50 times, then sampling time interval can be set as 20ms.In addition, in embodiments of the present invention, when sampling time section is with samplingBetween the setting that is spaced can also take other modes, if for example, the real time frame rate of detection mobile device is to be able to detectThe fluent movements degree of the game class application program of installation on the mobile apparatus, sampling time section and sampling time interval can basesSampling time section is set as 1s, is set as sampling time interval by the game class application program installed on detection mobile device10ms, and for example, if the real time frame rate of detection mobile device is to be able to the video calling class of detection installation on the mobile apparatusThe video pictures of application program show fluency, and sampling time section and sampling time interval can pacify according on detection mobile deviceSampling time section is set as 2s, sampling time interval is set as into 40ms by the video calling class software of dress, that is to say, that samplingThe setting of period and sampling time interval can also be determined by installing application program on the mobile apparatus, only be said hereinIt is bright, do not limit.
In some embodiments of the invention, when preset sampling time section timing starts, during according to preset samplingBetween interval acquiring mobile device physics video memory front and rear two frame pixel pixel value.In order to more accurately illustrateSampling time before one sampling time interval and two frames in sampling time afterwards, by the two in the embodiment of the present inventionFrame definition is " the first frame " and " the second frame ", then respectively in the sampling time of the first frame and the sampling time of the second frame, obtains respectivelyWhat is got is physics video memory in the pixel of the first frame and the pixel in the second frame, the two pixels respectively corresponding to pixelIt is worth and is:In the pixel value of the pixel of the first frame and the pixel value of pixel in the second frame.Some in the embodiment of the present inventionThe pixel value of pixel refers to the brightness value in the digital picture of the pixel, wherein, pass through the picture of the pixel of the first frameElement value can represents data content of the physics video memory of mobile device at the sampling time of the first frame, passes through the picture of the second frameThe pixel value can of vegetarian refreshments represents data content of the physics video memory of mobile device at the sampling time of the second frame.
In some embodiments of the invention, the data content stored in the physics video memory of mobile device is to seeming that video card is defeatedThe information of each pixel gone out onto display, and physics video memory is the important component of video card, and display chip has been handledPixel data can be saved in after pixel data in physics video memory, then read out pixel from physics video memory by digital analog converterData simultaneously convert digital signals into analog signal, are finally come out by the screen display of mobile device.In the embodiment of the present invention, whenPixel data can be saved in physics video memory by display chip after having handled pixel data, therefore can pass through the physics of mobile deviceIt is buffered in the pixel value for getting pixel in physics video memory in preset sampling time section according to preset sampling time interval.
In some embodiments of the invention, the clocking method of sampling time section and every sampling time interval timing touchThe mode that hair step 101 starts to perform can specifically be realized by timer come clocked flip, for example, sampling time section is 1s,Sampling time interval is 20ms, then when the timer time of sampling time section starts, timer just triggers step 101 every 20msPerform once.
102nd, according in the judgement of the pixel value of the pixel value of the pixel of above-mentioned first frame and the pixel of above-mentioned second frameState whether physics video memory changes.
Wherein, step 103 is performed when above-mentioned physics video memory changes.
In embodiments of the present invention, the sampling time before a sampling time interval is obtained by step 101 statisticsCollect data content in the physics video memory of mobile device for the pixel of the first frame pixel value, the sampling time interval itIt is the pixel value of the pixel of the second frame, Ran Hougen that sampling time afterwards, which collects data content in the physics video memory of mobile device,Judge whether physics video memory changes according to the pixel value of the pixel of the first frame and the pixel value of pixel of the second frame.ItsIn, in the embodiment of the present invention when physics video memory changes, digital analog converter reads out pixel data simultaneously from physics video memoryAnalog signal is converted digital signals into, screen-picture will produce change when finally being come out by the screen display of mobile device,Therefore whether the embodiment of the present invention is changed by physics video memory and gets the screen-picture of mobile device and display whether to becomeChange, so as to be changed the statistics of number to the frame per second of mobile device, and according to sampling time section so as to calculating mobile deviceReal time frame rate, refer to the description of subsequent embodiment.It should be noted that in embodiments of the present invention according to above-mentioned first frameThe pixel value of the pixel of the pixel value of pixel and above-mentioned second frame judge above-mentioned physics video memory whether change have it is a variety ofImplementation, for example, can be collected respectively for two sampling times before and after a sampling time intervalThe pixel value of pixel is compared frame by frame, can also be for being adopted at one so as to get whether physics video memory changesThe pixel value for the pixel that two sampling times before and after sample time interval collect respectively carries out summation inspection codeCompare, so as to get whether physics video memory changes, specifically can flexibly be set with application scenarios in actual applications, thisPlace for illustrative purposes only, does not limit.
It should be noted that in some embodiments of the invention, in step 102 when above-mentioned physics video memory becomesStep 103 is performed during change, refers to the description of subsequent step.In addition, when above-mentioned physics video memory does not change, it is necessary to againTriggering step 101 performs again, and what is simply got with the increase of the timer time of timer is between the latter sampling timeThe pixel value of the pixel for the frame that sampling time before and after collects.
103rd, when above-mentioned physics video memory changes, the frame per second statistical value of above-mentioned mobile device is increased into a statistics stepIt is long.
Wherein, by the judgement whether to be changed to physics video memory, show so as to get the screen-picture of mobile deviceShow whether changed, for example, the screen-picture of mobile device, which is shown, when physics video memory changes is becomeChange, when physics video memory does not change, the screen-picture of mobile device is displayed without changing.When above-mentioned physics video memoryWhen changing, the frame per second statistical value of above-mentioned mobile device is increased into a statistics step-length.Wherein, statistics step-length refers to frame per secondThe increasing degree of statistical value, counting the value of step-length can specifically be determined by the amplitude of variation of frame per second statistical value.For example, statisticsWhen step-length is arranged to 1, when changing physics video memory, the frame per second statistical value of mobile device is just increased by 1, and for example, statisticsWhen step-length is arranged to 2, when changing physics video memory, the frame per second statistical value of mobile device is just increased by 2.
104th, judge whether the timing duration of above-mentioned sampling time section has been completed.
Wherein, if the timing duration of above-mentioned sampling time section has not been completed, triggering step 101 performs again, when upperStep 105 is triggered at the end of stating sampling time section timing to perform.
In some embodiments of the invention, after in the sampling time, section timing starts, whenever a sampling time intervalLater, it is required for triggering step 101 to start to perform, this can sequence trigger switch subsequent step 102 to 104 after step 101 performsExecution, moved in circles so as to realize in a sampling time section repeatedly, until the timing of above-mentioned sampling time section terminates.
105th, at the end of above-mentioned sampling time section timing, above-mentioned frame per second statistical value is exported, according to above-mentioned sampling time sectionThe real time frame rate of above-mentioned mobile device is obtained with above-mentioned frame per second statistical value.
In embodiments of the present invention, step 101 to step 104 can be after in the sampling time, section timing starts, during according to samplingBetween be spaced and repeatedly move in circles executions, up to the timing of above-mentioned sampling time section terminates.When above-mentioned sampling time section timing terminatesWhen, above-mentioned frame per second statistical value is exported, the reality of above-mentioned mobile device is obtained according to above-mentioned sampling time section and above-mentioned frame per second statistical valueWhen frame per second.For example, if sampling time section is redefined for 1s, the frame per second statistical value of output is 30 statistics step-lengths, then leads toIt is 30 frames to cross frame per second statistical value divided by sampling time section can or the real time frame rate to mobile device.
Therefore sampling time section and sampling time interval are pre-set, then when the sampling time, section timing started,The pixel for two frames that the sampling time distribution collection before and after sampling time interval arrives is obtained according to sampling time intervalThe pixel value of point, obtains the pixel value of the pixel value of the pixel of the first frame and the pixel of the second frame, then according to the first frameThe pixel value of pixel and the pixel value of pixel of the second frame judge whether physics video memory changes, if so, will be mobileThe frame per second statistical value of equipment increases a statistics step-length, next judges whether the timing duration of sampling time section has been completed,If it is not, continue the pixel value of the pixel for two frames that a sampling time distribution collection arrives before and after obtaining according to sampling time interval,And continue the judgement whether physics video memory changes, until sampling time section timing terminates, output frame rate statistical value, rootThe real time frame rate of current mobile device is obtained according to sampling time section and frame per second statistical value.By in sampling time section according to samplingTime interval timing is extracted and compared to the data content of the physics video memory of mobile device, so as to calculate physics video memoryFrame per second, it is possible to achieve real-time detection is carried out to the screen display frame per second of mobile device anywhere or anytime.
Refer to shown in Fig. 2, the real time frame rate detection method for the mobile device that another embodiment of the present invention provides can be withIncluding:
201st, according to preset sampling time interval by above-mentioned mobile device the first frame physics video memory and second framePhysics video memory is mapped to the virtual address space of process.
In some embodiments of the invention, each process has the virtual address space of oneself, the address space of processSize can be determined by the CPU of mobile device digit.When preset sampling time section timing starts, adopted according to presetThe physics video memory for the first frame that sample time interval respectively collects the sampling time before sampling time interval is mapped to processVirtual address space, the physics video memory for the second frame for collecting the sampling time after sampling time interval be mapped to processVirtual address space.The virtual address space that physics video memory is mapped to process can specifically be realized by way of mmap.Wherein, the data content in physics video memory is mapped into internal memory by mmap, and data content is mapped on multiple pages, if in dataThe size sum of the not all page of size of appearance, the space that last page is not used will be reset.
202nd, the pixel of the pixel of the first frame is read out from the virtual address space of above-mentioned process in a manner of arrayThe pixel value of the pixel of value and the second frame.
Wherein, the physics video memory of the first frame is mapped to after the virtual address space of process, it is possible to pass through arrayMode reads out the pixel value of the pixel of the first frame from the virtual address space of process, likewise, the physics of the second frame is shownAfter the virtual address space for depositing the process of being mapped to, it is possible to read out by way of array from the virtual address space of processThe pixel value of the pixel of second frame.
How the physics video memory of mobile device to be mapped to the virtual address space of process in order to describe in detail and is read outThe pixel value of pixel, refer to as shown in figure 3, for the physics video memory of mobile device is mapped into process in the embodiment of the present inventionVirtual address space and read out the implementation schematic diagram of the pixel value of pixel, physics is shown by mmap modes firstThe virtual address space for the process of being mapped to is deposited,, can by the continuous change of i and j values then by array Array [i] [j]To read out the pixel value of pixel from the virtual address space of process, so as to realize the access to physics video memory.
In addition in some embodiments of the invention, physics video memory is got in the first frame by step 201 and step 202The pixel value of pixel and the pixel value of pixel in the second frame can also have other implementations, for example, canThink following steps:Physics video memory of the above-mentioned mobile device in the first frame is accessed, reads thing of the above-mentioned mobile device in the first frameThe file data in video memory is managed, obtains the pixel value of the pixel of above-mentioned first frame;Above-mentioned mobile device is accessed in the second framePhysics video memory, file data of the above-mentioned mobile device in the physics video memory of the second frame is read, obtains the pixel of above-mentioned second frameThe pixel value of point.That is, then step 201 reads picture using the virtual address space for the process that is mapped to 202 using arrayThe mode of the pixel value of vegetarian refreshments, the mode of data content in rdma read can be analogous to, its reading efficiency is higher, in foregoing citingIt is direct access physics video memory, is that have accessed physics video memory in a manner of reading " file system ", regards physics video memory as one" file system ", the file data in physics video memory is read by way of reading file, this mode is compared to rdma readMode efficiency it is slightly lower, but can also equally get the pixel value and the second frame of the pixel of the frame of mobile device firstPixel pixel value.
203rd, each first pixel of more above-mentioned first frame and each second pixel of above-mentioned second frame are respectiveWhether pixel value is identical.
Wherein, if the respective pixel value phase of each second pixel of each first pixel and the second pin of the first frameTogether, then illustrate that above-mentioned physics video memory does not change, if each the second of each first pixel and the second pin of the first frameThe pixel that pixel value differs in the respective pixel value of pixel be present, then illustrate that the physics video memory changes, it is above-mentionedLocation of pixels of the location of pixels of first pixel in the first frame with above-mentioned second pixel in the second frame is identical.
That is, when step 203 is by sampling of the location of pixels identical pixel before sampling time intervalBetween and sampling time interval after sampling time collect the first pixel and the second pixel respectively, pass through individual element positionPut compare the pixel that former and later two sampling times collect respectively pixel value it is whether different, if each location of pixels is front and rearThe pixel value for the pixel that two sampling times collect respectively is all identical, then it is assumed that the physics video memory of mobile device does not occurChange, if there is the pixel value for the pixel that former and later two sampling times collect respectively different in all location of pixels, recognizeChanged for the physics video memory of mobile device.
In addition in some embodiments of the invention, each first pixel of more above-mentioned first frame of step 203 is passed throughWith whether each respective pixel value of second pixel of above-mentioned second frame identical can also other implementations, citing comesSay, can be following steps:Go out from whole pixel point samplings of above-mentioned first frame respectively according to identical probability sampling methodOne pixel point set, go out the second pixel point set from whole pixel point samplings of above-mentioned second frame;More above-mentioned first pixelWhether each 3rd pixel of set is identical with the respective pixel value of each 4th pixel of above-mentioned second pixel point set,If identical, illustrate that above-mentioned physics video memory does not change, if differing, illustrate that above-mentioned physics video memory changes, itsIn, the location of pixels phase of location of pixels and above-mentioned 4th pixel in the second frame of above-mentioned 3rd pixel in the first frameTogether.That is, two samplings before and after sampling time interval is all judged relative to individual element position in step 203Whether the pixel value for the pixel that the time collects is identical, and the location of pixels of whole can also be taken out in the embodiment of the present inventionSample, partial pixel position is obtained, then compare two in these partial pixel positions before and after sampling time interval againWhether the pixel value for the pixel that the sampling time collects respectively is identical, specifically, can be by using identical probability samplingMethod goes out the first pixel point set from whole pixel point samplings of the first frame respectively, goes out from whole pixel point samplings of the second frameTwo pixel point sets, then each 3rd pixel of more above-mentioned first pixel point set and above-mentioned second pixel point setWhether the respective pixel value of each 4th pixel is identical.
204th, when above-mentioned physics video memory changes, the frame per second statistical value of above-mentioned mobile device is increased into a statistics stepIt is long.
Wherein, by the judgement whether to be changed to physics video memory, show so as to get the screen-picture of mobile deviceShow whether changed, for example, the screen-picture of mobile device, which is shown, when physics video memory changes is becomeChange, when physics video memory does not change, the screen-picture of mobile device is displayed without changing.When above-mentioned physics video memoryWhen changing, the frame per second statistical value of above-mentioned mobile device is increased into a statistics step-length.Wherein, statistics step-length refers to frame per secondThe increasing degree of statistical value, counting the value of step-length can specifically be determined by frame per second statistical value.
205th, judge whether the timing duration of above-mentioned sampling time section has been completed.
Wherein, if the timing duration of above-mentioned sampling time section has not been completed, triggering step 201 performs again, when upperStep 206 is triggered at the end of stating sampling time section timing to perform.
In some embodiments of the invention, after in the sampling time, section timing starts, whenever a sampling time intervalLater, it is required for triggering step 201 to start to perform, this can sequence trigger switch subsequent step 202 to 205 after step 201 performsExecution, moved in circles so as to realize in a sampling time section repeatedly, until the timing of above-mentioned sampling time section terminates.
206th, at the end of above-mentioned sampling time section timing, above-mentioned frame per second statistical value is exported, according to above-mentioned sampling time sectionThe real time frame rate of above-mentioned mobile device is obtained with above-mentioned frame per second statistical value.
In embodiments of the present invention, step 201 to step 205 can be after in the sampling time, section timing starts, during according to samplingBetween be spaced and repeatedly move in circles executions, up to the timing of above-mentioned sampling time section terminates.When above-mentioned sampling time section timing terminatesWhen, above-mentioned frame per second statistical value is exported, the reality of above-mentioned mobile device is obtained according to above-mentioned sampling time section and above-mentioned frame per second statistical valueWhen frame per second.
Refer to shown in Fig. 4, the real time frame rate detection method for the mobile device that another embodiment of the present invention provides can be withIncluding:
401st, above-mentioned mobile device is accessed in the physics video memory of the first frame, reads physics of the above-mentioned mobile device in the first frameFile data in video memory, obtain the pixel value of the pixel of above-mentioned first frame.
402nd, above-mentioned mobile device is accessed in the physics video memory of the second frame, reads physics of the above-mentioned mobile device in the second frameFile data in video memory, obtain the pixel value of the pixel of above-mentioned second frame.
In embodiments of the present invention, step 201 is mapped to the virtual address spaces of process to 202 uses in previous embodimentThen the mode of the pixel value of pixel is read using array, the mode of data content in rdma read can be analogous to, it reads effectRate is higher.Step 401 and being achieved in that for 402 samplings directly access physics video memory, are in a manner of reading " file system "Physics video memory is have accessed, physics video memory is regarded as one " file system ", physics video memory is read by way of reading fileIn file data, this mode is slightly lower compared to the mode efficiency of rdma read, but can also equally get movementThe pixel value of the pixel value of the pixel of the frame of equipment first and the pixel of the second frame.
403rd, the summation inspection code of whole pixels of above-mentioned first frame and whole pixels of above-mentioned second frame are calculated respectivelyThe summation inspection code of point.
Wherein, calculating the summation inspection code of pixel can be realized by way of checksum, be needed in checksumCalculate the sum of the pixel value of each pixel.
404th, the summation inspection code of whole pixels of above-mentioned first frame and whole pixels of above-mentioned second frame are judgedWhether summation inspection code is equal.
Wherein, if whole pixels of the summation inspection code of whole pixels of above-mentioned first frame and above-mentioned first frame it is totalIt is equal with check code, then illustrate that above-mentioned physics video memory does not change, if unequal, illustrate that above-mentioned physics video memory becomesChange.
Refer to shown in Fig. 5, be to whole pixels of the first frame and whole pixels of the second frame in the embodiment of the present inventionPoint carries out checksum implementation schematic diagram.Where it is assumed that the resolution ratio of image is that M × N, M and N are certainly in physical memorySo number, in the pixel of the first frame it is x for location of pixels 11,
Location of pixels 1 is x in the pixel of the second frame1', in the pixel of the first frame it is x for location of pixels 22, pixelPosition 2 is x in the pixel of the second frame2', the summation inspection code for calculating whole pixels of above-mentioned first frame is sum ', is calculatedThe summation inspection code for going out whole pixels of the second frame is sum, is then verified(check), judge sum ' and sum whether phaseDeng if so, then illustrating that above-mentioned physics video memory does not change, if unequal, illustrating that above-mentioned physics video memory changes.
In addition in some embodiments of the invention, by step 403 and step 404 by judging the complete of above-mentioned first frameWhether the summation inspection code of whole pixels of the summation inspection code of portion's pixel and above-mentioned second frame is equal to may determine that shiftingWhether the physics video memory of dynamic equipment changes, it is necessary to which what is illustrated is whether the physics video memory for judging mobile device changes alsoThere are other implementations, for example, can be following steps:According to identical probability sampling method respectively from above-mentioned first frameWhole pixel point samplings go out the first pixel point set, go out the second pixel point set from whole pixel point samplings of above-mentioned second frame;In the summation inspection code and above-mentioned second pixel point set that calculate whole pixels in above-mentioned first pixel point set respectivelyThe summation inspection code of whole pixels;Judge the summation inspection code of whole pixels in above-mentioned first pixel point set and above-mentionedWhether the summation inspection code of whole pixels in the second pixel point set is equal;If so, then illustrate that above-mentioned physics video memory does not haveChange, if unequal, illustrate that above-mentioned physics video memory changes.That is, foregoing be achieved in that to wholeLocation of pixels is sampled, and obtains partial pixel position, i.e. the first pixel point set and the second pixel point set, next respectivelyCalculate the summation inspection code of the first pixel point set and whole pixels in the second pixel point set.Pass through probability sampling methodProbability sampling is carried out to whole pixels in physics video memory, can faster judge whether physics video memory changes.
405th, when above-mentioned physics video memory changes, the frame per second statistical value of above-mentioned mobile device is increased into a statistics stepIt is long.
Wherein, by the judgement whether to be changed to physics video memory, show so as to get the screen-picture of mobile deviceShow whether changed, for example, the screen-picture of mobile device, which is shown, when physics video memory changes is becomeChange, when physics video memory does not change, the screen-picture of mobile device is displayed without changing.When above-mentioned physics video memoryWhen changing, the frame per second statistical value of above-mentioned mobile device is increased into a statistics step-length.Wherein, statistics step-length refers to frame per secondThe increasing degree of statistical value, counting the value of step-length can specifically be determined by frame per second statistical value.
406th, judge whether the timing duration of above-mentioned sampling time section has been completed.
Wherein, if the timing duration of above-mentioned sampling time section has not been completed, triggering step 401 performs again, when upperStep 407 is triggered at the end of stating sampling time section timing to perform.
In some embodiments of the invention, after in the sampling time, section timing starts, whenever a sampling time intervalLater, it is required for triggering step 401 to start to perform, this can sequence trigger switch subsequent step 402 to 406 after step 401 performsExecution, moved in circles so as to realize in a sampling time section repeatedly, until the timing of above-mentioned sampling time section terminates.
407th, at the end of above-mentioned sampling time section timing, above-mentioned frame per second statistical value is exported, according to above-mentioned sampling time sectionThe real time frame rate of above-mentioned mobile device is obtained with above-mentioned frame per second statistical value.
In embodiments of the present invention, step 401 to step 405 can be after in the sampling time, section timing starts, during according to samplingBetween be spaced and repeatedly move in circles executions, up to the timing of above-mentioned sampling time section terminates.When above-mentioned sampling time section timing terminatesWhen, above-mentioned frame per second statistical value is exported, the reality of above-mentioned mobile device is obtained according to above-mentioned sampling time section and above-mentioned frame per second statistical valueWhen frame per second.
Therefore sampling time section and sampling time interval are pre-set, then when the sampling time, section timing started,The pixel for two frames that the sampling time distribution collection before and after sampling time interval arrives is obtained according to sampling time intervalThe pixel value of point, obtains the pixel value of the pixel value of the pixel of the first frame and the pixel of the second frame, then according to the first frameThe pixel value of pixel and the pixel value of pixel of the second frame judge whether physics video memory changes, if so, will be mobileThe frame per second statistical value of equipment increases a statistics step-length, next judges whether the timing duration of sampling time section has been completed,If it is not, continue the pixel value of the pixel for two frames that a sampling time distribution collection arrives before and after obtaining according to sampling time interval,And continue the judgement whether physics video memory changes, until sampling time section timing terminates, output frame rate statistical value, rootThe real time frame rate of current mobile device is obtained according to sampling time section and frame per second statistical value.By in sampling time section according to samplingTime interval timing is extracted and compared to the data content of the physics video memory of mobile device, so as to calculate physics video memoryFrame per second, it is possible to achieve real-time detection is carried out to the screen display frame per second of mobile device anywhere or anytime.
For ease of being better understood from and implementing the such scheme of the embodiment of the present invention, corresponding application scenarios of illustrating below comeIt is specifically described.
Refer to the flow signal as shown in fig. 6, for the real time frame rate detection method of mobile device in the embodiment of the present inventionFigure, can include:
601st, preset counter Num and frame per second register FPS are initialized, wherein the sampling time interval setIt is 1s for 20ms, sampling time section, then is 50 in the maximum occurrences of the sampling time section inside counting device, minimum value is 0, justThe Num meaning for being entered as 50, representing assignment for symbol " <-" in figure 6 during beginningization, " Num < -50 " is expressed asNum's is entered as 50, and " <-" occurred in subsequent step also illustrates that assignment, and FPS is used for the frame per second statistics for storing mobile deviceValue, FPS can start counting up from less than or equal to 0, and FPS is entered as 0 during initialization, set and counts step-length as 1.
602, when the sampling time, section timing started, every 20ms trigger subsequent step 603 to step 606, in order toIt is easy to describe, step 603 to step 606 has been drawn into a big dotted line frame, therefore can simplifies and be described as triggering every 20msOnce the execution step in dotted line frame performs once.
603rd, judge whether Num is more than 0, if Num is less than or equal to 0, illustrate that the timing of sampling time section finishes,Retriggered step 601 and step 607 start to perform, if Num is more than 0, are illustrating the timing duration of sampling time section alsoCarry out, triggering step 604 starts to perform.
604th, Num is entered as again:Num-1, and read frame buffer(frame buffer), collect currentPhysics video memory in pixel pixel value, then perform step 605.
605th, judge whether the physics video memory of mobile device changes, it judges that the mode that physics video memory changes canRefering to the description in previous embodiment, if physics video memory changes triggering, step 606 starts to perform;
606th, when physics video memory changes, FPS is entered as again:FPS+1.
607th, at the end of sampling time section timing, the frame per second statistical value stored in FPS is exported, according to the above-mentioned sampling timeSection and above-mentioned frame per second statistical value obtain the real time frame rate of above-mentioned mobile device, if sampling time section is 1s, the reality of mobile deviceWhen frame per second be the frame per second statistical value stored in FPS.
Therefore sampling time section and sampling time interval are pre-set, then when the sampling time, section timing started,The pixel for two frames that the sampling time distribution collection before and after sampling time interval arrives is obtained according to sampling time intervalThe pixel value of point, obtains the pixel value of the pixel value of the pixel of the first frame and the pixel of the second frame, then according to the first frameThe pixel value of pixel and the pixel value of pixel of the second frame judge whether physics video memory changes, if so, will be mobileThe frame per second statistical value of equipment increases a statistics step-length, next judges whether the timing duration of sampling time section has been completed,If it is not, continue the pixel value of the pixel for two frames that a sampling time distribution collection arrives before and after obtaining according to sampling time interval,And continue the judgement whether physics video memory changes, until sampling time section timing terminates, output frame rate statistical value, rootThe real time frame rate of current mobile device is obtained according to sampling time section and frame per second statistical value.By in sampling time section according to samplingTime interval timing is extracted and compared to the data content of the physics video memory of mobile device, so as to calculate physics video memoryFrame per second, it is possible to achieve real-time detection is carried out to the screen display frame per second of mobile device anywhere or anytime.
It should be noted that for foregoing each method embodiment, in order to be briefly described, therefore it is all expressed as a series ofCombination of actions, but those skilled in the art should know, the present invention is not limited by described sequence of movement becauseAccording to the present invention, some steps can use other orders or carry out simultaneously.Secondly, those skilled in the art should also knowKnow, embodiment described in this description belongs to preferred embodiment, and involved action and module are not necessarily of the inventionIt is necessary.
For ease of preferably implementing the such scheme of the embodiment of the present invention, the phase for implementing such scheme is also provided belowClose device.
Refer to shown in Fig. 7-a, a kind of real time frame rate detection device 700 of mobile device provided in an embodiment of the present invention,It can include:Pixel value acquisition module 701, video memory judge module 702, statistical module 703, timing module 704, frame per second detection mouldBlock 705, wherein,
Pixel value acquisition module 701, for when preset sampling time section timing starts, according to the preset sampling timeThe physics video memory of interval acquiring mobile device in the pixel value of the pixel of the first frame and the pixel value of pixel in the second frame,The frame that first frame collects for the sampling time before the sampling time interval, second frame are in the samplingThe frame that sampling time after time interval collects;
Video memory judge module 702, for the pixel of first frame that is got according to pixel value acquisition module 701The pixel value of the pixel of pixel value and second frame judges whether the physics video memory changes;
Statistical module 703, for when video memory judge module 702 judge learn that the physics video memory changes when, by instituteStating the frame per second statistical value of mobile device increases a statistics step-length;
Timing module 704, for judging whether the timing duration of the sampling time section has been completed, if it is not, triggering institutePixel value acquisition module 701 is stated to perform again;
Frame per second detecting module 705, at the end of the sampling time section timing, output statistical module 703 to count onThe mobile device frame per second statistical value, the mobile device is obtained according to the sampling time section and the frame per second statistical valueReal time frame rate.
In some embodiments of the invention, video memory judge module 702, specifically for each the of first frameWhether one pixel is identical with each respective pixel value of second pixel of second frame, if identical, illustrates the thingReason video memory does not change, if differing, illustrates that the physics video memory changes, wherein, first pixel existsLocation of pixels of the location of pixels with second pixel in the second frame in first frame is identical.
Refer to as shown in Fig. 7-b, in some embodiments of the invention, the real time frame rate detection device of mobile device700, it can also include:
Setting module 706, for the speed of the internal memory according to the mobile device and the frequency setting of central processor CPUThe sampling time section and the sampling time interval.
In some embodiments of the invention, pixel value acquisition module 701, can include:
Mapping submodule 7011, for according to preset sampling time interval by the mobile device the first frame physicsThe physics video memory of video memory and the second frame is mapped to the virtual address space of process;
First reading submodule 7012, for reading out from the virtual address space of the process in a manner of arrayThe pixel value of the pixel of the pixel value of the pixel of one frame and the second frame.
In some embodiments of the invention, video memory judge module 702, can include:
First calculating sub module 7021, summation inspection code and institute for whole pixels for calculating first frame respectivelyState the summation inspection code of whole pixels of the second frame;
First judging submodule 7022, for the summation inspection code and described for the whole pixels for judging first frameWhether the summation inspection code of whole pixels of two frames is equal;If so, then illustrate that the physics video memory does not change, if notIt is equal, then illustrate that the physics video memory changes.
Refer to as shown in Fig. 7-c, in some embodiments of the invention, pixel value acquisition module 701, can include:
Video memory accesses submodule 7013, for accessing physics video memory of the mobile device in the first frame, accesses the shiftingPhysics video memory of the dynamic equipment in the second frame;
Second reading submodule 7014, for reading number of files of the mobile device in the physics video memory of the first frameAccording to obtaining the pixel value of the pixel of first frame;Read file of the mobile device in the physics video memory of the second frameData, obtain the pixel value of the pixel of second frame.
In some embodiments of the invention, video memory judge module 702, can include:
Sample submodule 7023, for according to identical probability sampling method respectively from whole pixels of first frameSample out the first pixel point set, go out the second pixel point set from whole pixel point samplings of second frame;
Second calculating sub module 7024, for calculating the summation of whole pixels in the first pixel point set respectivelyThe summation inspection code of check code and whole pixels in the second pixel point set;
Second judging submodule 7025, for judging the summation inspection of whole pixels in the first pixel point setWhether the summation inspection code of whole pixels in code and the second pixel point set is equal;If so, then illustrate the physicsVideo memory does not change, if unequal, illustrates that the physics video memory changes.
Refer to as shown in Fig. 7-d, in some embodiments of the invention, pixel value acquisition module 701, can include:
Video memory accesses submodule 7013, for accessing physics video memory of the mobile device in the first frame, accesses the shiftingPhysics video memory of the dynamic equipment in the second frame;
Second reading submodule 7014, for reading number of files of the mobile device in the physics video memory of the first frameAccording to obtaining the pixel value of the pixel of first frame;Read file of the mobile device in the physics video memory of the second frameData, obtain the pixel value of the pixel of second frame.
In some embodiments of the invention, video memory judge module 702, can include:
Sample submodule 7023, for according to identical probability sampling method respectively from whole pixels of first frameSample out the first pixel point set, go out the second pixel point set from whole pixel point samplings of second frame;
Comparison sub-module 7026, each 3rd pixel and second picture for the first pixel point setWhether the respective pixel value of each 4th pixel of vegetarian refreshments set is identical, if identical, illustrates that the physics video memory is not sent outChanging, if differing, illustrate that the physics video memory changes, wherein, the picture of the 3rd pixel in the first frameLocation of pixels of the plain position with the 4th pixel in the second frame is identical.
It should be noted that the content such as information exchange, implementation procedure between each module/unit of said apparatus, due toThe inventive method embodiment is based on same design, and its technique effect brought is identical with the inventive method embodiment, particular contentReference can be made to the narration in the foregoing shown embodiment of the method for the present invention, here is omitted.
To sum up, sampling time section and sampling time interval are pre-set, then when the sampling time, section timing started, according toSampling time interval obtains the pixel for two frames that the sampling time distribution collection before and after sampling time interval arrivesPixel value, the pixel value of the pixel value of the pixel of the first frame and the pixel of the second frame is obtained, then according to the picture of the first frameThe pixel value of the pixel of the pixel value of vegetarian refreshments and the second frame judges whether physics video memory changes, if so, by mobile deviceFrame per second statistical value increase by one statistics step-length, next judge whether the timing duration of sampling time section has been completed, if it is not,Continue the pixel value of the pixel for two frames that a sampling time distribution collection arrives before and after obtaining according to sampling time interval, and continueThe judgement whether physics video memory changes is carried out, until sampling time section timing terminates, output frame rate statistical value, according to samplingPeriod and frame per second statistical value obtain the real time frame rate of current mobile device.By in sampling time section according between the sampling timeThe data content of the physics video memory of mobile device is extracted and compared every timing, so as to calculate the frame per second of physics video memory,It can realize and real-time detection is carried out to the screen display frame per second of mobile device anywhere or anytime.
Below mainly with the frame per second detection method of the mobile device of the embodiment of the present invention be applied to terminal in come for example,The terminal can include smart mobile phone, tablet personal computer, E-book reader, dynamic image expert's compression standard audio aspect 3(Moving Picture Experts Group Audio Layer III, MP3)Player, dynamic image expert's compression standardAudio aspect 4(Moving Picture Experts Group Audio Layer IV, MP4)Player, portable meter on kneeCalculation machine and desktop computer etc..
Fig. 8 is refer to, it illustrates the structural representation of the terminal involved by the embodiment of the present invention, specifically:
Terminal can include radio frequency(Radio Frequency, RF)Circuit 20, include one or more computersThe memory 21 of readable storage medium storing program for executing, input block 22, display unit 23, sensor 24, voicefrequency circuit 25, Wireless Fidelity(wireless fidelity, WiFi) module 26, the processor 27 for including one or more than one processing core andThe grade part of power supply 28.It will be understood by those skilled in the art that the restriction of the terminal structure shown in Fig. 8 not structure paired terminal,It can include than illustrating more or less parts, either combine some parts or different parts arrangement.Wherein:
RF circuits 20 can be used for receive and send messages or communication process in, the reception and transmission of signal, especially, by under base stationAfter row information receives, transfer to one or more than one processor 27 is handled;In addition, it is sent to base by up data are related toStand.Generally, RF circuits 20 include but is not limited to antenna, at least one amplifier, tuner, one or more oscillators, userIdentity module(SIM)Card, transceiver, coupler, low-noise amplifier(Low Noise Amplifier, LNA), duplexerDeng.In addition, RF circuits 20 can also be communicated by radio communication with network and other equipment.The radio communication, which can use, appointsOne communication standard or agreement, including but not limited to global system for mobile communications (Global System of MobileCommunication, GSM), general packet radio service (General Packet Radio Service, GPRS), code division it is moreLocation (Code Division Multiple Access, CDMA), WCDMA (Wideband Code DivisionMultiple Access, WCDMA), Long Term Evolution (Long Term Evolution, LTE), Email, Short Message Service(Short Messaging Service, SMS) etc..
Memory 21 can be used for storage software program and module, and processor 27 is stored in the soft of memory 21 by operationPart program and module, so as to perform various function application and data processing.Memory 21 can mainly include storing program areaAnd storage data field, wherein, storing program area can storage program area, the application program needed at least one function(Such as soundSound playing function, image player function etc.)Deng;Storage data field can store uses created data according to terminal(Such asVoice data, phone directory etc.)Deng.In addition, memory 21 can include high-speed random access memory, can also include non-volatileProperty memory, a for example, at least disk memory, flush memory device or other volatile solid-state parts.Correspondingly, depositReservoir 21 can also include Memory Controller, to provide the access of processor 27 and input block 22 to memory 21.
Input block 22 can be used for the numeral or character information for receiving input, and generation is set with user and function controlIt is formed with keyboard, mouse, action bars, optics or the input of trace ball signal of pass.Specifically, in a specific embodiment,Input block 22 may include touch sensitive surface 221 and other input equipments 222.Touch sensitive surface 221, also referred to as touch display screen orPerson's Trackpad, collect touch operation of the user on or near it(For example user uses any suitable things such as finger, stylusThe operation of body or annex on touch sensitive surface 221 or near touch sensitive surface 221), and phase is driven according to formula set in advanceThe attachment means answered.Optionally, touch sensitive surface 221 may include both touch detecting apparatus and touch controller.Wherein, touchThe touch orientation of detection means detection user is touched, and detects the signal that touch operation is brought, transmits a signal to touch controller;Touch controller receives touch information from touch detecting apparatus, and is converted into contact coordinate, then gives processor 27, andThe order sent of reception processing device 27 and it can be performed.Furthermore, it is possible to using resistance-type, condenser type, infrared ray and surfaceThe polytypes such as sound wave realize touch sensitive surface 221.Except touch sensitive surface 221, input block 22 can also be set including other inputsStandby 222.Specifically, other input equipments 222 can include but is not limited to physical keyboard, function key(Such as volume control button,Switch key etc.), trace ball, mouse, the one or more in action bars etc..
Display unit 23 can be used for display by user input information or be supplied to user information and terminal it is variousGraphical user interface, these graphical user interface can be made up of figure, text, icon, video and its any combination.DisplayUnit 23 may include display panel 231, optionally, can use liquid crystal display (Liquid Crystal Display,LCD), the form such as Organic Light Emitting Diode (Organic Light-Emitting Diode, OLED) configures display panel231.Further, touch sensitive surface 221 can cover display panel 231, when touch sensitive surface 221 detects touching on or near itAfter touching operation, processor 27 is sent to determine the type of touch event, is followed by subsequent processing device 27 and is existed according to the type of touch eventCorresponding visual output is provided on display panel 231.Although in fig. 8, touch sensitive surface 221 and display panel 231 are as twoIndividual independent part realizes input and input function, but in some embodiments it is possible to by touch sensitive surface 221 and display surfacePlate 231 is integrated and realizes input and output function.
Terminal may also include at least one sensor 24, such as optical sensor, motion sensor and other sensors.ToolBody, optical sensor may include ambient light sensor and proximity transducer, wherein, ambient light sensor can be according to ambient lightLight and shade adjusts the brightness of display panel 231, proximity transducer can when terminal is moved in one's ear, close display panel 231 and/Or backlight.As one kind of motion sensor, gravity accelerometer can detect in all directions(Generally three axles)AccelerateThe size of degree, size and the direction of gravity are can detect that when static, the application available for identification mobile phone posture(For example horizontal/vertical screen is cutChange, dependent game, magnetometer pose calibrating), Vibration identification correlation function(Such as pedometer, percussion)Deng;May be used also as terminalThe other sensors such as the gyroscope of configuration, barometer, hygrometer, thermometer, infrared ray sensor, will not be repeated here.
Voicefrequency circuit 25, loudspeaker 251, microphone 252 can provide the COBBAIF between user and terminal.Voicefrequency circuitElectric signal after the voice data received conversion can be transferred to loudspeaker 251 by 25, and sound letter is converted to by loudspeaker 251Number output;On the other hand, the voice signal of collection is converted to electric signal by microphone 252, is changed after being received by voicefrequency circuit 25For voice data, then after voice data output processor 27 is handled, through RF circuits 20 to be sent to such as another terminal, orVoice data is exported to memory 21 further to handle.Voicefrequency circuit 25 is also possible that earphone jack, outer to provideIf the communication of earphone and terminal.
WiFi belongs to short range wireless transmission technology, and terminal can help user's transceiver electronicses postal by WiFi module 26Part, browse webpage and access streaming video etc., it has provided the user wireless broadband internet and accessed.Although Fig. 8 is shownWiFi module 26, but it is understood that, it is simultaneously not belonging to must be configured into for terminal, can not change as needed completelyOmitted in the essential scope of invention.
Processor 27 is the control centre of terminal, using various interfaces and the various pieces of connection whole mobile phone, is led toCross operation or perform the software program and/or module being stored in memory 21, and call the number being stored in memory 21According to the various functions and processing data of terminal being performed, so as to carry out integral monitoring to mobile phone.Optionally, processor 27 may includeOne or more processing cores;Preferably, processor 27 can integrate application processor and modem processor, wherein, applicationProcessor mainly handles operating system, user interface and application program etc., and modem processor mainly handles radio communication.CanWith understanding, above-mentioned modem processor can not also be integrated into processor 27.
Terminal also includes the power supply 28 to all parts power supply(Such as battery), it is preferred that power supply can pass through power supply pipeReason system and processor 27 are logically contiguous, so as to realize management charging, electric discharge and power managed etc. by power-supply management systemFunction.Power supply 28 can also include one or more direct current or AC power, recharging system, power failure monitor electricityThe random component such as road, power supply changeover device or inverter, power supply status indicator.
Although being not shown, terminal can also include camera, bluetooth module etc., will not be repeated here.Specifically in this implementationIn example, the display unit of terminal is touch-screen display, and the memory 21 of terminal seemingly, can store sampling with above-mentioned class databasePeriod, sampling time interval, frame per second statistical value.
And one or more than one program storage in memory 21, and are configured to by one in the terminal of the present embodimentIndividual either more than one processor 27 performs the following operational order that said one or more than one program are included:
When preset sampling time section timing starts, the physics of mobile device is obtained according to preset sampling time intervalFor video memory in the pixel value of the pixel of the first frame and the pixel value of pixel in the second frame, first frame is in the samplingThe frame that sampling time before time interval collects, second frame are the sampling time after the sampling time intervalThe frame collected;
The thing is judged according to the pixel value of the pixel value of the pixel of first frame and the pixel of second frameWhether reason video memory changes;
If so, the frame per second statistical value of the mobile device is increased into a statistics step-length;
Judge whether the timing duration of the sampling time section has been completed, if it is not, triggering is according to the preset sampling timeThe physics video memory of interval acquiring mobile device is in the pixel value of the pixel of the first frame and the pixel value of pixel in the second framePerform again;At the end of the sampling time section timing, the frame per second statistical value is exported, according to the sampling time section and instituteState the real time frame rate that frame per second statistical value obtains the mobile device.
Specifically, the pixel of the physics video memory in the first frame that mobile device is obtained according to preset sampling time intervalThe pixel value of the pixel value of point and the pixel in the second frame, including:
According to preset sampling time interval by the mobile device in the physics video memory of the first frame and the physics of the second frameVideo memory is mapped to the virtual address space of process;
Read out in a manner of array from the virtual address space of the process pixel of the first frame pixel value andThe pixel value of the pixel of second frame.
Specifically, the pixel of the physics video memory in the first frame that mobile device is obtained according to preset sampling time intervalThe pixel value of the pixel value of point and the pixel in the second frame, including:
Physics video memory of the mobile device in the first frame is accessed, reads physics video memory of the mobile device in the first frameIn file data, obtain the pixel value of the pixel of first frame;
Physics video memory of the mobile device in the second frame is accessed, reads physics video memory of the mobile device in the second frameIn file data, obtain the pixel value of the pixel of second frame.
Specifically, the pixel according to first frame pixel value and second frame pixel pixel valueJudge whether the physics video memory changes, including:
Compare each first pixel of first frame and each respective pixel of second pixel of second frameWhether value is identical, if identical, illustrates that the physics video memory does not change, if differing, illustrates the physics video memoryChange, wherein, first pixel location of pixels in the first frame and second pixel are in the second frameLocation of pixels is identical.
Specifically, the pixel according to first frame pixel value and second frame pixel pixel valueJudge whether the physics video memory changes, including:
The summation inspection code of whole pixels of first frame and whole pixels of second frame are calculated respectivelySummation inspection code;
Judge the summation of the summation inspection code of whole pixels of first frame and whole pixels of second frameWhether check code is equal;If so, then illustrating that the physics video memory does not change, if unequal, illustrate that the physics showsDeposit and change.
Specifically, the pixel according to first frame pixel value and second frame pixel pixel valueJudge whether the physics video memory changes, including:
Go out the first pixel point set from whole pixel point samplings of first frame respectively according to identical probability sampling methodClose, go out the second pixel point set from whole pixel point samplings of second frame;
The summation inspection code of whole pixels in the first pixel point set and second pixel are calculated respectivelyThe summation inspection code of whole pixels in set;
Judge the summation inspection code of whole pixels in the first pixel point set and the second pixel point setIn whole pixels summation inspection code it is whether equal;If so, then illustrate that the physics video memory does not change, if not phaseDeng then illustrating that the physics video memory changes.
Specifically, the pixel according to first frame pixel value and second frame pixel pixel valueJudge whether the physics video memory changes, including:
Go out the first pixel point set from whole pixel point samplings of first frame respectively according to identical probability sampling methodClose, go out the second pixel point set from whole pixel point samplings of second frame;
Compare each 3rd pixel and each 4th of the second pixel point set of the first pixel point setWhether the respective pixel value of pixel is identical, if identical, illustrates that the physics video memory does not change, if differing,Illustrate that the physics video memory changes, wherein, the 3rd pixel location of pixels in the first frame and the 4th pictureThe location of pixels of vegetarian refreshments in the second frame is identical.
Further, the sampling time section and the sampling time interval are according to the speed of the internal memory of the mobile deviceWith the frequency setting of central processor CPU.
One of ordinary skill in the art will appreciate that all or part of step in the various methods of above-described embodiment is canTo instruct the hardware of correlation to complete by program, the program can be stored in a computer-readable recording medium, storageMedium can include:Read-only storage(ROM), random access memory(RAM), disk or CD etc..
Detailed Jie has been carried out to the frame per second detection method and relevant apparatus of a kind of mobile device provided by the present invention aboveContinue, for those of ordinary skill in the art, according to the thought of the embodiment of the present invention, in specific embodiments and applicationsThere will be changes, in summary, this specification content should not be construed as limiting the invention.