Picture rendering method, electronic device and readable storage medium

CN122601916APending Publication Date: 2026-08-18VIVO MOBILE COMM CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610750393.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-05-27
Publication Date
2026-08-18

AI Technical Summary

Technical Problem

然而,受限于系统软件默认配置及功耗管理策略,陀螺仪数据向上层应用输出的实际频率通常限制在较低水平,典型值为50Hz

Benefits of technology

[0009] Fifthly, embodiments of this application provide a chip, which includes a processor and a communication interface, the communication interface and the processor being coupled together, the processor being used to run programs or instructions to implement the steps of the method as described in the first aspect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122601916A_ABST
    Figure CN122601916A_ABST
Patent Text Reader

Abstract

The application discloses a picture rendering method, an electronic device and a readable storage medium, and belongs to the technical field of image processing. The picture rendering method is applied to an electronic device, the electronic device comprises a gyroscope, and the picture rendering method comprises the following steps: collecting angular velocity data output by the gyroscope according to a first sampling rate, wherein the first sampling rate is greater than or equal to a picture rendering frame rate; storing the angular velocity data into a target memory area; acquiring first angular velocity data from the target memory area; and rendering a first picture according to the first angular velocity data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of image processing technology, specifically relating to a screen rendering method, electronic device, and readable storage medium. Background Technology

[0002] Currently, in motion-sensing control applications based on electronic devices, such as high frame rate first-person shooter (FPS) games, gyroscopes are widely used to acquire angular velocity data of electronic devices to achieve in-game viewpoint rotation control. However, due to the limitations of default system software configurations and power management strategies, the actual frequency at which gyroscope data is output to upper-layer applications is usually limited to a low level, typically 50Hz.

[0003] Mainstream gaming devices generally have high screen refresh rates. When the game's rendering frame rate is higher than the gyroscope's sampling rate, in order to ensure continuous response of the screen's perspective, related technologies generally use interpolation or prediction algorithms to estimate the angular velocity increment that should be used in the current frame. The accuracy is low, which in turn affects the rendering effect of the screen. Summary of the Invention

[0004] The purpose of this application is to provide a screen rendering method, an electronic device, and a readable storage medium that can improve the screen rendering effect.

[0005] In a first aspect, embodiments of this application provide a screen rendering method applied to an electronic device, the electronic device including a gyroscope, the screen rendering method comprising: The angular velocity data output by the gyroscope is collected based on the first sampling rate, which is greater than or equal to the frame rate of the screen rendering. Store the angular velocity data in the target memory area; Obtain the first angular velocity data from the target memory region; The first frame is rendered based on the first angular velocity data.

[0006] Secondly, embodiments of this application provide an electronic device, including a gyroscope, a sensor hub, and a processor; A sensor hub is used to acquire angular velocity data output by the gyroscope according to a first sampling rate and store the angular velocity data in the target memory area; the first sampling rate is greater than or equal to the screen rendering frame rate; The processor is used to obtain the first angular velocity data from the target memory region and render the first frame based on the first angular velocity data.

[0007] Thirdly, embodiments of this application provide an electronic device including a processor and a memory, the memory storing a program or instructions executable on the processor, the program or instructions, when executed by the processor, implementing the steps of the method as described in the first aspect.

[0008] Fourthly, embodiments of this application provide a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method as described in the first aspect.

[0009] Fifthly, embodiments of this application provide a chip, which includes a processor and a communication interface, the communication interface and the processor being coupled together, the processor being used to run programs or instructions to implement the steps of the method as described in the first aspect.

[0010] In a sixth aspect, embodiments of this application provide a computer program product stored in a storage medium, which, when executed by at least one processor, implements the steps of the method described in the first aspect.

[0011] This application embodiment stores high-sampling-rate angular velocity data in real time in a target memory region. When the application needs to render the first frame, it directly retrieves the angular velocity data for rendering the first frame from the target memory region. Since the first sampling rate is greater than or equal to the frame rate, there are at least one or more truly collected angular velocity data in the target memory region during each frame rendering cycle. The application does not need to rely on interpolation or prediction algorithms to estimate the angular velocity data between missing frames. That is, this application embodiment can perform frame rendering based on real angular velocity data, thus improving the rendering effect. Attached Figure Description

[0012] Figure 1 A block diagram illustrating the implementation of image rendering for related technologies; Figure 2 A flowchart illustrating a screen rendering method provided in an embodiment of this application; Figure 3 A flowchart illustrating another screen rendering method provided in this application embodiment; Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application; Figure 5 An interactive schematic diagram of screen rendering provided in an embodiment of this application; Figure 6 A block diagram illustrating the implementation of screen rendering provided in an embodiment of this application; Figure 7 This is a schematic diagram of the structure of another electronic device provided in an embodiment of this application; Figure 8This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0013] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.

[0014] The terms "first," "second," etc., used in this application's specification are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class, without limiting the number of objects; for example, a first object can be one or more. Furthermore, in the specification, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects have an "or" relationship.

[0015] In motion-sensing control applications based on electronic devices, especially in high-frame-rate (FPS) games, gyroscopes are widely used to acquire angular velocity data for controlling the in-game viewpoint. However, due to limitations in system software default configurations and power management strategies, the actual frequency at which gyroscope data is output to upper-layer applications is typically limited to a low level, usually around 50Hz. Meanwhile, mainstream gaming devices generally have higher refresh rates, exceeding 50Hz. When the game's refresh rate exceeds 50Hz, such as 120Hz, due to the low sampling rate of the gyroscope data, interpolation and prediction methods are usually required to estimate the gyroscope data needed for the current frame.

[0016] like Figure 1 As shown, g1, g2, and g3 are time points, the black dots represent the actual execution points of the corresponding levels, and the black solid arrows represent the time axis of data sampling or rendering. Figure 1 Taking a gyroscope sampling rate of 50Hz as an example, this means data is collected every 20ms, obtaining the actual data points corresponding to moments g1, g2, and so on. This gyroscope data is reported to the game at the same 50Hz, meaning the game thread only receives the data corresponding to moments g1, g2, and so on, with an interval of 20ms. The game thread executes at a frequency of 120Hz, higher than 50Hz, meaning the game renders one frame every 8.3ms.

[0017] For example, between the two sampling points g1 and g2, the game thread will perform two screen renderings, corresponding to... Figure 1In the context of g1 and g1-1, the first rendering happens to coincide with the actual data reporting, so the data corresponding to g1 can be directly used. The second rendering can only estimate the virtual data point g1-1 through interpolation or prediction. Similarly, between g2 and g3, the game thread estimates the virtual data point g2-2. d1-d5 represent the time points of the screen rendering output.

[0018] pass Figure 1 It can be seen that the 50Hz gyroscope cannot keep up with the frame rate requirements of a 120Hz screen. The game thread cannot obtain the actual gyroscope data frame by frame and can only estimate the gyroscope data (g1-1 and g2-2), which affects the rendering effect. For example, the rotation trajectory of the rendered screen deviates from the actual trajectory, affecting the user's control precision.

[0019] To address the aforementioned technical problems, this application provides a screen rendering method, an electronic device, and a readable storage medium. By setting a target memory region, high-sampling-rate angular velocity data is stored in real-time in the target memory region. When the application needs to render the first frame, it directly retrieves the angular velocity data for rendering the first frame from the target memory region. Since the first sampling rate is greater than or equal to the screen rendering frame rate, at least one or more truly acquired angular velocity data points exist in the target memory region during each frame rendering cycle. The application does not need to rely on interpolation or prediction algorithms to estimate missing inter-frame angular velocity data. In other words, this application embodiment can perform screen rendering based on real angular velocity data, thus improving the screen rendering effect.

[0020] The following description, in conjunction with the accompanying drawings, details the screen rendering method, electronic device, and readable storage medium provided in the embodiments of this application through specific examples and application scenarios.

[0021] Figure 2 This is a flowchart illustrating a screen rendering method provided in an embodiment of this application. This screen rendering method can be applied to electronic devices with motion-sensing control capabilities, including but not limited to smartphones, tablets, handheld game consoles, or Extended Reality (XR) headsets. The electronic device possesses at least the following characteristics: a built-in high-sampling-rate gyroscope, a high-refresh-rate display screen, and a target memory area.

[0022] like Figure 2 As shown, the image rendering method may include the following steps S210-S240.

[0023] S210. Collect angular velocity data output by the gyroscope according to the first sampling rate, wherein the first sampling rate is greater than or equal to the frame rate of the screen rendering.

[0024] S220, Store the angular velocity data in the target memory area.

[0025] S230: Obtain the first angular velocity data from the target memory region.

[0026] S240: Render the first frame based on the first angular velocity data.

[0027] This application embodiment stores high-sampling-rate angular velocity data in real time in a target memory region. When the application needs to render the first frame, it directly retrieves the angular velocity data for rendering the first frame from the target memory region. Since the first sampling rate is greater than or equal to the frame rate of the rendering, there are at least one or more truly collected angular velocity data in the target memory region during each frame rendering cycle. The application does not need to rely on interpolation or prediction algorithms to estimate the rotation between missing frames, thereby effectively reducing the viewpoint trajectory deviation caused by insufficient sampling rate and improving the realism of the screen response and the control precision.

[0028] The above steps are explained in detail below: In S210, the first sampling rate is the frequency at which the angular velocity data output by the gyroscope is collected; that is, the frequency at which the gyroscope samples the angular velocity data at the physical level, measured in Hz. In this embodiment, the first sampling rate is greater than or equal to the screen rendering frame rate. This ensures that in each subsequent frame rendering cycle, there are at least one or more truly collected angular velocity data points, allowing the acquisition of raw data for rendering the current frame without relying on interpolation or prediction algorithms, thus improving the precision of viewpoint control and the realism of the response. In some embodiments, the first sampling rate is greater than or equal to twice the screen rendering frame rate, and the upper limit of the first sampling rate can be determined by the maximum output data rate of the gyroscope. In some embodiments, the first sampling rate can be set to 1000Hz.

[0029] For example, an electronic device can acquire angular velocity data output by a gyroscope through a hardware bus interface, which may include, but is not limited to, an I2C interface, an SPI interface, a UART interface, or a sensor-specific hardware communication interface.

[0030] This embodiment can dynamically adjust the sampling rate of gyroscope data based on the screen rendering frame rate, so that the sampling rate of gyroscope data is greater than or equal to the screen rendering frame rate. This ensures that there are at least one or more real angular velocity data in each frame rendering cycle, eliminating the need to rely on interpolation or prediction algorithms for estimation. This improves the screen rendering effect and thus enhances the control precision of the viewpoint.

[0031] In S220, the target memory region can be a specially designated area within the electronic device. For example, this target memory region can be a region shared by the application processor, accessible jointly by the application processor and the sensor hub, such as by a game application running on the application processor. That is, in this embodiment, high-sampling-rate angular velocity data can be directly written to this target memory region without being reported to the application layer individually. This saves power and reduces the impact of high-frequency reporting on the application.

[0032] For example, the application processor (AP) and sensor hub (BP) are part of the structure of an electronic device, and the application processor may include a central processing unit (CPU).

[0033] For example, the target memory region could also be a shared memory area of ​​the sensor hub, thus taking full advantage of the sensor hub's low power consumption.

[0034] For example, the target memory region can also be an external hard drive used to store angular velocity data. Both the application processor and the sensor hub can access this hard drive.

[0035] For example, the target memory region can adopt a circular buffer structure. When the collected angular velocity data is written to the target memory region, the timestamp corresponding to the angular velocity data can be written simultaneously, facilitating the subsequent reading of the latest data required for each frame. For example, when the circular buffer region is full, the oldest data can be automatically overwritten.

[0036] In S230, the first frame is any frame to be rendered, and the first angular velocity data is the angular velocity data required for rendering the first frame. In this embodiment, the corresponding angular velocity data is only obtained from the target memory area when rendering the first frame, thus reducing the impact of high-frequency reporting on the application.

[0037] For example, an electronic device can obtain the latest angular velocity data corresponding to the rendering time from the target memory region as the first angular velocity data, based on the rendering time. It is understood that, without exceeding the maximum data output rate allowed by the gyroscope hardware, increasing the sampling rate helps to ensure that there are real sampling points near each frame rendering time, reducing errors introduced by interpolation or prediction due to missing data, and improving the rendering effect of the image as well as the realism and accuracy of motion control.

[0038] For example, the first angular velocity data for rendering the first frame can be read from the target memory region through a dedicated data read interface. This data read interface can interact with both the target memory region and the application layer. Through this data read interface, the application layer can shift from passively acquiring angular velocity data to actively acquiring it when needed, which reduces device power consumption and saves application layer resources.

[0039] In S240, exemplarily, the electronic device can render a first image based on the first angular velocity data. For example, an angle increment can be determined based on the first angular velocity data and a sensitivity parameter, and the first image can be rendered based on the angle increment. The sensitivity parameter can be preset by the user, and the default value is 1. Exemplarily, the product of the first angular velocity data and the timestamp interval can be determined first to obtain the first angle increment, and then the product of the first angle increment and the sensitivity parameter can be calculated to obtain the second angle increment, and the first image can be rendered based on the second angle increment. The specific rendering process is not limited in this embodiment.

[0040] Since the first angular velocity data is real-world data, it can accurately reflect the motion state of electronic devices, thus reducing errors caused by interpolation and prediction, and improving the realism and precision of motion control.

[0041] Figure 3 A flowchart illustrating another screen rendering method provided in this application embodiment. Figure 3 and Figure 2 The difference is that, Figure 3 It also includes S310-S320.

[0042] S310. Based on the angular velocity data at multiple sampling times, determine the angular acceleration of the gyroscope within the corresponding time period.

[0043] Taking a game scenario as an example, angular acceleration reflects the speed of the user's rotation operation. Multiple sampling moments here can be, for example, two adjacent sampling moments, or three or more adjacent sampling moments.

[0044] For example, when there are two sampling times, the angular acceleration of the gyroscope in the time period corresponding to the two sampling times can be determined based on the angular velocity data of the two sampling times and the time interval between the two sampling times.

[0045] For example, when there are at least three sampling times, the angular acceleration between each pair of adjacent sampling times can be calculated separately, and then the average of the multiple angular accelerations can be taken to obtain the angular acceleration of the gyroscope within that time period. For example, the angular acceleration can also be determined by linear fitting; for instance, a fitted straight line can be obtained using the least squares linear fitting method, and the slope of the fitted straight line is the angular acceleration. For example, the angular acceleration can also be calculated in other ways, and this embodiment does not impose specific limitations on these methods.

[0046] S320, Update the first sampling rate based on angular acceleration.

[0047] For example, the sampling rate of angular velocity data can be dynamically updated based on angular acceleration. For instance, when angular acceleration is large, it indicates a high-dynamic scene, and the sampling rate can be appropriately increased to capture more motion details. When angular velocity is small, it indicates a low-dynamic scene, and the sampling rate can be appropriately decreased to reduce sampled data, thereby reducing device power consumption and heat generation.

[0048] This embodiment can dynamically adjust the sampling rate of angular velocity data according to the angular acceleration of the gyroscope. In this way, the data accuracy in high dynamic scenarios can be improved, while the system power consumption in low dynamic scenarios can be reduced, thereby achieving on-demand sampling and adaptive balance between performance and resource consumption.

[0049] In some embodiments, the above-described S320 may include the following steps: If the angular acceleration is greater than or equal to the first threshold, the first sampling rate is updated to the second sampling rate, which is greater than the first sampling rate. If the angular acceleration is less than the first threshold, the first sampling rate is updated to the third sampling rate, which is less than the first sampling rate and greater than or equal to the rendering frame rate.

[0050] The magnitude of the first threshold can be determined based on experience, the scenario, etc. For example, when the angular acceleration is greater than or equal to the first threshold, it indicates a high-dynamic scenario, such as continuous rotation, sudden stops and turns, etc., in which case the sampling rate can be increased. Assuming the current sampling rate is the first threshold, when the angular acceleration is greater than or equal to the first threshold, it can be increased to the second sampling rate, and subsequent gyroscope angular velocity data can be collected according to the second sampling rate. Conversely, when the angular acceleration is less than the first threshold, such as in a stable or static scenario, the sampling rate can be decreased. Assuming the current sampling rate is the first threshold, when the angular acceleration is less than the first threshold, it can be decreased to the third sampling rate, and subsequent gyroscope angular velocity data can be collected according to the third sampling rate.

[0051] Considering that adjusting the sampling rate may introduce noise into the instantaneous data stream, some embodiments may employ smoothing filtering techniques such as Exponential Weighted Moving Average (EWMA) to smoothly switch the sampling rate. If the electronic device receives multiple commands simultaneously, such as an application-initiated sampling rate adjustment request and a system-initiated automatic sampling rate switching request, it can select the appropriate command to respond to based on the priority of the "application-initiated request" and the "system-initiated automatic switching." For example, if the priority of the system-initiated automatic switching is higher than that of the application-initiated request, then only the system-initiated automatic switching command will be responded to, and the sampling rate will be switched according to the system-initiated automatic switching instruction.

[0052] In this embodiment, the sampling rate is automatically increased in high-dynamic scenarios such as sudden stops and turns, which can capture richer motion details and improve the real-time performance and accuracy of view tracking; in low-dynamic scenarios, the sampling rate is reduced, which can reduce the load on the sensor and system, and reduce power consumption and heat generation.

[0053] To eliminate measurement errors caused by temperature changes, time drift, or inherent bias of the gyroscope and further improve the accuracy of the sampled data, embodiments of this application also provide a bias compensation mechanism. In some embodiments, the image rendering method may further include the following steps: When the electronic device is stationary, the static output value of the gyroscope is collected; Determine the zero-bias compensation amount of the gyroscope based on the static output value; Accordingly, the above-mentioned "storing angular velocity data to the target memory region" may include the following steps: The angular velocity data is corrected based on the zero bias compensation amount; The corrected angular velocity data is stored in the target memory area.

[0054] For example, during the operation of an electronic device, the three-axis angular velocity output of the gyroscope can be continuously monitored. When the following conditions are met, the electronic device is determined to be in a stationary state: the absolute values ​​of the three-axis angular velocities are all below a preset stationary threshold, and this state continues for more than a preset time window.

[0055] For example, when the electronic device is detected to be stationary, the static output value of the gyroscope during this stationary period can be collected. To improve compensation accuracy, multiple angular velocity data can be continuously collected, and the average value can be calculated. This average value reflects the zero bias error at the current moment. For example, a sliding window filtering method can also be used to update the zero bias estimate (zero bias compensation amount) in real time.

[0056] For example, during subsequent normal data acquisition, before writing the acquired raw angular velocity data into the target memory area, the raw angular velocity data can be corrected based on the zero-bias compensation amount obtained above. For instance, the difference between the raw angular velocity data and the zero-bias compensation amount can be used as the corrected angular velocity data, along with the corresponding timestamp, and written into the target memory area.

[0057] For example, zero-bias correction can be performed only during initialization or application startup, or it can be dynamically updated based on detected stationary states. To avoid frequent false triggering of stationary detection in intense game scenarios, for example, detection logic can be set to execute the stationary detection process and update the zero-bias compensation amount only when the angular velocity is below a threshold value for a long time and no touch operation is detected, or when the angular velocity is below a threshold value for a long time and no significant change in angular acceleration is detected.

[0058] This embodiment can effectively reduce angle drift caused by periodic errors or environmental changes by performing zero-bias correction on the angular velocity of the gyroscope, thereby improving the accuracy of the angular velocity data and thus enhancing the rendering effect of the image.

[0059] In some embodiments, the electronic device further includes a sensor hub, and accordingly, the image rendering method may further include the following steps: The first sampling rate is determined based on the data processing rate of the sensor hub and the maximum output data rate supported by the gyroscope.

[0060] For example, the maximum output data rate supported by the gyroscope is determined by the gyroscope hardware. For example, the first sampling rate can be determined jointly based on the data processing rate of the sensor hub and the maximum output data rate supported by the gyroscope. For instance, the upper limit of the first sampling rate can be the minimum of the data processing rate of the sensor hub and the maximum output data rate supported by the gyroscope. The lower limit of the first sampling rate is greater than or equal to the frame rate of the rendering. In this way, real gyroscope data can be acquired in each rendering cycle without exceeding the processing capacity of the sensor hub, which could lead to data loss or overflow, and without exceeding the upper limit of the gyroscope hardware, thus fully utilizing the hardware capabilities.

[0061] For example, the first sampling rate can be dynamically determined by the sensor hub based on the sensor hub's data processing rate and the maximum output data rate supported by the gyroscope, or it can be dynamically determined by the application processor based on the sensor hub's data processing rate and the maximum output data rate supported by the gyroscope, and then sent to the sensor hub.

[0062] Taking the determination of a first sampling rate based on a sensor hub as an example, the sensor hub can, upon receiving a sampling rate request from the application processor, dynamically determine the first sampling rate based on the sensor hub's data processing rate and the gyroscope's maximum supported output data rate. The sampling rate request includes the required sampling rate for angular velocity data. For example, if the required sampling rate is less than the gyroscope's maximum supported output data rate, the sensor hub can, for example, dynamically determine the first sampling rate based on the sensor hub's data processing rate and the gyroscope's maximum supported output data rate, and acquire angular velocity data based on the first sampling rate.

[0063] In some embodiments, the above-described S230 may include the following steps: The first angular velocity data is read from the target memory region using the data reading interface in the Software Development Kit (SDK).

[0064] Taking a game scenario as an example, the SDK can interact with the target memory region and the game thread to actively acquire angular velocity data. For example, the data reading interface can be a dedicated interface encapsulated in the SDK, which can directly access the angular velocity data in the target memory region. For example, this data reading interface can be the getLastestGyroData() interface. Through this interface, the latest gyroscope data corresponding to the rendering time can be obtained from the target memory region.

[0065] This embodiment uses an SDK to enable interaction between the application and the target memory region, transforming the passive acquisition of gyroscope data into active acquisition, reducing the latency of angular velocity data acquisition, and improving the smoothness of the screen.

[0066] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.

[0067] like Figure 4 As shown, the electronic device 400 includes a gyroscope 401, a sensor hub 402, and a processor 403.

[0068] Sensor hub 402 is used to acquire angular velocity data output by gyroscope 401 according to a first sampling rate and store the angular velocity data in a target memory area; Processor 403 is used to obtain first angular velocity data from the target memory region and render the first frame based on the first angular velocity data.

[0069] In this embodiment, the processor 403 can be an application processor. The sensor hub 402 can interact with the gyroscope 401 hardware. By configuring the gyroscope registers, the gyroscope 401 can operate at a high output data rate supported by its hardware, thereby achieving a sampling rate higher than the system default limit (e.g., 50Hz) in practical applications. For example, the sensor hub 402 can collect the angular velocity data output by the gyroscope 401 at a first sampling rate and write it to a target memory area. The target memory area can be directly accessed by the application layer, allowing the application layer to obtain the latest gyroscope data at the corresponding rendering moment. Furthermore, by utilizing the low power consumption advantage of the sensor hub 402, the high power consumption and heat generated by the application processor being frequently woken up by high-frequency data are reduced. This achieves high-precision motion control while maintaining the overall energy efficiency and battery life of the device.

[0070] When the processor 403 needs to render the first frame, it obtains the first angular velocity data from the target memory area and renders the first frame based on the first angular velocity data. This realizes the active acquisition of gyroscope data, reduces latency, and saves resources.

[0071] This application embodiment stores high-sampling-rate angular velocity data in real time in a target memory region. When the processor needs to render the first frame, it directly retrieves the angular velocity data for rendering the first frame from the target memory region. Since the first sampling rate is greater than or equal to the frame rate, at least one or more truly collected angular velocity data points exist in the target memory region during each frame rendering cycle. The application does not need to rely on interpolation or prediction algorithms to estimate the angular velocity data between missing frames. That is, this application embodiment can perform frame rendering based on real angular velocity data, thus improving the rendering effect.

[0072] In some embodiments, the processor 403 is specifically configured to: read data for the first angular velocity from a target memory region via a data read interface in the SDK.

[0073] For example, the processor 403 can obtain the latest gyroscope data corresponding to the rendering time from the target memory region through the getLastestGyroData() interface in the SDK. By implementing the interaction between the processor 403 and the target memory region through the SDK, the passive acquisition of gyroscope data is transformed into active acquisition, reducing the latency of angular velocity data acquisition and improving the smoothness of the image.

[0074] Taking a game scenario as an example, the game's main thread can obtain the latest gyroscope data corresponding to the rendering time from the target memory region through the getLastestGyroData() interface in the SDK.

[0075] In some embodiments, the sensor hub 402 is further configured to determine the angular acceleration of the gyroscope within a corresponding time period based on angular velocity data at multiple sampling times; and update the first sampling rate based on the angular acceleration. In this embodiment, the sensor hub 402 can determine the angular acceleration of the gyroscope in real time and dynamically adjust the sampling rate of the angular velocity data based on the angular acceleration, thereby adapting to different scenarios and improving the robustness of the method.

[0076] In some embodiments, the sensor hub 402 is specifically used for: If the angular acceleration is greater than or equal to the first threshold, the first sampling rate is updated to the second sampling rate, which is greater than the first sampling rate. If the angular acceleration is less than the first threshold, the first sampling rate is updated to the third sampling rate, which is less than the first sampling rate and greater than or equal to the frame rate of the rendered image.

[0077] For example, the sensor hub 402 can dynamically adjust the sampling rate of the gyroscope data based on the angular acceleration of the gyroscope 401, which is applicable to different scenarios.

[0078] In some embodiments, the sensor hub 402 is further configured to determine a first sampling rate based on the data processing rate of the sensor hub 402 and the maximum output data rate supported by the gyroscope 401.

[0079] In this way, the actual gyroscope data can be obtained in each rendering cycle without exceeding the processing capacity of the sensor hub, which would lead to data loss or overflow, or exceeding the upper limit of the gyroscope hardware, thus making full use of the hardware capabilities.

[0080] Other details can be found in the above embodiments, and will not be repeated here.

[0081] The following is combined Figure 5 The rendering process is explained below. The game main thread 501, SDK 502, perspective calculation module 503, and rendering module 504 are integrated into the processor 403. For ease of description... Figure 5 The parts are described separately to illustrate the interaction between them.

[0082] 1. Sensor hub 402 collects angular velocity data from gyroscope 401.

[0083] 2. Sensor hub 402 writes the collected angular velocity data into the target memory area.

[0084] 3. When the game's main thread 501 needs to render a scene, it calls the interface of SDK 502 to obtain the latest gyroscope data corresponding to the rendering time in the target memory area.

[0085] 4. SDK502 returns the latest gyroscope data to the game's main thread 501.

[0086] 5. The game's main thread 501 sends the latest gyroscope data and sensitivity parameters to the perspective calculation module 503.

[0087] 6. The viewing angle calculation module 503 calculates the angle increment corresponding to the current frame based on the latest received gyroscope data and sensitivity parameters.

[0088] 7. The perspective calculation module 503 returns the calculated angle increment of the current frame to the game main thread 501.

[0089] 8. The main game thread 501 sends the angle increment of the current frame to the rendering module 504.

[0090] 9. Rendering module 504 renders the current frame based on the angle increment.

[0091] After the current frame is rendered, the loop continues to render the next frame.

[0092] For example, such as Figure 6 As shown, the data sampling rate is set to 1000Hz. With the above scheme, the rendering thread (rendering module 504) can directly render the screen based on the real gyroscope data without having to perform a lot of frame interpolation or prediction, which reduces errors and improves the control precision and screen realism.

[0093] The electronic device in this application embodiment can be a terminal with an operating system. The operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit the specific operating system.

[0094] like Figure 7 As shown, this application embodiment also provides an electronic device 700, including a processor 701 and a memory 702. The memory 702 stores programs or instructions that can run on the processor 701. When the program or instructions are executed by the processor 701, they implement the various steps of the above-described screen rendering method embodiment and can achieve the same technical effect. To avoid repetition, they will not be described again here.

[0095] It should be noted that the electronic devices in the embodiments of this application include the mobile terminals and non-mobile terminals mentioned above.

[0096] Figure 8 This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of this application.

[0097] The electronic device 800 includes, but is not limited to, components such as: radio frequency unit 801, network module 802, audio output unit 803, input unit 804, sensor 805, display unit 806, user input unit 807, interface unit 808, memory 809, and processor 810.

[0098] Those skilled in the art will understand that the electronic device 800 may also include a power supply (such as a battery) for supplying power to various components. The power supply may be logically connected to the processor 810 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system. Figure 8 The structure of the electronic device 800 shown does not constitute a limitation on the electronic device 800. The electronic device 800 may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here.

[0099] In some embodiments of this application, the electronic device 800 further includes a gyroscope; The processor 810 is used to collect angular velocity data output by the gyroscope according to a first sampling rate, the first sampling rate being greater than or equal to the frame rate of the screen rendering; store the angular velocity data in a target memory area; obtain the first angular velocity data from the target memory area; and render the first screen according to the first angular velocity data.

[0100] This application embodiment stores high-sampling-rate angular velocity data in real time in a target memory region. When the application needs to render the first frame, it directly retrieves the angular velocity data for rendering the first frame from the target memory region. Since the first sampling rate is greater than or equal to the frame rate, there are at least one or more truly collected angular velocity data in the target memory region during each frame rendering cycle. The application does not need to rely on interpolation or prediction algorithms to estimate the angular velocity data between missing frames. That is, this application embodiment can perform frame rendering based on real angular velocity data, thus improving the rendering effect.

[0101] In some possible implementations of embodiments of this application, the processor 810 is specifically used for: Based on the angular velocity data at multiple sampling times, determine the angular acceleration of the gyroscope within the corresponding time period; The first sampling rate is updated based on angular acceleration.

[0102] In some possible implementations of embodiments of this application, the processor 810 is specifically used for: If the angular acceleration is greater than or equal to the first threshold, the first sampling rate is updated to the second sampling rate, which is greater than the first sampling rate. If the angular acceleration is less than the first threshold, the first sampling rate is updated to the third sampling rate, which is less than the first sampling rate and greater than or equal to the rendering frame rate.

[0103] In some possible implementations of embodiments of this application, the electronic device 800 further includes a sensor hub and a processor 810, specifically used for: The first sampling rate is determined based on the data processing rate of the sensor hub and the maximum output data rate supported by the gyroscope.

[0104] In some possible implementations of embodiments of this application, the processor 810 is specifically used for: The first angular velocity data is read from the target memory region using the data reading interface in the Software Development Kit (SDK).

[0105] It should be understood that, in this embodiment, the input unit 804 may include a graphics processing unit (GPU) 8041 and a microphone 8042. The GPU 8041 processes image data of still images or videos obtained by an image capture device (such as a camera) in video capture mode or image capture mode. The display unit 806 may include a display panel 8061, which may be configured in the form of a liquid crystal display, an organic light-emitting diode, or the like. The user input unit 807 includes at least one of a touch panel 8071 and other input devices 8072. The touch panel 8071 is also called a touch screen. The touch panel 8071 may include a touch detection device and a touch controller. Other input devices 8072 may include, but are not limited to, physical keyboards, function keys (such as volume control buttons, power buttons, etc.), trackballs, mice, and joysticks, which will not be described in detail here.

[0106] The memory 809 can be used to store software programs and various data. The memory 809 may primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area may store the operating system, application programs or instructions required for at least one function (such as sound playback, image playback, etc.). Furthermore, the memory 809 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus RAM (DRRAM). The memory 809 in the embodiments of this application includes, but is not limited to, these and any other suitable types of memory.

[0107] Processor 810 may include one or more processing units; optionally, processor 810 integrates an application processor and a modem processor, wherein the application processor mainly handles operations involving the operating system, user interface, and applications, and the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the aforementioned modem processor may also not be integrated into processor 810.

[0108] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described screen rendering method embodiments and achieve the same technical effect. To avoid repetition, they will not be described again here.

[0109] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.

[0110] This application embodiment also provides a chip, which includes a processor and a communication interface. The communication interface and the processor are coupled. The processor is used to run programs or instructions to implement the various processes of the above-described screen rendering method embodiments and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0111] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.

[0112] This application provides a computer program product, which is stored in a storage medium and executed by at least one processor to implement the various processes of the above-described screen rendering method embodiments, and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0113] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.

[0114] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the related technology, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0115] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.

Claims

1. A screen rendering method, applied to electronic devices, characterized in that, The electronic device includes a gyroscope, and the method includes: The angular velocity data output by the gyroscope is collected according to a first sampling rate, wherein the first sampling rate is greater than or equal to the frame rate of the screen rendering. The angular velocity data is stored in the target memory area; Obtain first angular velocity data from the target memory region; The first image is rendered based on the first angular velocity data.

2. The method according to claim 1, characterized in that, The method further includes: Based on the angular velocity data at multiple sampling times, the angular acceleration of the gyroscope within the corresponding time period is determined; The first sampling rate is updated based on the angular acceleration.

3. The method according to claim 2, characterized in that, Updating the first sampling rate based on the angular acceleration includes: If the angular acceleration is greater than or equal to a first threshold, the first sampling rate is updated to a second sampling rate, where the second sampling rate is greater than the first sampling rate. If the angular acceleration is less than a first threshold, the first sampling rate is updated to a third sampling rate, wherein the third sampling rate is less than the first sampling rate and the third sampling rate is greater than or equal to the frame rate of the screen rendering.

4. The method according to claim 1, characterized in that, The electronic device further includes a sensor hub, and the method further includes: The first sampling rate is determined based on the data processing rate of the sensor hub and the maximum output data rate supported by the gyroscope.

5. The method according to any one of claims 1-4, characterized in that, The step of obtaining the first angular velocity data from the target memory region includes: The first angular velocity data is read from the target memory region through the data reading interface in the software development kit (SDK).

6. An electronic device, characterized in that, Includes gyroscopes, sensor hubs, and processors; The sensor hub is used to collect the angular velocity data output by the gyroscope according to a first sampling rate, and store the angular velocity data in a target memory area; the first sampling rate is greater than or equal to the screen rendering frame rate; The processor is configured to acquire first angular velocity data from the target memory region and render a first image based on the first angular velocity data.

7. The electronic device according to claim 6, characterized in that, The sensor hub is also used to determine the angular acceleration of the gyroscope in a corresponding time period based on the angular velocity data at multiple sampling times; and to update the first sampling rate based on the angular acceleration.

8. The electronic device according to claim 7, characterized in that, The sensor hub is specifically used for: If the angular acceleration is greater than or equal to a first threshold, the first sampling rate is updated to a second sampling rate, where the second sampling rate is greater than the first sampling rate. If the angular acceleration is less than a first threshold, the first sampling rate is updated to a third sampling rate, wherein the third sampling rate is less than the first sampling rate and the third sampling rate is greater than or equal to the frame rate of the screen rendering.

9. The electronic device according to claim 6, characterized in that, The sensor hub is further configured to determine the first sampling rate based on the data processing rate of the sensor hub and the maximum output data rate supported by the gyroscope.

10. The electronic device according to any one of claims 6-9, characterized in that, The processor is specifically configured to: read the first angular velocity data from the target memory region through the data reading interface in the software development kit (SDK).

11. A readable storage medium on which a program or instructions are stored, characterized in that, When the program or instructions are executed by the processor, they implement the steps of the method as described in any one of claims 1-5.