Data processing method, readable storage medium, and electronic device
The processor adjusts the frame number of sensor data to solve the problem of substandard data transmission in high ODR scenarios, ensuring that applications obtain accurate data in smart devices and achieve functional accuracy.
Patent Information
- Application Number
- CN202310645683.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-01
- Publication Date
- 2024-10-08
- Estimated Expiration
- 2043-06-01
AI Technical Summary
In high output data rate (ODR) scenarios, sensor errors lead to substandard data transmission, affecting the functional accuracy of applications.
The processor adjusts the frame number of the data reported by the sensor and supplements or deletes the data to ensure that the data transmission speed reaches the target ODR and achieve data accuracy and consistency.
It effectively solves the problem of substandard data transmission from sensors in high ODR scenarios, ensuring that applications obtain accurate data amounts and achieve the accuracy of corresponding functions.
Smart Images

Figure CN117707470B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a data processing method, a readable storage medium, and an electronic device. Background Art
[0002] Nowadays, multiple sensors are installed in electronic devices such as smartphones and tablets, such as accelerometers, gyroscopes, etc. These sensors can usually report the collected data to the processor through interrupts, and the corresponding application runs in the processor to realize the functions of the corresponding application.
[0003] In some scenarios, applications have high requirements for the accuracy of the sensor data output rate (ODR). For example, in scenarios such as activity recognition of pedometers or compatibility test suites (CTS) of electronic devices, the ODR accuracy of the sensor needs to reach ±3%. However, due to the characteristics of the sensor, for example, in the capacitor-resistor oscillation circuit of the sensor itself, there will be errors in the resistance and capacitance when transmitting data, which will reduce the accuracy of the sensor's own ODR. Moreover, the higher the ODR, the more obvious the sensor's ODR error.
[0004] At present, most sensors on electronic devices such as mobile phones and tablets have the requirement to operate at high ODR. For example, the data output rate of a pedometer needs to be above 1000HZ. At this time, the ODR error of the sensor will become larger, and the sensor will experience data loss when transmitting data. This will cause the data transmission of the sensor to fail to meet the standard when operating in a high ODR scenario, seriously affecting the accuracy of the corresponding functions of the sensor's corresponding application. Summary of the invention
[0005] Embodiments of the present application provide a data processing method, a readable storage medium, and an electronic device.
[0006] In a first aspect, an embodiment of the present application provides a data processing method, which is applied to at least one processor in an electronic device, and the electronic device includes a sensor; the method includes: acquiring first data reported by the sensor, the first data having a first frame number; determining that the first frame number satisfies a first condition, wherein the first condition includes that the first frame number is different from a target reported frame number; processing the first data into second data, wherein the second frame number of the second data is the same as the target reported frame number; and performing a function related to the first data based on the second data.
[0007] It can be understood that in some embodiments of the present application, when the processor of the electronic device runs the relevant application, it will send the target speed of the reported data to the sensor. Since the speed of the sensor reporting data has errors. Therefore, when the application has a first condition on the speed of the sensor reporting data, the processor can adjust the first data reported by the sensor so that the number of frames of the first data meets the target number of frames reported by the application, so as to satisfy the application to accurately implement the relevant functions. Exemplarily, the first data can be acceleration data or sensor data that has not been adjusted by the processor in the following file, and the second data can be acceleration data or sensor data that has been adjusted by the processor in the following file.
[0008] In a possible implementation of the first aspect, the method further includes: the first condition further includes at least one of the following: the speed at which the sensor reports the first data reaches a first speed; the speed accuracy requirement for the sensor to report the first data is a first accuracy.
[0009] It is understood that the first condition may include, for example, that the speed at which the sensor reports the first data reaches a first speed, and the first speed may be, for example, a limit speed at which the sensor reports the data, or is close to the limit speed, such as 80% of the limit speed. In other embodiments, the first condition may also be that the application has accuracy requirements on the speed at which the sensor reports the first data, such as requiring the sensor to accurately report data at a target reporting speed issued by the application. It is understood that the first speed may be a target reporting speed or a target ODR described below.
[0010] In a possible implementation of the first aspect above, the method also includes: processing the first data into second data, including: corresponding to the first frame number being less than the target reported frame number, supplementing the first data with third data to generate second data; corresponding to the first frame number being greater than the target reported frame number, deleting fourth data from the first data to generate second data.
[0011] It can be understood that in some embodiments of the present application, the processor can process the first data reported by the sensor by, for example, adding frames or deleting frames to generate second data that meets the application program.
[0012] In a possible implementation of the first aspect, the method further includes: the first data includes a plurality of sensor data acquired by the sensor and a timestamp corresponding to each sensor data.
[0013] It can be understood that in some embodiments of the present application, the first data includes sensor data and timestamps corresponding to the sensor data, and the sensor reports the sensor data to the processor in chronological order of the timestamps to ensure the accuracy of the order in which the processor obtains the sensor data.
[0014] In a possible implementation of the first aspect above, the method further includes: corresponding to the first frame number being less than the target reported frame number, supplementing the first data with third data to generate second data, including: sorting multiple sensor data according to the order of timestamps of each sensor data in the first data; dividing the sorted multiple sensor data into multiple sensor data subsets, wherein the number of sensor data subsets is the same as the number of frames of the third data, and the number of sensor data in each sensor data subset is the same; inserting data interpolation at the same part of different sensor data subsets to generate second data.
[0015] It can be understood that the first data is divided into multiple sensor data subsets according to the order of timestamps, and the multiple sensor data subsets are also arranged in the order of timestamps, and the number of sensor data subsets is the same as the number of frames of the third data to be supplemented. In each sensor data subset, the number of sensor data frames is the same. When supplementing frames, data interpolation can be inserted in the same part of each sensor data subset to generate second data. For example, the first data is divided into 4 sensor data subsets according to the order of timestamps, and each sensor data subset includes 3 frames of data. When supplementing frames, data interpolation can be inserted between the second frame and the third frame of each sensor data subset. In this way, the uniformity of supplementing the third data to the first data can be guaranteed. In other embodiments, the number of frames of sensor data in each sensor data subset may be different. For example, the difference in the number of frames of sensor data in two sensor data subsets is 1. This embodiment is caused by the fact that the first number of frames cannot be evenly divided into multiple sensor data subsets.
[0016] In a possible implementation of the first aspect above, the method further includes: generating a data difference by any one of the following methods: calculating an average value of two sensor data at both ends of a sensor data subset as a data interpolation between the sensor data subset and an adjacent sensor data subset; performing data fitting on at least two sensor data at both ends of the sensor data subset to obtain a data interpolation between the sensor data subset and an adjacent sensor data subset.
[0017] It can be understood that when performing frame interpolation, the average value of two adjacent sensor data at the interpolation position can be obtained as the supplementary sensor data. In other embodiments, the supplementary data can also be, for example, fitting of multiple sensor data adjacent to the interpolation position, thereby obtaining the sensor data fitted at the interpolation position as the supplementary data. Obtaining the sensor data at the interpolation position in the above manner can make the supplementary data more realistic and ensure the accuracy of the sensor data.
[0018] In a possible implementation of the first aspect above, the method further includes: corresponding to the first frame number being greater than the target reported frame number, deleting the fourth data in the first data to generate the second data, including: sorting the multiple sensor data according to the order of the timestamps of the sensor data in the first data; acquiring sensor data from the sorted multiple sensor data at intervals of the first number, wherein the number of the acquired sensor data is the same as the number of frames of the fourth data; and deleting the acquired sensor data to generate the second data.
[0019] It can be understood that the first data can be arranged according to the order of the timestamps, and when the number of frames is deleted, the data is obtained at intervals of the first number. The first number can be determined according to the number of frames of the deleted fourth data and the first number of frames of the first data. For example, if the number of first frames is 12 and the target reporting number of frames is 10, the number of frames of the fourth data is 2, that is, 2 frames of data need to be deleted. Then the first number can be set to 5. That is, 1 frame of data is obtained every 5 frames of data, so that the 6th frame of data and the 12th frame of data are obtained as deleted data, and the remaining 10 frames of data are used as the second data.
[0020] In a possible implementation of the first aspect, the method further includes: determining a target reporting frame number based on a first time used by the sensor to report the first data and a target reporting speed of the processor.
[0021] It can be understood that after the processor sends the target reporting speed to the sensor, it can obtain the target reporting frame number based on the target reporting speed and the first time when the sensor reports the first data. The target reporting frame number is the product of the target reporting speed and the first time.
[0022] In a second aspect, an embodiment of the present application provides an electronic device comprising at least one processor and a sensor; the at least one processor is used to: obtain first data reported by the sensor, the first data having a first frame number; determine whether the first frame number satisfies a first condition, wherein the first condition includes that the first frame number is different from a target reported frame number; corresponding to the first frame number satisfying the first condition, process the first data into second data, wherein the second frame number of the second data is the same as the target reported frame number; and execute a function related to the first data based on the second data.
[0023] It is understandable that when the processor runs an application to obtain sensor data, it will send a target reporting speed for reporting sensor data to the sensor. The sensor needs to report data at the target reporting speed. When the speed at which the sensor reports the first data cannot reach the target reporting speed, the processor can adjust the first data to meet the needs of the application running the sensor, thereby ensuring the accuracy of the application implementing the corresponding function.
[0024] In a possible implementation of the second aspect above, the method above also includes: at least one processor includes a first processor and a second processor, wherein the first processor is used to obtain first data reported by the sensor; the first processor determines that the first frame number satisfies the first condition, and processes the first data into second data; the second processor is used to obtain the second data from the first processor and execute functions related to the first data.
[0025] It can be understood that in some embodiments of the present application, the second processor may be, for example, an application processor for running an application program, such as a pedometer. The first processor may be, for example, a coprocessor for acquiring sensor data and adjusting the sensor data. For example, when the pedometer application requires accuracy of the speed of the sensor data reported by the sensor, the coprocessor will supplement or delete some data from the sensor data when acquiring the sensor data reported by the sensor, and then report it to the application for processing. The process of supplementing or deleting data is described below. When the application processor runs the pedometer application, it performs step calculations based on the sensor data reported by the coprocessor.
[0026] In a third aspect, an embodiment of the present application provides a computer-readable storage medium, on which instructions are stored. When the instructions are executed on a computer, the computer executes the data processing method provided by the first aspect and various possible implementations of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 A schematic structural diagram of an electronic device is shown;
[0028] Figure 2 shows a timing diagram of a sensor transmitting data to a processor;
[0029] Figure 3a According to some embodiments of the present application, a structural schematic diagram of an electronic device is shown;
[0030] Figure 3b According to some embodiments of the present application, a timing diagram of a sensor transmitting data to a processor is shown;
[0031] Figure 4 According to some embodiments of the present application, a flowchart of an implementation method of a sensor data processing method is shown;
[0032] Figure 5 According to some embodiments of the present application, a flowchart of another sensor data processing method is shown;
[0033] Figure 6 According to some embodiments of the present application, an interactive flow chart of a sensor data processing process is shown;
[0034] Figure 7 According to some embodiments of the present application, a structural schematic diagram of an electronic device is shown;
[0035] Figure 8 According to some embodiments of the present application, a schematic block diagram of a system software architecture of a mobile phone is shown. DETAILED DESCRIPTION
[0036] The illustrative embodiments of the present application include, but are not limited to, a data processing method, a readable storage medium, and an electronic device.
[0037] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0038] Figure 1 A schematic structural diagram of an electronic device 100 is shown.
[0039] like Figure 1 As shown, the electronic device 100 includes a processor 110 and a sensor module 180. The sensor module 180 includes a memory 13.
[0040] The processor 110 runs the application and determines the function of the corresponding application based on the acceleration data obtained from the sensor module 180. For example, the processor 110 can run a pedometer application and implement the pedometer function by extracting gait features from the acceleration data through a pedometer algorithm based on the acceleration data reported by the sensor module 180.
[0041] The memory 13 is used to store data detected by the sensor module 180, such as acceleration data. In some embodiments, the memory 13 can store acceleration data through a first in first out (FIFO) queue, and the sensor module 180 can add the detected acceleration data to the FIFO frame by frame. When the data cached in the memory 13 reaches a preset data amount, for example, when the preset number of frames is reached, the sensor module 180 triggers an interrupt and transmits the data in the memory 13 to the processor 110.
[0042] It can be understood that a frame of data may include acceleration data of the sensor module 180 and a timestamp corresponding to the acceleration data.
[0043] Since the time length for the sensor module 180 to collect a frame of data is not fixed, the time required for the data in the memory 13 to be cached to the preset number of frames will also vary each time, that is, the intervals at which the sensor module 180 triggers interrupts are different, and the ODR of the sensor module 180 is changing. In this way, if the ODR of the sensor module 180 changes greatly, that is, the accuracy of the ODR of the sensor module 180 is low, the number of frames of data reported by the sensor module 180 to the processor 110 per unit time also changes greatly, which may cause functional abnormalities in the application.
[0044] For example, Figure 2 A timing diagram of the sensor module 180 transmitting data to the processor 110 is shown.
[0045] like Figure 2 As shown, it is assumed that the sensor module 180 reports to the processor 110 once for every 20 frames of data cached, that is, an interrupt is triggered once for every 20 frames of data cached. Assuming that the sensor module 180 starts transmitting data from t1=0ms, the time of the first interrupt triggering is t2=200ms, and the time of the second interrupt triggering is t3=440ms. In other words, during the period from t1 to t2, the ODR of the sensor module 180 is 20 frames / 200ms×1000=100 frames / s, that is, 100 frames of data are reported per second, and during the period from t2 to t3, the ODR of the sensor module 180 is 20 frames / 240ms×1000=83 frames / s, that is, 83 frames of data are reported per second.
[0046] If the ODR required by the application is 100 frames / s, the number of data frames that the sensor module 180 needs to report from 0 to t3 should be 440ms×100 frames / s=44 frames. However, the sensor module 180 actually had two interruptions from 0 to t3, and each interruption reported 20 frames of data. Therefore, the sensor module 180 actually reported 40 frames of data, which is different from the amount of data required by the application, and may cause the step counting data obtained by the application to be inaccurate.
[0047] In order to solve the above problems, the present application provides a sensor data processing method. When the processor in the electronic device obtains the sensor data required by the application from the sensor module 180, when the data reporting requirements of the application (such as target ODR, whether to report with high precision, etc.) meet the adjustment conditions, the number of data frames reported after each interrupt trigger of the sensor can be adjusted to be consistent with the number of data frames corresponding to the target ODR (hereinafter referred to as the target reporting frame number) before being transmitted to the application.
[0048] For example, the adjustment condition is when the target ODR reaches a preset value, such as 80% of the limit ODR of the sensor module 180. Or the application requires high-precision ODR reporting of sensor data. After the adjustment condition is met, the processor adjusts the ODR of the sensor reported data, so as to transmit the sensor data to the application at the target ODR.
[0049] The adjustment method is, for example, when the number of data frames (hereinafter referred to as the cached frame number) when the sensor reports an interrupt trigger and is less than the target reported frame number, the processor can fill the number of data frames reported by the sensor to the target reported frame number by filling the frame and then transmit it to the application. The filling method can be, for example, by fitting interpolation based on the frame number data at the filling position.
[0050] For another example, if the sensor has data overflow, that is, the number of frames reported by the sensor when the interrupt is triggered is greater than the target number of frames reported, the processor can delete part of the frames reported by the sensor, so that the number of data frames reported is the same as the target number of frames reported, and then transmit it to the application.
[0051] Through the data processing method provided by the present application, when the data reporting requirements of the application meet the adjustment conditions, the ODR of the data obtained by the application can be made the same as the target ODR, thereby ensuring that the application can obtain the accurate amount of data and realize the corresponding function.
[0052] In addition, when the application's requirement for the sensor's ODR meets the adjustment conditions, the processor starts the above adjustment scheme (hereinafter referred to as the ODR adjustment scheme) to ensure the accuracy of the sensor's ODR, thereby ensuring the accuracy of the corresponding application's function. When the application's requirement for the sensor's ODR does not meet the adjustment conditions, the processor turns off the ODR adjustment scheme to ensure the accuracy of the sensor data to meet the application's requirement for the sensor's data accuracy.
[0053] It should be understood that the target reporting frame number can be determined according to the target ODR and the time interval DT between the sensor reporting data this time and the last reporting data. Exemplarily, the target reporting frame number can be the product of the target ODR and DT. For example, assuming that the target ODR is 100 frames / second and DT=200ms, the target reporting frame number is 100 frames / second×200ms=20 frames.
[0054] Specifically, Figure 3a According to an embodiment of the present application, a structural schematic diagram of an electronic device 100 is shown.
[0055] like Figure 3a As shown, the electronic device 100 includes a processor 110 and a sensor module 180. The processor 110 includes an application processor 14 and a coprocessor 15, and the sensor module 180 includes a memory 13.
[0056] The memory 13 is used to store sensor data detected by the sensor module 180. When the data cached in the memory 13 reaches a preset data amount, for example, a preset number of frames, the sensor module 180 triggers an interrupt and transmits the data in the memory 13 to the coprocessor 15.
[0057] The coprocessor 15 is used to obtain acceleration data from the sensor module 180 and adjust the acceleration data so that the ODR of the sensor module 180 meets the target ODR of the application. For example, the coprocessor 15 can start the ODR adjustment scheme to add frames or delete the acceleration data reported by the sensor module 180 so that the ODR of the sensor module 180 meets the target ODR. The adjusted sensor data is reported to the application processor 14.
[0058] The application processor 14 is used to run the application and determine the function of the corresponding application based on the acceleration data obtained from the coprocessor 15. For example, the application processor 14 can run a pedometer application and implement the pedometer function by extracting gait features from the acceleration data through a pedometer algorithm based on the acceleration data reported by the coprocessor 15.
[0059] Through the electronic device of this embodiment, when the application has a demand for the ODR accuracy of the sensor module 180, the coprocessor 15 can start the ODR adjustment scheme to adjust the data reported by the sensor module 180 so that the ODR of the data obtained by the application processor 14 meets the target ODR of the application.
[0060] Figure 3b According to an embodiment of the present application, a timing diagram of the sensor module 180 transmitting data to the coprocessor 15 is shown.
[0061] like Figure 3b As shown, it is assumed that the target ODR of the sensor module 180 is 100 frames / second, the target ODR is greater than the preset ODR, and the sensor module 180 triggers an interrupt every time 20 frames of data are cached, and reports the cached data to the coprocessor 15.
[0062] refer to Figure 3b , the time when the sensor module 180 first starts to cache data is t1=0ms, and the time when 20 frames of data are cached is t2=200ms, that is, the sensor module 180 triggers an interrupt at 200ms and reports the cached data to the coprocessor 15. At this time, the actual ODR=20 frames / 200ms=100 frames / second, which is consistent with the target ODR. The coprocessor 15 does not need to process the data and directly transmits it to the application.
[0063] Continue to refer Figure 3b, the time when the sensor module 180 triggers the interrupt for the second time is t3=410ms, DT=t3-t2=210ms. At this time, the actual ODR=20 frames / 210ms=95.2 frames / second, which is less than the target ODR. That is to say, the time for the sensor module 180 to cache 20 frames of data becomes longer, and the actual ODR of the sensor module 180 cannot reach the target ODR. The coprocessor 15 needs to supplement the data reported by the sensor module 180. At this time, the target number of reported frames is 100 frames / second×210ms=21 frames. The coprocessor 15 can insert a frame of data into the data reported by the sensor module 180 and then report it to the application processor 14. The application processor 14 runs the application so that the application receives 21 frames of data within 210ms, thereby ensuring that the ODR of the data obtained by the application is the same as the target ODR.
[0064] Exemplarily, the coprocessor 15 may insert the 30' frame data after the 30th frame as the supplementary frame between the 21st frame and the 40th frame, that is, insert a frame of data in the middle of the data reported by the sensor module 180 .
[0065] It should be understood that in other embodiments, the coprocessor 15 may also insert a frame of data at the head or tail of the data reported by the sensor module 180 .
[0066] Continue to refer Figure 3b , the time when the sensor module 180 triggers the interrupt for the third time is t4=580ms, DT=t4-t3=170ms, at this time, the actual ODR=20 frames / 170ms=117.6 frames / second, which is greater than the target ODR. That is to say, the time for the sensor module 180 to cache 20 frames of data becomes shorter, and the actual ODR of the sensor module 180 exceeds the target ODR, and the coprocessor 15 needs to delete the data reported by the sensor module 180. At this time, the target number of reported frames is 100 frames / second×170ms=17 frames, so the coprocessor 15 can delete three frames of data from the data reported by the sensor module 180 when the third interrupt is triggered, so as to ensure that the ODR of the data obtained by the application is the same as the target ODR. For example, the coprocessor 15 can delete the data of the 41st frame, the 50th frame, and the 60th frame, so that the application only obtains 17 frames of data within 170ms.
[0067] In this way, it can be ensured that the speed at which the application obtains sensor data is the same as the target ODR, thereby ensuring the accuracy of the application in implementing the corresponding functions.
[0068] Figure 4 According to an embodiment of the present application, a flow chart of an implementation method of a sensor data processing method is shown.
[0069] It can be understood that the sensor data processing method provided in the embodiments of the present application is applied to electronic devices, which may include but are not limited to: mobile phones, tablets, computers, smart watches, car conference terminals, desktops, laptops, handheld computers, netbooks, and augmented reality (AR) and virtual reality (VR) devices, smart TVs, smart watches and other wearable devices, servers, portable game consoles, portable music players, reader devices, and other electronic devices embedded or coupled with one or more processors or including sensors.
[0070] It should be understood that the execution subject of each of the following steps may be a coprocessor in the electronic device for processing sensor data, such as the coprocessor 15 of the aforementioned electronic device 100. When introducing each step below, the execution subject of each step will not be introduced again.
[0071] 401: Send the target ODR of the application to the sensor.
[0072] For example, when the application processor 14 runs an application and needs to obtain sensor data, it will send a target ODR to the coprocessor 15. The target ODR is the speed at which the application obtains sensor data. The coprocessor 15 sends the target ODR to the sensor, and the sensor transmits the collected sensor data to the coprocessor 15 according to the target ODR.
[0073] 402 , determining whether the target ODR reaches the limit ODR of the sensor.
[0074] For example, the sensor itself has limit ODR data. When the sensor transmits data under the limit ODR, the ODR will have a large error, and the data transmitted by the sensor needs to be processed. Therefore, when the coprocessor 15 obtains the data reported by the sensor, it needs to determine whether the target ODR reaches the limit ODR. It should be understood that the sensor can only transmit data at the limit ODR at most. When the target ODR is greater than the limit ODR, the sensor transmits data at the limit ODR.
[0075] If the judgment result is yes, for example, the coprocessor 15 detects that the target ODR is greater than the limit ODR, and the sensor needs to transmit data at the limit ODR, which will result in a large error, then step 404 is executed to determine whether the target ODR is greater than the actual ODR of the sensor, so as to adjust the ODR of the sensor.
[0076] If the determination result is no, for example, the coprocessor 15 detects that the target ODR does not reach the limit ODR, and the error of the sensor when transmitting data is within the allowable range of the application, step 403 is executed to determine whether the application opens high-precision subscription.
[0077] 403, determine whether the application has enabled high-precision subscription.
[0078] For example, in some embodiments, the application has accuracy requirements for the ODR of the sensor. Therefore, when such applications acquire sensor data, it is necessary to ensure the accuracy of the sensor ODR. For example, a whitelist may be stored in the electronic device so that the coprocessor 15 can determine whether the application has enabled high-precision subscription based on the whitelist. For example, when the application acquires sensor data, the coprocessor 15 can determine whether to adjust the data when reporting the data to the application processor 14 by determining whether the corresponding application is in the whitelist.
[0079] If the result of the determination is yes, for example, the application is in the whitelist and the application has requirements for the ODR accuracy of the sensor, then step 404 is executed to determine whether the target ODR is greater than the actual ODR of the sensor.
[0080] If the judgment result is no, for example, the application is not in the whitelist, the application has no special requirements for the ODR accuracy of the sensor, and the error of the sensor when transmitting data is within the allowable range of the application, then step 407 is executed to report the data.
[0081] In other embodiments, high-precision subscription can be determined based on a voting mechanism. Taking the accelerometer as an example, if the first application, the second application, and the third application all need to use the data of the accelerometer. The first application and the third application have no accuracy requirements for the ODR of the accelerometer, and the target ODR of the first application and the third application does not reach the limit ODR of the accelerometer. The second application has accuracy requirements for the ODR of the accelerometer. After obtaining the data reported by the accelerometer, the coprocessor 15 needs to start the ODR adjustment scheme to adjust the ODR of the accelerometer. It should be understood that the voting mechanism can be, for example, that the sensor selects the ODR with the highest accuracy requirement among multiple applications to report sensor data.
[0082] In other embodiments, the voting mechanism for high-precision subscription can also be set according to the target ODR size of the application. For example, the first application, the second application, and the third application all need to obtain acceleration data from the acceleration sensor, among which the target ODR of the first application is the highest, reaching 1000Hz. Then the acceleration sensor needs to transmit data at the highest target ODR, that is, to transmit data at a speed of 1000Hz. If the limit ODR of the sensor is 1000Hz, the coprocessor 15 needs to start the ODR adjustment scheme to ensure that the speed at which the coprocessor 15 reports data to the application processor 14 is stable at 1000Hz. It should be understood that the voting mechanism can be, for example, that the sensor reports sensor data according to the ODR with the largest target ODR among multiple applications.
[0083] It is understood that in another embodiment, the determination step 402 can be reversed from the step 403. That is, first determine whether the application has enabled high-precision subscription, and then determine whether the target ODR of the application has reached the limit ODR of the sensor. The numbering sequence and description sequence of each step in this embodiment do not specifically limit the order in which the steps are executed.
[0084] 404 , determine whether the target ODR is greater than the actual ODR of the sensor.
[0085] Exemplarily, the sensor caches the collected data in an internal memory. When the data in the memory reaches a preset value, the sensor triggers an interrupt and reports the data cached in the memory to the coprocessor 15. Each time the sensor triggers an interrupt, it records the timestamp of the interrupt. The coprocessor 15 can obtain the cache time each time the sensor caches the preset data based on the interrupt timestamp. For example, the timestamp of the current interrupt triggering is subtracted from the timestamp of the last interrupt triggering, which is the cache time when the memory last cached the preset amount of data (hereinafter referred to as the actual cache time, i.e., the aforementioned DT). If the actual cache time is greater than the cache time of the sensor under the target ODR (hereinafter referred to as the target cache time), it can be determined that the actual ODR of the sensor is less than the target ODR. Similarly, if the coprocessor 15 detects that the actual cache time of the sensor is less than the target cache time, it can be indicated that the actual ODR of the sensor is greater than the target ODR.
[0086] If the determination result is yes, for example, the coprocessor 15 detects that the actual buffer time of the sensor is greater than the target buffer time, indicating that the target ODR is greater than the actual ODR, then step 406 is executed to interpolate the sensor data.
[0087] If the determination result is no, for example, the coprocessor 15 detects that the actual buffer time of the sensor is less than the target buffer time, indicating that the target ODR is less than the actual ODR, then step 405 is executed to delete part of the sensor data.
[0088] 405, delete some sensor data.
[0089] For example, when the actual ODR of the sensor is greater than the target ODR, the time for each sensor to trigger an interrupt will be shortened. Therefore, the coprocessor 15 can delete some data reported by the sensor to ensure that the number of frames reported to the application processor 14 is consistent with the target number of frames reported.
[0090] For example, for the situation shown in FIG3 above, the target ODR is 100 frames / s, and the memory in the sensor triggers an interrupt every time 20 frames of data are cached, so the target cache time is 200ms. However, the sensor takes 170ms to transmit 20 frames of data. At this time, the actual ODR of the sensor is 20 frames / 170ms=118 frames / second, which is greater than the target ODR. At this time, the target reported frame number is 100 frames / second×170ms=17 frames. Therefore, the actual number of frames reported by the sensor is 20 frames-17 frames=3 frames more than the target reported frame number. Therefore, the coprocessor 15 needs to delete 3 frames of data from the data reported by the sensor.
[0091] Exemplarily, the coprocessor 15 may delete frame data by, for example, dividing 20 frames of data into two areas, and deleting corresponding data at the end point of each area. In other embodiments, the location of deleted data may also be set according to the timestamp of each frame of data. For example, three groups of data with the shortest timestamps between two adjacent frames of data are selected from 20 frames of data, and one frame of data is selected from each group of data for deletion. By deleting three frames of data, the distribution of the remaining 17 frames of data can be made more uniform. It can be understood that the present solution does not specifically limit the location of deleted frames, and the frames can be deleted at the corresponding location according to specific needs.
[0092] 406, interpolate the sensor data.
[0093] For example, when the actual ODR of the sensor is less than the target ODR, the duration of each sensor interruption will be prolonged. Therefore, the coprocessor 15 needs to supplement some data to ensure that the speed of reporting data to the application processor 14 meets the target ODR.
[0094] For example, if the target ODR is 100 frames / second, the sensor will trigger an interrupt every time the memory 13 caches 20 frames of data, that is, the sensor needs to trigger an interrupt every 200ms. However, the sensor took 240ms to transmit 20 frames of data, and the actual ODR of the sensor is 20 frames / 240ms=83 frames / second, which is less than the target ODR. At this time, the target reported frame number is 100 frames / second×240ms=24 frames. Therefore, the data actually reported by the sensor is 24 frames-20 frames=4 frames less than the target reported data. Therefore, the coprocessor 15 needs to supplement the data reported by the sensor with 4 frames of data.
[0095] The method of frame supplementation can be, for example, to divide 20 frames of data into 3 areas, and to supplement the corresponding data at the end point of each area. In other embodiments, the position of the frame supplementation can also be set according to the timestamp of each frame of data, for example, the frame supplementation is performed at the 4 nodes with the longest timestamps of two adjacent needles. It can be understood that the present scheme does not make specific restrictions on the position of the frame supplementation, and the frame supplementation can be performed at the corresponding position according to specific needs. The data size of the supplementary frame number can be determined, for example, based on the data near the position of the frame supplementation. For example, the coprocessor 15 takes the average value of two data adjacent to the position of the frame supplementation as the data for the frame supplementation. In other embodiments, the coprocessor 15 can also fit a curve with time as the horizontal axis and the value collected by the sensor as the vertical axis for the 20 frames of data. Then select the value corresponding to the time point of the frame supplementation on the curve as the data for the frame supplementation, or use the nearest neighbor method, linear interpolation and other methods to perform frame supplementation.
[0096] 407, report data.
[0097] Exemplarily, after adjusting the sensor data, the coprocessor 15 can report the sensor data to the application processor 14, and the application processor 14 runs the application program and implements corresponding functions based on the sensor data reported by the coprocessor 15. It can be understood that if the sensor data does not need to be adjusted, the coprocessor 15 can directly report the acquired sensor data to the application processor 14.
[0098] In an embodiment of the present application, when the coprocessor 15 needs to obtain sensor data, the ODR adjustment scheme can be turned on according to the needs of the application. For example, when the target ODR of the application reaches the limit ODR of the sensor, or when the application has accuracy requirements for the ODR of the sensor, the coprocessor 15 turns on the ODR adjustment scheme. To ensure that the application can obtain sensor data at the target ODR and implement the corresponding functions. When some applications have no requirements for the ODR of the sensor, the coprocessor 15 can turn off the ODR adjustment scheme, and there is no need to add frames or delete frames for the sensor data, thereby ensuring the accuracy of the sensor data.
[0099] It should be understood that in some embodiments, part or all of the aforementioned steps 401 to 407 may also be executed by the application processor 14 or a micro controller unit (MCU) disposed outside the processor 110, which is not limited here.
[0100] Figure 5 According to some embodiments of the present application, a flowchart of another sensor data processing method is shown.
[0101] Understandably, Figure 5 The execution subject of each step of the process shown can be the coprocessor 15 in the electronic device that processes the sensor data, and there is no limitation here. Figure 5 The execution entities of each step will not be repeatedly introduced when describing each step of the process.
[0102] like Figure 5 As shown, the method includes the following processes:
[0103] 501 , determining whether the target ODR reaches the limit ODR of the sensor.
[0104] For example, when the application processor 14 runs an application and needs to obtain sensor data, it will send the target ODR of the application to the coprocessor 15, and the coprocessor 15 will send the target ODR to the sensor, and the sensor will transmit the collected data according to the target ODR. The sensor itself has limit ODR data. When the sensor transmits data under the limit ODR, the data transmission speed will have a large error, and the data transmitted by the sensor needs to be processed. Therefore, the coprocessor 15 needs to determine whether the target ODR reaches the limit ODR.
[0105] If the result of the determination is yes, for example, the target ODR exceeds the limit ODR, and the sensor transmits data at the limit ODR, a large error will occur. Then, step 503 is executed to determine that the actual ODR of the sensor is less than the target ODR, resulting in data loss. Alternatively, step 506 is executed to determine that the actual ODR of the sensor is greater than the target ODR, resulting in data overflow.
[0106] If the determination result is no, for example, the target ODR is less than the limit ODR, and the error of the sensor when transmitting data is within the allowable range, step 502 is executed to determine whether the application has enabled high-precision subscription.
[0107] 502, determine whether the application has enabled high-precision subscription.
[0108] For example, in some embodiments, the application has accuracy requirements for the ODR of the sensor. Therefore, when the application processor 14 runs such an application to obtain sensor data, it is necessary to ensure the accuracy of the data transmission speed. For example, a whitelist can be stored in the electronic device so that the coprocessor 15 can determine whether the application has enabled high-precision subscription based on the whitelist. For example, when the application obtains sensor data, the coprocessor 15 can determine whether to adjust the data when reporting the data to the application processor 14 by determining whether the corresponding application is in the whitelist.
[0109] If the judgment result is yes, for example, the application is in the whitelist and has requirements for the ODR accuracy of the sensor, then step 503 is executed to determine that the actual ODR of the sensor is less than the target ODR, resulting in data loss. Alternatively, step 506 is executed to determine that the actual ODR of the sensor is greater than the target ODR, resulting in data overflow.
[0110] If the judgment result is no, for example, the application is not in the whitelist, there is no special requirement for the ODR accuracy of the sensor, and the error of the sensor when transmitting data is within the allowable range, then step 507 is executed to report the data.
[0111] It can be understood that in another embodiment, the determination step 501 can be reversed from the step 502. That is, the coprocessor 15 first determines whether the application has enabled high-precision subscription, and then determines whether the target ODR of the application has reached the limit ODR of the sensor. The order of describing the process steps in this application does not impose any restrictions on the specific implementation order of the process.
[0112] 503, determining that the actual ODR of the sensor is less than the target ODR causes data loss.
[0113] Exemplarily, the sensor caches the collected data in an internal memory. When the data in the memory reaches a preset value, the sensor triggers an interrupt and reports the cached data to the coprocessor 15. Each time the sensor triggers an interrupt, it records the timestamp of the interrupt. The coprocessor 15 can obtain the cache time of each time the sensor caches the preset data based on the sensor interrupt timestamp. For example, the timestamp of the current interrupt triggering of the sensor minus the timestamp of the last interrupt triggering is the actual cache time of the currently reported data, that is, DT. If the cache time is greater than the target cache time of the target ODR, it can be determined that the actual ODR of the sensor is less than the target ODR. Therefore, the amount of data reported by the sensor within a certain period of time cannot meet the requirements, that is, part of the data is missing. When the coprocessor 15 reports the sensor data to the application processor 14, it will cause the functions implemented by the application program to be inaccurate.
[0114] 504, obtaining the interpolation frame position of the data reported by the sensor and performing slope calculation.
[0115] For example, the coprocessor 15 can generate a target frame number according to the target ODR and the actual buffer time DT when supplementing frames, and can supplement the data reported by the sensor to the target frame number when supplementing frames. Figure 4 Step 406 in the embodiment. When performing frame supplementation, the coprocessor 15 can obtain the slope of the sensor data at the frame supplementation position, and generate the frame number data to be supplemented based on the slope. For example, the sensor data of two adjacent frames at the frame supplementation position are averaged as the sensor data at the frame supplementation position.
[0116] 505, fill in the lost data.
[0117] Exemplarily, after the coprocessor 15 obtains the interpolation position and interpolation data, it can interpolate the data reported by the sensor to ensure that the data transmission speed reported to the application processor 14 meets the target ODR.
[0118] 506 , determining that the actual ODR of the sensor is greater than the target ODR causes data overflow.
[0119] For example, if the actual cache time of the sensor-reported data is less than the cache time of the target ODR, it can be determined that the actual ODR of the sensor is greater than the target ODR. In this way, within a certain period of time, the data reported by the sensor will exceed the data reported when the sensor is the target ODR. When the coprocessor 15 reports the sensor data to the application processor 14, it will also cause inaccurate functions of the application.
[0120] 507, delete the overflowed data.
[0121] For example, when the actual ODR of the sensor is greater than the target ODR, the time for each sensor to trigger an interrupt will be shortened. Therefore, the coprocessor 15 needs to delete some data from the data reported by the sensor to ensure that the number of frames reported to the application processor 14 is consistent with the target number of frames reported. The method of deleting the number of frames can be referred to Figure 4 Step 405 in the embodiment.
[0122] 508, report data.
[0123] Exemplarily, after the coprocessor 15 obtains the data reported by the sensor, it adjusts the sensor data based on the ODR adjustment scheme. Then, the coprocessor 15 reports the adjusted sensor data to the application processor 14. The application program run by the application processor 14 implements the functions of the application program. It can be understood that if the sensor data does not need to be adjusted, the coprocessor 15 can directly report the obtained sensor data to the application processor 14.
[0124] It can be understood that, through the embodiments of the present application, the coprocessor 15 can dynamically enable the ODR adjustment scheme so that the speed of reporting data meets the requirements of the application.
[0125] further, Figure 6 According to an embodiment of the present application, an interactive flow chart of a sensor data processing process is shown.
[0126] For example, Figure 6 The flowcharts shown in the figure respectively show the flowcharts of three applications acquiring sensor data. For example, application 611a is an application that needs to transmit data at a high ODR. Application 611b is an application that has high precision requirements for ODR. Application 611c is a standard application that allows a certain error in the transmission of ODR.
[0127] The interaction subjects in the sensor data processing process may be, for example, the application processor 14 and the sensor hub 620. The sensor hub 620 may be arranged in the coprocessor 15.
[0128] The application processor 14 is used to run the application program 611 and the sensor HAL 612 in the hardware abstract layer (HAL). The hardware abstract layer is a package of the hardware driver, providing a unified hardware capability general interface for the upper layer.
[0129] The sensor hub 620 may be provided in the coprocessor 15, and is used to run the sensor driver 621, other algorithms 622, and the pedometer algorithm 623. The sensor driver 621 is used to transmit sensor data and implement the sensor data processing method in any of the above embodiments. The other algorithms 622 are used to process the sensor data in other ways. The pedometer algorithm 623 is used to generate the data required by the pedometer based on the sensor data.
[0130] Specifically, Figure 5 As shown, the interaction process of application 611a includes the following steps:
[0131] S611 , the application 611 a activates the sensor HAL 512 .
[0132] Exemplarily, when the application 611 a acquires data of the corresponding sensor, it is necessary to activate the HAL 612 of the corresponding sensor in the HAL layer of the operating system of the electronic device 100 .
[0133] S612 , the application 611 a sends the target ODR to the sensor HAL 612 .
[0134] For example, when acquiring sensor data, the application 611a sends the target ODR to the sensor HAL 612, so that the sensor driver 612 transmits the sensor data with the target ODR.
[0135] S613, the sensor HAL 612 determines that the target ODR is equal to the limit ODR.
[0136] For example, the sensor has a high output data error at the extreme ODR, so it is necessary to Figure 4 The sensor data processing method in the embodiment processes the data transmitted by the sensor driver 621. When the sensor HAL 612 determines that the target ODR is equal to the limit ODR, the sensor driver 621 starts the ODR adjustment scheme.
[0137] It is understood that the target ODR does not necessarily need to be strictly greater than the limit ODR or equal to the limit ODR before the ODR adjustment scheme is activated. In other embodiments, the ODR adjustment scheme may also be activated if the target ODR is close to the limit ODR of the sensor. For example, when the target ODR reaches 80% of the limit ODR, the ODR adjustment scheme needs to be activated.
[0138] S614 , the sensor driver 621 returns the sensor data to the sensor HAL 612 .
[0139] Exemplarily, the sensor driver 621 transmits the processed sensor data to the application 611a through the sensor HAL 612. The processing of the sensor data may be, for example: when the sensor driver 621 detects that the ODR when reporting the data is less than the target ODR, the reported data is framed to ensure that the data transmission rate of the reported sensor data is equal to the target ODR. When the sensor driver 621 detects that the actual ODR when the sensor reports the data is greater than the target ODR, the data reported by the sensor is deleted. It is ensured that the data transmission rate of the sensor data reported by the sensor driver 621 to the application 611a is equal to the target ODR, thereby ensuring the accuracy of the speed at which the application 611a obtains the sensor data.
[0140] It should be understood that the process of adding frames and deleting frames can refer to Figure 4 Step 405 and step 406 in the embodiment.
[0141] S615 , the application 611 a turns off the sensor HAL 612 .
[0142] Exemplarily, there may be multiple applications 611a that require high ODR to transmit data. When each application 611a finishes acquiring sensor data, it will continue to determine whether the target ODR of the next application 611a reaches the limit ODR. When it is determined that the target ODR of the next application 611a is less than the limit ODR, the ODR adjustment scheme can be turned off to enable the sensor driver 612 to output the original sensor data.
[0143] Continue to refer Figure 6 , the interaction process of application 611b includes the following steps:
[0144] S621 , the application 611 b activates the sensor HAL 612 .
[0145] Exemplarily, when the application 611 b acquires data from the corresponding sensor, it is necessary to activate the HAL 612 of the corresponding sensor in the HAL layer of the operating system of the electronic device 100 .
[0146] S622 , the application 611 b sends the target ODR to the sensor HAL 612 .
[0147] For example, when acquiring sensor data, the application 611b sends the target ODR to the sensor HAL 612, so that the sensor driver 612 transmits the sensor data with the target ODR.
[0148] S623 , the sensor HAL 612 adds a high-precision subscription count to the sensor driver 621 .
[0149] For example, when the application 611b has a requirement for the accuracy of ODR, the sensor HAL 612 performs high-precision subscription counting to the sensor driver 621. The high-precision subscription counting is used to record the number of the application 611b, that is, the number of the application 611 that has a high-precision requirement for ODR.
[0150] It should be understood that the application for high-precision subscription has high requirements on the accuracy of sensor ODR. When the sensor reports data to the application, it is necessary to enable the ODR adjustment scheme to ensure the accuracy of sensor ODR.
[0151] It can be understood that the application programs 611b with high ODR precision requirements may include multiple ones, for example. Every time an application program 611b with high ODR precision requirements performs a high-precision subscription, the sensor HAL 612 increases the count of the high-precision subscription once.
[0152] When the sensor driver 621 has a high-precision subscription, it means that the current application 611b has requirements for the ODR accuracy of the sensor, so it is necessary to start the ODR adjustment solution, such as Figure 4The data processing method in the embodiment processes the data transmitted by the sensor driver 621 .
[0153] S624 , the sensor driver 621 returns the sensor data to the sensor HAL 612 .
[0154] Exemplarily, the sensor driver 621 transmits the sensor data processed by the ODR adjustment scheme to the application 611 b through the sensor HAL 612 .
[0155] For example, the processing of sensor data may be: when the actual ODR of the data reported by the sensor driver 621 is less than the target ODR when the sensor interrupt is detected, the sensor driver 621 adds frames to the reported sensor data to ensure that the data transmission rate of the reported sensor data is equal to the target ODR. When the ODR of the sensor driver 621 is greater than the target ODR when the sensor interrupt is detected, the sensor driver 621 deletes the data reported by the sensor to ensure that the data transmission rate of the sensor data reported by the sensor driver 621 is equal to the target ODR. It should be understood that the process of adding frames and deleting frames can refer to Figure 4 Step 405 and step 406 in the embodiment.
[0156] S625 , the application 611 b turns off the sensor HAL 612 .
[0157] Exemplarily, each time an application 611b finishes acquiring sensor data, the high-precision subscription count is reduced. When the high-precision subscription count is reduced to 0, it indicates that no application 611b requires high ODR precision output data. The sensor driver 621 can turn off the ODR adjustment scheme and report the original sensor data.
[0158] In other embodiments, the sensor hub 620 further includes a pedometer algorithm 623, which requires the sensor driver 621 to output data with a high-precision ODR. When the sensor driver 621 turns on the ODR adjustment scheme, the pedometer algorithm 623 sends a resampling request to the sensor driver 621, and then the sensor driver 621 returns the adjusted sensor data to the pedometer algorithm 623 to meet the calculation requirements of the pedometer algorithm 623.
[0159] Continue to refer Figure 6 , the interaction process of application 611c includes the following steps:
[0160] S631 , the application 611 c activates the sensor HAL 612 .
[0161] Exemplarily, when the application 611 c acquires data from the corresponding sensor, it needs to activate the HAL 612 of the corresponding sensor in the HAL layer of the operating system of the electronic device 100 .
[0162] S632 , the application 611 c sends the target ODR to the sensor HAL 612 .
[0163] For example, when acquiring sensor data, the application 611c sends the target ODR to the sensor HAL 612, so that the sensor driver 612 transmits the sensor data with the target ODR.
[0164] S633, the sensor HAL 612 sets the sensor driver 621 to transmit data with the target ODR.
[0165] It can be understood that the standard application 611c can be an application 611c that has no accuracy requirements for the sensor ODR and has a lower target ODR. When the target ODR is lower, the error of the sensor ODR is lower. Within the allowable range of the application 611c, the sensor driver 621 does not need to turn on the ODR adjustment scheme to ensure the accuracy of the sensor data. At this time, the ODR adjustment scheme is in a closed state.
[0166] S634 , the sensor driver 621 returns the sensor data to the sensor HAL 612 .
[0167] Exemplarily, when the sensor driver 621 determines that the ODR adjustment solution does not need to be enabled, the original sensor data may be directly transmitted to the application 611 c through the sensor HAL 612 .
[0168] It is understandable that when the ODR adjustment scheme is turned off, other algorithms 622 in the sensor hub 620 may issue a resampling request to the sensor driver 621. At this time, the sensor driver 621 may transmit the sensor data to other algorithms 622, and process the sensor data based on other algorithms 622.
[0169] S635 , the application 611 c turns off the sensor HAL 612 .
[0170] Exemplarily, there may be multiple standard applications 611c, and when each application 611c finishes acquiring sensor data, it will continue to determine whether the target ODR of the next application 611c reaches the limit ODR. When it is determined that the target ODR of the next application 611c is less than the limit ODR, the ODR adjustment scheme can be kept in the closed state, so that the sensor driver 612 outputs the original sensor data.
[0171] Through this embodiment, the sensor driver 621 can dynamically start the ODR adjustment scheme. For example, when the application 611a transmits data under a high ODR, the ODR will have a large error, and the sensor driver 621 will start the ODR adjustment scheme. Or when the application 611b has high-precision requirements for the ODR, the sensor driver 621 will also start the ODR adjustment scheme. In this way, the requirements of various applications 611 for the sensor ODR are met. When the application 611 has no requirements for the sensor ODR, for example, the application 611c allows the sensor ODR to be stored within a certain error, the sensor driver 621 turns off the ODR adjustment scheme. In this way, it is possible to avoid the sensor driver 621 from supplementing frames or deleting frames of the sensor data, thereby ensuring the accuracy of the sensor data transmitted by the sensor driver 621.
[0172] Taking a mobile phone as an example, the electronic devices involved in some embodiments of the present invention are described in detail below.
[0173] Figure 7 According to an embodiment of the present application, a structural schematic diagram of an electronic device is shown.
[0174] The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0175] It is to be understood that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or separate some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0176] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0177] The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of instruction fetching and execution.
[0178] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0179] In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0180] The I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 110 may include multiple groups of I2C buses. The processor 110 may couple the touch sensor 180K, the acceleration sensor 180E, etc. through different I2C bus interfaces, so as to obtain corresponding sensor data and adjust the ODR of the sensor.
[0181] The UART interface is a universal serial data bus used for asynchronous communication. The bus can be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication.
[0182] The MIPI interface can be used to connect the processor 110 with peripheral devices such as a display screen and a camera. The MIPI interface includes a camera serial interface (CSI), a display serial interface (DSI), and the like.
[0183] The GPIO interface can be configured by software. The GPIO interface can be configured as a control signal or as a data signal. In some embodiments, the GPIO interface can be used to connect the processor 110 with a camera, a display screen, a wireless communication module 160, a sensor module 180, etc. The GPIO interface can also be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, etc.
[0184] The USB interface 130 is an interface that complies with the USB standard specification, and specifically can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transfer data between the electronic device 100 and a peripheral device. It can also be used to connect headphones to play audio through the headphones. The interface can also be used to connect other electronic devices, such as AR devices, etc.
[0185] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present invention is only a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0186] The charging management module 140 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from a wired charger through the USB interface 130. In some wireless charging embodiments, the charging management module 140 may receive wireless charging input through a wireless charging coil of the electronic device 100. While the charging management module 140 is charging the battery 142, it may also power the electronic device through the power management module 141.
[0187] The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and supplies power to the processor 110, the internal memory 121, the display screen, the camera, and the wireless communication module 160. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc. In some other embodiments, the power management module 141 can also be set in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.
[0188] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
[0189] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
[0190] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.
[0191] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
[0192] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function, such as storing music, video and other files in the external memory card.
[0193] The internal memory 121 can be used to store computer executable program codes, which include instructions. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc. The processor 110 executes various functional applications and data processing of the electronic device 100 by running instructions stored in the internal memory 121, and / or instructions stored in a memory provided in the processor.
[0194] The pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A can be set on the display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. A capacitive pressure sensor can be a parallel plate including at least two conductive materials. When a force acts on the pressure sensor 180A, the capacitance between the electrodes changes. The electronic device 100 determines the intensity of the pressure based on the change in capacitance. When a touch operation acts on the display screen 194, the electronic device 100 detects the intensity of the touch operation based on the pressure sensor 180A. The electronic device 100 can also calculate the position of the touch based on the detection signal of the pressure sensor 180A.
[0195] The gyro sensor 180B may be used to determine the motion posture of the electronic device 100 .
[0196] The air pressure sensor 180C is used to measure air pressure. In some embodiments, the electronic device 100 calculates the altitude through the air pressure value measured by the air pressure sensor 180C to assist positioning and navigation.
[0197] The magnetic sensor 180D may include, for example, a Hall sensor.
[0198] The acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in all directions (generally three axes). When the electronic device 100 is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of the electronic device and is applied to applications such as horizontal and vertical screen switching and pedometers.
[0199] The distance sensor 180F is used to measure the distance. The electronic device 100 can measure the distance by infrared or laser. In some embodiments, when shooting a scene, the electronic device 100 can use the distance sensor 180F to measure the distance to achieve fast focusing.
[0200] The proximity light sensor 180G may include, for example, a light emitting diode (LED) and a light detector, such as a photodiode. The light emitting diode may be an infrared light emitting diode. The electronic device 100 emits infrared light outward through the light emitting diode. The electronic device 100 uses the photodiode to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device 100. When insufficient reflected light is detected, the electronic device 100 can determine that there is no object near the electronic device 100. The electronic device 100 can use the proximity light sensor 180G to detect that the user holds the electronic device 100 close to the ear to talk, so as to automatically turn off the screen to save power.
[0201] The ambient light sensor 180L is used to sense the ambient light brightness. The electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in a pocket to prevent accidental touches.
[0202] The fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can use the collected fingerprint characteristics to implement fingerprint unlocking, access application locks, fingerprint photography, fingerprint call answering, etc.
[0203] The temperature sensor 180J is used to detect the temperature.
[0204] The touch sensor 180K is also called a "touch control device". The touch sensor 180K can be set on the display screen 194. The touch sensor 180K and the display screen 194 form a touch screen, also called a "touch control screen". The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K can also be set on the surface of the electronic device 100, which is different from the position of the display screen 194.
[0205] The bone conduction sensor 180M can obtain vibration signals. In some embodiments, the bone conduction sensor 180M can obtain vibration signals of vibrating bones of the human body. The bone conduction sensor 180M can also contact the human body's pulse to receive blood pressure beating signals.
[0206] The SIM card interface 195 is used to connect a SIM card. The SIM card can be connected to and separated from the electronic device 100 by inserting it into the SIM card interface 195 or pulling it out from the SIM card interface 195. The electronic device 100 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, and the like. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the multiple cards can be the same or different. The SIM card interface 195 can also be compatible with different types of SIM cards. The SIM card interface 195 can also be compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to implement functions such as calls and data communications. In some embodiments, the electronic device 100 uses an eSIM, i.e., an embedded SIM card. The eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100.
[0207] Figure 8According to an embodiment of the present application, a schematic block diagram of a system software architecture of a mobile phone 100 is shown.
[0208] The software system of the mobile phone 100 may adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present invention takes the Android system of the layered architecture as an example to exemplify the software structure of the mobile phone 100.
[0209] The layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom, namely, the application layer, the application framework layer, the Android runtime and system library, and the kernel layer.
[0210] like Figure 8 As shown, the application layer may include a series of application packages.
[0211] The application package may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, etc.
[0212] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined functions.
[0213] The application framework layer may include window manager service (WMS), view system, graphics system, surface flinger, display engine service, resource manager, notification manager, etc.
[0214] WMS is used to manage window programs. WMS can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc.
[0215] The view system includes visual controls, such as controls for displaying text, controls for displaying images, etc. The view system can be used to build applications. The display interface can be composed of one or more views.
[0216] The graphics system is a general programming software package in the system, which is composed of graphics I / O devices. Its basic functions are primitive generation, attribute setting, etc.
[0217] Surface Flinger can also be called interface synthesis. The function of Surface Flinger is to accept the graphic display data provided by WMS, synthesize them, and input them to the display device for display. Surface Flinger can use the open graphics library (OpenGL) hardware synthesizer (HWC) to synthesize the interface (surface).
[0218] The display engine service can call the hardware capability provided by the ambient light sensor 180L in the hardware abstraction layer to obtain the illumination intensity of the ambient light.
[0219] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.
[0220] The notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as notifications of applications running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is displayed in the status bar, a prompt sound is emitted, an electronic device vibrates, an indicator light flashes, etc.
[0221] Android Runtime includes core libraries and virtual machines. Android runtime is responsible for scheduling and management of the Android system. The core library contains two parts: one is the function that the Java language needs to call, and the other is the Android core library.
[0222] The application layer and the application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.
[0223] The system library may include multiple functional modules, such as surface manager, media libraries, 3D graphics processing library (such as OpenGL, or OpenGL ES), 2D graphics engine (such as Skia graphics library, SGL), etc. It is understood that Android applications can call SGL or OpenGL ES interfaces to draw and render UI interfaces.
[0224] The surface manager is used to manage the display subsystem and provide the fusion of 2D and 3D layers for multiple applications.
[0225] The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
[0226] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
[0227] A 2D graphics engine is a drawing engine for 2D drawings.
[0228] It can be understood that the graphics drawing in Android applications is divided into 2D and 3D. 2D can be implemented by Skia, and Skia can also call some OpenGL ES content to achieve simple 3D effects.
[0229] The hardware abstraction layer, or HAL layer, is a package of hardware drivers, providing a unified hardware capability interface for the upper layer. Figure 8 As shown, the hardware abstraction layer includes CPU HAL, GPU HAL, sensor HAL, display HAL, and camera HAL.
[0230] The kernel layer is the layer between hardware and software. The kernel layer includes at least CPU driver, GPU driver, display driver, sensor driver, camera driver, etc.
[0231] The kernel layer may also include an ODR correction module, for example. The ODR correction module may execute any of the sensor data processing methods proposed in the embodiments of the present application to obtain a set of sensor data, and then provide the sensor data to the application in the application layer. For example, the ODR correction module may execute any of the sensor data processing methods proposed in the embodiments of the present application to obtain a set of acceleration data, and provide the acceleration data to the pedometer application.
[0232] For details, please refer to Figure 4 The relevant contents of the processing method of the sensor data shown are not repeated here. It should be noted that the ODR correction module can also be in the application framework layer or the system library. The embodiment of the present application does not limit the location of the ODR correction module in the software framework.
[0233] In the accompanying drawings, some structural or method features may be shown in a specific arrangement and / or order. However, it should be understood that such a specific arrangement and / or order may not be required. Instead, in some embodiments, these features may be arranged in a manner and / or order different from that shown in the illustrative drawings. In addition, the inclusion of structural or method features in a particular figure does not mean that such features are required in all embodiments, and in some embodiments, these features may not be included or may be combined with other features.
[0234] It should be noted that the units / modules mentioned in the various device embodiments of the present application are all logical units / modules. Physically, a logical unit / module can be a physical unit / module, or a part of a physical unit / module, or can be implemented as a combination of multiple physical units / modules. The physical implementation method of these logical units / modules themselves is not the most important. The combination of functions implemented by these logical units / modules is the key to solving the technical problems proposed by the present application. In addition, in order to highlight the innovative part of the present application, the above-mentioned device embodiments of the present application do not introduce units / modules that are not closely related to solving the technical problems proposed by the present application, which does not mean that there are no other units / modules in the above-mentioned device embodiments.
[0235] It should be noted that in the examples and description of this patent, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "including one" do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0236] Although the present application has been illustrated and described with reference to certain preferred embodiments thereof, it will be apparent to those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the present application.
Claims
1. A data processing method, characterized in that: At least one processor applied to an electronic device, wherein the electronic device includes a sensor; The method comprises: Acquire first data reported by the sensor, where the first data has a first frame number; Determining that the first number of frames satisfies a first condition, wherein the first condition includes that the first number of frames is different from a target reported number of frames; processing the first data into second data, corresponding to the first frame number being less than the target reporting frame number, supplementing the first data with third data to generate the second data; Corresponding to the first frame number being greater than the target reporting frame number, deleting fourth data from the first data to generate the second data; The second frame number of the second data is the same as the target reporting frame number; A function associated with the first data is performed based on the second data.
2. The method according to claim 1, characterized in that: The first condition also includes at least one of the following: The speed at which the sensor reports the first data reaches a first speed; The speed accuracy requirement for the sensor to report the first data is the first accuracy.
3. The method according to claim 1, characterized in that The first data includes a plurality of sensor data acquired by the sensor and a timestamp corresponding to each sensor data.
4. The method according to claim 3, characterized in that The step of supplementing the first data with third data to generate the second data corresponding to the first frame number being less than the target reporting frame number includes: Sorting the plurality of sensor data according to the order of timestamps of the sensor data in the first data; Dividing the sorted plurality of sensor data into a plurality of sensor data subsets, wherein the number of the sensor data subsets is the same as the number of frames of the third data, and the number of sensor data in each of the sensor data subsets is the same; The second data is generated by inserting data interpolation at the same position of different sensor data subsets.
5. The method according to claim 4, characterized in that The data interpolation is generated by any of the following methods: Calculate the average value of two sensor data at two ends of the sensor data subset as the data interpolation between the sensor data subset and an adjacent sensor data subset; Data fitting is performed on at least two of the sensor data at both ends of the sensor data subset to obtain data interpolation between the sensor data subset and an adjacent sensor data subset.
6. The method according to claim 3, characterized in that The step of deleting fourth data from the first data to generate the second data corresponding to the first frame number being greater than the target reporting frame number includes: Sorting the plurality of sensor data according to the order of timestamps of the sensor data in the first data; Acquire the sensor data from the sorted plurality of sensor data at intervals of a first number, wherein the number of the acquired sensor data is the same as the number of frames of the fourth data; The acquired sensor data is deleted to generate the second data.
7. The method according to any one of claims 1 to 6, characterized in that Also includes: The target reporting frame number is determined based on a first time taken by the sensor to report the first data and a target reporting speed of the processor.
8. An electronic device, characterized in that: comprising at least one processor and a sensor; The at least one processor is configured to: Acquire first data reported by the sensor, where the first data has a first frame number; Determine whether the first frame number satisfies a first condition, wherein the first condition includes that the first frame number is different from a target reported frame number; Corresponding to the first frame number satisfying the first condition, processing the first data into second data, wherein the second frame number of the second data is the same as the target reporting frame number; corresponding to the first frame number being less than the target reporting frame number, supplementing the first data with third data to generate the second data; Corresponding to the first frame number being greater than the target reporting frame number, deleting fourth data from the first data to generate the second data; A function associated with the first data is performed based on the second data.
9. The electronic device according to claim 8, characterized in that: The at least one processor includes a first processor and a second processor, wherein: The first processor is used to obtain the first data reported by the sensor and determine whether the first frame number meets the first condition, and, When the first number of frames satisfies the first condition, processing the first data into second data; The second processor is used to obtain the second data from the first processor and execute a function related to the first data.
10. A computer-readable storage medium, characterized in that: The readable storage medium stores instructions, and when the instructions are executed on a computer, the computer is caused to execute the data processing method according to any one of claims 1 to 7.
