WO2021008427A1 - Image synthesis method and apparatus, electronic device, and storage medium - Google Patents

Image synthesis method and apparatus, electronic device, and storage medium Download PDF

Info

Publication number
WO2021008427A1
WO2021008427A1 PCT/CN2020/100978 CN2020100978W WO2021008427A1 WO 2021008427 A1 WO2021008427 A1 WO 2021008427A1 CN 2020100978 W CN2020100978 W CN 2020100978W WO 2021008427 A1 WO2021008427 A1 WO 2021008427A1
Authority
WO
WIPO (PCT)
Prior art keywords
resolution
electronic device
power consumption
preset
multiple layers
Prior art date
Application number
PCT/CN2020/100978
Other languages
French (fr)
Chinese (zh)
Inventor
胡杰
易永鹏
Original Assignee
Oppo广东移动通信有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Oppo广东移动通信有限公司 filed Critical Oppo广东移动通信有限公司
Publication of WO2021008427A1 publication Critical patent/WO2021008427A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F1/00Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
    • G06F1/26Power supply means, e.g. regulation thereof
    • G06F1/32Means for saving power
    • G06F1/3203Power management, i.e. event-based initiation of a power-saving mode
    • G06F1/3206Monitoring of events, devices or parameters that trigger a change in power modality
    • G06F1/3212Monitoring battery levels, e.g. power saving mode being initiated when battery voltage goes below a certain level
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F1/00Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
    • G06F1/26Power supply means, e.g. regulation thereof
    • G06F1/32Means for saving power
    • G06F1/3203Power management, i.e. event-based initiation of a power-saving mode
    • G06F1/3234Power saving characterised by the action undertaken
    • G06F1/325Power saving in peripheral device
    • G06F1/3265Power saving in display device
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/14Digital output to display device ; Cooperation and interconnection of the display device with other functional units
    • G06F3/1407General aspects irrespective of display type, e.g. determination of decimal point position, display with fixed or driving decimal point, suppression of non-significant zeros

Definitions

  • This application relates to the field of image processing technology, and more specifically, to an image synthesis method, device, electronic equipment, and storage medium.
  • the display interface of electronic devices usually has multiple display layers, which are displayed by combining multiple display layers.
  • This application proposes an image synthesis method, device, electronic device, and storage medium to solve the problem that the layer synthesis capability and the power consumption of the electronic device are difficult to balance in image synthesis.
  • an embodiment of the present application provides an image synthesis method, which includes: obtaining the current power consumption of an electronic device and multiple layers of an image to be displayed; determining whether the current power consumption is higher than a preset threshold; If yes, use a multimedia display processor (MDP, Multimedia Display Processor) to synthesize and display the multiple layers; if not, use a graphics processor (GPU, Graphics Processing Unit) to perform the multiple layers Composite and display.
  • MDP Multimedia Display Processor
  • GPU Graphics Processing Unit
  • an embodiment of the present application provides an image synthesis device, which includes: an acquisition module for acquiring the current power consumption of an electronic device and multiple layers of an image to be displayed; a judgment module for judging Whether the current power consumption is higher than the preset threshold; the synthesis module is used to synthesize and display the multiple layers by using a multimedia display processor (MDP, Multimedia Display Processor) if so; if not, use graphics processing A GPU (Graphics Processing Unit) synthesizes and displays the multiple layers.
  • MDP Multimedia Display Processor
  • an embodiment of the present application provides an electronic device that includes one or more processors; a memory; one or more application programs, wherein the one or more application programs are stored in the memory And is configured to be executed by the one or more processors, and the one or more programs are configured to execute the method applied to the electronic device as described above.
  • an embodiment of the present application provides a computer-readable storage medium in which program code is stored, wherein the above-mentioned method is executed when the program code is running.
  • Fig. 1 shows a logical framework diagram of image processing provided by an embodiment of the present application.
  • Figure 2 shows a schematic diagram of a desktop display interface provided by an embodiment of the present application.
  • Fig. 3 shows a schematic diagram of various layers of a desktop display interface provided by an embodiment of the present application.
  • Fig. 4 shows a flowchart of an image synthesis method provided by an embodiment of the present application.
  • Fig. 5 shows a flowchart of an image synthesis method provided by another embodiment of the present application.
  • Fig. 6 shows a flowchart of an image synthesis method provided by another embodiment of the present application.
  • Fig. 7 shows a flowchart of an image synthesis method provided by still another embodiment of the present application.
  • Fig. 8 shows a functional block diagram of an image synthesis device provided by an embodiment of the present application.
  • Fig. 9 shows a structural block diagram of an electronic device proposed by an embodiment of the present application for executing the image synthesis method according to the embodiment of the present application.
  • FIG. 10 shows a storage medium provided by an embodiment of the present application for storing or carrying program code for implementing the image synthesis method according to the embodiment of the present application.
  • An application can create a window through the Windows manager.
  • the window manager creates a drawing surface for each window to draw various elements that need to be displayed on it, and each surface corresponds to one Layer, that is, a layer can be drawn on each surface.
  • each layer is rendered before composition. That is, each layer is drawn on the corresponding surface, that is, the corresponding layer is drawn on each surface.
  • HWUI hardware accelerated renderer
  • Skia graphics library to draw on the surface's canvas (cavas) Perform layer drawing.
  • the system then uses the layer transfer module (Surface Flinger) service to synthesize each surface, that is, synthesize each layer.
  • the SurfaceFlinger service runs in the system process and is used to uniformly manage the frame buffer of the system.
  • SurfaceFlinger obtains all the layers, and can use the graphics processor (GPU, Graphics Processing Unit) to synthesize all or part of the layers.
  • the result is saved to the frame buffer (FrameBuffer).
  • the hardware layer mixer (HWC, Hardware Composer) can synthesize the results of SurfaceFlinger through GPU synthesis with other layers.
  • HWC can call the Multimedia Display Processor (MDP, Multimedia Display Processor).
  • MDP Multimedia Display Processor
  • composition of the layers finally forms a Buffer in the BufferQueue, and then under the action of the display driver, the image synthesized in the Buffer is used for display.
  • the specific synthesis strategy of which part of the layer is synthesized by the GPU and the HWC can be determined according to the actual situation.
  • the display screen of the electronic device can display the display interface, and the display interface may include multiple layers, that is, the display interface is composed of multiple layers. Among them, each layer is composed of many pixels, and each layer is superimposed to form the entire image to form the display interface of the electronic device. Layers can accurately locate elements on the page. Text, pictures, tables, plug-ins can be added to the layer, and layers can also be nested inside. For layers and images synthesized by layers, it can be generally understood that a layer is like a film containing elements such as text or graphics. The layers are stacked in a specified order to form the final image. The effect is the image formed by the combination of layers, such as the display interface of an electronic device.
  • the desktop display interface 100 of the electronic device shown in FIG. 2 includes multiple layers, including a status bar 101, a navigation bar 102, a wallpaper 103, and an icon layer 104.
  • the system can use the GPU to synthesize image layers.
  • the synthesis method can be to determine the positional relationship between each layer according to the position of each layer in the display interface, and render the content of each layer to the GPU.
  • the positional relationship between the various layers in the buffer is the positional relationship in the display interface.
  • the temporary storage buffer is transmitted to the display hardware, so that when each layer is displayed on the screen, the image The display position of the layer is its position in the display interface.
  • the GPU when the GPU is used to process image layers, when the GPU is synthesizing layers, it has a strong synthesis ability, that is, there is no limit to the number of synthesized layers, but at the same time, it will generate greater power consumption and reduce the cost of electronic equipment. The standby time is long, thus affecting the user experience.
  • MDP hardware synthesis mechanism uses the HWC to call the MDP hardware module for synthesis.
  • This synthesis method has low power consumption and high speed, but has a limit on the number of layers to be processed. When the number of layers exceeds the number that can be processed, the task of layer synthesis cannot be completed, which affects the display on the screen.
  • the inventor proposes the image synthesis method, device, electronic equipment, and storage medium in this application as a synthesis strategy to select the device for layer synthesis according to the current power consumption of the electronic equipment.
  • layer composition is performed through MDP; if the current power consumption of the electronic device is lower than or equal to the preset threshold, layer composition is performed through GPU.
  • an embodiment of the present application provides an image synthesis method.
  • the execution subject of the processing procedure described in this embodiment may be an electronic device or a processor in the electronic device.
  • the specific method may include:
  • Step S110 Obtain the current power consumption of the electronic device and multiple layers of the image to be displayed.
  • Power consumption is an indicator that all electronic devices have, referring to the amount of energy consumed per unit time, and the unit can be watts (W). If the power consumption of the electronic device is too high, problems such as heat generation, slower operation speed, and rapid decrease of stored remaining power are likely to occur.
  • the electronic device displays the display interface on the display screen during the display process.
  • the display interface displayed on the display screen includes multiple layers. Before displaying, it is necessary to obtain each layer of the image to be displayed to be used for compositing each layer. It is understandable that the image to be displayed in this solution is an image displayed on the display screen, and specifically may be a display interface for display on the display screen.
  • the current power consumption of the electronic device can be obtained.
  • the power consumption of the electronic device can be mainly divided into four major blocks, Central Processing Unit (CPU)/GPU, screen, cellular/WiFi/data, and sensor.
  • the performance of the power consumption of the electronic device may be the degree of change of the remaining power of the electronic device or the GPU load rate.
  • acquiring the current power consumption of the electronic device may be acquiring the degree of change in the remaining power of the electronic device or acquiring the load of the GPU of the electronic device.
  • Step S120 Determine whether the current power consumption is higher than a preset threshold.
  • a preset threshold is preset, and the preset threshold may be a critical value of the power consumption of the electronic device. When it is greater than the critical value, the electronic device's data processing ability will be significantly reduced, which is likely to cause undesirable phenomena such as jams. When the current power consumption is less than or equal to the critical value, the electronic device is at a normal data processing level and will not cause stalls and other phenomena.
  • the preset threshold value may also be a value slightly smaller than the critical value, which is not limited in the embodiment of the present application.
  • the preset threshold can be set according to specific parameters. For example, if the parameter characterizing the power consumption of the electronic device is the amount of change in the power of the electronic device, then the corresponding power change threshold can be set as the preset threshold, and if the parameter characterizing the power consumption of the electronic device is the GPU load of the electronic device Rate, the corresponding load rate can be set as the preset threshold. Then, when the current power consumption is acquired, it can be determined whether the current power consumption is higher than the preset threshold according to the magnitude relationship between the current power consumption and the preset threshold.
  • Step S130 if yes, use a multimedia display processor (MDP, Multimedia Display Processor) to synthesize and display the plurality of layers; if not, use a graphics processor (GPU, Graphics Processing Unit) to synthesize and display the multiple layers The layers are combined and displayed.
  • MDP Multimedia Display Processor
  • GPU Graphics Processing Unit
  • the electronic device uses the GPU to synthesize image layers for a long time, it will usually cause heavy tasks on the GPU, resulting in higher power consumption; if the electronic device has been using MDP to synthesize image layers, due to its processing of layers The number is limited. When the scene contains many layers, the layer composition task cannot be completed at one time, which affects the composition speed.
  • GPU is a general-purpose graphics processor, which is stronger than MDP in graphics processing. In addition to 2D image processing, it can also do 3D image processing, special effects, etc. It can superimpose multiple layers at once, but The power consumption is relatively high.
  • the MDP is a dedicated display image processing unit, which can do conventional 2-dimensional image processing, and is mainly used for composite overlay of multiple layers.
  • the main advantage of MDP is low power consumption, but the number of layers for a performance synthesis is limited. Among them, the number of layers synthesized by MDP at one time corresponds to the number of FIFO pipes in MDP. The more layers that MDP can superimpose at one time, the more FIFO pipes are needed inside. These are more expensive circuits.
  • MDP The more layers that can be synthesized, the higher the cost.
  • the MDP has only 8 FIFO pipes at most, and can synthesize and superimpose up to 8 layers at a time.
  • an MDP may only have 4 FIFO pipes, and it can only be used at a time. Overlay 4 layers. Therefore, in electronic equipment, the maximum number of layers that MDP can synthesize at one time is limited.
  • the display interface includes multiple layers, if the MDP is used for synthesis, although the power consumption is low, it may not be possible to perform all the layers at once. Synthesis may require multiple synthesis or use other synthesis methods to synthesize together, etc., which affects the speed of synthesis.
  • the advantages and disadvantages of the GPU composite layer and the MDP composite layer can be combined.
  • the power consumption of the electronic device is higher than the preset threshold, it indicates that the current electronic device has a high power consumption.
  • the GPU method which has a strong layer synthesis ability, can be selected to synthesize the layers, thereby taking into account both the layer synthesis ability and the electronic device Power consumption.
  • the image synthesis method proposed in this application obtains the current power consumption of the electronic device and multiple layers of the image to be displayed; determines whether the current power consumption is higher than a preset threshold; if so, uses a multimedia display processor (MDP, Multimedia Display Processor) synthesizes and displays the multiple layers, if not, then synthesizes and displays the multiple layers using an image processor (GPU, Graphics Processing Unit).
  • MDP Multimedia Display Processor
  • GPU Graphics Processing Unit
  • another embodiment of the present application provides an image synthesis method.
  • this embodiment focuses on describing the difference between the layer resolution and the device resolution before layer synthesis. Coping methods, the method can include:
  • Step S210 Obtain the current screen resolution of the electronic device.
  • the screen resolution refers to the number of pixels that the monitor can display.
  • the screen resolution is the same, the higher the resolution, the finer and more delicate the display effect.
  • the screen resolution of the electronic device can be changed, and the user can change the screen resolution according to his own needs.
  • the electronic device responds to the user's operation of changing the resolution and sets the screen resolution to the resolution selected by the user.
  • the current screen resolution of the electronic device can be obtained to adjust the resolution of the image to be displayed and the screen resolution to fit.
  • the acquired screen resolution of the electronic device is the resolution currently selected by the electronic device.
  • the current resolution of the electronic device can be 2160x1080 and 1440x720. If the resolution selected by the user is 2160x1080, then the current screen resolution of the electronic device is 2160x1080.
  • Step S220 Acquire the current power consumption of the electronic device and multiple layers of the image to be displayed.
  • step S220 reference may be made to the corresponding part of the foregoing embodiment, which is not repeated here.
  • Step S230 Adjust the resolution of each of the multiple layers according to the screen resolution.
  • the resolution of any of the multiple layers of the image to be displayed does not match the screen resolution. If yes, you can adjust the resolution of each of the multiple layers separately according to the screen resolution; if not, that is, if the resolution of multiple layers is the same as the screen resolution, it is not necessary
  • the resolution adjustment is performed on the image to be displayed, that is, no resolution adjustment is performed on any layer of the image to be displayed.
  • the resolution mismatch may be a difference in resolution.
  • the resolution of a layer in the multiple layers of the image to be displayed when it is judged whether the resolution of a layer in the multiple layers of the image to be displayed does not match the screen resolution, it can be judged in turn whether the resolution of each layer matches the screen resolution. If it is determined that the resolution of a layer does not match the resolution of the screen, it can be determined that the resolution of a layer of multiple layers does not match the screen resolution.
  • the judgment when judging whether the resolution of each layer matches the screen resolution in turn, when it is judged that the resolution of a layer does not match the screen resolution, the judgment may not be continued; if it is not judged When the resolution of a layer does not match the resolution of the screen, it continues to determine whether the resolution of the next layer matches the screen resolution.
  • the resolution of each layer can be adjusted according to the screen resolution. Specifically, the resolution of the layer whose resolution is adapted to the screen resolution may be kept unchanged, and the resolution of the layer whose resolution is not adapted to the screen resolution is adjusted to be distinguished from the screen resolution. Rate adaptation, thereby reducing the amount of data processing.
  • the image to be displayed is a desktop scene
  • the layers obtained after image layering are the wallpaper layer, the status bar layer, the navigation bar layer, and the icon layer. For details, please refer to FIGS. 2 and 3. If the resolution of the current wallpaper layer matches the screen resolution, keep the resolution of the wallpaper layer unchanged.
  • the resolutions of the status bar layer, navigation bar layer and icon layer are all incompatible with the screen resolution . It is necessary to perform resolution conversion on the images of the status bar layer, the navigation bar layer and the icon layer, and convert the resolution to be adapted to the screen resolution.
  • the image display will be abnormal.
  • the actual display physical size of the image may be different from the physical size when the image is designed.
  • the physical size of the image is defined by device independent pixels (dp), and the screen resolution and the image resolution are adapted to keep the dp of the image unchanged.
  • the judgment process can be, for example, obtaining the dp value of the picture, determining the screen density according to the screen resolution, and determining whether the corresponding resolution of the dp value of the picture at the screen density is consistent with the current actual resolution of the picture, if Inconsistent, the resolution of the picture does not match the screen resolution.
  • the resolution of the layer does not fit the screen resolution
  • the resolution of the picture whose resolution does not fit the screen resolution can be adjusted to fit the screen resolution.
  • the actual resolution is adjusted to the resolution corresponding to the dp value of the picture under the screen density.
  • the pixel density (dpi, dots per inch) of the screen will increase . If the image is to be adapted to the resolution of the screen, keeping the dp of the image unchanged, the pixel size of the image, that is, the resolution, should be increased by the corresponding increase in screen density; In the case of screen resolution, when the screen resolution is reduced, the pixel density (dpi, dots per inch) of the screen is reduced.
  • the pixel density of the image is reduced by a multiple corresponding to the reduction in screen density, so that the resolution of each layer can be adapted to the screen resolution.
  • Step S240 Determine whether the current power consumption is higher than a preset threshold.
  • the current power consumption of the electronic device may be a parameter value that can reflect the power consumption of the electronic device, such as the change value of the power of the electronic device, or the GPU load rate.
  • the corresponding preset threshold may be the preset change threshold of the power or the preset load rate of the CPU. If the change value of the power is greater than the preset change threshold, it can be determined that the current power consumption is higher than the preset threshold; if the GPU load rate is greater than the preset load rate, it can be determined that the current power consumption is higher than the preset threshold .
  • Step S250 if yes, use a multimedia display processor (MDP, Multimedia Display Processor) to synthesize and display the multiple layers; if not, use an image processor (GPU, Graphics Processing Unit) to synthesize and display the multiple layers The layers are combined and displayed.
  • MDP Multimedia Display Processor
  • GPU Graphics Processing Unit
  • the MDP synthesis method can be used to synthesize the image layers, if the current If the power consumption is lower than or equal to the preset threshold, it indicates that the current electronic equipment has lower power consumption and better data processing performance, so you can use GPU synthesis to synthesize image layers.
  • the resolution of each layer obtained is adapted to the screen resolution of the display interface, and the layers can be synthesized and displayed directly.
  • Each layer is drawn with a corresponding window, the windows corresponding to the multiple layers on the display interface can be obtained, and the multiple layers are displayed on the display interface of the electronic device according to the corresponding windows.
  • the system will provide a corresponding window for each layer, which determines the display position of the layer on the display screen, and then displays the corresponding layer in the corresponding window, which will be seen on the display interface of the electronic device The corresponding desktop scene.
  • the image synthesis method proposed in this application obtains the current screen resolution of the electronic device, and if the resolution of the image to be displayed is different from the screen resolution, the resolution adjustments are performed on the images of the multiple layers, so that each The resolution of the layer is adapted to the screen resolution of the display interface. If multiple layers with a resolution adapted to the screen resolution are obtained, the resolution is maintained, and then a different one is selected according to the power consumption.
  • the way of synthesis so as to balance and balance the synthesis capability and the low power consumption of electronic devices.
  • FIG. 6 another embodiment of the present application provides an image synthesis method. Based on the foregoing embodiments, this embodiment focuses on determining whether the power consumption is higher than the
  • the process of presetting the threshold may include:
  • Step S310 Obtain a change value of the remaining power of the electronic device within a preset time period and multiple layers of the image to be displayed.
  • Step S320 It is determined whether the change value of the remaining power of the electronic device within a preset time period is greater than a preset change threshold.
  • the multiple layers of the image to be displayed refer to the corresponding part of the foregoing embodiment, which is not repeated here.
  • the power consumption can be characterized by the change value of the remaining power of the electronic device within a preset time period.
  • Obtaining the current power consumption of the electronic device may be obtaining a parameter value characterizing power consumption, and determining whether the current power consumption is higher than a preset threshold, or determining whether the obtained parameter value is higher than the preset corresponding to the parameter value Threshold.
  • obtaining the parameter value that characterizes the power consumption may be obtaining the change value of the remaining power of the electronic device. If the power consumption of the electronic device is larger, the power consumption will be lower than normal in the same time period. If the power level is higher, the change in the remaining power will be greater than normal.
  • the change value of the remaining power of the electronic device can be obtained to determine whether the power consumption of the electronic device is greater than a preset threshold.
  • a preset change threshold can be set in advance. This change threshold is the change value of the remaining power of the electronic device within a preset time period. Within the preset time period, if the change value of the remaining power of the electronic device is greater than the preset change Threshold, it can be considered that the power consumption of the electronic device is higher than the preset threshold.
  • obtaining the change value of the remaining power within a preset time period may be to obtain the remaining power of the electronic device at every preset time. For the remaining power obtained each time, if the remaining power is obtained from the last time If the difference is greater than the preset change threshold, it can be determined that the current power consumption is higher than the preset threshold.
  • the preset time period is 30s
  • the preset change threshold is 1%
  • the remaining power of the electronic device obtained for the first time is 78%
  • the remaining power of the electronic device obtained after 30s is 76%
  • the method for obtaining the remaining power of the electronic device is not limited in the embodiments of the present application. For example, it may be obtained by executing a command to obtain various information of the battery in the electronic device.
  • the obtained various information includes the remaining battery Power, so that the electronic device can obtain the remaining power of its battery.
  • step S330 if yes, use a multimedia display processor (MDP, Multimedia Display Processor) to synthesize and display the multiple layers; if not, use a graphics processor (GPU, Graphics Processing Unit) to synthesize and display the multiple layers. The layers are combined and displayed.
  • MDP Multimedia Display Processor
  • GPU Graphics Processing Unit
  • the change value of the remaining power of the electronic device is greater than the preset threshold, it can be considered that the current power consumption of the electronic device is greater than the preset threshold, indicating that the current power consumption of the electronic device is relatively high, and a synthesis method with lower power consumption can be used The obtained multiple layers are combined. Then, when the change value of the electric power of the electronic device is greater than the preset threshold, the MDP is used to synthesize and display the multiple layers to balance the power consumption of the electronic device.
  • the change value of the remaining power of the electronic device is less than or equal to the preset change threshold, it can be considered that the current power consumption of the electronic device is less than or equal to the preset threshold, indicating that the current power consumption of the electronic device is low, and the layer composition speed can be used The faster synthesis method synthesizes the acquired multiple layers. Then when the change value of the electric power of the electronic device is less than or equal to the preset threshold, the multiple layers are synthesized and displayed using the GPU synthesis method, so as to balance the synthesis capability and the low power consumption of the electronic device and balance.
  • the synthesis mode when the synthesis mode is selected according to the relationship between the change value of the remaining power and the preset change threshold, it is possible that the change value of the remaining power of the electronic device fluctuates up and down the preset change threshold, resulting in constant switching of the synthesis mode. , It will produce more power consumption due to switching the synthesis mode back and forth.
  • the change of the remaining power is less than the preset load rate
  • the GPU synthesis method is selected to synthesize the image.
  • the change of the remaining power of the electronic device within the preset time period may be due to the high power consumption of GPU synthesis If it is greater than the preset change threshold, the electronic device will switch the synthesis mode to the MDP synthesis mode.
  • the change in the remaining power of the electronic device within the preset time period is due to the lower MDP synthesis power consumption. If it is lower than the preset change threshold, the electronic device will switch the synthesis mode to the GPU synthesis mode again, thus switching the synthesis mode back and forth to generate greater power consumption.
  • a preset frequency can also be set in advance, where the preset frequency can be defined as the number of switching times of the layer synthesis mode within a preset time as the preset number, or the change in the remaining power Set the number of fluctuations up and down within the preset change threshold within a time period as the preset number of times, where the change from the preset threshold to the preset threshold is one fluctuation, and the switch from the preset threshold to the preset threshold is one fluctuation.
  • the fluctuation frequency of the change value of the remaining power is greater than the preset frequency, it can be determined that the current power consumption is higher than the preset threshold, and then select a synthesis method with lower power consumption to synthesize the layer, that is, select the MDP synthesis method
  • the layers are synthesized and maintained for a certain period of time.
  • the specific sustaining period is not limited in the embodiment of the present application.
  • a multimedia display processor may be used to synthesize multiple layers of the image to be displayed within a preset time.
  • the fluctuation frequency of the changing value of the remaining power is the number of times the changing value of the remaining power fluctuates within a preset time within a preset change threshold.
  • the fluctuation frequency of the change value of the remaining power is greater than the preset frequency, if so, it is determined that the current power consumption is higher than the preset threshold; if not, it is determined that the current power consumption is not higher than the preset threshold.
  • the preset time is 2 minutes
  • the preset change threshold is 1%
  • the preset frequency is 2. If the change value of the remaining power of the electronic device within the preset time period fluctuates around 1%, the remaining power is obtained The change value is 0.5%, 1.5%, 0.8%, 2%, 0.5%, 2%. It can be seen that the frequency of the change value of the remaining power fluctuates up and down the preset change threshold is 5, that is, the number of switching times of the layer synthesis mode If it is 5 times, which is greater than the preset frequency, it means that the current power consumption is higher than the preset threshold, and the MDP method can be used to synthesize the layers.
  • the layer is synthesized by MDP synthesis, and when the change of the remaining power is less than or equal to the preset change threshold of 1%, the layer is synthesized by the GPU
  • the change value of the remaining power will increase, and the synthesis mode will be continuously switched. Switching the synthesis mode at a high frequency within a certain period of time will also bring Additional power consumption, it can be determined that the current power consumption is higher than the preset threshold, you can select the MDP synthesis method to synthesize the layers and maintain them for a certain period of time to reduce the power consumption of the electronic device. It uses MDP to synthesize the layers within 10 minutes. The specific duration of a certain period of time can be set according to actual needs, which is not limited here.
  • the image synthesis method proposed in this application determines whether the change value of the remaining power of the electronic device within a preset time period is greater than a preset change threshold by obtaining the current power consumption of the electronic device and multiple layers of the image to be displayed, and if so, The GPU is used to synthesize and display the multiple layers; if not, the MDP is used to synthesize and display the multiple layers.
  • the power consumption of the electronic device is determined by the power consumption of the electronic device. When the power consumption of the electronic device is high, the synthesis method with lower power consumption is selected to balance the power consumption of the electronic device. When the power consumption of the electronic device is low, use A synthesis method with a strong layer synthesis ability to improve image processing performance, so as to balance and balance the layer synthesis ability of the electronic device and the low power consumption of the electronic device.
  • another embodiment of the present application provides an image synthesis method. Based on the foregoing embodiments, this embodiment focuses on determining whether the power is high when the power consumption is measured by the GPU load rate. In the process of presetting the threshold, the method may include:
  • Step S410 Obtain the current GPU load rate of the electronic device and multiple layers of the image to be displayed.
  • Step S420 Determine whether the current GPU load rate of the electronic device is greater than a preset load rate.
  • the purpose of obtaining the power consumption of the electronic device is to determine whether the current power consumption of the electronic device is too high.
  • other parameter values that can map the level of power consumption can also be used as the power consumption of the acquired electronic device and used to determine whether the power consumption is too high.
  • the parameter value that can map the level of power consumption is not limited in the embodiment of this application.
  • the power consumption of the electronic device is usually too high, such as GPU load rate, CPU load rate
  • the load rate of the GPU represents the number of tasks processed by the current GPU. The higher the load rate of the GPU, the more tasks the GPU handles.
  • the embodiment of the present application takes the GPU load rate mapping the power consumption of the electronic device as an example for specific description.
  • acquiring the current power consumption of the electronic device may be acquiring a parameter value that characterizes the power consumption of the electronic device.
  • obtaining the parameter value that characterizes the power consumption may be obtaining the current GPU load rate of the electronic device, and characterize the current overall power consumption of the electronic device according to the GPU load rate.
  • the main modules that affect the power consumption of electronic devices are GPU/CPU and screens.
  • the GPU performs image processing, close cooperation of the CPU is required for data preparation and other tasks, which will generate large power consumption, the screen will light up for content display, and will also generate large power consumption. Therefore, when the GPU load rate is high, it can be considered that the current electronic device is displaying more complex content. For example, when the electronic device is playing a battle game, it needs to refresh and display the game interface at a higher frame rate. The entire electronic device Will produce larger power consumption.
  • the power consumption of the entire electronic device can be characterized by the GPU load rate of the electronic device. If the GPU load rate of the current electronic device is high, it can indicate that the power consumption of the electronic device is high. The low rate indicates that the power consumption of the electronic device is low.
  • a preset load rate can be set in advance.
  • This preset load rate can be a critical value that affects the processing speed of the GPU, that is, when the load rate of the GPU is less than the critical value, it indicates the layer data processed by the GPU If the current power consumption of the electronic device is relatively low, it is determined that the current power consumption is less than or equal to the preset threshold. If the GPU load rate is greater than the preset load rate, it indicates that the current GPU processes more layer data and generates higher power consumption, and it can be determined that the current power consumption is higher than the preset threshold.
  • the method for the electronic device to obtain the current GPU load rate is not limited in the embodiments of the present application.
  • it may be obtained by accessing the GPU performance file to obtain the GPU parameters from the performance file, where the parameters include The current GPU load rate is calculated, so that the electronic device can obtain the current GPU load rate.
  • step S430 if yes, use a multimedia display processor (MDP, Multimedia Display Processor) to synthesize and display the multiple layers; if not, use a graphics processor (GPU, Graphics Processing Unit) to synthesize and display the multiple layers. The layers are combined and displayed.
  • MDP Multimedia Display Processor
  • GPU Graphics Processing Unit
  • the GPU load rate of the electronic device When the GPU load rate of the electronic device is greater than the preset load rate, it can be considered that the current power consumption of the electronic device is greater than the preset threshold, indicating that the current power consumption of the electronic device is high, and a synthesis method with lower power consumption can be used to obtain the Multiple layers to be combined. Then, when the GPU load rate of the electronic device is greater than the preset load rate, the MDP may be used to synthesize and display the multiple layers to balance the power consumption of the electronic device.
  • the GPU load rate of the electronic device is less than or equal to the preset load rate, it can be considered that the current power consumption of the electronic device is less than or equal to the preset threshold, indicating that the current power consumption of the electronic device is low, and the layer composition speed can be faster. The composite method of compositing multiple layers. Then, when the GPU load rate of the electronic device is less than or equal to the preset load rate, the multiple layers are synthesized and displayed using the GPU synthesis method to improve the layer synthesis ability.
  • the synthesis method when the synthesis method is selected according to the relationship between the load rate of the GPU and the preset load rate, it is possible that the GPU load rate of the electronic device fluctuates up and down the preset load rate, resulting in constant switching of the synthesis mode. More power consumption will be generated by switching the synthesis method back and forth. For example, when the GPU load rate is less than the preset load rate, the GPU synthesis method is selected to synthesize the image.
  • the GPU load rate of the electronic device may be greater than the preset load rate, and the electronic device will switch the synthesis method to In the MDP synthesis mode, after switching to the MDP synthesis mode, the load rate of the GPU is less than the preset load rate, and the electronic device will switch the synthesis mode to the GPU synthesis mode again, thereby switching the synthesis mode back and forth to generate greater power consumption.
  • a preset frequency can also be set in advance, where the preset frequency can be defined as the number of switching of the layer synthesis mode within the preset time as the preset number, or the GPU load rate at the preset time
  • the number of fluctuations of the inherent preset load rate is the preset number of times, where the change from the preset load rate to the preset load rate is one fluctuation, and the switch from the preset load rate to the preset load rate is one fluctuation.
  • the fluctuation frequency of the GPU's load rate is greater than the preset frequency, it can be determined that the current power consumption is higher than the preset threshold, and then the layer is synthesized with a lower power consumption synthesis method, that is, the MDP synthesis method is selected for
  • the layers are synthesized and maintained for a certain period of time.
  • the specific sustaining period is not limited in the embodiment of the present application.
  • a multimedia display processor may be used to synthesize multiple layers of the image to be displayed within a preset time.
  • the fluctuation frequency of the load rate of the GPU is the number of times the load rate of the GPU fluctuates within the preset load rate within a preset time.
  • the preset frequency corresponding to the load rate of the GPU and the preset frequency corresponding to the fluctuation frequency of the change value of the remaining power may be different or the same, which is not limited in the embodiment of the present application.
  • the preset time is 2 minutes
  • the preset load rate is 70%
  • the preset frequency is 2. If the load rate of the GPU of the electronic device fluctuates around 70%, the GPU load rate obtained within two minutes is in order 68%, 72%, 69%, 71%, 66%, 71%, it can be seen that the frequency of GPU load rate fluctuation is 5, that is, the number of times the layer synthesis mode is switched is greater than the preset frequency, indicating that the current power consumption is higher than If the threshold is preset, MDP can be used to synthesize the layers.
  • the layer is synthesized by MDP synthesis method, and when the GPU load rate is less than or equal to the preset load rate of 70%, the layer is synthesized by GPU synthesis method If the load rate of the GPU fluctuates at the preset load rate at this time, the synthesis mode will be switched continuously. Switching the synthesis mode at a high frequency within a certain period of time will also bring additional power consumption, so that the current power can be determined If the consumption is higher than the preset threshold, you can choose the MDP synthesis method to synthesize the layers and maintain them for a certain period of time to reduce the power consumption of the electronic device.
  • the maintenance for a certain period of time can be to use MDP to synthesize the layers within 10 minutes ,
  • the specific length of maintaining a certain time can be set according to actual needs, which is not limited here.
  • the image synthesis method proposed in this application determines whether the GPU load rate of the electronic device is greater than the preset load rate by acquiring the current power consumption of the electronic device and the multiple layers of the image to be displayed. The multiple layers are synthesized and displayed; if not, the multiple layers are synthesized and displayed using the GPU.
  • the power consumption of the electronic device is determined by the GPU load rate of the electronic device. When the power consumption of the electronic device is high, the synthesis method with lower power consumption is selected to balance the power consumption of the electronic device. When the power consumption of the electronic device is low, Choose a synthesis method with strong layer synthesis ability to improve image processing performance, so as to balance and balance the layer synthesis ability of the electronic device and the low power consumption of the electronic device.
  • FIG. 8 shows an image synthesis device 500 provided by an embodiment of the present application.
  • the device 500 includes an acquisition module 510, a judgment module 520, and a synthesis module 530.
  • the obtaining module 510 is used to obtain the current power consumption of the electronic device and the multiple layers of the image to be displayed; the judgment module 520 is used to judge whether the current power consumption is higher than a preset threshold; the synthesis module 530 is used to, if so, Then use a multimedia display processor (MDP, Multimedia Display Processor) to synthesize and display the multiple layers, if not, use a graphics processor (GPU, Graphics Processing Unit) to synthesize and display the multiple layers display.
  • MDP Multimedia Display Processor
  • GPU Graphics Processing Unit
  • the obtaining module 510 is also used to obtain the current screen resolution of the electronic device; after obtaining the current power consumption of the electronic device and multiple layers of the image to be displayed, it is also used to obtain the current screen resolution according to the screen resolution. The resolution adjustment is performed on each of the multiple layers respectively.
  • the acquiring module 510 is further configured to keep the resolution of the layer whose resolution is adapted to the screen resolution unchanged, and adjust the resolution of the layer whose resolution does not match the screen resolution. To adapt to the screen resolution.
  • the determining module 520 is also used to determine whether the change value of the remaining power of the electronic device within a preset time period is greater than a preset change threshold, and if it is greater than, determine that the current power consumption is higher than the preset threshold.
  • the judgment module 520 is also configured to obtain the remaining power of the electronic device at intervals of a preset time; for the remaining power acquired each time, if the difference between the remaining power acquired at the last preset time is greater than According to the preset change threshold, it is determined that the current power consumption is higher than the preset threshold.
  • the determining module 520 is also used to determine whether the current GPU load rate of the electronic device is greater than a preset load rate; if it is greater, then determine that the current power consumption is higher than a preset threshold.
  • composition module 530 is further configured to obtain windows corresponding to the multiple layers on the display interface, and display the multiple layers on the display interface of the electronic device according to the corresponding windows.
  • the image synthesis method obtains the current power consumption of the electronic device and multiple layers of the image to be displayed; determines whether the current power consumption is higher than a preset threshold; if so, uses multimedia display A processor (MDP, Multimedia Display Processor) synthesizes and displays the multiple layers, and if not, uses a graphics processor (GPU, Graphics Processing Unit) to synthesize and display the multiple layers.
  • MDP Multimedia Display Processor
  • GPU Graphics Processing Unit
  • the coupling or direct coupling or communication connection between the displayed or discussed modules may be through some interfaces.
  • the indirect coupling or communication connection of the devices or modules may be electrical, Mechanical or other forms.
  • each functional module in each embodiment of the present application may be integrated into one processing module, or each module may exist alone physically, or two or more modules may be integrated into one module.
  • the above-mentioned integrated modules can be implemented in the form of hardware or software functional modules.
  • the electronic device 600 may be an electronic device capable of running application programs, such as a smart phone, a tablet computer, or an e-book.
  • the electronic device 600 in this application may include one or more of the following components: a processor 610, a memory 620, and one or more application programs, where one or more application programs may be stored in the memory 620 and configured to be configured by One or more processors 610 execute, and one or more programs are configured to execute the methods described in the foregoing method embodiments.
  • the processor 610 may include one or more processing cores.
  • the processor 610 uses various interfaces and lines to connect various parts of the entire electronic device 600, and executes by running or executing instructions, programs, code sets, or instruction sets stored in the memory 620, and calling data stored in the memory 620.
  • the processor 610 may use at least one of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA).
  • DSP Digital Signal Processing
  • FPGA Field-Programmable Gate Array
  • PDA Programmable Logic Array
  • the processor 610 may be integrated with one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), a modem, and the like.
  • the CPU mainly processes the operating system, user interface, and application programs; the GPU is used for rendering and drawing of display content; the modem is used for processing wireless communication. It is understandable that the above-mentioned modem may not be integrated into the processor 610, but may be implemented by a communication chip alone.
  • the memory 620 may include random access memory (RAM) or read-only memory (Read-Only Memory).
  • the memory 620 may be used to store instructions, programs, codes, code sets or instruction sets.
  • the memory 620 may include a program storage area and a data storage area, where the program storage area may store instructions for implementing the operating system and instructions for implementing at least one function (such as touch function, sound playback function, image playback function, etc.) , Instructions for implementing the following method embodiments, etc.
  • the storage data area can also store data created by the electronic device 600 during use (such as phone book, audio and video data, chat record data) and the like.
  • FIG. 10 shows a structural block diagram of a computer-readable storage medium provided by an embodiment of the present application.
  • the computer-readable storage medium 700 stores program codes, and the program codes can be invoked by a processor to execute the methods described in the foregoing method embodiments.
  • the computer-readable storage medium 700 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read Only Memory), EPROM, hard disk, or ROM.
  • the computer-readable storage medium 700 includes a non-transitory computer-readable storage medium.
  • the computer-readable storage medium 700 has a storage space for the program code 710 for executing any method steps in the above methods. These program codes can be read out from or written into one or more computer program products.
  • the program code 710 may be compressed in a suitable form, for example.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Controls And Circuits For Display Device (AREA)
  • Control Of Indicators Other Than Cathode Ray Tubes (AREA)

Abstract

Disclosed in the present application are an image synthesis method and apparatus, an electronic device, and a storage medium. The method comprises: obtaining current power consumption of an electronic device and multiple image layers of an image to be displayed; determining whether the current power consumption is above a preset threshold; if yes, using a multimedia display processor to synthesize the multiple image layers and display same, and if not, using a graphics processing unit to synthesize the multiple image layers and display same. Different image layer synthesis modes are selected according to the current power consumption of an electronic device, if the power consumption of the electronic device is high, a low energy consumption synthesis mode is selected to balance the power consumption of the electronic device, and if the power consumption of the electronic device is low, a synthesis mode having high synthesis capability is selected to improve the image processing performance.

Description

图像合成方法、装置、电子设备及存储介质Image synthesis method, device, electronic equipment and storage medium
本申请要求于2019年7月17日提交的申请号为201910647109.7的中国专利申请的优先权,在此通过引用将其全部内容并入本文。This application claims the priority of the Chinese patent application with the application number 201910647109.7 filed on July 17, 2019, and the entire content of which is incorporated herein by reference.
技术领域Technical field
本申请涉及图像处理技术领域,更具体地,涉及一种图像合成方法、装置、电子设备及存储介质。This application relates to the field of image processing technology, and more specifically, to an image synthesis method, device, electronic equipment, and storage medium.
背景技术Background technique
随着电子技术的发展,具有图像显示功能的电子设备(如手机或平板电脑等)越来越多,电子设备的显示界面通常有多个显示图层,通过对多个显示图层进行合成显示在电子设备上。With the development of electronic technology, there are more and more electronic devices (such as mobile phones or tablet computers) with image display functions. The display interface of electronic devices usually has multiple display layers, which are displayed by combining multiple display layers. On electronic devices.
通常,电子设备在合成图层时,难以对电子设备的图层合成能力和电子设备的功耗进行兼顾,影响电子设备的使用体验。Generally, when an electronic device synthesizes layers, it is difficult to balance the layer synthesis capability of the electronic device and the power consumption of the electronic device, which affects the use experience of the electronic device.
发明内容Summary of the invention
本申请提出了一种图像合成方法、装置、电子设备及存储介质,以解决图像合成中图层合成能力和电子设备的功耗难以兼顾的问题。This application proposes an image synthesis method, device, electronic device, and storage medium to solve the problem that the layer synthesis capability and the power consumption of the electronic device are difficult to balance in image synthesis.
第一方面,本申请实施例提供了一种图像合成方法,该方法包括:获取电子设备的当前功耗以及待显示图像的多个图层;判断所述当前功耗是否高于预设阈值;若是,则利用多媒体显示处理器(MDP,Multimedia Display Processor)对所述多个图层进行合成并显示,若否,则利用图形处理器(GPU,Graphics Processing Unit)对所述多个图层进行合成并显示。In a first aspect, an embodiment of the present application provides an image synthesis method, which includes: obtaining the current power consumption of an electronic device and multiple layers of an image to be displayed; determining whether the current power consumption is higher than a preset threshold; If yes, use a multimedia display processor (MDP, Multimedia Display Processor) to synthesize and display the multiple layers; if not, use a graphics processor (GPU, Graphics Processing Unit) to perform the multiple layers Composite and display.
第二方面,本申请实施例提供了一种图像合成的装置,该装置包括:获取模块,用于获取电子设备的当前功耗以及待显示图像的多个图层;判断模块,用于判断所述当前功耗是否高于预设阈值;合成模块,用于若是,则利用多媒体显示处理器(MDP,Multimedia Display Processor)对所述多个图层进行合成并显示,若否,则利用图形处理器(GPU,Graphics Processing Unit)对所述多个图层进行合成并显示。In the second aspect, an embodiment of the present application provides an image synthesis device, which includes: an acquisition module for acquiring the current power consumption of an electronic device and multiple layers of an image to be displayed; a judgment module for judging Whether the current power consumption is higher than the preset threshold; the synthesis module is used to synthesize and display the multiple layers by using a multimedia display processor (MDP, Multimedia Display Processor) if so; if not, use graphics processing A GPU (Graphics Processing Unit) synthesizes and displays the multiple layers.
第三方面,本申请实施例提供了一种电子设备,该电子设备包括一个或多个处理器;存储器;一个或多个应用程序,其中所述一个或多个应用程序被存储在所述存储器中并被配置为由所述一个或多个处理器执行,所述一个或多个程序配置用于执行如上述应用于电子设备的方法。In a third aspect, an embodiment of the present application provides an electronic device that includes one or more processors; a memory; one or more application programs, wherein the one or more application programs are stored in the memory And is configured to be executed by the one or more processors, and the one or more programs are configured to execute the method applied to the electronic device as described above.
第四方面,本申请实施列提供一种计算机可读存储介质,所述计算机可读存储介质中存储有程序代码,其中,在所述程序代码运行时执行上述的方法。In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium in which program code is stored, wherein the above-mentioned method is executed when the program code is running.
附图说明Description of the drawings
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly describe the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings needed in the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
图1示出了本申请实施例提供的图像处理的逻辑框架图。Fig. 1 shows a logical framework diagram of image processing provided by an embodiment of the present application.
图2示出了本申请实施例提供的桌面显示界面的示意图。Figure 2 shows a schematic diagram of a desktop display interface provided by an embodiment of the present application.
图3示出了本申请实施例提供的桌面显示界面的各个图层的示意图。Fig. 3 shows a schematic diagram of various layers of a desktop display interface provided by an embodiment of the present application.
图4示出了本申请一个实施例提供的图像合成方法的流程图。Fig. 4 shows a flowchart of an image synthesis method provided by an embodiment of the present application.
图5示出了本申请另一个实施例提供的图像合成方法的流程图。Fig. 5 shows a flowchart of an image synthesis method provided by another embodiment of the present application.
图6示出了本申请又一个实施例提供的图像合成方法的流程图。Fig. 6 shows a flowchart of an image synthesis method provided by another embodiment of the present application.
图7示出了本申请再一个实施例提供的图像合成方法的流程图。Fig. 7 shows a flowchart of an image synthesis method provided by still another embodiment of the present application.
图8示出了本申请一个实施例提供的图像合成装置的功能模块图。Fig. 8 shows a functional block diagram of an image synthesis device provided by an embodiment of the present application.
图9示出了本申请实施例提出的用于执行根据本申请实施例的图像合成方法的电子设备的结构框图。Fig. 9 shows a structural block diagram of an electronic device proposed by an embodiment of the present application for executing the image synthesis method according to the embodiment of the present application.
图10示出了本申请实施例提供的用于保存或者携带实现根据本申请实施例的图像合成方法的程序代码的存储介质。FIG. 10 shows a storage medium provided by an embodiment of the present application for storing or carrying program code for implementing the image synthesis method according to the embodiment of the present application.
具体实施方式Detailed ways
为了使本技术领域的人员更好地理解本申请方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述。In order to enable those skilled in the art to better understand the solutions of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.
应用程序(application)可以通过窗口管理器(Windows manager)创建窗口(window),窗口管理器为每一个窗口创建绘图表面(Surface)用于在上面绘制各种需要显示的元素,每个surface对应一个图层,即可以在每个surface绘制一个图层。An application can create a window through the Windows manager. The window manager creates a drawing surface for each window to draw various elements that need to be displayed on it, and each surface corresponds to one Layer, that is, a layer can be drawn on each surface.
在显示界面(如Activity)中,可以包括多个图层,如导航栏、状态栏、程序界面等。每个图层在合成之前进行渲染。即,每个图层在相应的surface进行绘制,即在每个surface进行对应的图层的绘制,具体可以通过硬件加速渲染器(HWUI)和/或Skia图形库等在surface的画布(cavas)进行图层绘制。In the display interface (such as Activity), multiple layers can be included, such as navigation bar, status bar, program interface, etc. Each layer is rendered before composition. That is, each layer is drawn on the corresponding surface, that is, the corresponding layer is drawn on each surface. Specifically, you can use the hardware accelerated renderer (HWUI) and/or Skia graphics library to draw on the surface's canvas (cavas) Perform layer drawing.
系统(System)再使用图层传递模块(Surface Flinger)服务将各个surface进行合成,即将各个图层进行合成。其中,SurfaceFlinger服务运行在系统进程中,用来统一管理系统的帧缓冲区,SurfaceFlinger获取所有的图层,可以使用图像处理器(GPU,Graphics Processing Unit)对所有或者部分图层进行合成,将合成的结果保存到帧缓存区(FrameBuffer)。硬件图层混合器(HWC,Hardware composer)可以将SurfaceFlinger通过GPU合成的结果与其他图层一起合成,具体的,如图1所示,HWC可以调用多媒体显示处理器(MDP,Multimedia Display Processor)进行图层的合成,最终形成BufferQueue中的一个Buffer,再在显示驱动的作用下,将Buffer中合成的图像用于显示。其中,GPU以及HWC分别对哪一部分图层进行合成的具体合成策略,可以根据实际情况确定。The system then uses the layer transfer module (Surface Flinger) service to synthesize each surface, that is, synthesize each layer. Among them, the SurfaceFlinger service runs in the system process and is used to uniformly manage the frame buffer of the system. SurfaceFlinger obtains all the layers, and can use the graphics processor (GPU, Graphics Processing Unit) to synthesize all or part of the layers. The result is saved to the frame buffer (FrameBuffer). The hardware layer mixer (HWC, Hardware Composer) can synthesize the results of SurfaceFlinger through GPU synthesis with other layers. Specifically, as shown in Figure 1, HWC can call the Multimedia Display Processor (MDP, Multimedia Display Processor). The composition of the layers finally forms a Buffer in the BufferQueue, and then under the action of the display driver, the image synthesized in the Buffer is used for display. Among them, the specific synthesis strategy of which part of the layer is synthesized by the GPU and the HWC can be determined according to the actual situation.
电子设备的显示屏可以进行显示界面的显示,在显示界面中可能包括多个图层,即显示界面由多个图层合成。其中,每一个图层都是由许多像素组成的,各个图层通过叠加的方式组成整个图像,形成电子设备的显示界面。图层可以将页面上的元素精确定位,图层中可以加入文本、图片、表格、插件,也可以在里面再嵌套图层。对于图层以及图层合成的 图像,可以通俗地理解为,图层就像是含有文字或图形等元素的胶片,一张张图层按指定的顺序叠放在一起,组合起来形成的最终图像效果,就是由图层组合形成的图像,例如电子设备的显示界面。当然,可以理解的是,图层并不是真的胶片,上述描述只是为了便于理解的比喻。例如图2所示的电子设备的桌面显示界面100,包括的多个图层,分别为状态栏101、导航栏102、墙纸103以及图标层104。The display screen of the electronic device can display the display interface, and the display interface may include multiple layers, that is, the display interface is composed of multiple layers. Among them, each layer is composed of many pixels, and each layer is superimposed to form the entire image to form the display interface of the electronic device. Layers can accurately locate elements on the page. Text, pictures, tables, plug-ins can be added to the layer, and layers can also be nested inside. For layers and images synthesized by layers, it can be generally understood that a layer is like a film containing elements such as text or graphics. The layers are stacked in a specified order to form the final image. The effect is the image formed by the combination of layers, such as the display interface of an electronic device. Of course, it is understandable that the layers are not real films, and the above description is just a metaphor for easy understanding. For example, the desktop display interface 100 of the electronic device shown in FIG. 2 includes multiple layers, including a status bar 101, a navigation bar 102, a wallpaper 103, and an icon layer 104.
为了使显示界面在显示屏进行显示,需要将显示界面的各个图层进行合成。例如将图3所示的状态栏101、导航栏102、墙纸103以及图标层104合成为图2所示的显示界面100。通常的,系统可以利用GPU进行图像图层的合成,其合成方式可以是,根据各个图层在显示界面中的位置确定各个图层之间的位置关系,将各个图层的内容用GPU渲染到暂存缓冲区中,使在缓冲区中,各个图层间的位置关系为在显示界面中的位置关系,最后将暂存缓冲区传送到显示硬件,使各个图层在显示屏显示时,图层的显示位置为其在显示界面中的位置。然而在使用GPU进行图像图层的处理时,GPU在对图层进行合成时,合成能力较强,即对合成图层的数量没有限制,但同时会产生较大的功耗,缩短电子设备的待机时长,从而影响用户的使用体验。In order to display the display interface on the display screen, it is necessary to synthesize the layers of the display interface. For example, the status bar 101, the navigation bar 102, the wallpaper 103, and the icon layer 104 shown in FIG. 3 are synthesized into the display interface 100 shown in FIG. 2. Generally, the system can use the GPU to synthesize image layers. The synthesis method can be to determine the positional relationship between each layer according to the position of each layer in the display interface, and render the content of each layer to the GPU. In the temporary storage buffer, the positional relationship between the various layers in the buffer is the positional relationship in the display interface. Finally, the temporary storage buffer is transmitted to the display hardware, so that when each layer is displayed on the screen, the image The display position of the layer is its position in the display interface. However, when the GPU is used to process image layers, when the GPU is synthesizing layers, it has a strong synthesis ability, that is, there is no limit to the number of synthesized layers, but at the same time, it will generate greater power consumption and reduce the cost of electronic equipment. The standby time is long, thus affecting the user experience.
发明人经过研究发现,还可以通过多媒体显示处理器(MDP,Multimedia Display Processor)的硬件合成机制对图层进行合成。MDP硬件合成机制是通过HWC调用MDP硬件模块进行合成,这种合成方式功耗低,速度快,但对处理的图层数量有限制。在图层的数量超过其所能处理的数量时,不能完成图层合成的任务,从而影响在显示屏上的显示。The inventor found through research that the layers can also be synthesized through the hardware synthesis mechanism of the Multimedia Display Processor (MDP). The MDP hardware synthesis mechanism uses the HWC to call the MDP hardware module for synthesis. This synthesis method has low power consumption and high speed, but has a limit on the number of layers to be processed. When the number of layers exceeds the number that can be processed, the task of layer synthesis cannot be completed, which affects the display on the screen.
也就是说,若通过GPU图像进行图层合成,虽然相对于MDP合成方式,对图层的处理数量没有限制,但功耗较高,从而影响电子设备的运行速度以及待机时间等;若通过MDP进行图层合成,虽然功耗较低,但能处理的图层数量有限,不能处理过多图层的场景,则无法一次性完成图层合成任务,需要将一个显示界面的图层分多次进行合成,影响整体合成速度。因此,发明人提出了本申请中图像合成方法、装置、电子设备及存储介质作为一种合成策略,根据电子设备当前功耗的高低选择进行图层合成的器件。若电子设备的当前功耗高于预设阈值,则通过MDP进行图层合成;若电子设备的当前功耗低于或等于预设阈值,则通过GPU进行图层合成。根据电子设备的当前功耗选择不同的图层合成方式,在电子设备功耗较高的情况下,选用耗能低的合成方式,以平衡电子设备的功耗,在电子设备功耗较低的情况下,选用图层合成能力较强的合成方式,从而兼顾图层合成能力和电子设备的功耗。That is to say, if you use GPU image for layer synthesis, although there is no limit to the number of layers processed compared to MDP synthesis, the power consumption is higher, which affects the operating speed and standby time of electronic devices; if you use MDP For layer composition, although the power consumption is low, the number of layers that can be processed is limited. If the scene cannot be processed with too many layers, the layer composition task cannot be completed at one time. It is necessary to divide the layers of a display interface into multiple times Perform synthesis, which affects the overall synthesis speed. Therefore, the inventor proposes the image synthesis method, device, electronic equipment, and storage medium in this application as a synthesis strategy to select the device for layer synthesis according to the current power consumption of the electronic equipment. If the current power consumption of the electronic device is higher than the preset threshold, layer composition is performed through MDP; if the current power consumption of the electronic device is lower than or equal to the preset threshold, layer composition is performed through GPU. Choose different layer synthesis methods according to the current power consumption of the electronic device. In the case of high power consumption of the electronic device, select the synthesis method with low energy consumption to balance the power consumption of the electronic device. In this case, a synthesis method with a strong layer synthesis capability is selected so as to take into account both the layer synthesis capability and the power consumption of the electronic device.
下面将对本申请实施例进行详细的说明。The embodiments of the present application will be described in detail below.
请参阅图4,本申请实施例提供了一种图像合成方法,本实施例描述的处理流程的执行主体可以是电子设备,可以是电子设备中的处理器。具体的该方法可以包括:Referring to FIG. 4, an embodiment of the present application provides an image synthesis method. The execution subject of the processing procedure described in this embodiment may be an electronic device or a processor in the electronic device. The specific method may include:
步骤S110,获取电子设备的当前功耗以及待显示图像的多个图层。Step S110: Obtain the current power consumption of the electronic device and multiple layers of the image to be displayed.
电子设备在运行过程中都会产生功耗。其中,功耗是所有的电子设备都有的一个指标,指的是在单位时间中所消耗的能源的数量,单位可以是瓦特(W)。若电子设备的功耗过高,则容易产生发热、运行速度变慢以及存储的剩余电量快速降低等问题。Electronic equipment will generate power consumption during operation. Among them, power consumption is an indicator that all electronic devices have, referring to the amount of energy consumed per unit time, and the unit can be watts (W). If the power consumption of the electronic device is too high, problems such as heat generation, slower operation speed, and rapid decrease of stored remaining power are likely to occur.
另外,电子设备在显示过程中,在显示屏进行显示界面的显示。显示屏显示的显示界面作为待显示图像,包括多个图层。在显示之前,需要先获取待显示图像的各个图层,以 用于对各个图层进行合成。可以理解的,该方案中待显示图像为显示于显示屏的图像,具体可以为用于显示在显示屏的显示界面。In addition, the electronic device displays the display interface on the display screen during the display process. As the image to be displayed, the display interface displayed on the display screen includes multiple layers. Before displaying, it is necessary to obtain each layer of the image to be displayed to be used for compositing each layer. It is understandable that the image to be displayed in this solution is an image displayed on the display screen, and specifically may be a display interface for display on the display screen.
由于在图层合成过程中会产生功耗,因此,在本申请实施例中,可以获取电子设备的当前功耗。具体的,若电子设备为移动终端,则电子设备的功耗主要可以分为四大块,中央处理器(Central Processing Unit,CPU)/GPU,屏幕,蜂窝/WiFi/数据以及传感器等。电子设备的功耗的表现可以是电子设备的剩余电量的变化程度或是GPU负载率等。由此,获取电子设备的当前功耗可以是获取电子设备的剩余电量变化程度或者获取电子设备的GPU的负载等。Since power consumption will be generated during the layer synthesis process, in the embodiment of the present application, the current power consumption of the electronic device can be obtained. Specifically, if the electronic device is a mobile terminal, the power consumption of the electronic device can be mainly divided into four major blocks, Central Processing Unit (CPU)/GPU, screen, cellular/WiFi/data, and sensor. The performance of the power consumption of the electronic device may be the degree of change of the remaining power of the electronic device or the GPU load rate. Thus, acquiring the current power consumption of the electronic device may be acquiring the degree of change in the remaining power of the electronic device or acquiring the load of the GPU of the electronic device.
步骤S120,判断所述当前功耗是否高于预设阈值。Step S120: Determine whether the current power consumption is higher than a preset threshold.
其中,预先设置有预设阈值,所述预设阈值可以是电子设备功耗的临界值,在大于该临界值时,电子设备对数据的处理能力会明显下降,容易引起卡顿等不良现象,在所述当前功耗小于或等于临界值时,电子设备处于正常的数据处理水平,不会造成卡顿等现象。当然,该预设阈值也可以是比该临界值略小的值,在本申请实施例中并不限定。Wherein, a preset threshold is preset, and the preset threshold may be a critical value of the power consumption of the electronic device. When it is greater than the critical value, the electronic device's data processing ability will be significantly reduced, which is likely to cause undesirable phenomena such as jams. When the current power consumption is less than or equal to the critical value, the electronic device is at a normal data processing level and will not cause stalls and other phenomena. Of course, the preset threshold value may also be a value slightly smaller than the critical value, which is not limited in the embodiment of the present application.
由于表征电子设备的功耗的参数较多,因此该预设阈值可以根据具体的参数进行设定。例如,若表征电子设备的功耗的参数为电子设备的电量的变化量,则可以设定对应的电量变化阈值作为所述预设阈值,若表征电子设备的功耗的参数为电子设备GPU负载率,则可以设定对应的负载率作为所述预设阈值。那么,在获取到所述当前功耗时,则可以根据当前功耗与预设阈值的大小关系,判断所述当前功耗是否高于预设阈值。Since there are many parameters that characterize the power consumption of the electronic device, the preset threshold can be set according to specific parameters. For example, if the parameter characterizing the power consumption of the electronic device is the amount of change in the power of the electronic device, then the corresponding power change threshold can be set as the preset threshold, and if the parameter characterizing the power consumption of the electronic device is the GPU load of the electronic device Rate, the corresponding load rate can be set as the preset threshold. Then, when the current power consumption is acquired, it can be determined whether the current power consumption is higher than the preset threshold according to the magnitude relationship between the current power consumption and the preset threshold.
步骤S130,若是,则利用多媒体显示处理器(MDP,Multimedia Display Processor)对所述多个图层进行合成并显示,若否,则利用图形处理器(GPU,Graphics Processing Unit)对所述多个图层进行合成并显示。Step S130, if yes, use a multimedia display processor (MDP, Multimedia Display Processor) to synthesize and display the plurality of layers; if not, use a graphics processor (GPU, Graphics Processing Unit) to synthesize and display the multiple layers The layers are combined and displayed.
在电子设备中,可以有多种方式对多个图层进行合成并显示,例如,在使用Android系统的电子设备中,对图像的合成可以有两种方式,一种是利用图形处理器(GPU,Graphics Processing Unit)对所述多个图层进行合成并显示,即GPU合成方式;另一种是利用多媒体显示处理器(MDP,Multimedia Display Processor)对图层进行合成并显示,即MDP合成方式。In electronic devices, there can be multiple ways to synthesize and display multiple layers. For example, in electronic devices using the Android system, there are two ways to synthesize images. One is to use a graphics processor (GPU , Graphics Processing Unit) synthesize and display the multiple layers, that is, the GPU synthesis method; the other is to use the multimedia display processor (MDP, Multimedia Display Processor) to synthesize and display the layers, that is, the MDP synthesis method .
若电子设备长期使用GPU进行图像图层的合成时,通常会导致GPU的任务繁重,产生较高的功耗;若电子设备一直采用MDP进行图像图层的合成时,由于其对处理的图层数量有限制,在包含较多图层的场景时,则不能一次性完成图层合成任务,影响合成速度。If the electronic device uses the GPU to synthesize image layers for a long time, it will usually cause heavy tasks on the GPU, resulting in higher power consumption; if the electronic device has been using MDP to synthesize image layers, due to its processing of layers The number is limited. When the scene contains many layers, the layer composition task cannot be completed at one time, which affects the composition speed.
具体的,GPU是一个通用的图形处理器,在图形处理上比MDP功能强,除了能够做2维图像处理,还能做3维图像处理、特效等,一次性可以叠加多个图层,但是功耗相对较高。而MDP是一个专用的显示图像处理单元,能够做常规的2维图像处理,主要用于做多个图层的合成叠加。MDP的主要优点是功耗低,但是一次性能合成的图层数量有限。其中,MDP一次性能合成的图层数量与MDP中FIFO管道数量对应,MDP一次性能够叠加的图层越多,在其内部需要更多的FIFO管道,这都是比较昂贵的电路,因此,MDP可以合成的图层数量越多,成本越高。在某些厂商的高端平台中,MDP也最多只有8个FIFO管道,一次性最多能够合成叠加8个图层,而在中低端平台,一个MDP可能只有4个FIFO管道,一次性最多只能够叠加4个图层。因此,在电子设备中,MDP一次性最多能合成的图 层数量有限,在显示界面包括多个图层时,若使用MDP进行合成,虽然功耗较低,但是可能无法一次将所有图层进行合成,可能需要分多次合成或者借助其他合成方式共同合成等,影响合成的速度。Specifically, GPU is a general-purpose graphics processor, which is stronger than MDP in graphics processing. In addition to 2D image processing, it can also do 3D image processing, special effects, etc. It can superimpose multiple layers at once, but The power consumption is relatively high. The MDP is a dedicated display image processing unit, which can do conventional 2-dimensional image processing, and is mainly used for composite overlay of multiple layers. The main advantage of MDP is low power consumption, but the number of layers for a performance synthesis is limited. Among them, the number of layers synthesized by MDP at one time corresponds to the number of FIFO pipes in MDP. The more layers that MDP can superimpose at one time, the more FIFO pipes are needed inside. These are more expensive circuits. Therefore, MDP The more layers that can be synthesized, the higher the cost. In the high-end platforms of some manufacturers, the MDP has only 8 FIFO pipes at most, and can synthesize and superimpose up to 8 layers at a time. On the low-end platform, an MDP may only have 4 FIFO pipes, and it can only be used at a time. Overlay 4 layers. Therefore, in electronic equipment, the maximum number of layers that MDP can synthesize at one time is limited. When the display interface includes multiple layers, if the MDP is used for synthesis, although the power consumption is low, it may not be possible to perform all the layers at once. Synthesis may require multiple synthesis or use other synthesis methods to synthesize together, etc., which affects the speed of synthesis.
由此,可以结合GPU合成图层和MDP合成图层的优缺点,在所述电子设备的功耗高于预设阈值时,表明当前的电子设备的功耗较高,为了降低功耗,减少功耗过高对电子设备运行速度以及电量的影响,则可以选用功耗较低的合成方式即MDP方式对图层进行合成,以平衡电子设备的功耗;在所述电子设备的功耗低于或等于所述预设阈值时,表明当前电子设备的功耗不高,可以选用图层合成能力较强的合成方式即GPU方式对图层进行合成,从而兼顾图层合成能力和电子设备的功耗。Therefore, the advantages and disadvantages of the GPU composite layer and the MDP composite layer can be combined. When the power consumption of the electronic device is higher than the preset threshold, it indicates that the current electronic device has a high power consumption. In order to reduce power consumption, reduce If too high power consumption affects the operating speed and power of the electronic device, you can choose a synthesis method with lower power consumption, that is, the MDP method, to synthesize the layers to balance the power consumption of the electronic device; the power consumption of the electronic device is low When it is equal to or equal to the preset threshold value, it indicates that the current electronic device has low power consumption. The GPU method, which has a strong layer synthesis ability, can be selected to synthesize the layers, thereby taking into account both the layer synthesis ability and the electronic device Power consumption.
本申请提出的图像合成方法,通过获取电子设备的当前功耗以及待显示图像的多个图层;判断所述当前功耗是否高于预设阈值;若是,则利用多媒体显示处理器(MDP,Multimedia Display Processor)对所述多个图层进行合成并显示,若否,则利用图像处理器(GPU,Graphics Processing Unit)对所述多个图层进行合成并显示。根据电子设备的当前功耗选择不同的图层合成方式,在电子设备功耗较高的情况下,选用功耗低的合成方式,以平衡电子设备的功耗,在电子设备功耗较低的情况下,选用图层合成能力较强的合成方式,从而兼顾图层合成能力和电子设备的功耗。The image synthesis method proposed in this application obtains the current power consumption of the electronic device and multiple layers of the image to be displayed; determines whether the current power consumption is higher than a preset threshold; if so, uses a multimedia display processor (MDP, Multimedia Display Processor) synthesizes and displays the multiple layers, if not, then synthesizes and displays the multiple layers using an image processor (GPU, Graphics Processing Unit). Choose different layer synthesis methods according to the current power consumption of the electronic device. In the case of high power consumption of the electronic device, select the synthesis method with low power consumption to balance the power consumption of the electronic device. In this case, a synthesis method with a strong layer synthesis capability is selected so as to take into account both the layer synthesis capability and the power consumption of the electronic device.
请参阅图5,本申请另一实施例提供了一种图像合成方法,本实施例在前述实施例的基础上,重点描述了在图层合成前,对于图层分辨率与设备分辨率不同的应对处理方式,该方法可以包括:Referring to FIG. 5, another embodiment of the present application provides an image synthesis method. On the basis of the foregoing embodiment, this embodiment focuses on describing the difference between the layer resolution and the device resolution before layer synthesis. Coping methods, the method can include:
步骤S210,获取电子设备当前的屏幕分辨率。Step S210: Obtain the current screen resolution of the electronic device.
其中,屏幕分辨率是指显示器所能显示的像素的多少,屏幕大小一样时,分辨率越高,显示效果就越精细和细腻。通常,电子设备的屏幕分辨率可以更改,用户可以根据自身的需求更改屏幕分辨率,电子设备响应于用户更改分辨率的操作,将屏幕分辨率设置为用户选定的分辨率。Among them, the screen resolution refers to the number of pixels that the monitor can display. When the screen size is the same, the higher the resolution, the finer and more delicate the display effect. Generally, the screen resolution of the electronic device can be changed, and the user can change the screen resolution according to his own needs. The electronic device responds to the user's operation of changing the resolution and sets the screen resolution to the resolution selected by the user.
在所述屏幕分辨率与待显示图像的分辨率不适配时,待显示图像则不能在电子设备上进行正常的显示,由此,为了避免待显示图像由于与屏幕分辨率不适配而异常显示,可以获取电子设备当前的屏幕分辨率,以将待显示图像的分辨率与屏幕分辨率调整到适配。其中,获取的电子设备的屏幕分辨率为电子设备当前所选用的分辨率。例如,电子设备当前的分辨率可以选择2160x1080以及1440x720,若用户所选择的分辨率为2160x1080,那么获取到电子设备当前的屏幕分辨率则为2160x1080。When the screen resolution does not match the resolution of the image to be displayed, the image to be displayed cannot be displayed normally on the electronic device. Therefore, in order to prevent the image to be displayed from being abnormal due to the incompatibility with the screen resolution For display, the current screen resolution of the electronic device can be obtained to adjust the resolution of the image to be displayed and the screen resolution to fit. Wherein, the acquired screen resolution of the electronic device is the resolution currently selected by the electronic device. For example, the current resolution of the electronic device can be 2160x1080 and 1440x720. If the resolution selected by the user is 2160x1080, then the current screen resolution of the electronic device is 2160x1080.
步骤S220,获取电子设备的当前功耗以及待显示图像的多个图层。Step S220: Acquire the current power consumption of the electronic device and multiple layers of the image to be displayed.
步骤S220可参照前述实施例对应部分,在此不再赘述。For step S220, reference may be made to the corresponding part of the foregoing embodiment, which is not repeated here.
步骤S230,根据所述屏幕分辨率分别对所述多个图层的各个图层进行分辨率调整。Step S230: Adjust the resolution of each of the multiple layers according to the screen resolution.
在获取到显示界面的屏幕分辨率时,继续获取待显示图像的分辨率,并确定所述待显示图像的多个图层的分辨率。When the screen resolution of the display interface is obtained, continue to obtain the resolution of the image to be displayed, and determine the resolution of multiple layers of the image to be displayed.
可选的,可以判断待显示图像的多个图层中是否有图层的分辨率与屏幕分辨率不适配。若有,则可以根据屏幕分辨率分别对所述多个图层的各个图层进行分辨率调整;若没有,也就是说,若多个图层的分辨率都与屏幕分辨率相同,可以不对该待显示图像进行分辨率 调整,即不对该待显示图像的任何图层进行分辨率调整。该分辨率的不适配可以是分辨率的不同。Optionally, it can be determined whether the resolution of any of the multiple layers of the image to be displayed does not match the screen resolution. If yes, you can adjust the resolution of each of the multiple layers separately according to the screen resolution; if not, that is, if the resolution of multiple layers is the same as the screen resolution, it is not necessary The resolution adjustment is performed on the image to be displayed, that is, no resolution adjustment is performed on any layer of the image to be displayed. The resolution mismatch may be a difference in resolution.
其中,判断待显示图像的多个图层中是否有图层的分辨率与屏幕分辨率不适配时,可以依次判断每个图层的分辨率与屏幕分辨率是否适配。若判断到有图层的分辨率与屏幕的分辨率不适配,可以确定多个图层中有图层的分辨率与屏幕分辨率不适配。可选的,在依次判断每个图层的分辨率与屏幕分辨率是否适配时,当判断到有图层的分辨率与屏幕分辨率不适配时,可以不再继续判断;若未判断到有图层的分辨率与屏幕的分辨率不适配,则继续判断下一个图层的分辨率与屏幕分辨率是否适配。Wherein, when it is judged whether the resolution of a layer in the multiple layers of the image to be displayed does not match the screen resolution, it can be judged in turn whether the resolution of each layer matches the screen resolution. If it is determined that the resolution of a layer does not match the resolution of the screen, it can be determined that the resolution of a layer of multiple layers does not match the screen resolution. Optionally, when judging whether the resolution of each layer matches the screen resolution in turn, when it is judged that the resolution of a layer does not match the screen resolution, the judgment may not be continued; if it is not judged When the resolution of a layer does not match the resolution of the screen, it continues to determine whether the resolution of the next layer matches the screen resolution.
在确定所述待显示图像多个图层后,则可以根据所述屏幕分辨率对各个图层的分辨率进行调整。具体的,可以是保持分辨率与所述屏幕分辨率适配的图层的分辨率不变,将分辨率与所述屏幕分辨率不适配的图层的分辨率调整到与所述屏幕分辨率适配,从而减少数据处理量。例如,待显示图像为一个桌面场景,进行图像分层后得到的图层分别是壁纸层,状态栏层,导航栏层,以及图标层,具体可参照图2和图3。若当前壁纸层的分辨率与所述屏幕分辨率适配,则保持壁纸层的分辨率不变,若状态栏层,导航栏层以及图标层的分辨率都与所述屏幕分辨率不适配,则需要将状态栏层,导航栏层以及图标层的图像进行分辨率转换,将所述分辨率转换到与所述屏幕分辨率适配。After determining the multiple layers of the image to be displayed, the resolution of each layer can be adjusted according to the screen resolution. Specifically, the resolution of the layer whose resolution is adapted to the screen resolution may be kept unchanged, and the resolution of the layer whose resolution is not adapted to the screen resolution is adjusted to be distinguished from the screen resolution. Rate adaptation, thereby reducing the amount of data processing. For example, the image to be displayed is a desktop scene, and the layers obtained after image layering are the wallpaper layer, the status bar layer, the navigation bar layer, and the icon layer. For details, please refer to FIGS. 2 and 3. If the resolution of the current wallpaper layer matches the screen resolution, keep the resolution of the wallpaper layer unchanged. If the resolutions of the status bar layer, navigation bar layer and icon layer are all incompatible with the screen resolution , It is necessary to perform resolution conversion on the images of the status bar layer, the navigation bar layer and the icon layer, and convert the resolution to be adapted to the screen resolution.
具体的,电子设备的显示屏对应的屏幕分辨率,可以是指在屏幕横纵向上的像素点数,单位是px,1px=1个像素点,例如,若以纵向像素*横向像素表示屏幕分辨率,纵向上有1960个像素点、横向上有1080个像素点的屏幕的分辨率为1960*1080。本申请实施例中,为了便于理解,以对应屏幕分辨率的表示方式定义图像分辨率,即定义图像分辨率为图像的像素尺寸,即图像在横纵向上的像素点数,单位是px,1px=1个像素点,如以纵向像素*横向像素表示图像分辨率,纵向上有1960个像素点、横向上有1080个像素点的图像的分辨率为1960*1080。在电子设备的屏幕分辨率与图像的图像分辨率不适配,则图像显示则会异常,具体可能表现为图像的实际显示物理尺寸与设计该图像时的物理尺寸不同。其中,图像的物理尺寸通过设备独立像素(dp,device independent pixels)进行限定,屏幕分辨率与图像分辨率的适配为使图像的dp保持不变。Specifically, the screen resolution corresponding to the display screen of the electronic device may refer to the number of pixels in the horizontal and vertical directions of the screen, the unit is px, 1px=1 pixel, for example, if vertical pixels * horizontal pixels represent the screen resolution , The resolution of a screen with 1960 pixels in the vertical direction and 1080 pixels in the horizontal direction is 1960*1080. In the embodiments of the present application, for ease of understanding, the image resolution is defined in a representation corresponding to the screen resolution, that is, the image resolution is defined as the pixel size of the image, that is, the number of pixels in the horizontal and vertical directions of the image, the unit is px, 1px= 1 pixel, such as vertical pixel * horizontal pixel represents the image resolution, the resolution of an image with 1960 pixels in the vertical and 1080 pixels in the horizontal is 1960*1080. When the screen resolution of the electronic device does not match the image resolution of the image, the image display will be abnormal. Specifically, the actual display physical size of the image may be different from the physical size when the image is designed. Among them, the physical size of the image is defined by device independent pixels (dp), and the screen resolution and the image resolution are adapted to keep the dp of the image unchanged.
在确定各个图层的分辨率与屏幕分辨率是否适配时,可以是判断各个图层中图片的分辨率与屏幕分辨率是否适配,即判断在该屏幕分辨率下,图片在当前分辨率的情况下是否能以图片所要显示的dp进行显示。结合前述描述,该判断过程例如可以是,获取图片的dp数值,根据屏幕分辨率确定屏幕密度,确定图片的dp数值在该屏幕密度下对应的分辨率与图片当前实际的分辨率是否一致,若不一致,则图片的分辨率与屏幕分辨率不适配。若不适配,则可以确定图层的分辨率与屏幕分辨率不适配,将分辨率与屏幕分辨率不适配的图片的分辨率调整为与屏幕分辨率适配,具体可以将图片的实际分辨率调整为图片的dp数值在该屏幕密度下对应的分辨率。When determining whether the resolution of each layer matches the screen resolution, it can be judged whether the resolution of the picture in each layer matches the screen resolution, that is, it is judged that the picture is at the current resolution under the screen resolution. In the case of whether it can be displayed in the dp to be displayed in the picture. In combination with the foregoing description, the judgment process can be, for example, obtaining the dp value of the picture, determining the screen density according to the screen resolution, and determining whether the corresponding resolution of the dp value of the picture at the screen density is consistent with the current actual resolution of the picture, if Inconsistent, the resolution of the picture does not match the screen resolution. If it does not fit, it can be determined that the resolution of the layer does not fit the screen resolution, and the resolution of the picture whose resolution does not fit the screen resolution can be adjusted to fit the screen resolution. The actual resolution is adjusted to the resolution corresponding to the dp value of the picture under the screen density.
对于用户调整显示屏的屏幕分辨率的情况,对于同一显示屏,在图片适配显示屏分辨率的情况下,当屏幕分辨率被调高,屏幕的像素密度(dpi,dots per inch)增大,若要图像适配于屏幕的分辨率,保持图像的dp不变,则图像的像素尺寸,即分辨率,应以对应屏幕密度增加的倍数增大;对于同一显示屏,在图片适配显示屏分辨率的情况下,当屏幕分辨率 被调低,屏幕的像素密度(dpi,dots per inch)降低,若要图像适配于屏幕的分辨率,保持图像的dp不变,则图像的像素尺寸,即分辨率,以对应屏幕密度降低的倍数降低,则可以使各个图层的分辨率与所述屏幕分辨率适配。For the user to adjust the screen resolution of the display screen, for the same display screen, when the picture is adapted to the display screen resolution, when the screen resolution is increased, the pixel density (dpi, dots per inch) of the screen will increase , If the image is to be adapted to the resolution of the screen, keeping the dp of the image unchanged, the pixel size of the image, that is, the resolution, should be increased by the corresponding increase in screen density; In the case of screen resolution, when the screen resolution is reduced, the pixel density (dpi, dots per inch) of the screen is reduced. If the image is adapted to the screen resolution and the dp of the image remains unchanged, the pixel density of the image The size, that is, the resolution, is reduced by a multiple corresponding to the reduction in screen density, so that the resolution of each layer can be adapted to the screen resolution.
步骤S240,判断所述当前功耗是否高于预设阈值。Step S240: Determine whether the current power consumption is higher than a preset threshold.
获取电子设备的当前功耗,所述功耗可以是能反映出电子设备的功耗参数值,如电子设备的电量的变化值,或是GPU负载率等。那么对应的预设阈值则可以是电量的预设变化阈值或是CPU的预设负载率。若电量的变化值大于所述预设变化阈值,则可以判定所述当前功耗高于预设阈值;若GPU负载率大于预设负载率,则可以判定所述当前功耗高于预设阈值。Acquire the current power consumption of the electronic device, and the power consumption may be a parameter value that can reflect the power consumption of the electronic device, such as the change value of the power of the electronic device, or the GPU load rate. Then the corresponding preset threshold may be the preset change threshold of the power or the preset load rate of the CPU. If the change value of the power is greater than the preset change threshold, it can be determined that the current power consumption is higher than the preset threshold; if the GPU load rate is greater than the preset load rate, it can be determined that the current power consumption is higher than the preset threshold .
步骤S250,若是,则利用多媒体显示处理器(MDP,Multimedia Display Processor)对所述多个图层进行合成并显示,若否,则利用图像处理器(GPU,Graphics Processing Unit)对所述多个图层进行合成并显示。Step S250, if yes, use a multimedia display processor (MDP, Multimedia Display Processor) to synthesize and display the multiple layers; if not, use an image processor (GPU, Graphics Processing Unit) to synthesize and display the multiple layers The layers are combined and displayed.
在判定所述当前功耗高于预设阈值时,表明当前电子设备的功耗较高,为了平衡电子设备的功耗,则可以采用MDP合成方式对图像的图层进行合成,若所述当前功耗低于或等于预设阈值,表明当前电子设备的功耗较低,数据处理性能较好,则可以使用GPU合成方式对图像的图层进行合成。When it is determined that the current power consumption is higher than the preset threshold, it indicates that the current power consumption of the electronic device is relatively high. In order to balance the power consumption of the electronic device, the MDP synthesis method can be used to synthesize the image layers, if the current If the power consumption is lower than or equal to the preset threshold, it indicates that the current electronic equipment has lower power consumption and better data processing performance, so you can use GPU synthesis to synthesize image layers.
其中在对所述图像的图层进行合成处理时,获取到的各个图层的分辨率与显示界面的屏幕分辨率适配,可以直接对所述图层进行合成并显示。每个图层都会绘制有对应的窗口,可以获取所述多个图层在显示界面上对应的窗口,将所述多个图层按照对应的窗口显示在电子设备的显示界面上。例如,在桌面场景下,有四个图层分别是状态栏,导航栏,壁纸以及图标。系统会给每个图层提供对应的窗口,该窗口确定了图层在显示屏上的显示位置,再将对应的图层在对应的窗口进行显示,在电子设备的显示界面上则会看到对应的桌面场景。Wherein, when the layers of the image are synthesized, the resolution of each layer obtained is adapted to the screen resolution of the display interface, and the layers can be synthesized and displayed directly. Each layer is drawn with a corresponding window, the windows corresponding to the multiple layers on the display interface can be obtained, and the multiple layers are displayed on the display interface of the electronic device according to the corresponding windows. For example, in the desktop scene, there are four layers: status bar, navigation bar, wallpaper, and icons. The system will provide a corresponding window for each layer, which determines the display position of the layer on the display screen, and then displays the corresponding layer in the corresponding window, which will be seen on the display interface of the electronic device The corresponding desktop scene.
本申请提出的图像合成方法,通过获取电子设备当前的屏幕分辨率,若待显示图像的分辨率与所述屏幕分辨率不同,分别对所述多个图层的图像进行分辨率调整,使各个图层的分辨率与所述显示界面的屏幕分辨率适配,若获取到多个分辨率与所述屏幕分辨率适配的图层,则保持所述分辨率,再根据功耗选择不同的合成的方式,从而对合成能力和电子设备的低功耗进行兼顾以及平衡。The image synthesis method proposed in this application obtains the current screen resolution of the electronic device, and if the resolution of the image to be displayed is different from the screen resolution, the resolution adjustments are performed on the images of the multiple layers, so that each The resolution of the layer is adapted to the screen resolution of the display interface. If multiple layers with a resolution adapted to the screen resolution are obtained, the resolution is maintained, and then a different one is selected according to the power consumption. The way of synthesis, so as to balance and balance the synthesis capability and the low power consumption of electronic devices.
请参阅图6,本申请又一实施例提供了一种图像合成方法,本实施例在前述实施例的基础上,重点描述了以电量衡量功耗的情况下,判断所述功耗是否高于预设阈值的过程,该方法可以包括:Please refer to FIG. 6, another embodiment of the present application provides an image synthesis method. Based on the foregoing embodiments, this embodiment focuses on determining whether the power consumption is higher than the The process of presetting the threshold may include:
步骤S310,获取电子设备的在预设时间段内电子设备的剩余电量的改变值以及待显示图像的多个图层。Step S310: Obtain a change value of the remaining power of the electronic device within a preset time period and multiple layers of the image to be displayed.
步骤S320,判断在预设时间段内电子设备的剩余电量的改变值是否大于预设变化阈值。Step S320: It is determined whether the change value of the remaining power of the electronic device within a preset time period is greater than a preset change threshold.
在本申请实施例中,待显示图像的多个图层参照前述实施例对应部分,在此不再赘述。In the embodiment of the present application, the multiple layers of the image to be displayed refer to the corresponding part of the foregoing embodiment, which is not repeated here.
由于功耗越高,耗电量越大,在该实施例中,可以通过在预设时间段内电子设备的剩余电量的改变值表征功耗。获取电子设备的当前功耗,可以是获取表征功耗的参数值,判 断所述当前功耗是否高于预设阈值,可以是,判断获取到的参数值是否高于该参数值对应的预设阈值。Since the higher the power consumption, the greater the power consumption. In this embodiment, the power consumption can be characterized by the change value of the remaining power of the electronic device within a preset time period. Obtaining the current power consumption of the electronic device may be obtaining a parameter value characterizing power consumption, and determining whether the current power consumption is higher than a preset threshold, or determining whether the obtained parameter value is higher than the preset corresponding to the parameter value Threshold.
在该实施例中,获取表征功耗的参数值可以是获取电子设备的剩余电量的改变值,若电子设备的功耗较大,那么在相同的时间段内,电量的消耗会比正常的情况下更高,那么剩余电量的改变值会比正常情况下更大。在电子设备没有进行充电的情况下,则可以获取电子设备的剩余电量的改变值来确定电子设备的功耗是否大于预设阈值。具体的,可以预先设置一个预设变化阈值,这个变化阈值为电子设备在预设时间段内剩余电量的改变值,在预设时间段内,若电子设备的剩余电量的改变值大于预设变化阈值,则可认为电子设备功耗高于预设阈值。In this embodiment, obtaining the parameter value that characterizes the power consumption may be obtaining the change value of the remaining power of the electronic device. If the power consumption of the electronic device is larger, the power consumption will be lower than normal in the same time period. If the power level is higher, the change in the remaining power will be greater than normal. When the electronic device is not being charged, the change value of the remaining power of the electronic device can be obtained to determine whether the power consumption of the electronic device is greater than a preset threshold. Specifically, a preset change threshold can be set in advance. This change threshold is the change value of the remaining power of the electronic device within a preset time period. Within the preset time period, if the change value of the remaining power of the electronic device is greater than the preset change Threshold, it can be considered that the power consumption of the electronic device is higher than the preset threshold.
其中,在预设时间段内获取剩余电量的改变值,可以是每间隔一个预设时间,获取一次电子设备的剩余电量,对于每次获取的剩余电量,若与上次所获取的剩余电量的差值大于所述预设变化阈值,则可判定当前功耗高于预设阈值。例如,预设时间段为30s,预设变化阈值为1%,在第一次获取的电子设备的剩余电量为78%,30s后再获取电子设备的剩余电量为76%,则该次获取的剩余电量与上个预设时间获取的剩余电量的差值为78%-76%=2%,大于预设变化阈值1%,则可认为所述当前功耗大于预设阈值。Among them, obtaining the change value of the remaining power within a preset time period may be to obtain the remaining power of the electronic device at every preset time. For the remaining power obtained each time, if the remaining power is obtained from the last time If the difference is greater than the preset change threshold, it can be determined that the current power consumption is higher than the preset threshold. For example, the preset time period is 30s, the preset change threshold is 1%, the remaining power of the electronic device obtained for the first time is 78%, and the remaining power of the electronic device obtained after 30s is 76%, then the obtained The difference between the remaining power and the remaining power acquired at the last preset time is 78%-76%=2%, and if it is greater than the preset change threshold of 1%, it can be considered that the current power consumption is greater than the preset threshold.
其中,电子设备获取剩余电量的方法在本申请实施例中并不限定,例如可以是通过执行命令的方法获取电子设备中电池的各种信息,在获取到的各种信息中就包括电池的剩余电量,从而电子设备可以获取到其电池的剩余电量。The method for obtaining the remaining power of the electronic device is not limited in the embodiments of the present application. For example, it may be obtained by executing a command to obtain various information of the battery in the electronic device. The obtained various information includes the remaining battery Power, so that the electronic device can obtain the remaining power of its battery.
步骤S330,若是,则利用多媒体显示处理器(MDP,Multimedia Display Processor)对所述多个图层进行合成并显示,若否,则利用图形处理器(GPU,Graphics Processing Unit)对所述多个图层进行合成并显示。In step S330, if yes, use a multimedia display processor (MDP, Multimedia Display Processor) to synthesize and display the multiple layers; if not, use a graphics processor (GPU, Graphics Processing Unit) to synthesize and display the multiple layers. The layers are combined and displayed.
在电子设备的剩余电量的变化值大于预设阈值时,则可以认为电子设备的当前功耗大于预设阈值,表明电子设备的当前功耗较高,则可以采用功耗较小的合成方式对获取到的多个图层进行合成。那么在所述电子设备电量的变化值大于预设阈值时,则利用MDP对所述多个图层进行合成并显示,以平衡电子设备的功耗。When the change value of the remaining power of the electronic device is greater than the preset threshold, it can be considered that the current power consumption of the electronic device is greater than the preset threshold, indicating that the current power consumption of the electronic device is relatively high, and a synthesis method with lower power consumption can be used The obtained multiple layers are combined. Then, when the change value of the electric power of the electronic device is greater than the preset threshold, the MDP is used to synthesize and display the multiple layers to balance the power consumption of the electronic device.
若电子设备的剩余电量的变化值小于或等于预设变化阈值时,则可以认为电子设备的当前功耗小于或等于预设阈值,表明电子设备的当前功耗较低,可以采用图层合成速度较快的合成方式对获取到的多个图层进行合成。那么在所述电子设备的电量的变化值小于或等于预设阈值时,则利用GPU合成方式对所述多个图层进行合成并显示,从而对合成能力和电子设备的低功耗进行兼顾以及平衡。If the change value of the remaining power of the electronic device is less than or equal to the preset change threshold, it can be considered that the current power consumption of the electronic device is less than or equal to the preset threshold, indicating that the current power consumption of the electronic device is low, and the layer composition speed can be used The faster synthesis method synthesizes the acquired multiple layers. Then when the change value of the electric power of the electronic device is less than or equal to the preset threshold, the multiple layers are synthesized and displayed using the GPU synthesis method, so as to balance the synthesis capability and the low power consumption of the electronic device and balance.
此外,在根据剩余电量的改变值与所述预设变化阈值的大小关系选定合成方式时,有可能出现电子设备剩余电量的改变值在预设变化阈值上下波动,导致不断切换合成方式的情况,则会因为来回切换合成方式产生更大的功耗。例如,在剩余电量的改变值小于预设负载率时,选用了GPU合成方式对图像进行合成,这时,在预设时间段内电子设备的剩余电量的改变值可能由于GPU合成功耗较高而大于所述预设变化阈值,电子设备则会切换合成方式为MDP合成方式,在切换为MDP合成方式后,在预设时间段内电子设备的剩余电量的改变值又由于MDP合成功耗较低而小于预设变化阈值,电子设备则会再次将合成方式切换为GPU合成方式,由此,来回切换合成方式产生更大的功耗。In addition, when the synthesis mode is selected according to the relationship between the change value of the remaining power and the preset change threshold, it is possible that the change value of the remaining power of the electronic device fluctuates up and down the preset change threshold, resulting in constant switching of the synthesis mode. , It will produce more power consumption due to switching the synthesis mode back and forth. For example, when the change of the remaining power is less than the preset load rate, the GPU synthesis method is selected to synthesize the image. At this time, the change of the remaining power of the electronic device within the preset time period may be due to the high power consumption of GPU synthesis If it is greater than the preset change threshold, the electronic device will switch the synthesis mode to the MDP synthesis mode. After switching to the MDP synthesis mode, the change in the remaining power of the electronic device within the preset time period is due to the lower MDP synthesis power consumption. If it is lower than the preset change threshold, the electronic device will switch the synthesis mode to the GPU synthesis mode again, thus switching the synthesis mode back and forth to generate greater power consumption.
因此,可选的,也可以预先设定一个预设频率,其中,预设频率可以定义为图层合成方式在预设时间内的切换次数为预设次数,或者说剩余电量的改变值在预设时间内在预设变化阈值上下波动次数为预设次数,其中,从预设阈值上改变为预设阈值下为波动一次,从预设阈值下切换为预设阈值上为波动一次。若所述剩余电量的改变值的波动频率大于预设频率,则可判定所述当前功耗高于预设阈值,则选用功耗较低的合成方式对图层进行合成,即选用MDP合成方式对图层进行合成并维持一定时间,具体维持时间在本申请实施例中并不限定,例如可以是在预设时间内利用多媒体显示处理器对待显示图像的多个图层进行合成。剩余电量的改变值的波动频率为剩余电量的改变值在预设时间内在预设变化阈值上下波动次数。也就是说,可以判断剩余电量的改变值的波动频率是否大于预设频率,若是,判定当前功耗高于预设阈值;若否,判定当前功耗不高于预设阈值。Therefore, optionally, a preset frequency can also be set in advance, where the preset frequency can be defined as the number of switching times of the layer synthesis mode within a preset time as the preset number, or the change in the remaining power Set the number of fluctuations up and down within the preset change threshold within a time period as the preset number of times, where the change from the preset threshold to the preset threshold is one fluctuation, and the switch from the preset threshold to the preset threshold is one fluctuation. If the fluctuation frequency of the change value of the remaining power is greater than the preset frequency, it can be determined that the current power consumption is higher than the preset threshold, and then select a synthesis method with lower power consumption to synthesize the layer, that is, select the MDP synthesis method The layers are synthesized and maintained for a certain period of time. The specific sustaining period is not limited in the embodiment of the present application. For example, a multimedia display processor may be used to synthesize multiple layers of the image to be displayed within a preset time. The fluctuation frequency of the changing value of the remaining power is the number of times the changing value of the remaining power fluctuates within a preset time within a preset change threshold. That is, it can be determined whether the fluctuation frequency of the change value of the remaining power is greater than the preset frequency, if so, it is determined that the current power consumption is higher than the preset threshold; if not, it is determined that the current power consumption is not higher than the preset threshold.
例如,预设时间为2分钟,预设变化阈值为1%,预设频率为2,若电子设备的在预设时间段内剩余电量的改变值在1%上下波动,即获取到剩余电量的改变值依次为0.5%,1.5%,0.8%,2%,0.5%,2%,可以看出剩余电量的改变值在预设变化阈值上下波动的频率为5,即图层合成方式的切换次数为5次,大于预设频率,表示当前功耗高于预设阈值,则可选用MDP方式对图层进行合成。由于在剩余电量的改变值大于预设变化阈值1%时,采用MDP合成方式对图层进行合成,在剩余电量的改变值小于或等于预设变化阈值1%时,采用GPU合成方式对图层进行合成,由于GPU合成方式功耗较高,消耗较大的电量,则会导致剩余电量的改变值增大,则会不断切换合成方式,在一定时间内高频率的切换合成方式也会带来额外的功耗,由此可以判定所述当前功耗高于预设阈值,则可以选用MDP合成方式对图层进行合成并维持一定时间,以减小电子设备的功耗,其中维持一定时间可以是在10分钟内都采用MDP对图层进行合成,具体的维持一定时间的长度可根据实际的需要进行设置,在此不做限定。For example, the preset time is 2 minutes, the preset change threshold is 1%, and the preset frequency is 2. If the change value of the remaining power of the electronic device within the preset time period fluctuates around 1%, the remaining power is obtained The change value is 0.5%, 1.5%, 0.8%, 2%, 0.5%, 2%. It can be seen that the frequency of the change value of the remaining power fluctuates up and down the preset change threshold is 5, that is, the number of switching times of the layer synthesis mode If it is 5 times, which is greater than the preset frequency, it means that the current power consumption is higher than the preset threshold, and the MDP method can be used to synthesize the layers. Since the change of the remaining power is greater than the preset change threshold of 1%, the layer is synthesized by MDP synthesis, and when the change of the remaining power is less than or equal to the preset change threshold of 1%, the layer is synthesized by the GPU For synthesis, due to the high power consumption of the GPU synthesis method, which consumes a large amount of power, the change value of the remaining power will increase, and the synthesis mode will be continuously switched. Switching the synthesis mode at a high frequency within a certain period of time will also bring Additional power consumption, it can be determined that the current power consumption is higher than the preset threshold, you can select the MDP synthesis method to synthesize the layers and maintain them for a certain period of time to reduce the power consumption of the electronic device. It uses MDP to synthesize the layers within 10 minutes. The specific duration of a certain period of time can be set according to actual needs, which is not limited here.
本申请提出的图像合成方法,通过获取电子设备的当前功耗以及待显示图像的多个图层,判断在预设时间段内电子设备的剩余电量的改变值是否大于预设变化阈值,若是,则利用GPU对所述多个图层进行合成并显示,若否,则利用MDP对所述多个图层进行合成并显示。通过电子设备的电量来确定电子设备的功耗,在电子设备的功耗较高时选择功耗较低的合成方式,以平衡电子设备的功耗,在电子设备的功耗较低时,选用图层合成能力较强的合成方式,以提升图像处理性能,从而对电子设备的图层合成能力和电子设备的低功耗进行兼顾以及平衡。The image synthesis method proposed in this application determines whether the change value of the remaining power of the electronic device within a preset time period is greater than a preset change threshold by obtaining the current power consumption of the electronic device and multiple layers of the image to be displayed, and if so, The GPU is used to synthesize and display the multiple layers; if not, the MDP is used to synthesize and display the multiple layers. The power consumption of the electronic device is determined by the power consumption of the electronic device. When the power consumption of the electronic device is high, the synthesis method with lower power consumption is selected to balance the power consumption of the electronic device. When the power consumption of the electronic device is low, use A synthesis method with a strong layer synthesis ability to improve image processing performance, so as to balance and balance the layer synthesis ability of the electronic device and the low power consumption of the electronic device.
请参阅图7,本申请再一实施例提供了一种图像合成方法,本实施例在前述实施例的基础上,重点描述了以GPU负载率衡量功耗的情况下,判断所述功率是否高于预设阈值的过程,该方法可以包括:Referring to FIG. 7, another embodiment of the present application provides an image synthesis method. Based on the foregoing embodiments, this embodiment focuses on determining whether the power is high when the power consumption is measured by the GPU load rate. In the process of presetting the threshold, the method may include:
步骤S410,获取电子设备当前GPU负载率以及待显示图像的多个图层。Step S410: Obtain the current GPU load rate of the electronic device and multiple layers of the image to be displayed.
步骤S420,判断电子设备的当前GPU负载率是否大于预设负载率。Step S420: Determine whether the current GPU load rate of the electronic device is greater than a preset load rate.
获取待显示图像的多个图层的具体方式可以参照前述描述,在此不再赘述。For the specific manner of obtaining multiple layers of the image to be displayed, reference may be made to the foregoing description, and details are not described herein again.
另外,本申请实施例中,获取电子设备的功耗的目的在于判断电子设备的当前功耗是否过高。其中,除了通过电量等表现功耗的直接参数值进行功耗高低的判断,还可以通过其他可以映射功耗高低的参数值,作为获取到的电子设备的功耗并用于判断功耗是否过高。 其中,可以映射功耗高低的参数值在本申请实施例中并不限定,具体可以是,当该参数值过高时,通常电子设备的功耗也过高,例如GPU负载率、CPU负载率等,其中GPU的负载率为表征当前GPU处理的任务数量,GPU的负载率越高,表明GPU处理的任务越多。本申请实施例以GPU负载率映射电子设备的功耗为例进行具体说明。In addition, in the embodiment of the present application, the purpose of obtaining the power consumption of the electronic device is to determine whether the current power consumption of the electronic device is too high. Among them, in addition to judging the level of power consumption by direct parameter values such as power consumption, other parameter values that can map the level of power consumption can also be used as the power consumption of the acquired electronic device and used to determine whether the power consumption is too high. . Among them, the parameter value that can map the level of power consumption is not limited in the embodiment of this application. Specifically, when the parameter value is too high, the power consumption of the electronic device is usually too high, such as GPU load rate, CPU load rate The load rate of the GPU represents the number of tasks processed by the current GPU. The higher the load rate of the GPU, the more tasks the GPU handles. The embodiment of the present application takes the GPU load rate mapping the power consumption of the electronic device as an example for specific description.
也就是说,获取电子设备的当前功耗,可以是获取表征电子设备功耗的参数值。In other words, acquiring the current power consumption of the electronic device may be acquiring a parameter value that characterizes the power consumption of the electronic device.
在本申请实施例中,获取表征功耗的参数值可以是获取电子设备的当前GPU负载率,根据GPU负载率来表征当前电子设备的整体功耗。其中,影响电子设备功耗的主要模块有GPU/CPU以及屏幕。通常在GPU进行图像处理时,需要CPU的密切配合,进行数据的准备等工作,会产生较大的功耗,屏幕会亮起以进行内容的显示,也会产生较大的功耗。因此在GPU的负载率较高时,可以认为当前电子设备在进行较为复杂的内容显示,例如,电子设备在进行对战游戏时,需要以较高的帧率进行游戏界面的刷新显示,整个电子设备则会产生较大的功耗。由此,是可以通过电子设备的GPU的负载率来表征整个电子设备的功耗高低,若当前电子设备的GPU负载率高,则可表明电子设备的功耗高,若当前电子设备的GPU负载率低,则可表明电子设备的功耗低。In the embodiment of the present application, obtaining the parameter value that characterizes the power consumption may be obtaining the current GPU load rate of the electronic device, and characterize the current overall power consumption of the electronic device according to the GPU load rate. Among them, the main modules that affect the power consumption of electronic devices are GPU/CPU and screens. Generally, when the GPU performs image processing, close cooperation of the CPU is required for data preparation and other tasks, which will generate large power consumption, the screen will light up for content display, and will also generate large power consumption. Therefore, when the GPU load rate is high, it can be considered that the current electronic device is displaying more complex content. For example, when the electronic device is playing a battle game, it needs to refresh and display the game interface at a higher frame rate. The entire electronic device Will produce larger power consumption. Therefore, the power consumption of the entire electronic device can be characterized by the GPU load rate of the electronic device. If the GPU load rate of the current electronic device is high, it can indicate that the power consumption of the electronic device is high. The low rate indicates that the power consumption of the electronic device is low.
具体的,可以预先设定一个预设负载率,这个预设负载率可以是影响GPU处理速度的临界值,也就是在GPU的负载率小于该临界值时,则表明GPU所处理的图层数据较少,当前电子设备的功耗较低,则判定所述当前功耗小于或等于预设阈值。若GPU负载率大于所述预设负载率,表明当前GPU处理的图层数据较多,产生较高的功耗,则可判定所述当前功耗高于预设阈值。Specifically, a preset load rate can be set in advance. This preset load rate can be a critical value that affects the processing speed of the GPU, that is, when the load rate of the GPU is less than the critical value, it indicates the layer data processed by the GPU If the current power consumption of the electronic device is relatively low, it is determined that the current power consumption is less than or equal to the preset threshold. If the GPU load rate is greater than the preset load rate, it indicates that the current GPU processes more layer data and generates higher power consumption, and it can be determined that the current power consumption is higher than the preset threshold.
其中,电子设备获取当前GPU负载率的方法在本申请实施例中并不限定,例如可以是通过访问GPU性能文件,从所述性能文件中获取到GPU的参数,其中,所述参数中就包括了当前GPU负载率,从而电子设备可以获取到当前GPU负载率。Wherein, the method for the electronic device to obtain the current GPU load rate is not limited in the embodiments of the present application. For example, it may be obtained by accessing the GPU performance file to obtain the GPU parameters from the performance file, where the parameters include The current GPU load rate is calculated, so that the electronic device can obtain the current GPU load rate.
步骤S430,若是,则利用多媒体显示处理器(MDP,Multimedia Display Processor)对所述多个图层进行合成并显示,若否,则利用图形处理器(GPU,Graphics Processing Unit)对所述多个图层进行合成并显示。In step S430, if yes, use a multimedia display processor (MDP, Multimedia Display Processor) to synthesize and display the multiple layers; if not, use a graphics processor (GPU, Graphics Processing Unit) to synthesize and display the multiple layers. The layers are combined and displayed.
在电子设备的GPU负载率大于预设负载率时,则可以认为电子设备的当前功耗大于预设阈值,表明电子设备的当前功耗较高,则可以采用功耗较小的合成方式对获取到的多个图层进行合成。那么在所述电子设备的GPU负载率大于预设负载率时,则可以利用MDP对所述多个图层进行合成并显示,以平衡电子设备的功耗。When the GPU load rate of the electronic device is greater than the preset load rate, it can be considered that the current power consumption of the electronic device is greater than the preset threshold, indicating that the current power consumption of the electronic device is high, and a synthesis method with lower power consumption can be used to obtain the Multiple layers to be combined. Then, when the GPU load rate of the electronic device is greater than the preset load rate, the MDP may be used to synthesize and display the multiple layers to balance the power consumption of the electronic device.
若电子设备的GPU负载率小于或等于预设负载率时,则可以认为电子设备的当前功耗小于或等于预设阈值,表明电子设备的当前功耗较低,可以采用图层合成速度较快的合成方式对获取到的多个图层进行合成。那么在所述电子设备的GPU负载率小于或等于预设负载率时,则利用GPU合成方式对所述多个图层进行合成并显示,以提高图层的合成能力。If the GPU load rate of the electronic device is less than or equal to the preset load rate, it can be considered that the current power consumption of the electronic device is less than or equal to the preset threshold, indicating that the current power consumption of the electronic device is low, and the layer composition speed can be faster The composite method of compositing multiple layers. Then, when the GPU load rate of the electronic device is less than or equal to the preset load rate, the multiple layers are synthesized and displayed using the GPU synthesis method to improve the layer synthesis ability.
此外,在根据GPU的负载率与所述预设负载率的大小关系选定合成方式时,有可能出现电子设备的GPU负载率在预设负载率上下波动,导致不断切换合成方式的情况,则会因为来回切换合成方式产生更大的功耗。例如,在GPU的负载率小于预设负载率时,选用了GPU合成方式对图像进行合成,这时,电子设备的GPU负载率可能大于所述预设负载率,电子设备则会切换合成方式为MDP合成方式,在切换为MDP合成方式后,GPU的负载率 小于预设负载率,电子设备则会再次将合成方式切换为GPU合成方式,由此,来回切换合成方式产生更大的功耗。In addition, when the synthesis method is selected according to the relationship between the load rate of the GPU and the preset load rate, it is possible that the GPU load rate of the electronic device fluctuates up and down the preset load rate, resulting in constant switching of the synthesis mode. More power consumption will be generated by switching the synthesis method back and forth. For example, when the GPU load rate is less than the preset load rate, the GPU synthesis method is selected to synthesize the image. At this time, the GPU load rate of the electronic device may be greater than the preset load rate, and the electronic device will switch the synthesis method to In the MDP synthesis mode, after switching to the MDP synthesis mode, the load rate of the GPU is less than the preset load rate, and the electronic device will switch the synthesis mode to the GPU synthesis mode again, thereby switching the synthesis mode back and forth to generate greater power consumption.
因此,可选的,也可以预先设定一个预设频率,其中,预设频率可以定义为在预设时间内图层合成方式的切换次数为预设次数,或者说GPU负载率在预设时间内在预设负载率上下波动次数为预设次数,其中,从预设负载率上改变为预设负载率下为波动一次,从预设负载率下切换为预设负载率上为波动一次。若所述GPU的负载率的波动频率大于预设频率,则可判定所述当前功耗高于预设阈值,则选用功耗较低的合成方式对图层进行合成,即选用MDP合成方式对图层进行合成并维持一定时间,具体维持时间在本申请实施例中并不限定,例如可以是在预设时间内利用多媒体显示处理器对待显示图像的多个图层进行合成。GPU的负载率的波动频率为GPU的负载率在预设时间内在预设负载率上下波动次数。也就是说,可以判断GPU的负载率的波动频率是否大于预设频率,若是,判定当前功耗高于预设阈值;若否,判定当前功耗不高于预设阈值。可选的,该GPU的负载率对应的预设频率与剩余电量的改变值的波动频率对应的预设频率可以不同,也可以相同,在本申请实施例中并不限定。Therefore, optionally, a preset frequency can also be set in advance, where the preset frequency can be defined as the number of switching of the layer synthesis mode within the preset time as the preset number, or the GPU load rate at the preset time The number of fluctuations of the inherent preset load rate is the preset number of times, where the change from the preset load rate to the preset load rate is one fluctuation, and the switch from the preset load rate to the preset load rate is one fluctuation. If the fluctuation frequency of the GPU's load rate is greater than the preset frequency, it can be determined that the current power consumption is higher than the preset threshold, and then the layer is synthesized with a lower power consumption synthesis method, that is, the MDP synthesis method is selected for The layers are synthesized and maintained for a certain period of time. The specific sustaining period is not limited in the embodiment of the present application. For example, a multimedia display processor may be used to synthesize multiple layers of the image to be displayed within a preset time. The fluctuation frequency of the load rate of the GPU is the number of times the load rate of the GPU fluctuates within the preset load rate within a preset time. That is, it can be determined whether the fluctuation frequency of the GPU load rate is greater than the preset frequency, if so, it is determined that the current power consumption is higher than the preset threshold; if not, it is determined that the current power consumption is not higher than the preset threshold. Optionally, the preset frequency corresponding to the load rate of the GPU and the preset frequency corresponding to the fluctuation frequency of the change value of the remaining power may be different or the same, which is not limited in the embodiment of the present application.
例如,预设时间为2分钟,预设负载率为70%,预设频率为2,若电子设备的GPU的负载率在70%上下波动,即在两分钟内获取到的GPU负载率依次为68%,72%,69%,71%,66%,71%,可以看出GPU负载率上下波动的频率为5,即切换图层合成方式的次数大于预设频率,表示当前功耗高于预设阈值,则可选用MDP方式对图层进行合成。由于在GPU的负载率大于预设负载率70%时,采用MDP合成方式对图层进行合成,在GPU的负载率小于或等于预设负载率70%时,采用GPU合成方式对图层进行合成,若此时GPU的负载率在预设负载率上来波动,则会不断切换合成方式,在一定时间内高频率的切换合成方式也会带来额外的功耗,由此可以判定所述当前功耗高于预设阈值,则可以选用MDP合成方式对图层进行合成并维持一定时间,以减小电子设备的功耗,其中维持一定时间可以是在10分钟内都采用MDP对图层进行合成,具体的维持一定时间的长度可根据实际的需要进行设置,在此不做限定。For example, the preset time is 2 minutes, the preset load rate is 70%, and the preset frequency is 2. If the load rate of the GPU of the electronic device fluctuates around 70%, the GPU load rate obtained within two minutes is in order 68%, 72%, 69%, 71%, 66%, 71%, it can be seen that the frequency of GPU load rate fluctuation is 5, that is, the number of times the layer synthesis mode is switched is greater than the preset frequency, indicating that the current power consumption is higher than If the threshold is preset, MDP can be used to synthesize the layers. When the GPU load rate is greater than 70% of the preset load rate, the layer is synthesized by MDP synthesis method, and when the GPU load rate is less than or equal to the preset load rate of 70%, the layer is synthesized by GPU synthesis method If the load rate of the GPU fluctuates at the preset load rate at this time, the synthesis mode will be switched continuously. Switching the synthesis mode at a high frequency within a certain period of time will also bring additional power consumption, so that the current power can be determined If the consumption is higher than the preset threshold, you can choose the MDP synthesis method to synthesize the layers and maintain them for a certain period of time to reduce the power consumption of the electronic device. The maintenance for a certain period of time can be to use MDP to synthesize the layers within 10 minutes , The specific length of maintaining a certain time can be set according to actual needs, which is not limited here.
本申请提出的图像合成方法,通过获取电子设备的当前功耗以及待显示图像的多个图层,判断在电子设备的GPU负载率是否大于预设负载率,若是,则利用MDP对所述多个图层进行合成并显示,若否,则利用GPU对所述多个图层进行合成并显示。通过电子设备的GPU负载率来确定电子设备的功耗,在电子设备的功耗较高时选择功耗较低的合成方式,平衡电子设备的功耗,在电子设备的功耗较低时,选用图层合成能力较强的合成方式,以提升图像处理性能,从而对电子设备的图层合成能力和电子设备的低功耗进行兼顾以及平衡。The image synthesis method proposed in this application determines whether the GPU load rate of the electronic device is greater than the preset load rate by acquiring the current power consumption of the electronic device and the multiple layers of the image to be displayed. The multiple layers are synthesized and displayed; if not, the multiple layers are synthesized and displayed using the GPU. The power consumption of the electronic device is determined by the GPU load rate of the electronic device. When the power consumption of the electronic device is high, the synthesis method with lower power consumption is selected to balance the power consumption of the electronic device. When the power consumption of the electronic device is low, Choose a synthesis method with strong layer synthesis ability to improve image processing performance, so as to balance and balance the layer synthesis ability of the electronic device and the low power consumption of the electronic device.
请参阅图8,其示出了本申请实施例提供的一种图像合成装置500,所述装置500包括获取模块510,判断模块520,合成模块530。Please refer to FIG. 8, which shows an image synthesis device 500 provided by an embodiment of the present application. The device 500 includes an acquisition module 510, a judgment module 520, and a synthesis module 530.
获取模块510,用于获取电子设备的当前功耗以及待显示图像的多个图层;判断模块520,用于判断所述当前功耗是否高于预设阈值;合成模块530,用于若是,则利用多媒体显示处理器(MDP,Multimedia Display Processor)对所述多个图层进行合成并显示,若否,则利用图形处理器(GPU,Graphics Processing Unit)对所述多个图层进行合成并显示。The obtaining module 510 is used to obtain the current power consumption of the electronic device and the multiple layers of the image to be displayed; the judgment module 520 is used to judge whether the current power consumption is higher than a preset threshold; the synthesis module 530 is used to, if so, Then use a multimedia display processor (MDP, Multimedia Display Processor) to synthesize and display the multiple layers, if not, use a graphics processor (GPU, Graphics Processing Unit) to synthesize and display the multiple layers display.
进一步的,所述获取模块510还用于获取电子设备当前的屏幕分辨率;在所述获取电子设备的当前功耗以及待显示图像的多个图层之后,还用于根据所述屏幕分辨率分别对所述多个图层的各个图层进行分辨率调整。Further, the obtaining module 510 is also used to obtain the current screen resolution of the electronic device; after obtaining the current power consumption of the electronic device and multiple layers of the image to be displayed, it is also used to obtain the current screen resolution according to the screen resolution. The resolution adjustment is performed on each of the multiple layers respectively.
进一步的,所述获取模块510还用于保持分辨率与所述屏幕分辨率适配的图层的分辨率不变,将分辨率与所述屏幕分辨率不适配的图层的分辨率调整到与所述屏幕分辨率适配。Further, the acquiring module 510 is further configured to keep the resolution of the layer whose resolution is adapted to the screen resolution unchanged, and adjust the resolution of the layer whose resolution does not match the screen resolution. To adapt to the screen resolution.
进一步的,所述判断模块520还用于判断在预设时间段内电子设备的剩余电量的改变值是否大于预设变化阈值,若大于,则判定所述当前功耗高于预设阈值。Further, the determining module 520 is also used to determine whether the change value of the remaining power of the electronic device within a preset time period is greater than a preset change threshold, and if it is greater than, determine that the current power consumption is higher than the preset threshold.
进一步的,所述判断模块520还用于每间隔一个预设时间,获取一次电子设备的剩余电量;对于每次获取的剩余电量,若与上个预设时间所获取的剩余电量的差值大于所述预设变化阈值,则判定所述当前功耗高于预设阈值。Further, the judgment module 520 is also configured to obtain the remaining power of the electronic device at intervals of a preset time; for the remaining power acquired each time, if the difference between the remaining power acquired at the last preset time is greater than According to the preset change threshold, it is determined that the current power consumption is higher than the preset threshold.
进一步的,所述判断模块520还用于判断所述电子设备的当前GPU负载率是否大于预设负载率;若大于,则判定所述当前功耗高于预设阈值。Further, the determining module 520 is also used to determine whether the current GPU load rate of the electronic device is greater than a preset load rate; if it is greater, then determine that the current power consumption is higher than a preset threshold.
进一步的,所述合成模块530还用于获取所述多个图层在显示界面上对应的窗口,将所述多个图层按照对应的窗口显示在电子设备的显示界面上。Further, the composition module 530 is further configured to obtain windows corresponding to the multiple layers on the display interface, and display the multiple layers on the display interface of the electronic device according to the corresponding windows.
需要说明的是,所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述装置和模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。It should be noted that those skilled in the art can clearly understand that, for the convenience and conciseness of description, the specific working process of the above described device and module can refer to the corresponding process in the foregoing method embodiment, which will not be repeated here.
综上所述,本申请提供的图像合成方法,通过获取电子设备的当前功耗以及待显示图像的多个图层;判断所述当前功耗是否高于预设阈值;若是,则利用多媒体显示处理器(MDP,Multimedia Display Processor)对所述多个图层进行合成并显示,若否,则利用图形处理器(GPU,Graphics Processing Unit)对所述多个图层进行合成并显示。根据电子设备的当前功耗选择不同的图层合成方式,在电子设备功耗较高的情况下,选用耗能低的合成方式,以平衡电子设备的功耗,在电子设备功耗较低的情况下,选用合成能力较高的合成方式,以提升图像处理性能。In summary, the image synthesis method provided in this application obtains the current power consumption of the electronic device and multiple layers of the image to be displayed; determines whether the current power consumption is higher than a preset threshold; if so, uses multimedia display A processor (MDP, Multimedia Display Processor) synthesizes and displays the multiple layers, and if not, uses a graphics processor (GPU, Graphics Processing Unit) to synthesize and display the multiple layers. Choose different layer synthesis methods according to the current power consumption of the electronic device. In the case of high power consumption of the electronic device, select the synthesis method with low energy consumption to balance the power consumption of the electronic device. In this case, select a synthesis method with higher synthesis capability to improve image processing performance.
在本申请所提供的几个实施例中,所显示或讨论的模块相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或模块的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, the coupling or direct coupling or communication connection between the displayed or discussed modules may be through some interfaces. The indirect coupling or communication connection of the devices or modules may be electrical, Mechanical or other forms.
另外,在本申请各个实施例中的各功能模块可以集成在一个处理模块中,也可以是各个模块单独物理存在,也可以两个或两个以上模块集成在一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。In addition, each functional module in each embodiment of the present application may be integrated into one processing module, or each module may exist alone physically, or two or more modules may be integrated into one module. The above-mentioned integrated modules can be implemented in the form of hardware or software functional modules.
请参考图9,其示出了本申请实施例提供的一种电子设备的结构框图。该电子设备600可以是智能手机、平板电脑、电子书等能够运行应用程序的电子设备。本申请中的电子设备600可以包括一个或多个如下部件:处理器610、存储器620、以及一个或多个应用程序,其中一个或多个应用程序可以被存储在存储器620中并被配置为由一个或多个处理器610执行,一个或多个程序配置用于执行如前述方法实施例所描述的方法。Please refer to FIG. 9, which shows a structural block diagram of an electronic device provided by an embodiment of the present application. The electronic device 600 may be an electronic device capable of running application programs, such as a smart phone, a tablet computer, or an e-book. The electronic device 600 in this application may include one or more of the following components: a processor 610, a memory 620, and one or more application programs, where one or more application programs may be stored in the memory 620 and configured to be configured by One or more processors 610 execute, and one or more programs are configured to execute the methods described in the foregoing method embodiments.
处理器610可以包括一个或者多个处理核。处理器610利用各种接口和线路连接整个电子设备600内的各个部分,通过运行或执行存储在存储器620内的指令、程序、代码集或指令集,以及调用存储在存储器620内的数据,执行电子设备600的各种功能和处理数据。可选地,处理器610可以采用数字信号处理(Digital Signal Processing,DSP)、现场 可编程门阵列(Field-Programmable Gate Array,FPGA)、可编程逻辑阵列(Programmable Logic Array,PLA)中的至少一种硬件形式来实现。处理器610可集成中央处理器(Central Processing Unit,CPU)、图像处理器(Graphics Processing Unit,GPU)和调制解调器等中的一种或几种的组合。其中,CPU主要处理操作系统、用户界面和应用程序等;GPU用于负责显示内容的渲染和绘制;调制解调器用于处理无线通信。可以理解的是,上述调制解调器也可以不集成到处理器610中,单独通过一块通信芯片进行实现。The processor 610 may include one or more processing cores. The processor 610 uses various interfaces and lines to connect various parts of the entire electronic device 600, and executes by running or executing instructions, programs, code sets, or instruction sets stored in the memory 620, and calling data stored in the memory 620. Various functions and processing data of the electronic device 600. Optionally, the processor 610 may use at least one of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). A kind of hardware form to realize. The processor 610 may be integrated with one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), a modem, and the like. Among them, the CPU mainly processes the operating system, user interface, and application programs; the GPU is used for rendering and drawing of display content; the modem is used for processing wireless communication. It is understandable that the above-mentioned modem may not be integrated into the processor 610, but may be implemented by a communication chip alone.
存储器620可以包括随机存储器(Random Access Memory,RAM),也可以包括只读存储器(Read-Only Memory)。存储器620可用于存储指令、程序、代码、代码集或指令集。存储器620可包括存储程序区和存储数据区,其中,存储程序区可存储用于实现操作系统的指令、用于实现至少一个功能的指令(比如触控功能、声音播放功能、图像播放功能等)、用于实现下述各个方法实施例的指令等。存储数据区还可以存储电子设备600在使用中所创建的数据(比如电话本、音视频数据、聊天记录数据)等。The memory 620 may include random access memory (RAM) or read-only memory (Read-Only Memory). The memory 620 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 620 may include a program storage area and a data storage area, where the program storage area may store instructions for implementing the operating system and instructions for implementing at least one function (such as touch function, sound playback function, image playback function, etc.) , Instructions for implementing the following method embodiments, etc. The storage data area can also store data created by the electronic device 600 during use (such as phone book, audio and video data, chat record data) and the like.
请参考图10,其示出了本申请实施例提供的一种计算机可读存储介质的结构框图。该计算机可读存储介质700中存储有程序代码,所述程序代码可被处理器调用执行上述方法实施例中所描述的方法。Please refer to FIG. 10, which shows a structural block diagram of a computer-readable storage medium provided by an embodiment of the present application. The computer-readable storage medium 700 stores program codes, and the program codes can be invoked by a processor to execute the methods described in the foregoing method embodiments.
计算机可读存储介质700可以是诸如闪存、EEPROM(电可擦除可编程只读存储器)、EPROM、硬盘或者ROM之类的电子存储器。可选地,计算机可读存储介质700包括非瞬时性计算机可读介质(non-transitory computer-readable storage medium)。计算机可读存储介质700具有执行上述方法中的任何方法步骤的程序代码710的存储空间。这些程序代码可以从一个或者多个计算机程序产品中读出或者写入到这一个或者多个计算机程序产品中。程序代码710可以例如以适当形式进行压缩。The computer-readable storage medium 700 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read Only Memory), EPROM, hard disk, or ROM. Optionally, the computer-readable storage medium 700 includes a non-transitory computer-readable storage medium. The computer-readable storage medium 700 has a storage space for the program code 710 for executing any method steps in the above methods. These program codes can be read out from or written into one or more computer program products. The program code 710 may be compressed in a suitable form, for example.
最后应说明的是:以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不驱使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the application, not to limit them; although the application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: The technical solutions recorded in the foregoing embodiments are modified, or some of the technical features are equivalently replaced; these modifications or replacements do not drive the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims (20)

  1. 一种图像合成方法,其特征在于,所述方法包括:An image synthesis method, characterized in that the method includes:
    获取电子设备的当前功耗以及待显示图像的多个图层;Obtain the current power consumption of the electronic device and multiple layers of the image to be displayed;
    判断所述当前功耗是否高于预设阈值;Judging whether the current power consumption is higher than a preset threshold;
    若是,则利用多媒体显示处理器对所述多个图层进行合成并显示,If yes, use the multimedia display processor to synthesize and display the multiple layers,
    若否,则利用图形处理器对所述多个图层进行合成并显示。If not, the graphics processor is used to synthesize and display the multiple layers.
  2. 根据权利要求1所述的方法,其特征在于,所述方法还包括:The method of claim 1, wherein the method further comprises:
    获取电子设备当前的屏幕分辨率;Obtain the current screen resolution of the electronic device;
    所述获取电子设备的当前功耗以及待显示图像的多个图层之后,还包括:After obtaining the current power consumption of the electronic device and the multiple layers of the image to be displayed, the method further includes:
    根据所述屏幕分辨率分别对所述多个图层的各个图层进行分辨率调整。The resolution adjustment is performed on each of the multiple layers according to the screen resolution.
  3. 根据权利要求2所述的方法,其特征在于,所述根据所述屏幕分辨率分别对所述多个图层的各个图层进行分辨率调整,包括:The method of claim 2, wherein the adjusting the resolution of each of the multiple layers according to the screen resolution comprises:
    保持分辨率与所述屏幕分辨率适配的图层的分辨率不变,Keep the resolution of the layer whose resolution matches the screen resolution unchanged,
    将分辨率与所述屏幕分辨率不适配的图层的分辨率调整到与所述屏幕分辨率适配。The resolution of the layer whose resolution does not match the screen resolution is adjusted to match the screen resolution.
  4. 根据权利要求2或3所述的方法,其特征在于,所述根据所述屏幕分辨率分别对所述多个图层的各个图层进行分辨率调整之前,还包括:The method according to claim 2 or 3, wherein before the adjusting the resolution of each of the multiple layers according to the screen resolution, the method further comprises:
    判断所述多个图层中是否有图层的分辨率与所述屏幕分辨率不适配;Determining whether the resolution of any of the multiple layers does not match the screen resolution;
    若有,执行所述根据所述屏幕分辨率分别对所述多个图层的各个图层进行分辨率调整。If yes, performing the resolution adjustment of each of the multiple layers according to the screen resolution.
  5. 根据权利要求4所述的方法,其特征在于,判断待显示图像的多个图层中是否有图层的分辨率与屏幕分辨率不适配,包括:The method according to claim 4, wherein determining whether the resolution of a layer among the multiple layers of the image to be displayed does not match the screen resolution, comprising:
    依次判断每个图层的分辨率与屏幕分辨率是否适配;Determine in turn whether the resolution of each layer matches the screen resolution;
    若判断到有图层的分辨率与屏幕的分辨率不适配,确定多个图层中有图层的分辨率与屏幕分辨率不适配。If it is determined that the resolution of a layer does not match the resolution of the screen, it is determined that the resolution of a layer of multiple layers does not match the screen resolution.
  6. 根据权利要求5所述的方法,其特征在于,依次判断每个图层的分辨率与屏幕分辨率是否适配,包括:The method according to claim 5, wherein sequentially determining whether the resolution of each layer matches the screen resolution comprises:
    判断各个图层中图片的分辨率与屏幕分辨率是否适配;Determine whether the resolution of the picture in each layer matches the screen resolution;
    若图层中图片的分辨率与屏幕分辨率不适配,确定图层的分辨率与屏幕分辨率不适配。If the resolution of the image in the layer does not match the screen resolution, determine that the resolution of the layer does not match the screen resolution.
  7. 根据权利要求6所述的方法,其特征在于,所述根据所述屏幕分辨率分别对所述多个图层的各个图层进行分辨率调整,包括:The method according to claim 6, wherein the adjusting the resolution of each of the multiple layers according to the screen resolution comprises:
    将分辨率与所述屏幕分辨率不适配的图片的分辨率调整到与所述屏幕分辨率适配。The resolution of the picture whose resolution does not match the screen resolution is adjusted to match the screen resolution.
  8. 根据权利要求1至7任一项所述的方法,其特征在于,获取电子设备的当前功耗包括:The method according to any one of claims 1 to 7, wherein obtaining the current power consumption of the electronic device comprises:
    获取表征功耗的参数值。Obtain parameter values that characterize power consumption.
  9. 根据权利要求8任一项所述的方法,其特征在于,所述判断所述当前功耗是否高于预设阈值,包括:The method according to any one of claims 8, wherein the determining whether the current power consumption is higher than a preset threshold value comprises:
    判断获取到的参数值是否高于所述参数值对应的预设阈值。It is determined whether the acquired parameter value is higher than a preset threshold corresponding to the parameter value.
  10. 根据权利要求1至9任一项所述的方法,其特征在于,所述判断所述当前功耗是否高于预设阈值,包括:The method according to any one of claims 1 to 9, wherein the judging whether the current power consumption is higher than a preset threshold comprises:
    判断在预设时间段内电子设备的剩余电量的改变值是否大于预设变化阈值;Determining whether the change value of the remaining power of the electronic device within the preset time period is greater than the preset change threshold;
    若大于,则判定所述当前功耗高于预设阈值。If it is greater than, it is determined that the current power consumption is higher than the preset threshold.
  11. 根据权利要求10所述的方法,其特征在于,所述判断在预设时间段内电子设备的剩余电量的改变值是否大于预设变化阈值,包括:The method according to claim 10, wherein the determining whether the change value of the remaining power of the electronic device within a preset time period is greater than a preset change threshold comprises:
    每间隔一个预设时间,获取一次电子设备的剩余电量;Obtain the remaining power of the electronic device at intervals of a preset time;
    对于每次获得的剩余电量,若与上个预设时间所获取的剩余电量的差值大于所述预设变化阈值,则判定剩余电量的改变值大于预设变化阈值。For the remaining power obtained each time, if the difference between the remaining power obtained at the last preset time is greater than the preset change threshold, it is determined that the change value of the remaining power is greater than the preset change threshold.
  12. 根据权利要求11所述的方法,其特征在于,所述判断所述当前功耗是否高于预设阈值,还包括:The method according to claim 11, wherein said determining whether the current power consumption is higher than a preset threshold value further comprises:
    判断剩余电量的改变值的波动频率是否大于预设频率;Determine whether the fluctuation frequency of the change value of the remaining power is greater than the preset frequency;
    若是,判定当前功耗高于预设阈值。If yes, it is determined that the current power consumption is higher than the preset threshold.
  13. 根据权利要求12所述的方法,其特征在于,若剩余电量的改变值的波动频率大于预设频率,在预设时间内利用多媒体显示处理器对所述多个图层进行合成。The method according to claim 12, wherein if the fluctuation frequency of the change value of the remaining power is greater than the preset frequency, the multimedia display processor is used to synthesize the multiple layers within the preset time.
  14. 根据权利要求1-9任一项所述的方法,其特征在于,所述判断所述当前功耗是否高于预设阈值,包括:The method according to any one of claims 1-9, wherein the judging whether the current power consumption is higher than a preset threshold comprises:
    判断所述电子设备的当前图形处理器负载率是否大于预设负载率;Determine whether the current graphics processor load rate of the electronic device is greater than a preset load rate;
    若大于,则判定所述当前功耗高于预设阈值。If it is greater than, it is determined that the current power consumption is higher than the preset threshold.
  15. 根据权利要求14所述的方法,其特征在于,所述判断所述当前功耗是否高于预设阈值,还包括:The method according to claim 14, wherein the determining whether the current power consumption is higher than a preset threshold value further comprises:
    判断GPU的负载率的波动频率是否大于预设频率;若是,判定当前功耗高于预设阈值。Determine whether the fluctuation frequency of the GPU load rate is greater than the preset frequency; if so, determine that the current power consumption is higher than the preset threshold.
  16. 根据权利要求15所述的方法,其特征在于,若GPU的负载率的波动频率大于预设频率,在预设时间内利用多媒体显示处理器对所述多个图层进行合成。15. The method according to claim 15, wherein if the fluctuation frequency of the GPU load rate is greater than the preset frequency, the multimedia display processor is used to synthesize the multiple layers within the preset time.
  17. 根据权利要求1-16任一项所述的方法,其特征在于,对所述多个图层进行合成并显示,包括:The method according to any one of claims 1-16, wherein synthesizing and displaying the multiple layers comprises:
    获取所述多个图层在显示界面上的对应的窗口;Acquiring corresponding windows of the multiple layers on the display interface;
    将所述多个图层按照对应的窗口显示在电子设备的显示界面上。The multiple layers are displayed on the display interface of the electronic device according to the corresponding windows.
  18. 一种图像合成装置,其特征在于,所述装置包括:An image synthesis device, characterized in that the device includes:
    获取模块,用于获取电子设备的当前功耗以及待显示图像的多个图层;The obtaining module is used to obtain the current power consumption of the electronic device and multiple layers of the image to be displayed;
    判断模块,用于判断所述当前功耗是否高于预设阈值;A judging module for judging whether the current power consumption is higher than a preset threshold;
    合成模块,用于若是,则利用多媒体显示处理器对所述多个图层进行合成并显示,The synthesis module is used for synthesizing and displaying the multiple layers using the multimedia display processor, if so,
    若否,则利用图形处理器对所述多个图层进行合成并显示。If not, the graphics processor is used to synthesize and display the multiple layers.
  19. 一种电子设备,其特征在于,所述电子设备包括:An electronic device, characterized in that, the electronic device includes:
    一个或多个处理器;One or more processors;
    存储器,与所述一个或多个处理器电连接;A memory, electrically connected to the one or more processors;
    一个或多个应用程序,其中所述一个或多个应用程序被存储在所述存储器中并被配置为由所述一个或多个处理器执行,所述一个或多个应用程序配置用于执行如权利要求1至17任一项所述的方法。One or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the one or more processors, and the one or more application programs are configured to execute The method of any one of claims 1-17.
  20. 一种计算机可读取存储介质,其特征在于,所述计算机可读取存储介质中存储有程序代码,所述程序代码可被处理器调用执行如权利要求1至7任一项所述的方法。A computer readable storage medium, wherein the computer readable storage medium stores program code, and the program code can be called by a processor to execute the method according to any one of claims 1 to 7 .
PCT/CN2020/100978 2019-07-17 2020-07-09 Image synthesis method and apparatus, electronic device, and storage medium WO2021008427A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910647109.7 2019-07-17
CN201910647109.7A CN110413245A (en) 2019-07-17 2019-07-17 Image composition method, device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
WO2021008427A1 true WO2021008427A1 (en) 2021-01-21

Family

ID=68361800

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/100978 WO2021008427A1 (en) 2019-07-17 2020-07-09 Image synthesis method and apparatus, electronic device, and storage medium

Country Status (2)

Country Link
CN (1) CN110413245A (en)
WO (1) WO2021008427A1 (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110413245A (en) * 2019-07-17 2019-11-05 Oppo广东移动通信有限公司 Image composition method, device, electronic equipment and storage medium
CN110377257B (en) * 2019-07-17 2022-04-19 Oppo广东移动通信有限公司 Layer composition method and device, electronic equipment and storage medium
CN113625983A (en) * 2021-08-10 2021-11-09 Oppo广东移动通信有限公司 Image display method, image display device, computer equipment and storage medium
CN113655975B (en) * 2021-08-10 2022-12-02 北京百度网讯科技有限公司 Image display method, image display device, electronic apparatus, and medium
CN114691069A (en) * 2022-03-30 2022-07-01 Oppo广东移动通信有限公司 Image display adjustment method and device and electronic equipment

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130038615A1 (en) * 2011-08-09 2013-02-14 Apple Inc. Low-power gpu states for reducing power consumption
CN106407003A (en) * 2016-08-29 2017-02-15 广州视睿电子科技有限公司 Screen interface display method and system
CN107680029A (en) * 2017-08-31 2018-02-09 深圳天珑无线科技有限公司 Image processing method, electronic equipment and the device with store function
CN109379627A (en) * 2018-11-27 2019-02-22 Oppo广东移动通信有限公司 Method for processing video frequency, device, electronic equipment and storage medium
CN109871192A (en) * 2019-03-04 2019-06-11 京东方科技集团股份有限公司 A kind of display methods, device, electronic equipment and computer readable storage medium
CN110413245A (en) * 2019-07-17 2019-11-05 Oppo广东移动通信有限公司 Image composition method, device, electronic equipment and storage medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103593155B (en) * 2013-11-06 2016-09-07 华为终端有限公司 Display frame generating method and terminal device
US9582068B2 (en) * 2015-02-24 2017-02-28 Qualcomm Incorporated Circuits and methods providing state information preservation during power saving operations
CN106331831B (en) * 2016-09-07 2019-05-03 珠海市魅族科技有限公司 The method and device of image procossing

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130038615A1 (en) * 2011-08-09 2013-02-14 Apple Inc. Low-power gpu states for reducing power consumption
CN106407003A (en) * 2016-08-29 2017-02-15 广州视睿电子科技有限公司 Screen interface display method and system
CN107680029A (en) * 2017-08-31 2018-02-09 深圳天珑无线科技有限公司 Image processing method, electronic equipment and the device with store function
CN109379627A (en) * 2018-11-27 2019-02-22 Oppo广东移动通信有限公司 Method for processing video frequency, device, electronic equipment and storage medium
CN109871192A (en) * 2019-03-04 2019-06-11 京东方科技集团股份有限公司 A kind of display methods, device, electronic equipment and computer readable storage medium
CN110413245A (en) * 2019-07-17 2019-11-05 Oppo广东移动通信有限公司 Image composition method, device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN110413245A (en) 2019-11-05

Similar Documents

Publication Publication Date Title
WO2021008420A1 (en) Layer synthesis method and apparatus, electronic device, and storage medium
WO2021008427A1 (en) Image synthesis method and apparatus, electronic device, and storage medium
US20220139353A1 (en) Display method, electronic device, and non-transitory computer-readable storage medium
CN110377264B (en) Layer synthesis method, device, electronic equipment and storage medium
WO2021008424A1 (en) Method and device for image synthesis, electronic apparatus and storage medium
AU2020201023B2 (en) Adaptive transfer function for video encoding and decoding
WO2021008418A1 (en) Layer composition method and apparatus, electronic device, and storage medium
CN110688081B (en) Method for displaying data on screen and display control device
EP2756481B1 (en) System and method for layering using tile-based renderers
EP2778898A1 (en) Image data processing method and electronic device supporting the same
WO2021008390A1 (en) Image layer processing method and apparatus, electronic device, and computer-readable medium
WO2018176734A1 (en) Data processing method and terminal
WO2018000372A1 (en) Picture display method and terminal
WO2017202175A1 (en) Method and device for video compression and electronic device
WO2018126594A1 (en) Display switching method for terminal, and terminal
CN112596843A (en) Image processing method, image processing device, electronic equipment and computer readable storage medium
CN109688462B (en) Method and device for reducing power consumption of equipment, electronic equipment and storage medium
CN109587555B (en) Video processing method and device, electronic equipment and storage medium
JP2010097334A (en) Drawing device
US11169683B2 (en) System and method for efficient scrolling
CN111475665B (en) Picture playing method, device, terminal and storage medium
JP4402088B2 (en) Image processing method and apparatus, and electronic apparatus using them
US8754908B2 (en) Optimized on-screen video composition for mobile device
JP6120561B2 (en) Graphic drawing apparatus and graphic drawing program
US20240169953A1 (en) Display processing unit (dpu) pixel rate based on display region of interest (roi) geometry

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20839890

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20839890

Country of ref document: EP

Kind code of ref document: A1