Parameter adjustment method and electronic device
By acquiring and adjusting the number of dropped frames in electronic devices, the problem of low CPU frequency tuning accuracy across multiple game applications was solved, the neural network model was adapted to multiple applications, and the accuracy of CPU frequency was improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HONOR DEVICE CO LTD
- Filing Date
- 2024-11-29
- Publication Date
- 2026-05-29
AI Technical Summary
In electronic devices, existing technologies struggle to improve the accuracy of CPU frequency tuning while reducing costs, especially when there are significant differences between multiple game applications. When using the same neural network model for CPU frequency tuning, the accuracy is low.
By obtaining the first average number of dropped frames, it is determined whether a specific condition is met, and the frame count deviation value is adjusted based on the maximum number of dropped frames to update the number of dropped frames of the neural network model, thereby correcting the inaccuracy of the CPU target frequency. This method is applicable to multiple applications.
While saving costs, the accuracy of the CPU target frequency output by the neural network model is improved, making it applicable to multiple applications and avoiding the need to train a separate neural network model for each application.
Smart Images

Figure CN122111636A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing, and more specifically, to a parameter adjustment method and an electronic device. Background Technology
[0002] As electronic devices become increasingly powerful and more applications are installed on them, some of these applications place higher demands on the performance of electronic devices. For example, with the improvement of game graphics and the enrichment of gameplay and game scenes, gaming applications are placing even greater demands on the performance of electronic devices.
[0003] To ensure smooth gameplay, electronic devices can operate at the highest frequency of their central processing unit (CPU). However, if the CPU runs at its highest frequency for extended periods, the device's temperature will become too high. Therefore, the device must reduce the CPU frequency to lower the temperature. But reducing the CPU frequency, on the other hand, will decrease game smoothness, affecting the user's gaming experience. In this situation, a neural network model can be used to determine the optimal CPU frequency for running the game application. However, the variety of games installed on electronic devices is increasing, and these games differ from one another. Training a separate neural network model for each game application to adjust the CPU frequency would be too costly; using the same neural network for all games would result in low accuracy due to the differences between the games.
[0004] Therefore, how to improve the accuracy of CPU frequency modulation while reducing costs has become an urgent problem to be solved. Summary of the Invention
[0005] This application provides a parameter adjustment method that can improve the accuracy of CPU frequency modulation while reducing costs.
[0006] Firstly, a parameter adjustment method is provided, which is applied in electronic devices, and the method includes:
[0007] Obtain the first average number of dropped frames, which is the number of dropped frames in the display screen of the first application running in the electronic device within a first preset time period;
[0008] Determine whether the first average number of dropped frames meets the first condition. The first condition is determined based on the first over-supplied number of frames, the maximum number of dropped frames, and the target number of frames. The target number of frames refers to the preset number of frames for the first application display screen. The first over-supplied number of frames refers to the number of image frames in the image queue to be displayed for the first preset duration that is greater than the preset number threshold.
[0009] If the first average number of dropped frames meets the first condition, the frame number deviation value is adjusted based on the maximum number of dropped frames to obtain the updated frame number deviation value. The updated frame number deviation value is used to adjust the number of dropped frames input to the neural network model. The neural network model is used to determine the target frequency of the CPU corresponding to the first application.
[0010] The maximum number of dropped frames can be a value determined based on user experience, and the maximum frame drop rate can be represented by lossMax.
[0011] The target frame count can be represented by target_fps, the first oversupply frame count can be represented by oversupplys1, and the frame count deviation can be represented by bias.
[0012] Optionally, during the process of adjusting the frame rate deviation value based on the maximum number of dropped frames, the frame rate deviation value can be adjusted using formula (1), wherein formula (1) includes:
[0013] bias1=bias0+loss-lossMax; formula (1).
[0014] Here, bias1 can refer to the updated frame rate deviation value bias, bias0 can refer to the frame rate deviation value bias before adjustment, loss can refer to the first average frame drop rate, and lossMax can refer to the maximum number of dropped frames.
[0015] The updated frame rate deviation value can be used to adjust the number of dropped frames input to the neural network model, which is used to determine the target CPU frequency for the first application.
[0016] For example, the number of frames dropped in the input neural network model can be represented by loss-input, which can be determined by formula (4), where formula (4) includes:
[0017] loss-input=target_fps–actual_fps+bias; formula (4)
[0018] The parameter adjustment method provided in this application embodiment can be applied to the process of determining the number of dropped frames in the input neural network model. It obtains a first average number of dropped frames, then determines whether the first average number of dropped frames meets a first condition. If the first average number of dropped frames meets the first condition, it adjusts the frame number deviation value based on the maximum number of dropped frames to obtain an updated frame number deviation value. The first average number of dropped frames can refer to the number of dropped frames in the first application display screen running in the electronic device within a first preset time period. The first condition is determined based on a first over-supplied frame count, the maximum number of dropped frames, and the target frame count. The first over-supplied frame count can refer to the number of image frames in the image queue to be displayed within the first preset time period where the number of images to be displayed is greater than a preset threshold. The updated frame rate deviation value can be used to adjust the number of dropped frames input to the neural network model. The neural network model is used to determine the target frequency of the CPU corresponding to the first application. This is equivalent to correcting the problem of inaccurate target frequency of the CPU corresponding to the first application output by the neural network model by using the frame rate loss-input during the process of determining the target frequency of the CPU corresponding to the first application. This allows a neural network model to be adapted to multiple applications, avoiding the need to train a corresponding neural network model for each application. It improves the accuracy of the target frequency of the CPU corresponding to the first application output by the neural network model while saving costs.
[0019] In conjunction with the first aspect, in some embodiments of the first aspect, the first condition includes: a first average number of dropped frames is greater than a maximum number of dropped frames, and a first over-supplied number of frames is greater than a first preset value, the first preset value being determined based on a target number of frames.
[0020] In conjunction with the first aspect, in some embodiments of the first aspect, the first preset value is the product of the target number of frames and a preset ratio.
[0021] The first preset value can be determined based on the product of the target number of frames and a preset ratio. For example, the preset ratio can be 30%, and the first preset value can be the value obtained by multiplying the target number of frames by 30%.
[0022] In conjunction with the first aspect, in some embodiments of the first aspect, the method further includes: if the first average number of dropped frames does not meet the first condition, determining whether the first average number of dropped frames is less than the minimum number of dropped frames; if the first average number of dropped frames is less than the minimum number of dropped frames, adjusting the frame number deviation value based on the minimum number of dropped frames to obtain the updated frame number deviation value.
[0023] The minimum number of frames lost can be a value determined empirically and can be represented by lossMin.
[0024] If the first average number of dropped frames (loss) is less than the minimum number of dropped frames (lossMin), it indicates that the difference between the current target number of frames (target_fps) and the actual number of frames (actual_fps) is small, and the frame rate bias can be reduced. For example, the frame rate bias can be adjusted using formula (2), which includes:
[0025] bias2=bias0-(lossMin-loss); formula (2).
[0026] Here, bias2 can refer to the updated frame rate deviation value bias, bias0 can refer to the frame rate deviation value bias before adjustment, loss can refer to the first average frame drop rate, and lossMin can refer to the minimum number of dropped frames.
[0027] In conjunction with the first aspect, in some embodiments of the first aspect, the method further includes: if the first average number of dropped frames is greater than or equal to the minimum number of dropped frames, then determining whether the first over-supplied frame count is greater than a first value, the first value being determined based on the target number of frames; if the first over-supplied frame count is greater than the first value, then adjusting the frame count deviation value based on a second preset value to obtain an updated frame count deviation value.
[0028] If the first oversupply frame count (oversupplys1) is greater than a certain value, then the frame drops occurring at the current moment are mainly due to a large number of images waiting to be displayed in the image queue, and have little to do with the CPU frequency of the electronic device. In this case, since it is impossible to reduce the application's frame drop rate by increasing the CPU frequency, the frame count deviation value can be reduced to avoid the problem of excessively high electronic device temperature caused by blindly increasing the CPU frequency.
[0029] For example, the frame rate deviation value can be adjusted based on a second preset value. For instance, the frame rate deviation value can be adjusted using formula (3), where formula (3) includes:
[0030] bias3=bias0-m; formula (3).
[0031] Here, bias3 can refer to the updated frame rate deviation value bias, bias0 can refer to the frame rate deviation value bias before adjustment, and m can refer to the user-set empirical value, such as 0.3.
[0032] In conjunction with the first aspect, in some embodiments of the first aspect, the method further includes: if the first over-supply frame number is less than or equal to the first value, then the frame number deviation value is not adjusted.
[0033] In conjunction with the first aspect, in some embodiments of the first aspect, the method further includes: obtaining a first over-supply frame count.
[0034] In conjunction with the first aspect, in some embodiments of the first aspect, the updated frame rate deviation value falls within a preset range.
[0035] It should be noted that, in order to prevent malfunctions in electronic devices, the frame rate deviation value (bias) must not be adjusted beyond its preset range. For example, if the preset range for the frame rate deviation value (bias) is -0.2 frames to 3 frames, the updated frame rate deviation value (bias) must not be less than -0.2 frames or greater than 3 frames.
[0036] In conjunction with the first aspect, in some embodiments of the first aspect, the method further includes: obtaining a second average number of dropped frames, the second average number of dropped frames being the number of dropped frames of a first application display screen running in an electronic device within a second preset duration, the second preset duration being less than a first preset duration; obtaining a second over-supplied number of frames; the second over-supplied number of frames referring to the number of image frames in the image queue to be displayed within the second preset duration where the number of images to be displayed is greater than a preset number threshold; determining whether the second average number of dropped frames satisfies a second condition, the second condition being determined based on the maximum number of dropped frames and the second over-supplied number of frames; if the second average number of dropped frames satisfies the second condition, then adjusting the frame number weight value based on the maximum number of dropped frames, the frame number weight value being used to adjust the number of dropped frames input to the neural network model.
[0037] If the adjustment period is long, for example, one second, a significant change in thread load within a short timeframe can prevent the electronic device from adjusting the frame rate deviation in time. This results in a higher loss-input ratio at the current moment, impacting the accuracy of the neural network model. The electronic device can employ a boost mechanism to handle sudden changes in thread load, preventing the inability to adjust the frame rate deviation in a timely manner and thus avoiding a decrease in the accuracy of the neural network model.
[0038] For example, the number of frames dropped in the input neural network model can be adjusted by adding a frame count weight value (boost) to the above formula (4). For instance, the number of frames dropped in the input neural network model (loss-input) can be determined by formula (5). Formula (5) includes:
[0039] loss-input=target_fps–actual_fps+bias+boost; formula (5).
[0040] Here, loss-input can refer to the number of lost frames, target_fps can refer to the target number of frames, actual_fps can refer to the actual number of frames, bias can refer to the above frame number deviation value, and boost can refer to the frame number weight value.
[0041] In conjunction with the first aspect, in some embodiments of the first aspect, the second condition includes a second average number of dropped frames greater than a maximum number of dropped frames, and a second over-supplied number of frames less than a fifth preset value.
[0042] The fifth preset value can be a value determined based on user experience, such as 0. When the fifth preset value is 0, the second over-supply frame count being less than 0 is equivalent to no over-supply frame count at the current moment.
[0043] If the second average number of dropped frames is greater than the maximum number of dropped frames, and there is no oversupply of frames, it indicates that the difference between the target number of frames and the actual number of frames is large within a short period of time, and the frame drop rate needs to be further increased to improve the accuracy of the CPU frequency output by the neural network model.
[0044] When adjusting the frame rate weight value boost based on the maximum number of dropped frames, the frame rate weight value boost can be adjusted using formula (7), where formula (7) includes:
[0045] boost=(loss2-lossMax) / 2; formula (7).
[0046] Here, boost can refer to the frame weight value, loss2 can be the second average frame drop rate, and lossMax can be the maximum number of dropped frames.
[0047] In conjunction with the first aspect, in some embodiments of the first aspect, the method further includes: if the second average number of dropped frames does not meet the second condition, then setting the frame number weight value to a sixth preset threshold.
[0048] The sixth preset value can be a value determined based on user experience.
[0049] In conjunction with the first aspect, in some embodiments of the first aspect, the aforementioned sixth preset threshold is 0.
[0050] When the sixth preset value is 0, setting the frame number weight value boost to the sixth preset value is equivalent to not adding the frame number weight value boost on the basis of formula (4) to determine the number of lost frames loss-input of the input neural network model.
[0051] Secondly, a parameter adjustment apparatus is provided, including a unit for performing any of the methods in the first aspect. This apparatus may be a server, a terminal device, or a chip within a terminal device. The apparatus may include an input unit and a processing unit.
[0052] When the device is a terminal device, the processing unit may be a processor, and the input unit may be a communication interface; the terminal device may also include a memory for storing computer program code, which, when the processor executes the computer program code stored in the memory, causes the terminal device to perform any of the methods in the first aspect.
[0053] When the device is a chip within a terminal device, the processing unit can be an internal processing unit of the chip, and the input unit can be an output interface, pin, or circuit, etc.; the chip may also include a memory, which can be an internal memory of the chip (e.g., a register, cache, etc.) or an external memory (e.g., a read-only memory, random access memory, etc.); the memory is used to store computer program code, and when the processor executes the computer program code stored in the memory, the chip performs any of the methods in the first aspect.
[0054] In one possible implementation, a memory is used to store computer program code; a processor executes the computer program code stored in the memory. When the computer program code stored in the memory is executed, the processor performs the following: obtaining a first average number of dropped frames, which is the number of dropped frames in the display screen of a first application running in the electronic device within a first preset time period; determining whether the first average number of dropped frames meets a first condition, which is determined based on a first over-supplied number of frames, a maximum number of dropped frames, and a target number of frames. The target number of frames refers to a preset number of frames in the display screen of the first application, and the first over-supplied number of frames refers to the number of image frames in the image queue to be displayed within the first preset time period that is greater than a preset number threshold; if the first average number of dropped frames meets the first condition, adjusting the frame number deviation value based on the maximum number of dropped frames to obtain an updated frame number deviation value. The updated frame number deviation value is used to adjust the number of dropped frames input to the neural network model, and the neural network model is used to determine the target frequency of the CPU corresponding to the first application.
[0055] Thirdly, a computer-readable storage medium is provided, the computer-readable storage medium storing computer program code, which, when run by a parameter adjustment device, causes the parameter adjustment device to perform any of the parameter adjustment methods in the first aspect.
[0056] Fourthly, a computer program product is provided, the computer program product comprising: computer program code, which, when run by a parameter adjustment device, causes the parameter adjustment device to perform any of the apparatus methods in the first aspect.
[0057] The parameter adjustment method and electronic device provided in this application can be applied to the process of determining the number of dropped frames in the input neural network model. By obtaining a first average number of dropped frames, and then determining whether the first average number of dropped frames meets a first condition, and if the first average number of dropped frames meets the first condition, the frame number deviation value is adjusted based on the maximum number of dropped frames to obtain an updated frame number deviation value. The first average number of dropped frames can refer to the number of dropped frames in the first application display screen running in the electronic device within a first preset time period. The first condition is determined based on a first over-supplied frame count, the maximum number of dropped frames, and the target frame count. The first over-supplied frame count can refer to the number of images to be displayed in the image queue within the first preset time period that is greater than a preset number threshold. For example, the updated frame rate deviation can be used to adjust the number of dropped frames input to the neural network model. The neural network model is used to determine the target frequency of the CPU corresponding to the first application. This is equivalent to correcting the problem of inaccurate target frequency of the CPU corresponding to the first application output by the neural network model by using the frame rate loss-input during the process of determining the target frequency of the CPU corresponding to the first application. This allows a neural network model to be adapted to multiple applications, avoiding the need to train a corresponding neural network model for each application. It improves the accuracy of the target frequency of the CPU corresponding to the first application output by the neural network model while saving costs. Attached Figure Description
[0058] Figure 1 This is a schematic diagram of a hardware system for an electronic device applicable to this application;
[0059] Figure 2 This is a schematic diagram of an application scenario provided by an embodiment of this application;
[0060] Figure 3 This is a flowchart illustrating a parameter adjustment method provided in an embodiment of this application;
[0061] Figure 4 This is a schematic diagram of CPU frequency modulation using a neural network model provided in an embodiment of this application;
[0062] Figure 5 This is a flowchart illustrating a parameter adjustment method provided in an embodiment of this application;
[0063] Figure 6 This is a schematic diagram of the process of an electronic device provided in an embodiment of this application;
[0064] Figure 7 This is a schematic diagram of a parameter adjustment device provided in this application;
[0065] Figure 8This is a schematic diagram of an electronic device for parameter adjustment provided in this application. Detailed Implementation
[0066] The technical solutions of the embodiments of this application will be described below with reference to the accompanying drawings. In the description of the embodiments of this application, unless otherwise stated, " / " means "or," for example, A / B can mean A or B; "and / or" in this text is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Furthermore, in the description of the embodiments of this application, "multiple" refers to two or more than two.
[0067] Hereinafter, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first," "second," or "third" may explicitly or implicitly include one or more of that feature.
[0068] For ease of understanding, the examples provided are for reference only and are related to the concepts in the embodiments of this application.
[0069] 1. Cluster.
[0070] Cluster can refer to a physical or logical unit that encapsulates multiple processor cores, their shared cache (usually the last level cache, LLC), and other related circuitry together.
[0071] Some CPUs can include three clusters: large, medium, and small. The large cluster can be called the prime core, the medium cluster can be called the gold core, and the small cluster can be called the silver core.
[0072] 2. CPU frequency adjustment.
[0073] CPU frequency refers to the speed at which a CPU processes instructions per unit of time, usually measured in Hertz (Hz) or gigahertz (GHz). It determines a computer's processing power and response speed. Increasing the CPU frequency can significantly improve a computer's operating speed, but it may also lead to problems such as increased heat generation and power consumption.
[0074] In some cases, a CPU may consist of multiple clusters. For example, if a CPU includes prime cores, gold cores, and silver cores, each cluster typically has a different frequency. CPU frequency tuning can refer to adjusting the frequencies of the prime cores, gold cores, and silver cores separately.
[0075] 3. Reinforcement learning (RL).
[0076] Reinforcement learning is used to describe and solve problems where an agent learns policies to maximize rewards or achieve specific goals through interactions with its environment. A common model for reinforcement learning is the Markov Decision Process (MDP), a mathematical model for analyzing decision-making problems. In reinforcement learning, the agent learns through trial and error, guided by rewards obtained from interactions with the environment, with the goal of maximizing rewards. The reinforcement signals (rewards) provided by the environment evaluate the quality of actions, rather than telling the reinforcement learning system how to produce the correct action. Because the external environment provides limited information, the agent must learn through experience. In this way, the agent acquires knowledge in the action-reward (i.e., reward) environment and improves its actions to adapt to the environment. Common reinforcement learning algorithms include Deep Q Network (DQN), Q-learning, policy gradient, and actor-critic. Reinforcement learning primarily comprises five elements: agent, environment, state, action, and reward. The state describes the environment and changes after the agent performs an action. Actions describe the agent's behavior and represent the result of its decisions. In other words, the agent's input is the state, and its output is the action. The reward (positive or negative) is calculated by the agent based on the environment's feedback after it performs an action. The training process for reinforcement learning involves: the agent interacting with the environment multiple times, obtaining the action, state, and reward for each interaction; using these multiple sets of (action, state, reward) as training data to train the agent once. This process is repeated for subsequent rounds of training until convergence is met.
[0077] As electronic devices become increasingly powerful and more applications are installed on them, some of these applications place higher demands on the performance of electronic devices. For example, with the improvement of game graphics and the enrichment of gameplay and game scenes, gaming applications are placing even greater demands on the performance of electronic devices.
[0078] To ensure smooth gameplay, electronic devices can adjust the CPU's operating frequency to the highest frequency supported by the CPU. However, if the CPU runs at its highest frequency for an extended period, it can cause the device to overheat. In this case, the device needs to reduce the CPU frequency to lower the temperature. Downclocking the CPU, on the other hand, can lead to decreased game smoothness, negatively impacting the user's gaming experience.
[0079] Understandably, game applications typically need to process game logic while simultaneously rendering game visuals. Therefore, game applications usually run both logic threads and rendering threads concurrently. In this case, the logic threads and rendering threads can run in two different clusters. For example, the logic threads can run in the prime core, and the rendering threads can run in the gold core. Alternatively, the logic threads can run in the gold core, and the rendering threads can run in the prime core.
[0080] Electronic devices can use neural network models to perform reinforcement learning to determine the optimal CPU frequency for running games. In determining the optimal CPU frequency, the load corresponding to each thread is typically used as input to the neural network model. As described above, the same thread can run in different clusters, and the load corresponding to the same thread will differ depending on the cluster it runs in. That is, each thread corresponds to the load of multiple clusters. If a thread corresponds to only one load, and that load is used as input to the neural network, it may lead to a decrease in the accuracy of the neural network model.
[0081] However, the variety of games installed on electronic devices is increasing, and there are significant differences between various game applications. Training a corresponding neural network model for each game application for CPU frequency adjustment would be too costly; if the same neural network model is used for CPU frequency adjustment for multiple game applications, the differences between the applications will lead to low accuracy in CPU frequency adjustment.
[0082] In view of this, embodiments of this application provide a parameter adjustment method relating to the field of artificial intelligence, comprising: obtaining a first average number of dropped frames, then determining whether the first average number of dropped frames meets a first condition, and, if the first average number of dropped frames meets the first condition, adjusting the frame number deviation value based on the maximum number of dropped frames to obtain an updated frame number deviation value, wherein the first average number of dropped frames may refer to the number of dropped frames of the first application display screen running in the electronic device within a first preset time period, the first condition is determined based on a first over-supplied frame number, the maximum number of dropped frames, and the target frame number, and the first over-supplied frame number may refer to the number of image frames in the image queue to be displayed within the first preset time period where the number of images to be displayed is greater than a preset number threshold, and updating... The resulting frame rate deviation can be used to adjust the number of dropped frames input to the neural network model. The neural network model is used to determine the target frequency of the CPU corresponding to the first application. This is equivalent to correcting the problem of inaccurate target frequency of the CPU corresponding to the first application output by the neural network model by using the frame rate loss-input during the process of determining the target frequency of the CPU corresponding to the first application. This allows one neural network model to be adapted to multiple applications, avoiding the need to train a corresponding neural network model for each application. It improves the accuracy of the target frequency of the CPU corresponding to the first application output by the neural network model while saving costs.
[0083] The parameter adjustment method provided in this application can be applied to electronic devices. Optionally, the electronic device includes a terminal device, which can also be called a terminal, user equipment (UE), mobile station (MS), mobile terminal (MT), etc. The terminal device can be a mobile phone, smart TV, wearable device, tablet computer, computer with wireless transceiver function, virtual reality (VR) terminal device, augmented reality (AR) terminal device, wireless terminal in industrial control, wireless terminal in self-driving, wireless terminal in remote medical surgery, wireless terminal in smart grid, wireless terminal in transportation safety, wireless terminal in smart city, wireless terminal in smart home, etc. The embodiments of this application do not limit the specific technology or device form used in the terminal device.
[0084] For example, Figure 1 A schematic diagram of the structure of electronic device 100 is shown. 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, antenna 1, 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, a headphone jack 170D, a sensor module 180, buttons 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, a barometric pressure sensor 180C, a magnetic sensor 180D, an accelerometer sensor 180E, a distance sensor 180F, a proximity 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.
[0085] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0086] Processor 110 may include one or more processing units, such as: application processor (AP), modem processor, graphics processing unit (GPU), image signal processor (ISP), controller, memory, video codec, digital signal processor (DSP), baseband processor, and / or neural network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0087] The controller can be the nerve center and command center of the electronic device 100. The controller can generate operation control signals according to the instruction opcode and timing signals to complete the control of fetching and executing instructions.
[0088] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can retrieve it directly from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0089] In some embodiments, the processor 110 may include one or more interfaces. Interfaces 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.
[0090] Electronic device 100 implements display functions through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, connecting the display screen 194 and the application processor. The GPU performs mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs, which execute program instructions to generate or modify display information. For example, the GPU can perform image rendering for game scenes.
[0091] Display screen 194 is used to display images, videos, etc. Display screen 194 includes a display panel. The display panel may be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a miniature LED, a microLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, electronic device 100 may include one or N displays 194, where N is a positive integer greater than 1.
[0092] Electronic device 100 can perform shooting functions through ISP, camera 193, video codec, GPU, display 194 and application processor.
[0093] An NPU (Neural Processing Unit) is a neural network (NN) computing processor that, by borrowing the structure of biological neural networks, such as the transmission patterns between neurons in the human brain, rapidly processes input information and can continuously learn on its own. NPUs enable intelligent cognitive applications in electronic devices, such as image recognition, facial recognition, speech recognition, and text understanding. For example, electronic devices can use the neural network model within the NPU to adjust the CPU frequency.
[0094] It should be noted that any electronic device mentioned in the embodiments of this application may include more or fewer modules in electronic device 100.
[0095] The software system of electronic device 100 can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture.
[0096] The application scenarios provided by the embodiments of this application are described below with reference to the accompanying drawings.
[0097] The method provided in this application can be applied to scenarios requiring CPU frequency adjustment, such as gaming, watching videos, and video calls. It should be understood that a higher CPU frequency results in faster CPU processing speed and better electronic device performance. Conversely, a lower CPU frequency leads to slower CPU processing speed and worse electronic device performance. Lowering the CPU frequency reduces power consumption and prevents overheating. Simultaneously, because applications like games require high frame rates, electronic devices require significant CPU processing power to launch them. Therefore, when launching high-frame-rate applications like games, electronic devices can adjust the CPU frequency to regulate CPU processing power and improve CPU performance.
[0098] Taking games as an example, electronic devices can increase the CPU frequency to meet the high frame rate requirements of games; conversely, they can decrease the CPU frequency to reduce power consumption and prevent overheating. In other words, when launching a game, the electronic device can balance the game's frame rate and the device's power consumption by adjusting the CPU frequency.
[0099] Electronic devices can adjust the CPU frequency using neural network models, which can be deployed in cloud servers or within electronic devices.
[0100] If the neural network model is deployed on a cloud server, such as Figure 2 As shown, electronic devices can communicate with cloud servers, sending their load information and CPU frequency to the cloud server. The cloud server then uses this load information and a neural network model to determine the optimal CPU frequency for the application. The load information can include application load information, load information for different clusters within the CPU, and load information for different threads within the application.
[0101] If a neural network model is deployed in an electronic device, the electronic device can collect the load information of the electronic device and the CPU frequency data, input the load information of the electronic device and the CPU frequency into the neural network model, and obtain the optimal CPU frequency corresponding to the application.
[0102] It's understandable that different electronic devices have different performance levels, which means their optimal CPU frequencies may also differ. Therefore, the optimal CPU frequency for an application will change as the performance of the electronic device varies. In other words, the optimal CPU frequency for an application is not a single value, but rather a list.
[0103] The neural network model can be a reinforcement learning neural network model, such as a batch-constrained deep Q-learning (BCQ) model or a multi-agent deep deterministic policy gradient (MADDPG) model.
[0104] It should be understood that the above are illustrative examples of application scenarios and do not limit the application scenarios of this application in any way.
[0105] The following explanation uses a game application as an example.
[0106] Training a neural network model specifically for a game application to determine its optimal CPU frequency is costly. Some games with low CPU usage can share a single neural network model to save costs. However, because the neural network model wasn't trained specifically for a particular game application, the resulting optimal CPU frequency is inaccurate. Electronic devices can improve the accuracy of the optimal CPU frequency by adding a frame drop loss during the neural network model training process.
[0107] Frame loss refers to the difference between the target frame rate (target_fps) and the actual frame rate (actual_fps). The target frame rate (target_fps) refers to the display frame rate set by the game application. For a game application running at full frame rate (60fps), the target frame rate (target_fps) is 60fps. However, games often experience frame drops during gameplay, meaning they may not display 60 frames per second. For example, if a game drops 2 frames per second, its actual frame rate (actual_fps) is 58. In this case, to ensure the game runs at full frame rate (60fps), a bias value (e.g., 2 frames) is usually added to the target frame rate (target_fps) to increase it to the target value. For example, 60 + 2 = 62 frames, thus increasing the actual frame rate (actual_fps) to 60. In other words, when using a neural network model, the frame loss loss can be obtained by using the frame loss bias value to calculate the frame loss loss. Then, the frame loss loss loss loss can be input into the neural network model to obtain a more accurate CPU frequency.
[0108] It's important to note that during the display process of an electronic device, the rendered images to be displayed are typically stored in a queue. The electronic device then sequentially sends these images to the queue according to a preset display cycle. In one possible scenario, if the queue contains too many images, the electronic device may discard some images based on their order of entry into the queue, resulting in frame drops. This type of frame drop is usually unrelated to the CPU frequency. Therefore, if a game application drops 2 frames per second, the bias added to the target frame rate (target_fps) may not be 2 frames; it can be a value determined based on the electronic device's operating conditions, such as 1.5 frames or 2.5 frames.
[0109] The following is through Figure 3 The illustrated embodiment details the specific process of determining the bias value.
[0110] Figure 3 This is a flowchart illustrating a parameter adjustment method provided in an embodiment of this application, as shown below. Figure 3 As shown, the method includes:
[0111] S101, Obtain the first average number of dropped frames.
[0112] The first average number of dropped frames (loss) can refer to the number of dropped frames within a first preset duration, where the first preset duration can refer to the duration determined by the user based on experience, such as 1 second.
[0113] Electronic devices can calculate the average number of frames dropped within a first preset time period as the first average number of dropped frames. For example, if the refresh rate of the electronic device's display is 60fps, that is, 60 frames are displayed per second, the electronic device can calculate the average number of dropped frames within 60 frames as the first average number of dropped frames.
[0114] S102, Obtain the first over-supply frame count.
[0115] The first over-supply frame count can refer to the number of frames with image backlog in the image queue to be displayed within the aforementioned first preset time period. For example, if the refresh rate of the electronic device's display screen is 60fps, that is, 60 frames are displayed per second, the electronic device can count the number of frames in the image queue to be displayed that are greater than or equal to the preset backlog number during the display of 60 frames. The preset backlog number threshold can be 2.
[0116] It is understandable that if the number of images to be displayed in the image queue is greater than or equal to the preset stacking number (e.g., 2), it means that the speed of generating images to be displayed is higher than the speed of sending images to be displayed, and there is an oversupply of images to be displayed.
[0117] S103. Determine whether the first average number of dropped frames meets the first condition. The first condition is determined based on the first over-supplied frame count, the maximum number of dropped frames, and the target frame count.
[0118] As described in S102, when the number of images to be displayed in the image queue is greater than or equal to the preset stacking number (e.g., 2), it indicates that the speed of generating images to be displayed is higher than the speed of sending images to be displayed, and there is an oversupply of images to be displayed.
[0119] In this scenario, if the first average number of dropped frames (loss) is greater than the maximum number of dropped frames (lossMax), it indicates that the electronic device's performance is poor at the current moment. Simultaneously, if the first number of oversupplied frames (oversupplys1) is less than a first preset value, it indicates that the electronic device's CPU frequency is low and needs to be increased.
[0120] The first preset value can be determined based on the total number of frames within a first preset duration. For example, the first preset value can indicate the product of the total number of frames within the first preset duration and a preset ratio. For instance, the preset ratio can be 30%, the first preset duration can be 1 second, and if the electronic device displays 60 frames in 1 second, then the first preset value can be 60 * 30% = 18 frames.
[0121] The first condition can be that the first average frame drop rate is greater than the maximum number of frame drops (lossMax), and the first over-supplied frame count is less than the first preset value.
[0122] The maximum number of dropped frames can be a value determined based on user experience.
[0123] For example, the maximum frame drop count can be 0.5 frames. For a game application with a set frame rate of 60 frames per second, if the frame rate is 59 frames per second, the first average frame drop count (loss) is 60 - 59 = 1 frame, which is greater than the maximum frame drop count of 0.5 frames. Furthermore, the first over-supplied frame count within 1 second is 10 frames, which is less than the first preset value of 60 * 30% = 18 frames. In this case, since the first over-supplied frame count is less than the aforementioned first preset value, frame drops caused by anomalies in the game application can be ruled out. If frame drops are caused by anomalies in the game application, increasing the frame rate deviation value (bias) will not solve the frame drop problem.
[0124] Therefore, only when the first average frame drop rate is greater than the maximum number of frame drops (lossMax) and the first over-supplied frame count is less than the first preset value, will the frame count deviation value (bias) be adjusted based on the maximum number of frame drops to obtain the updated frame count deviation value (bias), which is to execute S104.
[0125] If the average number of dropped frames does not meet the first condition, it is necessary to further determine whether to adjust the frame number deviation value bias. For example, it can be determined whether the first average number of dropped frames loss is less than the minimum number of dropped frames, that is, to execute S105.
[0126] S104. Adjust the frame rate deviation value based on the maximum number of dropped frames to obtain the updated frame rate deviation value.
[0127] When adjusting the frame rate deviation value bias based on the maximum number of dropped frames, the frame rate deviation value bias can be adjusted using formula (1), where formula (1) includes:
[0128] bias1=bias0+loss-lossMax; formula (1).
[0129] Here, bias1 can refer to the updated frame rate deviation value bias, bias0 can refer to the frame rate deviation value bias before adjustment, loss can refer to the first average frame drop rate, and lossMax can refer to the maximum number of dropped frames.
[0130] For example, the maximum frame drop can be 0.5 frames. For a game application with a set frame rate of 60 frames per second, if the frame rate is 59 frames per second, the first average frame drop loss is 60 - 59 = 1 frame, which is greater than the maximum frame drop loss of 0.5 frames. Furthermore, the first overloaded frame rate within 1 second is 10 frames, which is less than the first preset value of 60 * 30% = 18 frames. Therefore, bias1 - bias0 = 1 - 0.5 = 0.5 frames, which is equivalent to increasing the frame rate deviation value bias by 0.5 frames.
[0131] The parameter adjustment method provided in this application embodiment can be applied to the process of determining the number of dropped frames in the input neural network model. It obtains a first average number of dropped frames, then determines whether the first average number of dropped frames meets a first condition. If the first average number of dropped frames meets the first condition, it adjusts the frame number deviation value based on the maximum number of dropped frames to obtain an updated frame number deviation value. The first average number of dropped frames can refer to the number of dropped frames in the first application display screen running in the electronic device within a first preset time period. The first condition is determined based on a first over-supplied frame count, the maximum number of dropped frames, and the target frame count. The first over-supplied frame count can refer to the number of image frames in the image queue to be displayed within the first preset time period where the number of images to be displayed is greater than a preset threshold. The updated frame rate deviation value can be used to adjust the number of dropped frames input to the neural network model. The neural network model is used to determine the target frequency of the CPU corresponding to the first application. This is equivalent to correcting the problem of inaccurate target frequency of the CPU corresponding to the first application output by the neural network model by using the frame rate loss-input during the process of determining the target frequency of the CPU corresponding to the first application. This allows a neural network model to be adapted to multiple applications, avoiding the need to train a corresponding neural network model for each application. It improves the accuracy of the target frequency of the CPU corresponding to the first application output by the neural network model while saving costs.
[0132] S105. Determine whether the first average number of dropped frames (loss) is less than the minimum number of dropped frames.
[0133] Among them, the minimum number of frames lost (lossMin) can be a value determined based on user experience.
[0134] For example, the minimum number of frames lost (lossMin) could be 0.2 frames.
[0135] If the first average number of lost frames (loss) is less than the minimum number of lost frames (lossMin), it indicates that the difference between the current target number of frames (target_fps) and the actual number of frames (actual_fps) is small, and the frame rate bias can be reduced. For example, the electronic device can adjust the frame rate bias based on the minimum number of lost frames to obtain the updated bias, which is to execute S106.
[0136] If the first average number of lost frames (loss) is greater than or equal to the minimum number of lost frames (lossMin), then it can be further determined whether the number of over-supplied frames is greater than the first value, that is, S107 is executed.
[0137] S106. Adjust the frame number deviation value bias based on the minimum number of dropped frames to obtain the updated frame number deviation value bias.
[0138] When adjusting the frame rate deviation value bias based on the minimum number of dropped frames, the frame rate deviation value bias can be adjusted using formula (2), where formula (2) includes:
[0139] bias2=bias0-(lossMin-loss); formula (2).
[0140] Here, bias2 can refer to the updated frame rate deviation value bias, bias0 can refer to the frame rate deviation value bias before adjustment, loss can refer to the first average frame drop rate, and lossMin can refer to the minimum number of dropped frames.
[0141] For example, the minimum number of dropped frames can be 0.2 frames. For a game application with a set frame rate of 60 frames per second, the frame rate is 59.9 frames per second, which means the first average number of dropped frames is 60 - 59.0 = 0.1 frames, less than the minimum number of dropped frames of 0.2 frames. Therefore, bias0 - bias2 = 0.2 - 0.1 = 0.1 frames, which is equivalent to reducing the frame rate deviation value bias by 0.1 frames.
[0142] S107. Determine whether the first over-supply frame count is greater than the first value.
[0143] The first value is determined based on the target frame rate. For example, the first value is the product of the target frame rate and a preset ratio, where the preset ratio can be 50%. Taking a preset ratio of 50% as an example, determining whether the first oversupply frame rate is greater than the first value can mean determining whether the first oversupply frame rate oversupplys1 is greater than the target frame rate target_fps*50%.
[0144] If the first oversupply frame count (oversupplys1) is greater than a first value, the frame drops occurring at the current moment are mainly due to the large number of images to be displayed in the image queue, and have little to do with the CPU frequency of the electronic device. In this case, since it is impossible to reduce the application's frame drop rate by increasing the CPU frequency, the frame count deviation value (bias) can be reduced to avoid the problem of excessively high electronic device temperature caused by blindly increasing the CPU frequency. If the first oversupply frame count is greater than the first value, the frame count deviation value (bias) is adjusted based on a second preset value to obtain an updated deviation value (bias), which is to execute S108.
[0145] If the first over-supplied frame count is less than or equal to the first value, the frame count bias value will not be adjusted.
[0146] S108. Adjust the frame rate deviation value bias based on the second preset value.
[0147] When adjusting the frame rate deviation value based on the second preset value, the frame rate deviation value can be adjusted using formula (3), wherein formula (3) includes:
[0148] bias3=bias0-m; formula (3).
[0149] Here, bias3 can refer to the updated frame rate deviation value bias, bias0 can refer to the frame rate deviation value bias before adjustment, and m can refer to the user-set empirical value, such as 0.3.
[0150] It should be noted that, in order to prevent malfunctions in electronic devices, the frame rate deviation value (bias) must not be adjusted beyond its preset range. For example, if the preset range for the frame rate deviation value (bias) is -0.2 frames to 3 frames, the updated frame rate deviation value (bias) must not be less than -0.2 frames or greater than 3 frames.
[0151] After obtaining the updated frame rate deviation value (bias), the lost frame rate (loss-input) of the neural network model can be determined according to formula (4), and the optimal CPU frequency for the game application can be output by the neural network model. Formula (4) includes:
[0152] loss-input=target_fps–actual_fps+bias; formula (4).
[0153] Wherein, loss-input can refer to the number of lost frames, target_fps can refer to the target number of frames, actual_fps can refer to the actual number of frames, and bias can refer to the frame deviation value after the above update, such as bias1 shown in formula (1), bias2 shown in formula (2), and bias3 shown in formula (3).
[0154] For example, such as Figure 4 As shown, the input data of the neural network model includes gold-task, prime-task, total game load, mid-core CPU load, large-core CPU load, and lost frame count (loss-input).
[0155] Here, "gold-task" can refer to the most heavily loaded thread on the medium cores, and "prime-task" can indicate the most heavily loaded thread on the large cores; that is, gold-task and prime-task refer to the load information of different threads in the application. Medium core CPU load and large core CPU load can refer to the load information of different clusters within the CPU. The neural network model infers the optimal CPU frequency for the game application under different load and frame drop conditions by processing the above gold-task, prime-task, total game load, medium core CPU load, large core CPU load, and frame drop loss input.
[0156] pass Figure 3 The embodiment shown adjusts the frame rate bias value first, requiring the acquisition of the average number of dropped frames. The average number of dropped frames is the average number of dropped frames within an adjustment period. In this case, if the adjustment period is long, for example, one second, a significant change in the thread load of the electronic device within a short period can prevent the device from adjusting the frame rate bias value in a timely manner, leading to an increase in the current frame rate loss (loss-input).
[0157] Electronic devices can use a boost mechanism to cope with sudden changes in thread load, thereby avoiding situations where electronic devices cannot adjust the frame rate deviation value bias in time, which would lead to an increase in the number of lost frames at the current moment.
[0158] For example, the number of frames dropped in the input neural network model can be adjusted by adding a frame count weight value (boost) to formula (4). For instance, the number of frames dropped in the input neural network model (loss-input) can be determined by formula (5). Formula (5) includes:
[0159] loss-input=target_fps–actual_fps+bias+boost; formula (5).
[0160] Here, loss-input can refer to the number of lost frames, target_fps can refer to the target number of frames, actual_fps can refer to the actual number of frames, bias can refer to the above frame number deviation value, and boost can refer to the frame number weight value.
[0161] The following is through Figure 5 The illustrated example demonstrates in detail how to adjust the boost value.
[0162] Figure 5 A flowchart illustrating another parameter adjustment method provided in this application embodiment is shown below. Figure 5 As shown, the method includes:
[0163] S201. Determine the second average number of dropped frames.
[0164] The second average number of dropped frames can refer to the average number of dropped frames within a preset number of frames.
[0165] It is understood that electronic devices typically have high screen refresh rates, for example, 60fps, meaning the screen refreshes 60 times per second. The preset frame rate can refer to a number of frames less than a third preset value. This third preset value can be a value determined based on user experience. For example, the third preset value could be 3 frames, 4 frames, or 5 frames; this embodiment does not impose any limitations on this.
[0166] It should be noted that the preset frame rate is usually less than the number of frames displayed within the first preset duration. That is, the frame rate used in determining the first average frame drop is greater than the frame rate used in determining the second average frame drop.
[0167] In determining the second average number of dropped frames, since the preset number of frames is usually small and the frame length of each frame fluctuates greatly, it is easy to generate a large error. Therefore, when calculating the second average number of dropped frames, formula (6) can be used to calculate the second average number of dropped frames. Formula (6) includes:
[0168] loss2=target_fps–actual_fps; formula (6).
[0169] Here, loss2 can represent the second average number of dropped frames; target_fps can represent the target number of frames; and actual_fps can indicate the actual number of frames.
[0170] Wherein, actual_fps can be a number of frames determined based on a fourth preset value of historical frames. For example, the fourth preset value can be 20, then actual_fps can be a number of frames determined based on 20 historical frames. The fourth preset value can also be 30, or it can also be 40, and this application embodiment does not limit this.
[0171] S202, Obtain the second over-supply frame count.
[0172] The second over-supplied frame count refers to the over-supplied frame count within a preset frame count.
[0173] S203. Determine whether the second average number of dropped frames satisfies the second condition.
[0174] The second condition can be determined based on the maximum number of dropped frames and the second number of over-supplied frames.
[0175] For example, the second condition could be that the second average number of dropped frames is greater than the maximum number of dropped frames, and the second number of over-supplied frames is less than a fifth preset value. The fifth preset value could be a value determined based on user experience, for example, a fifth preset value of 0. When the fifth preset value is 0, the second number of over-supplied frames being less than 0 is equivalent to no over-supplied frames at the current moment.
[0176] If the second average number of dropped frames is greater than the maximum number of dropped frames, and there is no overfeed of frames, it indicates that the difference between the target number of frames and the actual number of frames is large within a short period of time, requiring a further increase in the frame drop rate to improve the accuracy of the CPU frequency output by the neural network model. The electronic device can adjust the frame number weight value boost based on the maximum number of dropped frames, which is equivalent to executing S204.
[0177] If the second average number of dropped frames does not meet the second condition, then the frame weight value boost is set to the sixth preset value, which is to execute S205.
[0178] S204. Adjust the frame rate weight value boost based on the maximum number of dropped frames.
[0179] When adjusting the frame rate weight value boost based on the maximum number of dropped frames, the frame rate weight value boost can be adjusted using formula (7), where formula (7) includes:
[0180] boost=(loss2-lossMax) / 2; formula (7).
[0181] Here, boost can refer to the frame weight value, loss2 can be the second average frame drop rate, and lossMax can be the maximum number of dropped frames.
[0182] S205. Set the frame rate weight value boost to the sixth preset value.
[0183] The sixth preset value can be a value determined based on user experience. For example, the sixth preset value can be 0. When the sixth preset value is 0, setting the frame number weight value boost to the sixth preset value is equivalent to not adding the frame number weight value boost to the formula (4) to determine the number of lost frames loss-input of the input neural network model.
[0184] The effects of the parameter adjustment method shown in the embodiments of this application will be explained below.
[0185] For example, data collection can be performed on a game application that uses the parameter adjustment method shown in the embodiments of this application to adjust the CPU frequency, and the results can be obtained as follows: Figure 6 The process diagram is shown below.
[0186] like Figure 6As shown, UnityMain 17283 represents the logical thread numbered 17283, UnityGfxDeviceW17424 represents the rendering thread numbered 17424, RL Cluster1 Freq represents the recommended frequency of the neural network model for Cluster1, RL Cluster3 Freq represents the recommended frequency of the neural network model for Cluster3, CPU 4 (mid) represents the mid-core of the 4th CPU, CPU 5 (mid) represents the mid-core of the 5th CPU, CPU 6 (mid) represents the mid-core of the 6th CPU, CPU 7 (big) represents the big core of the 7th CPU, CPU 0 Frequency represents the actual frequency of the 0th CPU, CPU1 Frequency represents the actual frequency of the 1st CPU, CPU 2 Frequency represents the actual frequency of the 2nd CPU, CPU3 Frequency represents the actual frequency of the 3rd CPU, CPU 4 Frequency represents the actual frequency of the 4th CPU, CPU5 Frequency represents the actual frequency of the 5th CPU, and CPU... 6Frequency represents the actual frequency of the 6th CPU, and CPU7Frequency represents the actual frequency of the 7th CPU.
[0187] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowchart may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0188] It is understood that, in order to achieve the above functions, the electronic device includes hardware and / or software modules that perform the respective functions. Based on the algorithmic steps of the examples described in conjunction with the embodiments disclosed herein, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is implemented in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application in conjunction with the embodiments, but such implementation should not be considered beyond the scope of this application.
[0189] This application embodiment can divide an electronic device into functional modules based on the above method examples. For example, each function can be divided into its own functional modules, or two or more functions can be integrated into one module. It should be noted that the module division in this application embodiment is illustrative and represents only one logical functional division; other division methods may be used in actual implementation. It should also be noted that the module names in this application embodiment are illustrative, and the names of the modules are not limited in actual implementation.
[0190] Figure 7 This is a schematic diagram of a parameter adjustment device provided in an embodiment of this application.
[0191] It should be understood that the parameter adjustment device 600 can perform... Figures 3 to 5 The parameter adjustment method shown; the parameter adjustment device 600 includes: an acquisition unit 610 and a processing unit 620.
[0192] The acquisition unit 610 is used to acquire the first average number of dropped frames, which may refer to the number of dropped frames of the first application display screen running in the electronic device within a first preset time period.
[0193] The processing unit 620 is used to determine whether the first average number of dropped frames meets the first condition, and if the first average number of dropped frames meets the first condition, it adjusts the frame number deviation value based on the maximum number of dropped frames to obtain the updated frame number deviation value. The first condition is determined based on the first over-supplied frame number, the maximum number of dropped frames, and the target number of frames. The first over-supplied frame number may refer to the number of image frames in the image queue to be displayed within a first preset time period that is greater than a preset number threshold. The updated frame number deviation value can be used to adjust the number of dropped frames input to the neural network model.
[0194] The parameter adjustment device provided in this embodiment is used to execute the parameter adjustment method of the above embodiment. The technical principle and technical effect are similar, and will not be described again here.
[0195] It should be noted that the aforementioned parameter adjustment device 600 is embodied in the form of a functional unit. The term "unit" here can be implemented in software and / or hardware, without specific limitations.
[0196] For example, a "unit" can be a software program, a hardware circuit, or a combination of both that implements the above functions. The hardware circuit may include an application-specific integrated circuit (ASIC), electronic circuitry, a processor (e.g., a shared processor, a proprietary processor, or a group processor) and memory for executing one or more software or firmware programs, integrated logic circuitry, and / or other suitable components that support the described functions.
[0197] Therefore, the units of the various examples described in the embodiments of this application can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0198] Figure 8 A schematic diagram of the structure of an electronic device provided in this application is shown. Figure 8 The dashed lines indicate that the unit or module is optional. The electronic device 700 can be used to implement the parameter adjustment method described in the above method embodiments.
[0199] The electronic device 700 includes one or more processors 701, which can support the parameter adjustment method in the method embodiments of the electronic device 700. The processor 701 can be a general-purpose processor or a special-purpose processor. For example, the processor 701 can be a central processing unit (CPU), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, such as discrete gates, transistor logic devices, or discrete hardware components.
[0200] The processor 701 can be used to control the electronic device 700, execute software programs, and process data from the software programs. The electronic device 700 may also include a communication unit 705 for inputting (receiving) and outputting (transmitting) signals.
[0201] For example, electronic device 700 may be a chip, communication unit 705 may be the input and / or output circuit of the chip, or communication unit 705 may be the communication interface of the chip, and the chip may be a component of terminal device or other electronic device.
[0202] For example, electronic device 700 can be a terminal device, communication unit 705 can be the transceiver of the terminal device, or communication unit 705 can be the transceiver circuit of the terminal device.
[0203] The electronic device 700 may include one or more memories 702, which store a program 704. The program 704 can be executed by the processor 701 to generate instructions 703, causing the processor 701 to execute the impedance matching method described in the above method embodiments according to the instructions 703.
[0204] Optionally, the memory 702 may also store data. Optionally, the processor 701 may also read the data stored in the memory 702, which may be stored at the same memory address as the program 704, or the data may be stored at a different memory address than the program 704.
[0205] The processor 701 and memory 702 can be configured separately or integrated together; for example, integrated on the system on chip (SOC) of the terminal device.
[0206] For example, the memory 702 can be used to store the relevant program 704 of the parameter adjustment method provided in the embodiments of this application, and the processor 701 can be used to call the relevant program 704 of the parameter adjustment method stored in the memory 702 when performing parameter adjustment, and execute the parameter adjustment method of the embodiments of this application; including: obtaining a first average frame loss number, the first average frame loss number being the number of frames lost in the display screen of the first application running in the electronic device within a first preset time period; determining whether the first average frame loss number meets a first condition, the first condition being determined based on a first over-supplied frame number, a maximum frame loss number, and a target frame number, the target frame number being a preset frame number of the display screen of the first application, and the first over-supplied frame number being the number of image frames in the image queue to be displayed within a first preset time period that is greater than a preset number threshold; if the first average frame loss number meets the first condition, then adjusting the frame number deviation value based on the maximum frame loss number to obtain an updated frame number deviation value, the updated frame number deviation value being used to adjust the frame loss number input to the neural network model, and the neural network model being used to determine the target frequency of the CPU corresponding to the first application.
[0207] This application also provides a computer program product that, when executed by processor 701, implements the parameter adjustment method described in any of the method embodiments of this application.
[0208] The computer program product can be stored in memory 702, for example, program 704. Program 704 is finally converted into an executable object file that can be executed by processor 701 after processing such as preprocessing, compilation, assembly and linking.
[0209] This application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a computer, implements the parameter adjustment method described in any of the method embodiments of this application. The computer program may be a high-level language program or an executable object program.
[0210] The computer-readable storage medium is, for example, memory 702. Memory 702 can be volatile memory or non-volatile memory, or memory 702 can include both volatile and non-volatile memory. The non-volatile memory can 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. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous linked dynamic random access memory (SLDRAM), and direct rambus RAM (DR RAM).
[0211] In this application, "at least one" means one or more, and "more than one" means two or more. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or multiple items. For example, at least one of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple.
[0212] It should be understood that in the various embodiments of this application, the order of the above-mentioned processes does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0213] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0214] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0215] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for example, the division of units is merely a logical functional division, and other division methods may exist in actual implementation; for example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0216] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0217] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0218] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A parameter adjustment method, characterized in that, The method is applied in an electronic device, and the method includes: Obtain the first average number of dropped frames, where the first average number of dropped frames is the number of dropped frames displayed in the first application running in the electronic device within a first preset time period; Determine whether the first average number of dropped frames meets the first condition. The first condition is determined based on the first over-supplied number of frames, the maximum number of dropped frames, and the target number of frames. The target number of frames refers to the preset number of frames of the first application display screen. The first over-supplied number of frames refers to the number of image frames in the first preset duration image queue to be displayed that is greater than the preset number threshold. If the first average number of dropped frames meets the first condition, the frame number deviation value is adjusted based on the maximum number of dropped frames to obtain an updated frame number deviation value. The updated frame number deviation value is used to adjust the number of dropped frames input to the neural network model, and the neural network model is used to determine the target frequency of the CPU corresponding to the first application.
2. The method according to claim 1, characterized in that, The first condition includes: the first average number of dropped frames is greater than the maximum number of dropped frames, and the first over-supplied number of frames is greater than a first preset value, wherein the first preset value is determined based on the target number of frames.
3. The method according to claim 2, characterized in that, The first preset value is the product of the target number of frames and the preset ratio.
4. The method according to any one of claims 1 to 3, characterized in that, The method further includes: If the first average number of dropped frames does not meet the first condition, determine whether the first average number of dropped frames is less than the minimum number of dropped frames. If the first average number of dropped frames is less than the minimum number of dropped frames, then the frame count deviation value is adjusted based on the minimum number of dropped frames to obtain the updated frame count deviation value.
5. The method according to claim 4, characterized in that, The method further includes: if the first average number of dropped frames is greater than or equal to the minimum number of dropped frames, then determining whether the first over-supplied number of frames is greater than a first value, wherein the first value is determined based on the target number of frames; If the first over-supplied frame count is greater than the first value, then the frame count deviation value is adjusted based on the second preset value to obtain the updated frame count deviation value.
6. The method according to claim 5, characterized in that, The method further includes: If the first over-supplied frame count is less than or equal to the first value, then the frame count deviation value is not adjusted.
7. The method according to any one of claims 1 to 6, characterized in that, The method further includes: Obtain the first over-supply frame count.
8. The method according to any one of claims 1 to 7, characterized in that, The updated frame rate deviation value is within a preset range.
9. The method according to any one of claims 1 to 8, characterized in that, The method further includes: Obtain the second average number of dropped frames, which is the number of dropped frames in the display screen of the first application running in the electronic device within a second preset time period, and the second preset time period is less than the first preset time period; Obtain the second over-supply frame count; the second over-supply frame count refers to the number of image frames in the image queue to be displayed within the second preset time period when the number of images to be displayed is greater than the preset number threshold. Determine whether the second average number of dropped frames meets the second condition, which is determined based on the maximum number of dropped frames and the second over-supplied number of frames; If the second average number of dropped frames meets the second condition, then the frame number weight value is adjusted based on the maximum number of dropped frames. The frame number weight value is used to adjust the number of dropped frames input to the neural network model.
10. The method according to claim 9, characterized in that, The second condition includes that the second average number of dropped frames is greater than the maximum number of dropped frames, and the second over-supplied number of frames is less than a fifth preset value.
11. The method according to claim 9 or 10, characterized in that, The method further includes: If the second average number of dropped frames does not meet the second condition, then the frame weight value is set to the sixth preset threshold.
12. The method according to claim 11, characterized in that, The sixth preset threshold is 0.
13. An electronic device, characterized in that, The electronic device includes a module for performing the method as described in any one of claims 1 to 12.
14. An electronic device, characterized in that, include: One or more processors; Memory; And one or more computer programs, wherein the one or more computer programs are stored on the memory, and when the computer programs are executed by the one or more processors, cause the electronic device to perform the method as described in any one of claims 1 to 12.
15. A chip system, characterized in that, The chip system includes a processor for calling and running a computer program from memory, causing an electronic device on which the chip system is installed to perform the method as described in any one of claims 1 to 12.
16. A computer-readable storage medium comprising a computer program, characterized in that, When the computer program is run on an electronic device, it causes the electronic device to perform the method as described in any one of claims 1 to 12.