Adaptive compression method for picture-text browsing scenario and electronic device
By using an adaptive compression method, the compression ratio of the fixed bit rate in the image and text browsing scenario is dynamically adjusted, which solves the problems of increased memory usage and power consumption in the image and text browsing scenario, achieves lossless visual effects, and improves device performance and user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HONOR DEVICE CO LTD
- Filing Date
- 2024-12-02
- Publication Date
- 2026-06-02
AI Technical Summary
In image and text browsing scenarios, the image rendering and display of electronic devices leads to increased memory usage, bandwidth consumption, and GPU load, resulting in increased system load, decreased performance, increased power consumption, and negatively impacting user experience.
An adaptive compression method is adopted, which dynamically adjusts the fixed bit rate compression ratio by recognizing image and text browsing scene information, controlling system resource usage, reducing memory bandwidth consumption, and reducing power consumption. This includes recognizing user browsing operations, image attributes, device power consumption modes, and performance status, and using hardware-level texture compression technology.
It effectively reduces memory usage and bandwidth consumption, lowers power consumption, improves device performance, solves problems such as lag and insufficient battery life, and enhances user experience.
Smart Images

Figure CN122137961A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to an adaptive compression method and electronic device for image and text browsing scenarios. Background Technology
[0002] Currently, in image and text browsing scenarios such as browsing web pages, social media application interfaces, or local images, electronic devices render and display image and text pages in real time. The browsing page often features multiple images, large images, or high-resolution images on the first screen. At this time, the rendering and display of images will significantly increase memory usage, bandwidth consumption, and GPU load, leading to increased system load, performance degradation, and increased power consumption. This can cause browsing lag, rapid drop in device battery power, and seriously affect the user experience. Summary of the Invention
[0003] This application provides an adaptive compression method and electronic device for image and text browsing scenarios, which can effectively control the occupation of system resources, reduce memory bandwidth usage, reduce power consumption, and avoid problems such as lag and insufficient battery life, thereby improving the user experience.
[0004] In a first aspect, this application provides an adaptive compression method for a text and image browsing scenario, applied to an electronic device. The method includes: receiving a first operation performed by a user on a first interface, the first interface displaying images and text; responding to the first operation, identifying the current user scenario as a text and image browsing scenario; in the text and image browsing scenario, acquiring image attribute information of the first interface, detecting user browsing operation information performed on the first interface, and monitoring device power consumption mode and device performance status; and, based on the first scenario information, invoking an adaptive compression control algorithm to compress the text and image content of the first interface at a fixed bit rate; wherein the first scenario information includes at least one of the following: image attribute information of the first interface, user browsing operation information, device power consumption mode, and device performance status.
[0005] Among them, fixed bit rate compression is a hardware-based texture compression technology. Since the texture compression module is a hardware-level compression chip, it can achieve a high compression ratio and significantly reduce the amount of texture data while ensuring rendering quality.
[0006] The adaptive compression method for image and text browsing scenarios provided in this application allows for fixed-bitrate compression of image and text content. Based on user browsing operation information (such as browsing speed / dwell time / editing status), image attribute information (such as multiple images / thumbnail / large image), device power consumption mode (such as whether it is in power-saving mode), and device performance status (such as whether it is in low-performance state), the fixed-bitrate compression ratio is dynamically adjusted to achieve adaptive compression control. This effectively controls system resource usage, reduces memory consumption and bandwidth consumption, lowers overall power consumption, improves performance, and provides visually lossless effects. Especially for low-performance electronic devices (e.g., small memory, low CPU / GPU performance), it solves problems such as lag and insufficient battery life, greatly improving the user experience.
[0007] Fixed bitrate compression is a lossy compression method, allowing for some quality loss during rendering. Because at higher bitrates, despite being lossy compression, the image loss is almost imperceptible, achieving a visually lossless effect, fixed bitrate compression is also called visually lossless compression. In image and text browsing scenarios, which involve loading a large number of images, this application uses fixed bitrate compression for image and text compression and dynamically adjusts the compression ratio based on the image and text browsing scenario information. This not only reduces GPU load, improves rendering performance, and reduces power consumption, but also achieves a visual effect close to lossless compression.
[0008] In some possible implementations, the step of invoking an adaptive compression control algorithm to perform fixed bit rate compression on the text and image content of the first interface based on the first scene information includes: invoking the adaptive compression control algorithm to determine a fixed bit rate compression strategy based on the first scene information; and performing texture compression on the text and image content of the first interface according to the fixed bit rate compression strategy. The fixed bit rate compression strategy includes adopting a fixed bit rate compression method and a first compression level.
[0009] The above scheme allows for the use of a fixed bit rate compression method in image and text browsing scenarios. By selecting an appropriate compression level based on the scenario information, texture compression can be applied to the image and text content. This reduces memory usage and bandwidth consumption, lowers overall power consumption, improves performance, and provides visually lossless effects.
[0010] In some possible implementations, the first compression level can correspond to a compression ratio.
[0011] In some other possible implementations, the first compression level can correspond to multiple alternative compression ratios.
[0012] In some possible implementations, the step of performing texture compression on the graphic content of the first interface according to the fixed bit rate compression strategy includes: determining a first compression ratio from a plurality of alternative compression ratios based on the compression ratio supported by the view texture format corresponding to the first interface and the compression ratio supported by the hardware module in the electronic device; and performing texture compression on the graphic content of the first interface using the first compression ratio.
[0013] The above approach allows for more precise control of the fixed bit rate compression ratio, more effective control of system resource usage, reduced memory consumption and bandwidth usage, lower overall power consumption, and better improvement of device performance.
[0014] It is understandable that increasing the compression ratio of textures reduces the memory occupied by textures, reduces GPU load, reduces power consumption, and makes the improvement in device performance more obvious.
[0015] The compression ratio can also be called the compression ratio or compression rate.
[0016] For example, a compression ratio of 4:1 means the ratio of the original data size to the compressed data size is 4:1 (i.e., 8:2). A compression ratio of 2:1 means the ratio of the original data size to the compressed data size is 2:1 (i.e., 8:4). A compression ratio of 8:5 means the ratio of the original data size to the compressed data size is 8:5. A compression ratio of 4:1 is greater than a compression ratio of 2:1, and a compression ratio of 2:1 is greater than a compression ratio of 8:5.
[0017] It should be noted that the above compression ratio is an illustrative example. In actual implementation, the compression ratio can be set according to actual usage requirements.
[0018] In some possible implementations, fixed bitrate compression can be implemented as texture block compression, which involves dividing the texture into multiple texture blocks, for example, each containing 4*4 pixels, and then compressing each texture block. By dividing the texture into fixed-size texture blocks, compressing each texture block individually, and loading it into video memory, video memory usage can be reduced.
[0019] Besides using compression ratio to characterize the degree of compression at a fixed bit rate, the compressed bit rate can also be used. For example, the unit of compressed bit rate can be BPC (bits per component, the number of bits per color channel). The compressed bit rate represents the number of bits per color channel per pixel after compression at a fixed bit rate.
[0020] In some embodiments, the compression bit rate can be 2 BPC, that is, after compression at a fixed bit rate, each color channel corresponds to 2 bits (i.e., occupies 2 bits).
[0021] In other embodiments, the compression bit rate can be 4 BPC, meaning that after compression at a fixed bit rate, each color channel corresponds to 4 bits (i.e., occupies 4 bits).
[0022] In some cases, compression bitrate can be understood as the number of bits per second used to represent encoded (compressed) audio / video data. Generally, a higher compression bitrate (smaller compression ratio) results in a larger amount of data transmitted and better audio / video quality. Conversely, a lower compression bitrate (larger compression ratio) results in a smaller amount of data transmitted, but with a slight decrease in audio / video quality.
[0023] In some possible implementations, after determining the fixed bit rate compression strategy, the method further includes: creating compression control parameters in the form of a structure, the compression control parameters including a first flag bit and a second flag bit; writing an identifier of the fixed bit rate compression method into the first flag bit and writing an identifier of the first compression level into the second flag bit; and calling the graphics API interface of the electronic device to pass the first compression control parameters to a hardware module with texture compression capability.
[0024] Fixed bitrate compression is a hardware-based texture compression technology. Since the texture compression module is a hardware-level compression chip, it can achieve a high compression ratio and significantly reduce the amount of texture data while maintaining rendering quality. It is understandable that in image and text browsing scenarios, the memory bandwidth requirements of electronic devices increase, and the GPU load on these devices increases significantly. The solution in this application, by performing fixed bitrate compression on image and text content based on the current scene information, can reduce memory bandwidth usage, lower CPU / GPU power consumption, improve system performance, and provide visually lossless effects.
[0025] In some possible implementations, the step of identifying the current user scenario as a text and image browsing scenario in response to the first operation includes: identifying the view corresponding to the first interface; identifying whether the first operation meets preset operation conditions; if the first interface includes an image view (ImageView) and a text view (TextView), and the first operation meets the preset operation conditions, then the current user scenario is determined to be the text and image browsing scenario.
[0026] The above scheme can accurately identify the image and text browsing scenario, and then use fixed bit rate compression for the image and text browsing scenario, thereby reducing memory bandwidth usage and reducing CPU and GPU power consumption.
[0027] In some possible implementations, monitoring the device performance status includes: acquiring real-time dynamic performance parameters of the electronic device, including CPU utilization, DDR memory utilization, DDR bandwidth, and / or GPU load; acquiring pre-configured performance parameters of the electronic device, including available DDR memory, available DDR bandwidth, and GPU frequency; and determining the device performance status based on the real-time dynamic performance parameters and the pre-configured performance parameters.
[0028] In some possible implementations, the adaptive compression control algorithm includes: for the device performance state, the compression ratio corresponding to the low performance state is higher than the compression ratio corresponding to the high performance state.
[0029] For example, the device performance status may include multiple levels, such as two states: high and low. Alternatively, it may include three states: high, medium, and low, or it may be divided into even more states.
[0030] It should be noted that the performance status of electronic devices is related not only to pre-configured performance parameters but also to real-time dynamic performance parameters. For the same device, performance can be affected by foreground and background applications. Under conditions of high resource contention, background applications may impact the performance of foreground applications. Therefore, the adaptive compression control algorithm provided in this application embodiment can adjust the fixed bit rate compression ratio in real time according to the dynamic changes in device performance status, effectively controlling the occupation of system resources, improving performance, and providing visually lossless effects.
[0031] In some possible implementations, an initial compression ratio can be preset based on an adaptive compression control algorithm. For example, the preset compression ratio could be 2:1.
[0032] In some possible implementations, the step of invoking an adaptive compression control algorithm to compress the text and image content at a fixed bit rate based on the first scene information includes the following three implementation methods:
[0033] Implementation Method 1: In image and text browsing scenarios, directly employ a fixed bitrate compression method to perform texture compression on the image and text content at a preset compression ratio. This approach reduces memory bandwidth usage and lowers CPU and GPU power consumption, thus avoiding issues such as stuttering and insufficient battery life, thereby improving the user experience.
[0034] Implementation Method Two: Determine whether the electronic device is in a high-load or low-performance state based on its pre-configured performance parameters and real-time dynamic performance parameters. In the high-load or low-performance state, use a fixed bitrate compression method to perform texture compression on the text and image content at a preset compression ratio. This approach determines whether the electronic device is in a high-load or low-performance state during text and image browsing. If it is, the text and image content is compressed at a fixed bitrate using a preset compression ratio. This reduces memory bandwidth usage and lowers CPU and GPU power consumption, effectively avoiding issues such as lag and insufficient battery life, thus improving the user experience.
[0035] Implementation Method 3: Determine whether the electronic device is in a high-load state and / or a low-performance state based on the pre-configured performance parameters and real-time dynamic performance parameters of the electronic device; in the high-load state and / or low-performance state, based on the first scenario information, call the adaptive compression control algorithm to determine the fixed bit rate compression ratio, and use the compression ratio to compress the text and image content.
[0036] The above solution determines whether an electronic device is under high load and / or low performance in an image and text browsing scenario. If the device is under high load and / or low performance, an adaptive compression control algorithm is invoked to determine the compression ratio based on scenario information such as image attribute information, user browsing operation information, device power consumption mode, and / or device performance status. The image and text content is then compressed at a fixed bit rate using the determined compression ratio. This reduces memory bandwidth usage and lowers CPU and GPU power consumption, effectively avoiding issues such as lag and insufficient battery life, thus improving the user experience.
[0037] For example, in image and text browsing scenarios where electronic devices display multiple images (complex content) and the system is under high load, the system prioritizes using fixed bitrate compression. Then, based on scenario information such as content complexity, user browsing operations, device performance, and / or system status, the compression level is dynamically adjusted in real time.
[0038] For example, in an image and text browsing scenario where an electronic device displays multiple images (complex content) and power-saving mode is enabled, the system prioritizes fixed bitrate compression. Then, based on scenario information such as content complexity, user browsing operations, device performance, and / or system status, the compression level is dynamically adjusted in real time.
[0039] For example, in image and text browsing scenarios where electronic devices display multiple images (complex content), users browse quickly, and the system is under high load, the system prioritizes using fixed bitrate compression. Then, based on scenario information such as content complexity, user browsing behavior, device performance, and / or system status, the compression level is dynamically adjusted in real time.
[0040] In some possible implementations, the image attribute information of the first interface is used to indicate whether the images on the first interface belong to a first type of image or a second type of image; wherein, the first type of image includes thumbnails, multiple images, images with blurring, and / or background layers; the second type of image includes large images, detailed images, and / or images in edit mode. Accordingly, the adaptive compression control algorithm includes: the compression ratio corresponding to the first type of image is higher than the compression ratio corresponding to the second type of image.
[0041] It should be noted that users may have varying sensitivities to visual quality depending on the number and size of images. Therefore, different compression strategies can be employed for different image display formats. The solution in this application first analyzes image attribute information to determine whether it is a multi-image or thumbnail display format, or a detailed or large image display format. Then, an appropriate compression strategy is determined based on the image attribute information. For example, detailed or large image displays may require a lower compression ratio to maintain clarity, while multi-image or thumbnail displays may tolerate a higher compression ratio.
[0042] The above solution allows electronic devices to automatically select compression strategies and compress text and image content at a fixed bit rate by recognizing image attribute information. This reduces memory bandwidth usage and lowers CPU and GPU power consumption, effectively avoiding issues such as lag and insufficient battery life, thus improving the user experience.
[0043] In some possible implementations, the device power consumption mode is a power-saving mode, a memory-saving mode, or a normal mode. Accordingly, the adaptive compression control algorithm includes a compression ratio higher for the power-saving / memory-saving mode than for the normal mode. This application determines the compression ratio strategy based on the device power consumption mode. When the electronic device is in power-saving mode, increasing the compression ratio can reduce memory bandwidth consumption, thereby reducing power consumption.
[0044] In some possible implementations, image attribute information corresponds to a first weight parameter, user browsing operation information corresponds to a second weight parameter, device power consumption mode corresponds to a third weight coefficient, and device performance status corresponds to a fourth weight coefficient. Accordingly, the step of determining the compression ratio by invoking the adaptive compression control algorithm based on the first scenario information includes: performing a weighted calculation based on the image attribute information and the first weight parameter, user browsing operation information and the second weight parameter, device power consumption mode and the third weight parameter, and device performance status and the fourth weight coefficient, to obtain the compression level or compression ratio.
[0045] It is understandable that the larger the weighting coefficient, the greater its reference value or contribution in determining the compression ratio.
[0046] In some possible implementations, electronic devices can set weight coefficients for various factors based on actual performance and user needs (such as smoothness or clarity requirements).
[0047] For example, for electronic devices with lower performance (e.g., less memory, lower CPU / GPU performance), if users have high demands for smoothness, then a higher weighting can be applied to the device's performance status. This is because, in a low-performance state, increasing the compression ratio can improve smoothness.
[0048] For example, if users have high requirements for image clarity, then a larger weighting coefficient can be set for user browsing operation information and image attributes.
[0049] The above solution can determine an appropriate compression ratio based on the current scene information, the actual performance of electronic devices, and the actual needs of users. It can adaptively compress the texture of text and images, effectively control the use of system resources, reduce memory bandwidth usage, reduce power consumption, improve system performance, solve problems such as lag and insufficient battery life, and greatly enhance the user experience.
[0050] In some possible implementations, after the fixed bit rate compression of the image and text content, the method further includes: when the first scene information changes, invoking an adaptive compression control algorithm to adjust the compression ratio, and using the adjusted compression ratio to perform texture compression on the image and text content.
[0051] In some possible implementations, the step of invoking an adaptive compression control algorithm to adjust the compression ratio when the first scene information changes includes:
[0052] When the image attribute information changes from the second type of image to the first type of image, the adaptive compression control algorithm is invoked to increase the compression ratio; when the image attribute information changes from the first type of image to the second type of image, the adaptive compression control algorithm is invoked to decrease the compression ratio.
[0053] And / or, if the browsing operation speed increases and the increased browsing operation speed is greater than the first speed, the adaptive compression control algorithm is invoked to increase the compression ratio; if the browsing operation speed decreases and the decreased browsing operation speed is less than the first speed, the adaptive compression control algorithm is invoked to decrease the compression ratio.
[0054] And / or, if the browsing time is less than the preset duration, the adaptive compression control algorithm is invoked to increase the compression ratio; if the browsing time is greater than the preset duration, the adaptive compression control algorithm is invoked to decrease the compression ratio.
[0055] And / or, while in image editing mode, invoke the adaptive compression control algorithm to lower the compression ratio; after exiting image editing mode, invoke the adaptive compression control algorithm to increase the compression ratio.
[0056] And / or, when the electronic device switches from normal mode to power saving mode, the adaptive compression control algorithm is invoked to increase the compression ratio; when the electronic device switches from power saving mode to normal mode, the adaptive compression control algorithm is invoked to decrease the compression ratio.
[0057] For example, in image and text browsing scenarios, when browsing speed is fast, increasing the compression ratio reduces memory bandwidth consumption and power consumption, ensuring visual quality without affecting user experience. When browsing speed is slow or browsing time is long, decreasing the compression ratio maintains clarity and improves user experience.
[0058] For example, in image and text browsing scenarios, users may not be able to perceive subtle changes in image quality when displaying multiple images or thumbnails. Therefore, increasing the compression ratio can reduce memory bandwidth consumption, lower power consumption, improve performance, enhance smoothness, and ensure visually lossless results without affecting the user experience. The performance improvement mentioned here mainly manifests as smoothness, i.e., reducing rendering time and frame drops / stuttering, and the higher the compression ratio, the more significant the performance improvement. When displaying detailed images, the compression ratio can be reduced to improve image quality and enhance the user experience.
[0059] For example, in image and text browsing scenarios, when an electronic device switches to power-saving mode, the compression ratio can be increased to reduce memory bandwidth consumption, lower power consumption, improve performance and smoothness, and ensure visually lossless results. When the electronic device switches to normal mode, the compression ratio can be reduced to improve image quality and enhance the user experience.
[0060] The above solution allows for dynamic adjustment of the compression ratio in image and text browsing scenarios based on changes in user browsing operation information, image attribute information, device power consumption mode, and device performance status. This effectively controls system resource usage, reduces memory bandwidth consumption, lowers CPU / GPU power consumption, and improves system performance. In particular, for electronic devices with lower performance (e.g., small memory and low CPU / GPU performance), it solves problems such as lag and insufficient battery life, greatly enhancing the user experience.
[0061] In some possible implementations, the electronic device includes hardware modules such as a central processing unit (CPU), a texture compression module, a graphics processing unit (GPU), and DDR. The texture compression module is a chip with texture compression capabilities. Accordingly, the step of invoking the adaptive compression control algorithm to perform fixed-bit-rate compression on the image and text content includes: the CPU invoking the texture compression module to perform fixed-bit-rate compression on the image and text content using the adaptive compression control algorithm; the CPU storing the texture-compressed data of the image and text content in the DDR and sending image and text content rendering instructions to the GPU.
[0062] The texture compression module, a hardware-level compression chip, achieves a high compression ratio and significantly reduces texture data volume while maintaining rendering quality. By compressing text and image content at a fixed bitrate, system resource usage is effectively controlled, memory bandwidth consumption is reduced, power consumption is lowered, and system performance is improved. This is particularly beneficial for low-performance electronic devices (e.g., those with limited memory or low CPU / GPU performance), resolving issues such as lag and insufficient battery life, and greatly enhancing the user experience.
[0063] In some possible implementations, the electronic device also includes software modules such as a hardware-accelerated rendering engine (e.g., HWUI), a graphics processing engine (e.g., Skia), and a graphics API interface (e.g., OpenGL / Vulkan). Accordingly, the CPU invokes the texture compression module to perform fixed-bitrate compression on the text and image content using an adaptive compression control algorithm. This includes: the CPU determining a fixed-bitrate compression strategy through the hardware-accelerated rendering engine; the hardware-accelerated rendering engine passing the fixed-bitrate compression strategy to the graphics processing engine; the graphics processing engine obtaining texture compression parameters based on the fixed-bitrate compression strategy and passing these parameters to the texture compression module through the graphics API interface; the texture compression parameters include the texture compression type and compression ratio; and the texture compression module performing fixed-bitrate compression on the text and image content based on the texture compression parameters.
[0064] In some possible implementations, the electronic device also includes an application framework layer module. This module monitors user browsing operations, image attribute information, device power consumption mode, and device performance status in text and image browsing scenarios. It also transmits text and image content rendering instructions to the hardware-accelerated rendering engine. Accordingly, the hardware-accelerated rendering engine determines a fixed bitrate compression strategy, including: in response to text and image content rendering instructions, the engine obtains first-scene information such as user browsing operations, image attribute information, device power consumption mode, and / or device performance status from the application framework layer module; and based on this first-scene information, the engine invokes an adaptive compression control algorithm to determine the fixed bitrate compression strategy.
[0065] In some possible implementations, the electronic device also includes a display screen. Accordingly, after the CPU sends a graphic content rendering instruction to the GPU, the method further includes: in response to the graphic content rendering instruction sent by the CPU, the GPU reads texture compression data of the graphic content from DDR and decompresses the texture compression data; the GPU performs texture rendering based on the decompressed texture data and transmits the texture rendering result to the display screen; the display screen displays the graphic content based on the texture rendering result.
[0066] By combining the software and hardware modules of the electronic device, and adaptively compressing the text and image content at a fixed bit rate based on the current scene information, the above solution can effectively control the system resource usage, reduce memory bandwidth usage, lower power consumption, improve system performance, solve problems such as lag and insufficient battery life, and greatly enhance the user experience.
[0067] Secondly, this application provides an adaptive compression apparatus for a text and image browsing scenario. The apparatus includes units for performing the method described in the first aspect above. This apparatus can correspond to performing the method described in the first aspect above. For a detailed description of the units within the apparatus, please refer to the description in the first aspect above; for brevity, it will not be repeated here.
[0068] The method described in the first aspect above can be implemented in hardware or by hardware executing corresponding software. The hardware or software includes one or more modules or units corresponding to the above functions. For example, a processing module or unit, a display module or unit, etc.
[0069] Thirdly, this application provides an electronic device, which includes a processor, a computer program or instructions stored in a memory, wherein the processor is used to execute the computer program or instructions to cause the method in the first aspect to be performed.
[0070] Fourthly, this application provides a computer-readable storage medium having a computer program (also referred to as instructions or code) stored thereon for implementing the method of the first aspect. For example, when the computer program is executed by a computer, it enables the computer to perform the method of the first aspect.
[0071] Fifthly, this application provides a chip including a processor. The processor is used to read and execute a computer program stored in a memory to perform the methods in the first aspect and any possible implementation thereof. Optionally, the chip further includes a memory connected to the processor via a circuit or wire.
[0072] Sixthly, this application provides a chip system including a processor. The processor is used to read and execute a computer program stored in a memory to perform the methods in the first aspect and any possible implementation thereof. Optionally, the chip system further includes a memory connected to the processor via a circuit or wire.
[0073] In a seventh aspect, this application provides a computer program product comprising a computer program (also referred to as instructions or code), which, when executed by an electronic device, causes the electronic device to implement the method in the first aspect.
[0074] It is understood that the beneficial effects of the second to seventh aspects mentioned above can be found in the relevant descriptions in the first aspect mentioned above, and will not be repeated here. Attached Figure Description
[0075] Figure 1A A schematic diagram of a text and image browsing scenario provided in an embodiment of this application;
[0076] Figure 1BA schematic diagram illustrating an improvement to the adaptive compression method for a text and image browsing scenario provided in this application embodiment;
[0077] Figure 2 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application;
[0078] Figure 3 A schematic diagram of the software architecture of an electronic device provided in an embodiment of this application;
[0079] Figure 4A A schematic diagram of the graphic interface view provided in the embodiments of this application;
[0080] Figure 4B This is a flowchart illustrating a possible implementation of texture compression using a CPU, a texture compression module, and a GPU, as provided in an embodiment of this application.
[0081] Figure 4C A schematic diagram illustrating texture compression and rendering using CPU and GPU, etc., provided for embodiments of this application;
[0082] Figures 5A to 5C A schematic diagram of texture compression in the adaptive compression method for a text and image browsing scenario provided in the embodiments of this application;
[0083] Figure 6 A flowchart illustrating the adaptive compression method for a text and image browsing scenario provided in this application embodiment;
[0084] Figure 7 This is a schematic diagram illustrating the selection of a compression ratio based on scene information in the adaptive compression method for a text and image browsing scenario provided in this application embodiment.
[0085] Figure 8 A flowchart illustrating the adaptive compression method for image and text browsing scenarios provided in this application embodiment. Figure 2 ;
[0086] Figure 9 and Figure 10 A schematic diagram illustrating the view drawing process provided in an embodiment of this application;
[0087] Figure 11 A schematic diagram of the temporal interaction process of the adaptive compression method for a text and image browsing scenario provided in the embodiments of this application;
[0088] Figure 12 This is a schematic diagram illustrating the setting of compression parameters in the adaptive compression method for a text and image browsing scenario provided in this application embodiment. Detailed Implementation
[0089] The embodiments of this application will be further described in detail below with reference to specific examples and the accompanying drawings.
[0090] Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as implying or suggesting relative importance or implicitly indicating the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature, and in the description of the embodiments of this application, unless otherwise stated, "more than" means two or more.
[0091] The term "user interface (UI)" used in the following embodiments of this application refers to the medium interface through which an application or operating system interacts and exchanges information with the user. It realizes the conversion between the internal form of information and the form that the user can accept. The user interface is source code written in a specific computer language such as Java or Extensible Markup Language (XML). The interface source code is parsed and rendered on the electronic device, ultimately presenting content that the user can recognize. A common form of user interface is the graphical user interface (GUI), which refers to a user interface related to computer operation displayed graphically. It can be visible interface elements such as text, icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, and widgets displayed on the screen of an electronic device.
[0092] The following is a detailed description of some of the terms used in the embodiments of this application.
[0093] 1) Texture: A texture is a structured storage format that can be read and written by shaders. For example, text and image content textures can include two-dimensional textures, three-dimensional textures, and video textures. Texture formats are data formats that the GPU can directly sample and use when loading and rendering textures.
[0094] 2) GPU: A GPU is a type of dedicated hardware in electronic devices used for processing graphics. A GPU can read texture data (referred to as texture data), load textures, and render textures, thereby efficiently rendering graphics, images, and video content.
[0095] It's important to note that if texture data consumes too much memory, it can cause overheating and negatively impact graphics rendering performance on devices with limited memory bandwidth. Memory bandwidth refers to the amount of data that memory can transfer per unit of time, typically expressed in bytes per second or bits per second.
[0096] 3) Texture Compression: Texture compression is an image compression technique specifically designed for storing textures in computer graphics rendering systems to address memory bandwidth issues. For example, texture compression compresses data in 4x4 pixel blocks. Texture-compressed data can be directly read by the GPU, which then decodes it for graphics rendering, reducing the CPU load and improving GPU rendering efficiency.
[0097] The embodiments of this application may use compression ratio or compression bit rate to characterize the degree of texture compression.
[0098] 4) Compression Ratio: The compression ratio refers to the ratio between the original data size and the data size after texture compression. The compression ratio can also be called the compression rate or compression ratio.
[0099] The smaller the compression ratio, the better the graphics rendering effect, but the larger the file will be.
[0100] The higher the compression ratio, the lower the graphics rendering effect, but the more significantly it can reduce memory usage and transmission bandwidth consumption.
[0101] 5) Compression bit rate: The compression bit rate indicates how many bits are needed to represent each color channel of each pixel in the encoded (compressed) texture data, and the unit is BPC (bits per component). A bit is the smallest unit in binary, represented by 0 or 1.
[0102] Currently, in image and text browsing scenarios such as browsing web pages, social media application interfaces, or local images, electronic devices render and display image and text pages in real time. The browsing page often features multiple images, large images, or high-resolution images on the first screen. At this time, the rendering and display of images will significantly increase memory usage, bandwidth consumption, and GPU load, leading to increased system load, performance degradation, and increased power consumption. This can cause browsing lag, rapid drop in device battery power, and seriously affect the user experience.
[0103] To address the aforementioned issues, this application proposes an adaptive compression method for image and text browsing scenarios. This method is an adaptive lossy compression method based on fixed bit rate compression. By identifying the scenario, the compression ratio of the image and text content is dynamically adjusted, thereby effectively controlling resource consumption when rendering the image and text content.
[0104] The method provided in this application can be applied to various image and text browsing scenarios, such as users browsing web pages, users browsing social media application interfaces, or users browsing image galleries.
[0105] In image and text browsing scenarios, a large number of images are loaded. This application uses a fixed bit rate compression method for image and text compression and dynamically adjusts the image and text compression ratio according to the image and text browsing scenario information. This not only reduces GPU load, improves rendering performance and reduces power consumption, but also achieves a visual effect that is close to lossless compression.
[0106] Figure 1A These are schematic diagrams illustrating various image and text browsing scenarios in the embodiments of this application. Figure 1A (a) in the example represents a scenario where multiple images are viewed on the first screen. The electronic device displays the first screen page, which contains multiple images. Figure 1A (b) in the example represents a large image browsing scenario, where the text and image page displayed on the electronic device includes a single image of a relatively large size. Figure 1A (c) in the image gallery represents a multi-image browsing scenario where an electronic device displays an image gallery page containing a large number of small-sized images. Figure 1A (d) in the image library represents a large image browsing scenario where electronic devices display a single image with a larger size.
[0107] In various image and text browsing scenarios, users will browse in different ways. For example, sometimes they browse quickly, in which case the page scrolling speed is relatively fast; sometimes they stay on a certain page for a long time, in which case the page scrolling speed is relatively slow.
[0108] In various image and text browsing scenarios, the image attribute information is different, that is, the role and size of the image on the page will be different. Accordingly, there are various image display formats on image and text pages, such as multi-image display format, large image display format, or thumbnail display format.
[0109] In various image and text browsing scenarios, the device's power consumption mode (or memory mode) may change. For example, it is usually in normal mode to ensure high-performance operation of the device; under high load conditions, it may start power saving mode to reduce power consumption.
[0110] In various image and text browsing scenarios, the device's performance status will constantly change. For example, the device's performance status is usually good, but sometimes it will be in a low performance state under high load, which can easily cause browsing to lag. At this time, it is necessary to reduce the hardware load.
[0111] This application can identify image and text browsing scenarios and dynamically adjust the compression ratio of image and text content based on the user's browsing operation information (such as scrolling speed and dwell time), image display format (multiple images / large images), device power consumption mode, and device performance status. This reduces GPU load, improves rendering performance, and reduces power consumption, enabling effective control of resource consumption when rendering image and text content.
[0112] First, let's explain the various possible texture compression methods. For example, texture compression can include uncompressed compression, hardware-specific compression, and fixed bit rate compression.
[0113] Uncompressed textures are the most basic storage method, applying no compression whatsoever to the texture data; this method can also be called lossless compression. The color information for each pixel is stored directly, typically including red, green, blue, and possibly alpha (RGBA) channels. Advantages include: maintaining the highest quality of the original image due to the lack of compression; relatively simple algorithms for processing uncompressed textures, easy to implement and understand; and direct GPU access to texture data without decompression. Disadvantages include: high memory consumption; uncompressed textures require more storage space and memory bandwidth, which can be problematic on resource-constrained devices. Furthermore, higher memory bandwidth requirements can lead to higher power consumption.
[0114] The default compression methods used by chips include many GPU-supported hardware-accelerated compression formats, such as S3TC / DXT, PVRTC, ETC, and ASTC. These formats are typically designed by GPU manufacturers based on hardware characteristics. In practice, the chip encodes the texture image using the default compression method and then decompresses the texture using the GPU. This texture compression method results in a relatively large memory footprint for the compressed texture data. Advantages include: hardware-accelerated decompression can reduce memory usage and improve rendering performance while maintaining good image quality. Many modern GPUs support one or more hardware compression formats. Disadvantages include: to reduce data volume, these formats often sacrifice some image quality. Furthermore, different GPUs may support different compression formats, which can lead to cross-platform compatibility issues.
[0115] Fixed bitrate compression is a technique that allocates a fixed number of bits to each image block for compression. It offers predictable resource consumption and performance while maintaining image quality within acceptable limits. Advantages include: using the same bitrate for each image block makes the memory and bandwidth requirements of the compressed image predictable (i.e., predictable resource consumption), aiding resource management. Compared to uncompressed data, fixed bitrate compression significantly reduces memory read / write traffic. At higher bitrates, image loss is almost imperceptible, providing a good visual experience. It also reduces memory and bandwidth consumption, helping to lower GPU and CPU power consumption. Disadvantages include: although the visual effect is good at high bitrates, fixed bitrate compression is still a lossy compression technique and may sacrifice some image detail.
[0116] The choice of each texture storage format needs to be comprehensively considered based on the application scenario, performance requirements, and resource constraints. In practical use, these different texture storage formats can be combined according to specific needs.
[0117] It should be noted that the initial settings of electronic devices can be the default compression of the chip.
[0118] This application can obtain image and text browsing scene information through scene recognition, and select an appropriate texture compression method based on the image and text browsing scene information, which can effectively control the system resource usage. Image and text browsing scene information may include image attribute information, user browsing operation information, device power consumption mode and / or device performance status.
[0119] In this embodiment of the application, in the image and text browsing scenario, a fixed bit rate compression method can be used to compress the image and text content texture, and the compression ratio can be adjusted according to the current scene information. This can effectively control the system resource occupation, reduce memory bandwidth occupation, reduce power consumption, and avoid problems such as lag and insufficient battery life in the image and text browsing scenario, thus improving the user experience.
[0120] To better understand the embodiments of this application, the embodiments of this application will be briefly described below:
[0121] The adaptive compression method for image and text browsing scenarios provided in this application includes: responding to user operations and identifying the current scenario as an image and text browsing scenario; monitoring user browsing operation information, image attribute information, device power consumption mode, and device performance status; and, based on first scenario information, invoking an adaptive compression control algorithm to perform fixed bit rate compression on the image and text content. If the first scenario information changes, the adaptive compression control algorithm is invoked to adjust the compression ratio, and the adjusted compression ratio is used to perform fixed bit rate compression on the image and text content. The first scenario information includes at least one of the following: user browsing operation information, image attribute information, device power consumption mode, and device performance status.
[0122] Image and text browsing scenarios refer to various scenarios where users browse pages containing images. For example, image and text browsing scenarios could include browsing web pages, browsing social media application interfaces, or browsing local images.
[0123] The adaptive compression method for image and text browsing scenarios provided in this application allows for texture compression of image and text content using a fixed bitrate compression method, based on user browsing operation information, image attribute information, device power consumption mode, and / or device performance status. By applying a fixed bitrate compression method to image and text content based on the current scene information, this solution ensures that each image texture block is stored and transmitted using a fixed bitrate, effectively controlling system resource usage. This not only reduces memory bandwidth consumption but also lowers CPU / GPU power consumption, improves system performance, and provides visually lossless effects. Especially for low-performance electronic devices (e.g., those with limited memory and low CPU / GPU performance), this method solves problems such as lag and insufficient battery life, significantly improving the user experience.
[0124] Figure 1B This diagram illustrates the improvements and technical effects of the proposed solution compared to traditional solutions. In traditional solutions, rendering and displaying a large number of images in text and image browsing scenarios consumes significant system resources, such as significantly increasing memory usage, bandwidth consumption, and GPU load, leading to increased system load, performance degradation, and power consumption.
[0125] After improvements, in image and text browsing scenarios, especially when device resources are limited (e.g., electronic devices are under high load and / or low performance), a fixed bitrate compression method is enabled. This method adaptively compresses image and text content based on current scenario information, optimizing memory usage and bandwidth consumption. Specifically, in image and text browsing scenarios, the electronic device dynamically adjusts the fixed bitrate compression ratio based on user browsing operation information, image attribute information, device power consumption mode, and device performance status. This effectively controls system resource usage, reduces memory consumption and bandwidth consumption, and lowers overall power consumption. Power consumption measures the efficiency of resource (electricity) consumption during computation. Given a fixed battery capacity, the lower the power consumption of the phone, the less power is consumed per unit time, and the longer the device can be used.
[0126] The improvements in this application's solution are as follows: It employs fixed bitrate compression, which reduces GPU load while maintaining visual quality, thereby improving performance and reducing power consumption. Furthermore, it uses an adaptive compression strategy to dynamically adjust the compression ratio based on different device states and browsing scenarios, achieving a balance between performance and visual quality.
[0127] The following description, in conjunction with the accompanying drawings, describes the electronic device to which the adaptive compression method for image and text browsing scenarios provided in this application is applied. For example, the electronic device in this application embodiment may be a mobile phone, tablet computer, ultra-mobile personal computer (UMPC), netbook, as well as a cellular phone, personal digital assistant (PDA), wearable device (such as a smartwatch, smart bracelet), or other device with image display capabilities. This application embodiment does not impose any special limitations on the specific form of the electronic device.
[0128] Figure 2 This illustration shows a hardware structure diagram of an electronic device according to an embodiment of this application. For example, a mobile phone is used as an example. Figure 2 As shown, the electronic device may include: a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, antenna 1, antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver (i.e., earpiece) 170B, a microphone 170C, a headphone jack 170D, a sensor module 180, buttons 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The aforementioned sensor module may include pressure sensors and touch sensors.
[0129] Processor 110 may include one or more processing units, such as a central processing unit (CPU), an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural network processing unit (NPU). These different processing units may be independent devices or integrated into one or more processors.
[0130] The CPU performs calculations and decoding on the resources, and then transmits the texture data to the GPU. The GPU decompresses the texture data into a texture buffer and performs texture rendering based on the decompressed texture data.
[0131] GPUs employ a massively parallel hardware architecture, enabling the simultaneous execution of multiple threads, thereby significantly enhancing graphics rendering and data-parallel computing capabilities. As a key hardware component of a computer system, GPUs can be embedded within a chip system or connected to the motherboard as a standalone graphics card unit. Regardless of the method, GPUs provide powerful graphics rendering and visual computing support for the system. Electronic devices equipped with GPU acceleration can not only smoothly render 3D graphics, animations, and video content, but also are widely used in visually intensive scenarios such as gaming, professional graphics, and video editing.
[0132] A controller can be the nerve center and command center of an electronic device. Based on the instruction opcode and timing signals, the controller generates operation control signals to control the fetching and execution of instructions.
[0133] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can retrieve it directly from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0134] In some embodiments, the processor 110 may include one or more interfaces. Interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0135] It is understood that the interface connection relationships between the modules illustrated in this embodiment are merely illustrative and do not constitute a structural limitation on the electronic device. In other embodiments, the electronic device may also employ different interface connection methods or combinations of multiple interface connection methods as described in the above embodiments.
[0136] In this embodiment, the processor 110 may further include a texture compression module. The texture compression module is hardware with texture compression and decompression capabilities. The specific application of the texture compression module will be described in detail below.
[0137] In this embodiment, the processor 110 is used to perform fixed bit rate compression on the text and image content using a texture compression module in a text and image browsing scenario. It also dynamically adjusts the fixed bit rate compression ratio based on current scenario information such as user browsing operation information, image attribute information, device power consumption mode, and device performance status to achieve adaptive compression control. This can effectively control the occupation of system resources, reduce memory occupation and bandwidth consumption, and reduce overall power consumption.
[0138] The external storage interface 120 can be used to connect an external storage card, such as a Micro SD card, to expand the storage capacity of the electronic device. The external storage card communicates with the processor 110 through the external storage interface 120 to perform data storage functions. For example, music, video, and other files can be saved on the external storage card.
[0139] Internal memory 121 can be used to store computer executable program code, including instructions. Internal memory 121 may include a program storage area and a data storage area. The program storage area may store the operating system, applications required for at least one function, etc. The data storage area may store data created during the use of the electronic device, etc.
[0140] For example, in this embodiment, the processor 110 can implement the adaptive compression method for the image and text browsing scenario provided in this embodiment by executing instructions stored in the internal memory 121.
[0141] In addition, the internal memory 121 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc. The processor 110 performs various functional applications and data processing of the electronic device by executing instructions stored in the internal memory 121 and / or instructions stored in memory disposed in the processor.
[0142] For example, in this embodiment of the application, the internal memory 121 may include DDR main memory, DDR video memory, and texture cache.
[0143] The charging management module 140 receives charging input from a charger (such as a wireless charger or a wired charger) to charge the battery 142. The power management module 141 connects the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140 to power various components of the electronic device.
[0144] The wireless communication function of electronic devices can be realized through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor, and baseband processor.
[0145] Electronic devices can achieve shooting functions through image signal processors, cameras 193, video codecs, GPUs, displays 194, and application processors.
[0146] Electronic devices can implement display functions through GPUs, displays 194, and application processors. A GPU is a microprocessor for image processing, connecting the display 194 and the application processor. The GPU performs mathematical and geometric calculations and is used for graphics rendering. Processor 110 may include one or more GPUs, which execute program instructions to generate or modify display information.
[0147] The display screen 194 is used to display images or videos, etc. In this embodiment of the application, the display screen 194 can display a graphic interface, and the graphic interface can display one or more images and text, etc.
[0148] The above is a detailed description of the embodiments of this application using electronic device 100 as an example. It should be understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on electronic device 100. Electronic device 100 may have more or fewer components than shown in the figures, may combine two or more components, or may have different component configurations. The various components shown in the figures can be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and / or application-specific integrated circuits.
[0149] In addition, an operating system runs on top of the aforementioned hardware. This operating system can be any one or more computer operating systems that implement business processing through processes, such as Linux, Unix, Android, iOS, or Windows. Applications can be installed and run on this operating system.
[0150] The operating system of electronic device 100 can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This application embodiment uses the layered architecture Android system as an example to exemplify the software structure of electronic device 100.
[0151] Figure 3 This is a software structure block diagram of the electronic device 100 according to an embodiment of this application.
[0152] A layered architecture divides software into several layers, each with a clear role and function. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into five layers, from top to bottom: the application layer, the application framework layer, the native system library layer, the hardware abstraction layer (HAL), and the kernel layer.
[0153] The application layer can include a series of application packages. For example, the application layer can include a gallery app, a browser app, a video app, and a game app.
[0154] The application framework layer provides application programming interfaces (APIs) and a programming framework for applications within the application layer. The application framework layer includes some predefined functions. It may include functional modules such as Activity Management (ActivityManager), Window Management (WindowManager), ViewSystem (ViewSystem), Input Management Service (InputManagerService), and power management; however, this embodiment does not impose any limitations on these modules.
[0155] The Activity management module can be used to manage application Activities, etc.
[0156] In this embodiment of the application, when an Activity is launched, the Activity creates or binds to a window. This window is a container for the view hierarchy, and all views are drawn in this window.
[0157] The window management module is responsible for managing application windows, handling window layout on the screen, hierarchical relationships between windows, and operations such as adding, moving, and deleting windows.
[0158] The view system can manage the views in a window and can provide a view tree structure. In this embodiment, the view system can determine whether the current page is a text and image page and obtain the content, number, and size of the image views.
[0159] The input management service module is responsible for managing the processing and distribution of input events from different input devices. For example, it can detect user browsing activity information.
[0160] The power management module can be used to manage device power consumption modes. In image and text browsing scenarios, the power management module will obtain power consumption mode information. If the power consumption mode information indicates that power saving mode is enabled, the electronic device can increase the fixed bit rate compression ratio to reduce power consumption.
[0161] The native system library layer, also known as the native service layer or native framework layer, is a native code platform library that provides native services and link libraries for hardware operations to the upper layers. In this embodiment, the native system library may include a hardware-accelerated rendering engine (such as HWUI) and a graphics processing engine (such as Skia).
[0162] HWUI (Hardware Accelerated Rendering Engine for UI) is a GPU-accelerated 2D graphics engine primarily used for UI rendering in the Android system. HWUI leverages the powerful computing capabilities of the GPU to provide faster rendering speeds and a better user experience.
[0163] Skia is a 2D graphics processing engine that provides basic graphics drawing functions, including the processing of graphics, text, and bitmaps. In the Android system, Skia is the core graphics library of HWUI, providing basic drawing functions such as graphics, text, and bitmaps. Skia supports hardware-accelerated rendering, fully utilizing the GPU for concurrent computing to speed up UI rendering.
[0164] In the Android system, HWUI uses Skia as the core graphics library, supporting hardware-accelerated rendering to achieve UI rendering goals.
[0165] In this embodiment, the local system library also includes an adaptive compression control algorithm. Using the adaptive compression control algorithm provided in this embodiment, a texture compression module is used to compress the text and image content at a fixed bit rate in a text and image browsing scenario. Furthermore, based on current scenario information such as user browsing operation information (e.g., browsing speed, dwell time), image attribute information (e.g., multiple images / thumbnail / large image), device power consumption mode (e.g., whether it is in power-saving mode), and device performance status (e.g., whether it is in low-performance or high-load state), the fixed bit rate compression ratio is dynamically adjusted to achieve adaptive compression control. This effectively controls system resource usage, reduces memory consumption and bandwidth consumption, lowers overall power consumption, and provides visually lossless effects.
[0166] The Hardware Abstraction Layer (HAL) is a wrapper around Linux kernel drivers, providing interfaces to the upper layers and shielding them from the implementation details of the lower-level hardware.
[0167] In this embodiment of the application, the hardware abstraction layer may include display HAL and graphics API, etc.
[0168] A graphics API is an interface that allows software programs to communicate with graphics hardware, enabling control of the GPU and graphics rendering functions. For example, graphics APIs include graphics interfaces such as OpenGL and / or Vulkan. These graphics APIs define a set of programming interfaces for rendering 2D and 3D graphics, through which the GPU can be invoked for graphics rendering.
[0169] The Display Layout Algorithm (HAL) is used to define a set of routines, protocols, and tools for interacting with the hardware. In Android, the HAL ensures consistent graphics rendering across different devices and supports various graphics APIs such as OpenGL and Vulkan.
[0170] The kernel layer is the layer between hardware and software. The kernel layer contains at least a display driver. The display driver is the driver layer for the display screen. For example, the display driver can start the display screen in the hardware layer, and the display screen can display text and images.
[0171] For clarity, the diagram also illustrates the hardware layer that interacts with the aforementioned software architecture. For example, the hardware layer may include components such as the CPU, GPU, DDR, display screen, and texture compression module.
[0172] It should be noted that the texture compression module can be a module with texture compression / decompression capabilities, or it can be a chip with texture compression / decompression capabilities.
[0173] In some embodiments, the texture compression module is integrated on the CPU.
[0174] In other embodiments, the texture compression module is integrated on the GPU.
[0175] In other embodiments, the texture compression module is independent of the CPU and GPU.
[0176] In some embodiments, the CPU invokes the texture compression module to implement fixed bit rate compression.
[0177] In other embodiments, the GPU invokes a texture compression module to implement fixed bit rate compression / decompression.
[0178] It should be noted that although the embodiments of this application are described using the Android system as an example, the basic principles are also applicable to electronic devices based on operating systems such as iOS or Windows.
[0179] The following explains the view of the image and text page and the view drawing process.
[0180] View of the image and text page
[0181] In Android, each interface is composed of views of varying sizes. Each view in an application undergoes measurement, layout, and drawing. The main thread passes view resources to the CPU, which decompresses the resources, performs texture compression using a texture compression module, and then uses the OpenGL / Vulkan interface to call the GPU to decompress the texture and render the graphics. Next, the data to be displayed is passed to SurfaceFlinger via inter-process communication. SurfaceFlinger then hands the rendering result to the hardware compositor for compositing and output to the display screen, where the text and images are displayed.
[0182] In this embodiment, the current scenario can be determined as a text and image browsing scenario based on the view types contained in the user's browsing window. For example, if the user's browsing window includes views such as ImageView and TextView, then the current scenario can be determined as a text and image browsing scenario.
[0183] like Figure 4A As shown, the window contains a root view DecorView, an image view ImageView, and a text view TextView, which are controls used to display images in Android development.
[0184] It's important to note that each Activity has an associated window, which hosts a DecorView. A DecorView can contain a title bar and content panes, among other things. The DecorView is the root view of all views in an Android application and is one of the core components of the framework used to manage and display the application's interface. As the top-level container, the DecorView carries the application's view structure, defines the boundaries of the application's interface, and all views are drawn and events are dispatched within these boundaries.
[0185] ImageView is a control used to display images.
[0186] TextView is a control used to display text content.
[0187] In this embodiment of the application, for ease of explanation, the window containing views such as ImageView and TextView is referred to as the image and text page window.
[0188] The various views in the image / text window are transformed and stored as multiple layers in a layer cache, which is then passed to SurfaceFlinger. SurfaceFlinger integrates the multiple layers in the layer cache and then passes the integrated result to the display screen for displaying the image / text page.
[0189] In this embodiment of the application, fixed bitrate compression is performed on the text and image content, including fixed bitrate compression on various views such as ImageView and TextView.
[0190] The process of drawing views on a text and image page
[0191] The following describes the view drawing process. Phase 1: UI Thread Drawing. When a View needs to be drawn, the UI thread calls the corresponding drawing method, such as onDraw(). These drawing methods perform drawing operations through the interface provided by the Canvas class. The Canvas drawing commands are translated into Skia drawing commands and stored in the display list. Phase 2: The rendering thread retrieves the drawing commands from the display list and sends these commands to the GPU for execution via the OpenGL / Vulkan interface. Phase 3: The GPU completes the rendering and outputs the rendering results to the screen.
[0192] In this embodiment of the application, displaying the view in the graphic window on the screen requires the collaboration of the CPU and GPU.
[0193] Figure 4BThis is a flowchart illustrating a possible implementation of texture compression using a CPU, a texture compression module, and a GPU, as provided in an embodiment of this application. The CPU decodes the view resource, the texture compression module performs texture compression on the decoded view resource, the CPU uploads the compressed texture resource, and then the CPU calls a graphics API to decompress the texture and complete the rendering. The graphics API includes OpenGL and / or Vulkan interfaces.
[0194] It's important to note that, in addition to the CPU, GPU, and display, the texture compression process also involves DDR main memory and DDR video memory. The CPU is responsible for loading the compressed texture data from DDR main memory into DDR video memory. The CPU sets the rendering state and instructs the GPU to start rendering via a Draw Call command. The GPU can access DDR video memory, obtain the compressed texture data, decompress the compressed texture data, and store it in the layer buffer. The GPU then performs texture rendering based on the decompressed texture data.
[0195] Texture compression reduces the package size and the amount of data. After texture compression, memory usage is more efficient, reducing the pressure of bandwidth calculation and reducing GPU load.
[0196] Figure 4C This is a schematic diagram illustrating the interaction between various hardware components in the embodiments of this application. For example... Figure 4C As shown, in an image and text browsing scenario, after acquiring the image and text content, the CPU can call the texture compression module to perform fixed-bitrate compression on the content, achieving hardware-level texture compression, and storing the compressed texture data in DDR main memory. The CPU sets the rendering state and instructs the GPU to start rendering via a Draw Call command. The CPU loads the compressed texture data from DDR main memory into DDR video memory.
[0197] After receiving a Draw Call command, the GPU reads compressed texture data from DDR memory. The GPU then calls the texture compression module to decompress the read texture data and stores the decompressed texture data in a texture buffer. Next, the GPU performs texture rendering based on the texture data cached in the texture buffer. Finally, the GPU transmits the texture rendering result to the display screen.
[0198] The display screen shows text and image content based on the texture rendering results.
[0199] The rendering and display of text and image content consumes system resources including memory, CPU, GPU, and battery.
[0200] This application embodiment can use a fixed bitrate compression method to compress text and image content. This fixed bitrate compression is a hardware-based texture compression technology. Since the texture compression module is a hardware-level compression module, it can achieve a high compression ratio and significantly reduce the amount of texture data while ensuring rendering quality.
[0201] This application embodiment can employ an adaptive compression control algorithm to adaptively compress text and image content. Through this algorithm, in a text and image browsing scenario, a texture compression module is used to compress the text and image content at a fixed bit rate. Furthermore, based on current scenario information such as user browsing operation information, image attribute information, device power consumption mode, and device performance status, the fixed bit rate compression ratio is dynamically adjusted to achieve adaptive compression control. This effectively controls system resource usage, reduces memory consumption and bandwidth consumption, and lowers overall power consumption.
[0202] In this embodiment, texture data compressed at a fixed bit rate can be directly read by the GPU, enabling rapid texture rendering. This allows for faster image loading and reduces GPU and DDR load.
[0203] It should be noted that the fixed bit rate compression used in the embodiments of this application is lossy compression, which allows for a certain loss of quality during rendering, and can achieve a visually lossless effect.
[0204] The adaptive compression method for image and text browsing scenarios provided in this application can be implemented by the aforementioned electronic device, or by a functional module and / or entity within that electronic device capable of implementing the adaptive compression method for image and text browsing scenarios. Furthermore, this application's solution can be implemented through hardware and / or software, the specific implementation depending on actual usage requirements, and this application does not impose limitations. The following description uses an electronic device as an example, along with the accompanying drawings, to exemplarily illustrate the adaptive compression method for image and text browsing scenarios provided in this application.
[0205] The embodiments of this application will be described below with reference to the accompanying drawings and through several exemplary embodiments. The methods in the following embodiments can all be implemented in an electronic device having the above-described hardware structure and software architecture. The hardware structure diagram of the electronic device can be as follows: Figure 2 As shown, the software structure block diagram of an electronic device can be as follows: Figure 3 As shown, the embodiments of this application are not limited to this. For ease of explanation, the electronic device used in the embodiments of this application is a mobile phone.
[0206] First, the implementation method and principle of texture compression used in the embodiments of this application will be explained.
[0207] Implementation methods and principles of texture compression
[0208] Texture compression can refer to texture block compression. For example... Figure 5A As shown, the original image texture is divided into multiple texture blocks, for example, each texture block contains 4*4 pixels (16 pixels in total), and then each texture block is compressed.
[0209] Texture compression includes two methods: variable rate compression (VRC) and fixed-rate compression (FRC).
[0210] Dynamic bitrate compression, also known as variable bitrate compression, dynamically adjusts the compression ratio based on the complexity of the image content (4x4 pixel blocks). For example, more bits are allocated to complex image areas to maintain image quality, while fewer bits are allocated to simpler image areas to reduce storage space and transmission bandwidth. VRC is typically set as the default compression format.
[0211] Fixed bitrate compression (FRC) refers to compression by allocating a fixed number of bits to each pixel block (4x4 pixel block). With this compression method, the same bitrate is used for compression regardless of the complexity of the image content. For example, compression is performed in 4x4 pixel blocks, with each compressed block having a fixed size. This fixed block structure allows the GPU to quickly access any part of the texture because the entire block can be decompressed at once and stored in the texture cache, thus improving access efficiency. In other words, consistent decoding speed for any pixel ensures that the GPU can efficiently access pixels randomly. FRC is particularly suitable for electronic devices with limited memory and bandwidth.
[0212] The main differences between FRC and VRC are explained below with reference to Table 1, in terms of bit rate allocation, predictability of resource usage, visual quality, power consumption and application scenarios.
[0213] Table 1
[0214]
[0215]
[0216] Regarding bitrate allocation, VRC can dynamically adjust the bitrate based on the complexity of the image content, meaning it uses different compression ratios for each texture block; a relatively low compression ratio is used for complex image areas, while a relatively high compression ratio is used for simple areas. FRC, on the other hand, can allocate a fixed number of bits for compression to each texture block, meaning it uses the same compression ratio for all texture blocks. This implies that regardless of the image content, the data size of each block is the same.
[0217] Regarding the predictability of resource usage, for VRC, the bit rate varies depending on the image content, and the compressed data size may fluctuate significantly, making it difficult to accurately predict resource usage. For FRC, since each image block uses a fixed bit rate, the system can accurately predict the memory and bandwidth required for the compressed image, which is highly advantageous for devices with limited resources such as memory and bandwidth.
[0218] In terms of visual quality, VRC (Dynamic Voltage Compression) intelligently allocates bitrates to maintain image quality as much as possible while keeping file size low. However, in extreme cases, simple areas may be over-compressed, while complex areas may lose detail due to bitrate limitations. FRC (Fragmented Rendering) at higher bitrates, although it involves lossy compression, the image loss is almost imperceptible, achieving a visually lossless effect.
[0219] In terms of power consumption, while VRC can also reduce power consumption to some extent by decreasing file size, the dynamic bitrate characteristic may result in a less significant power reduction compared to FRC. FRC, by reducing memory and bandwidth usage, can significantly reduce GPU and CPU power consumption, making it particularly suitable for power-saving modes.
[0220] In terms of application scenarios, VRC is more suitable for scenarios with high image quality requirements, such as high-quality image storage and non-real-time video processing. FRC is particularly suitable for scenarios with strict resource requirements, such as mobile devices, real-time rendering, and video playback.
[0221] A comparison reveals the following advantages of FRC compression technology: FRC uses a consistent bit rate, meaning compressed blocks use the same bit rate, simplifying the encoding and decoding process; a consistent bit rate typically reduces bandwidth requirements when transmitting images, thus improving overall application performance; by compressing images, fixed bit rate compression significantly reduces the amount of memory required to store images, which is highly beneficial for programs that need to manage large amounts of image data; compressed images retain significant details, especially at edges and in high-frequency areas, achieving visual quality comparable to lossless compression. Compared to lossless compression, it offers better performance and is more suitable for situations with limited memory and bandwidth.
[0222] Therefore, in this embodiment of the application, in a text and image browsing scenario, a fixed bitrate compression method can be used to compress the text and image content. Under this compression method, the same bitrate will be used for compression regardless of the complexity of the image content.
[0223] For example, fixed-bitrate compression can be performed using 4x4 pixel blocks, with each compressed block having a fixed size. This fixed block structure allows the GPU to quickly access any part of the texture because the entire block can be decompressed at once and stored in the texture buffer, thereby improving access efficiency. This effectively controls system resource usage, reduces memory consumption and bandwidth consumption, and lowers overall power consumption.
[0224] Because at higher bit rates, although it is lossy compression, the image loss is almost imperceptible, achieving a visually lossless effect, fixed bit rate compression is also called visually lossless compression.
[0225] The adaptive compression control algorithm provided in this application can support multiple levels of compression ratio. The compression ratio can also be referred to as the compression ratio or compression rate.
[0226] For example, a compression ratio of 4:1 means that the ratio between the original data size and the compressed data size is 4:1 (i.e., 8:2).
[0227] For example, a compression ratio of 2:1 means that the ratio between the original data size and the compressed data size is 2:1 (i.e., 8:4).
[0228] For example, a compression ratio of 8:5 means that the ratio between the original data size and the compressed data size is 8:5.
[0229] Among them, the compression ratio 4:1 is greater than the compression ratio 2:1, and the compression ratio 2:1 is greater than the compression ratio 8:5.
[0230] It should be noted that the above compression ratio is an illustrative example. In actual implementation, the compression ratio can be set according to actual usage requirements.
[0231] It is understandable that increasing the compression ratio of textures reduces the memory occupied by textures, reduces GPU load, reduces power consumption, and makes the improvement in device performance more obvious.
[0232] It should be noted that fixed bitrate compression can be a method of texture block compression. That is, the texture is divided into multiple texture blocks, for example, each texture block contains 4*4 pixels, and then each texture block is compressed. The compressed pixel information is stored in a pixel set, and the index position of each texture block is stored in a block index map. By dividing the texture into fixed-size texture blocks, compressing each texture block separately, and loading it into video memory, the video memory usage can be reduced.
[0233] Besides using compression ratio to characterize the degree of compression at a fixed bit rate, the compressed bit rate can also be used. For example, the unit of compressed bit rate can be BPC (bits per component, the number of bits per color channel). The compressed bit rate represents the number of bits per color channel per pixel after compression at a fixed bit rate.
[0234] The following example illustrates the compression bit rate. The original image is an RGBA image (RGB three channels + Alpha channel), with each pixel including four color channels, and each color channel corresponding to 8 bits (i.e., occupying 8 bits).
[0235] In some embodiments, the compression bit rate can be 2 BPC, meaning that after compression at a fixed bit rate, each color channel corresponds to 2 bits (i.e., occupies 2 bits). It can be understood that the original image has 8 bits per color channel, and after compression, each color channel has 2 bits, a ratio of 4:1, therefore the corresponding compression ratio is 4:1.
[0236] It should be noted that the above example of each color channel corresponding to 2 bits is for illustrative purposes only. In actual implementation, since each pixel is not necessarily represented by RGBA when storing texture according to image blocks, 2 bits is an equivalent statement.
[0237] In this embodiment of the application, if the compression bit rate is 2BPC, then after compression at a fixed bit rate, the average number of bits for multiple channels of a pixel can be 2 bits.
[0238] In some embodiments, the compression bit rate can be 4 BPC, meaning that after compression at a fixed bit rate, each color channel corresponds to 4 bits (i.e., occupies 4 bits). It can be understood that the original image has 8 bits per color channel, and after compression, each color channel has 4 bits, a ratio of 2:1, therefore the corresponding compression ratio is 2:1.
[0239] In this embodiment of the application, if the compression bit rate is 4 BPC, then after compression at a fixed bit rate, the average number of bits for multiple channels of a pixel can be 4 bits.
[0240] In some cases, compression bitrate can be understood as the number of bits per second used to represent encoded (compressed) audio / video data. Generally, a higher compression bitrate (smaller compression ratio) results in a larger amount of data transmitted and better audio / video quality. Conversely, a lower compression bitrate (larger compression ratio) results in a smaller amount of data transmitted, but with a slight decrease in audio / video quality.
[0241] The basic principle of fixed bit rate compression used in the embodiments of this application will be explained below with reference to the accompanying drawings. For ease of explanation, a compression ratio of 2:1 or 4:1 will be used as an example for illustration.
[0242] Let's start by explaining fixed bit rate compression from the perspective of each pixel.
[0243] refer to Figure 5B As shown in (a), each pixel includes four color channels: RGBA, and each color channel occupies 8 bits. If texture compression is performed at a 4:1 ratio, each color channel will occupy 2 bits after compression. Therefore, this compression at a 4:1 ratio can also be called 2BPC texture compression.
[0244] refer to Figure 5B As shown in (b), each pixel includes four color channels: RGBA, and each color channel occupies 8 bits. If texture compression is performed at a 2:1 ratio, each color channel will occupy 4 bits after compression. Therefore, this compression at a 2:1 ratio can also be called 4BPC texture compression.
[0245] It's understandable that fixed bit rate compression reduces the number of bits per color channel.
[0246] Next, let's explain fixed bit rate compression from the perspective of each texture block.
[0247] refer to Figure 5C As shown in (a), for the original image, each texture block consists of 4*4 pixels, and each pixel includes four color channels (RGBA), with each color channel occupying 8 bits. Each texture block in the original image occupies 16×4×8=512 bits. If texture compression is performed at a compression ratio of 2:1 (corresponding to a compression bitrate of 4 BPC), after compression, each color channel occupies 4 bits, and correspondingly, each texture block occupies 16×4×4=256 bits. In other words, through fixed bitrate compression, the number of bits occupied by each texture block is reduced from 512 to 256.
[0248] refer to Figure 5C As shown in (b), if texture compression is performed at a compression ratio of 4:1 (corresponding to a compression bit rate of 2 BPC), then after compression, each color channel occupies 2 bits, and correspondingly, each texture block occupies 16 × 2 × 4 = 128 bits. That is to say, through fixed bit rate compression, the number of bits occupied by each texture block is reduced from 512 to 128.
[0249] It is understandable that by using fixed bit rate compression, the number of bits per color channel is reduced, thereby reducing the number of bits per texture block.
[0250] In this embodiment of the application, by dividing the texture into texture blocks of fixed size, compressing each texture block separately and loading it into the video memory, the video memory usage can be reduced.
[0251] Fixed-bitrate compression reduces memory usage and bandwidth consumption, thereby alleviating memory pressure on mobile devices, reducing the decoding burden on the CPU / GPU, and improving rendering performance. Reducing memory usage also helps prevent device crashes due to insufficient memory.
[0252] Adaptive compression method for image and text browsing scenarios
[0253] The above explains the two compression methods of texture compression and the basic principles of fixed bit rate compression. The following describes the adaptive compression method for image and text browsing scenarios provided in this application, with specific examples.
[0254] Example 1
[0255] In some cases, during image and text browsing scenarios, a fixed bit rate compression method is directly used to compress the image and text content at a preset compression ratio.
[0256] In other cases, during image and text browsing scenarios, it can be determined whether the electronic device is in a high-load state and / or a low-performance state based on the pre-configured performance parameters and real-time dynamic performance parameters of the electronic device; if it is determined that the electronic device is in a high-load state, a fixed bit rate compression method is used to perform texture compression on the image and text content at a preset compression ratio.
[0257] For example, pre-configured performance parameters include the amount of available DDR memory, the available range of DDR bandwidth, and GPU frequency.
[0258] For example, real-time dynamic performance parameters include CPU utilization, DDR memory usage, DDR bandwidth, and / or GPU load.
[0259] For example, when CPU utilization exceeds a first threshold, DDR memory utilization exceeds a second threshold, DDR bandwidth is insufficient, and / or GPU load exceeds a third threshold, it can be determined that the electronic device is in a high-load and / or low-performance state. Each threshold is determined by pre-configured performance parameters.
[0260] The above solution determines whether the electronic device is under high load and / or low performance in the image and text browsing scenario. If the electronic device is under high load and / or low performance, the image and text content is compressed at a fixed bit rate with a preset compression ratio. This reduces memory bandwidth usage and lowers CPU and GPU power consumption, effectively avoiding problems such as lag and insufficient battery life, thus improving the user experience.
[0261] For example, the preset compression ratio can be 2:1 or other possible compression ratios.
[0262] The above solution directly compresses the text and image content at a fixed bit rate using a preset compression ratio in text and image browsing scenarios. This reduces memory bandwidth usage and lowers CPU and GPU power consumption, thus avoiding issues such as lag and insufficient battery life, thereby improving the user experience.
[0263] Second Embodiment
[0264] In the second embodiment, in a text and image browsing scenario, an adaptive compression control algorithm can be invoked to determine a fixed bitrate compression ratio based on user browsing operation information, image attribute information, device power consumption mode, and device performance status. This fixed bitrate compression ratio is then used to perform texture compression on the text and image content. This approach more effectively controls system resource usage, reduces memory bandwidth consumption, lowers CPU / GPU power consumption, and improves system performance.
[0265] Figure 6 This is a flowchart illustrating the adaptive compression method for a text and image browsing scenario provided in an embodiment of this application. (Refer to...) Figure 6 As shown, the method includes the following steps S201-S207.
[0266] S201. In response to user operation, the current scene is identified as a text and image browsing scene.
[0267] Image and text browsing scenarios refer to various scenarios where users browse pages containing images. For example, image and text browsing scenarios could include browsing web pages, browsing social media application interfaces, or browsing local images.
[0268] S202. Identify image attribute information.
[0269] For example, when an electronic device displays a gallery interface, in response to the user's actions on the gallery interface (such as swiping or clicking), the electronic device can recognize that the current scene is a text and image browsing scene.
[0270] The gallery interface includes both multi-image and detailed image display modes. For example, the main page of the gallery interface typically displays multiple images. Users can switch between these modes in response to user actions.
[0271] For example, when an electronic device displays a shopping application interface, in response to the user's actions on the shopping application interface (such as swiping or clicking), the electronic device can recognize that the current scene is a text and image browsing scene.
[0272] The shopping app interface includes both multi-image and detailed image display formats. For example, the initial screen of a shopping app typically displays multiple images. Users can switch between these formats in response to user actions.
[0273] It should be noted that users have different sensitivities to visual quality, or different requirements for visual quality, when displaying multiple images or detailed images. For example, as shown in Table 2, users have lower requirements for visual quality in multi-image or thumbnail display formats, while they have higher requirements for visual quality in detailed image display formats, thus requiring higher resolution.
[0274] Table 2
[0275] Image attribute information Visual quality requirements Multiple images lower thumbnails lower Blur image / background image lower Detailed drawing higher Large Image higher
[0276] S203. Monitor user browsing operation information.
[0277] In some embodiments, during image and text browsing scenarios, the electronic device monitors user browsing operation information. This user browsing operation information includes browsing speed, browsing dwell time, and whether image editing was triggered.
[0278] It should be noted that the requirements for operational smoothness and visual quality vary depending on the user's browsing operation information. For example, as shown in Table 5, when the browsing speed is greater than a certain threshold, the browsing speed is fast, the requirement for operational smoothness is high, and the requirement for visual quality is low; when the browsing speed is less than or equal to a certain frequency threshold, the browsing speed is slow, the requirement for operational smoothness is low, and the requirement for visual quality is high.
[0279] Table 3
[0280]
[0281]
[0282] S204, Monitoring device power consumption mode.
[0283] For example, device power consumption modes can include power saving mode and normal mode.
[0284] In normal mode, electronic devices perform well, with the CPU and GPU operating at maximum frequency, providing optimal performance and user experience.
[0285] In power-saving mode, electronic devices extend battery life by reducing device power consumption. For example, in power-saving mode, electronic devices automatically adjust system settings, such as reducing CPU performance and disabling unnecessary hardware functions. Due to power management limitations, device performance in power-saving mode is reduced, with lower CPU and GPU operating frequencies, resulting in overall performance that is not as good as in normal mode.
[0286] It should be noted that electronic devices adjust the visual quality of text and image content depending on the device's power consumption mode. For example, as shown in Table 4, when an electronic device is in normal mode, it is usually required to display text and image content with high visual quality in order to provide good performance and user experience; when an electronic device is in power-saving mode, it needs to reduce the consumption of memory bandwidth to reduce power consumption and improve smooth performance, so it will appropriately reduce the visual quality of text and image content.
[0287] Table 4
[0288] Device power consumption mode Visual quality requirements Smoothness requirements Normal mode Keep Keep Power saving mode reduce promote
[0289] This application does not limit the execution order of S202, S203 and S204 above; they can be executed in parallel or sequentially.
[0290] S205. Monitor the performance status of equipment.
[0291] For example, equipment performance status can include normal status, high load status, or low performance status.
[0292] When the electronic device is in normal working order, it can provide good operational smoothness.
[0293] When electronic devices are under high load or low performance, their operation becomes less smooth and they are prone to lag.
[0294] S206. Based on user browsing operation information, image attribute information, device power consumption mode and / or device performance status, call the adaptive compression control algorithm to determine the fixed bit rate compression ratio, and use the fixed bit rate compression ratio to perform texture compression on the text and image content.
[0295] In this embodiment, the electronic device can determine a fixed bit rate compression ratio by invoking an adaptive compression control algorithm based on image and text browsing scenario information, and then use this fixed bit rate compression ratio to perform texture compression on the image and text content. The image and text browsing scenario information includes at least one of the following: user browsing operation information, image attribute information, device power consumption mode, and / or device performance status.
[0296] It should be noted that in image and text browsing scenarios, different information within the image and text browsing context necessitates different requirements for visual quality or operational smoothness. These different requirements, in turn, lead to different compression ratios.
[0297] For example, for higher visual quality requirements, a smaller compression ratio can be selected.
[0298] For example, for applications requiring high levels of operational smoothness, a larger compression ratio can be selected.
[0299] Referring to Table 6, suggested compression ratios are given for scenarios such as user browsing operation information, image attribute information, device power consumption mode, and device performance status.
[0300] Table 6
[0301]
[0302] The compression ratio is not limited in this embodiment; it can be set according to actual usage requirements.
[0303] For example, a higher compression ratio can be 4:1, a medium compression ratio can be 2:1, and a lower compression ratio can be 8:5.
[0304] Figure 7 Possible implementations of the adaptive compression control algorithm provided in the embodiments of this application.
[0305] Method 1: Determine the compression ratio based on image attribute information.
[0306] In some possible implementations, the image attribute information includes the number and size of images. Image attributes can be thumbnails or multiple images, or large images or detailed images. Correspondingly, the adaptive compression control algorithm includes a higher compression ratio for thumbnails or multiple images compared to large images or detailed images.
[0307] Because users have varying sensitivities to visual quality when displaying multiple images, thumbnails, detailed images, or large images on the interface, different compression strategies can be employed for different types of images. The solution in this application first analyzes the image attributes in the image-text browsing scenario to determine whether it is a multiple-image / thumbnail mode or a detailed-image / large-image mode, and then determines an appropriate compression strategy based on the image attribute information. For example, a detailed-image / large-image mode may require a lower compression ratio to maintain clarity, while a multiple-image / thumbnail mode may tolerate a higher compression ratio.
[0308] For example, such as Figure 7 As shown, when the image attribute is a thumbnail or multiple images, a higher compression ratio can be selected. When the image attribute is a large image or detailed image, a lower compression ratio can be selected.
[0309] Electronic devices can automatically select compression strategies by recognizing image attribute information and compress text and image content at a fixed bit rate, thereby reducing memory bandwidth usage and lowering CPU and GPU power consumption. This can effectively avoid problems such as lag and insufficient battery life, thus improving the user experience.
[0310] Method 2: Determine the compression ratio based on the user's browsing operation information.
[0311] For example, user browsing information includes browsing speed. If the browsing speed is fast, a higher compression ratio is selected to ensure smooth operation; if the browsing speed is slow, a lower compression ratio is selected to ensure the clarity of the text and images.
[0312] For example, user browsing information includes browsing time. If the browsing time is short, a higher compression ratio is selected to ensure smooth operation; if the browsing time is long, a lower compression ratio is selected to ensure the clarity of the text and images.
[0313] For example, user browsing activity information includes whether image editing mode has been triggered. If image editing mode has been triggered, a lower compression ratio is selected.
[0314] Method 3: Determine the compression ratio based on the device's power consumption mode.
[0315] In some possible implementations, the device power consumption mode is either a power-saving mode or a normal mode. Accordingly, the adaptive compression control algorithm includes a compression ratio higher in the power-saving mode than in the normal mode.
[0316] This application determines the compression ratio based on the device's power consumption mode. For example, when the device's power consumption mode is normal, a lower compression ratio, such as 2:1, can be selected. When the device's power consumption mode is power-saving, a higher compression ratio, such as 4:1, can be selected. By increasing the compression ratio, the consumption of memory bandwidth is reduced, thereby lowering power consumption.
[0317] Method 4: Calculate the compression ratio based on weighted average of information from multiple scenarios.
[0318] For example, image attribute information corresponds to the first weight parameter, user browsing operation information corresponds to the second weight parameter, power consumption mode corresponds to the third weight coefficient, and device performance status corresponds to the fourth weight coefficient. Accordingly, the electronic device can use the image attribute information and the first weight parameter, the user browsing operation information and the second weight parameter, the device power consumption mode and the third weight parameter, and the device performance status and the fourth weight coefficient to call the adaptive compression control algorithm for weighted calculation to obtain the compression level or compression ratio.
[0319] It is understandable that the larger the weighting coefficient, the greater its reference value or contribution in determining the compression ratio.
[0320] It should be noted that the weighting coefficients of each factor can be set according to the actual performance of the electronic device and the user's actual needs (such as smoothness requirements or clarity requirements). For example, for electronic devices with lower performance (such as small memory size or low CPU / GPU performance), larger weighting coefficients can be set for device power consumption mode and device performance status.
[0321] In addition, weighting coefficients can be set for image attribute information, user browsing operation information, device power consumption mode, and device performance status according to clarity and / or smoothness requirements.
[0322] For example, if users have high requirements for clarity, then the weighting factor for setting the detail display format is the highest, and the selection strategy is: in the detail display format, a lower compression ratio can be selected to ensure the clarity requirements.
[0323] For example, if users have a high demand for smoothness, then the weight coefficient of user browsing speed should be set to the highest, and the strategy should be: when the user's browsing speed is fast, a higher compression ratio can be selected to ensure the smoothness requirement.
[0324] The following examples illustrate how to select a compression strategy based on a preset calculation method and / or user needs in some scenarios.
[0325] In some embodiments, when the interface displays multiple images and is in power-saving mode, the system prioritizes fixed bit rate compression technology to perform lossy compression on the image and text content, significantly reducing memory and bandwidth usage while maintaining near-lossless visual quality.
[0326] In some embodiments, the text and image content is displayed in a multi-image format, allowing for fast user browsing and a power-saving device mode. In this scenario, a higher compression ratio, such as 4:1, can be selected to ensure the quality of content display and smoothness.
[0327] In some embodiments, the text and image content is displayed in a large image format, the user's browsing speed is slow, and the device power consumption mode is in normal mode. In this scenario, a lower compression ratio can be selected, such as 2:1, which can ensure high visual quality and smoothness requirements.
[0328] The above solution can determine an appropriate compression ratio based on the current scene information, the actual performance of electronic devices, and the actual needs of users. It can adaptively compress text and image content at a fixed bit rate, effectively control the use of system resources, reduce memory bandwidth usage, reduce power consumption, improve system performance, solve problems such as lag and insufficient battery life, and greatly enhance the user experience.
[0329] S207. Render the image and text content based on the texture compression data of the image and text content, and display the image and text content on the screen.
[0330] In this embodiment, the texture compressed data of the graphic content can be stored in DDR. The texture compressed data of the graphic content is read from the DDR, decompressed, and then texture rendering is performed based on the decompressed texture data. Finally, the graphic content is displayed on the screen based on the texture rendering result.
[0331] The adaptive compression method for image and text browsing scenarios provided in this application allows for texture compression of image and text content using a fixed bitrate compression method, based on user browsing operation information, image attribute information, device power consumption mode, and / or device performance status. By applying a fixed bitrate compression method to image and text content based on the current scene information, this solution ensures that each image texture block is stored and transmitted using a fixed bitrate, effectively controlling system resource usage. This not only reduces memory bandwidth consumption but also lowers CPU / GPU power consumption, improves system performance, and provides visually lossless effects. Especially for low-performance electronic devices (e.g., those with limited memory and low CPU / GPU performance), this method solves problems such as lag and insufficient battery life, significantly improving the user experience.
[0332] It is understandable that in image and text browsing scenarios, the memory bandwidth requirements of electronic devices increase, and the GPU load on electronic devices increases significantly. The solution in this application, based on image and text browsing scenario information, performs fixed-bitrate compression on the image and text content, which can reduce memory bandwidth usage, lower CPU / GPU power consumption, improve system performance, and provide visually lossless effects.
[0333] Third Embodiment
[0334] In the third embodiment, in a text and image browsing scenario, it is determined whether the electronic device is in a high-load state and / or a low-performance state. If it is determined that the electronic device is in a high-load state and / or a low-performance state, an adaptive compression control algorithm is invoked to determine a fixed bitrate compression ratio based on scenario information such as image attribute information, user browsing operation information, device power consumption mode, and device performance status. This fixed bitrate compression ratio is then used to perform texture compression on the text and image content. When the scenario information changes, the fixed bitrate compression ratio is adjusted according to the changed scenario information, and the adjusted fixed bitrate compression ratio is used to perform texture compression on the text and image content. This can more effectively control the system resource usage, reduce memory bandwidth usage, reduce CPU / GPU power consumption, and improve system performance.
[0335] Figure 8 This is a flowchart illustrating the adaptive compression method for a text and image browsing scenario provided in an embodiment of this application. (Refer to...) Figure 8 As shown, the method includes the following steps S301-S305.
[0336] S301. In response to user operation, the current scene is identified as a text and image browsing scene.
[0337] S302. Determine whether the electronic device is in a low-performance state and / or a high-load state based on the pre-configured performance parameters and real-time dynamic performance parameters of the electronic device.
[0338] For example, pre-configured performance parameters include the amount of available DDR memory, the available range of DDR bandwidth, and GPU frequency.
[0339] For example, real-time dynamic performance parameters include CPU utilization, DDR utilization, DDR bandwidth, and / or GPU load.
[0340] DDR stands for Double Data Rate Synchronous Dynamic Random Access Memory.
[0341] When an electronic device is determined to be in a high-load and / or low-performance state, it acquires scenario information such as user browsing operation information, image attribute information, device power consumption mode, and device performance status.
[0342] S303. When the electronic device is not under high load and / or low performance, the electronic device may use the default compression method (such as lossless compression or dynamic bit rate compression) to compress the text and image content.
[0343] S304. When the electronic device is under high load and / or low performance, based on scene information such as image attribute information, user browsing operation information, device power consumption mode and / or device performance status, call the adaptive compression control algorithm to determine a fixed bit rate compression ratio, and use the fixed bit rate compression ratio to perform texture compression on the image and text content.
[0344] In image and text browsing scenarios, it determines whether the electronic device is in a high-load and / or low-performance state. If the electronic device is in a high-load and / or low-performance state, it calls an adaptive compression control algorithm to determine the compression ratio based on scenario information such as image attribute information, user browsing operation information, device power consumption mode and / or device performance status, and compresses the image and text content at a fixed bit rate according to the determined compression ratio. This can reduce memory bandwidth usage and reduce CPU and GPU power consumption, more effectively avoiding problems such as lag and insufficient battery life, thus improving the user experience.
[0345] S305. Render the image and text content based on the texture compression data of the image and text content, and display the image and text content on the screen.
[0346] Continue executing S302 after S305.
[0347] In image and text browsing scenarios, electronic devices can monitor changes in scene information in real time. If changes occur, an adaptive compression control algorithm is invoked to adjust the fixed bitrate compression ratio based on the changed scene information. The adjusted fixed bitrate compression ratio is then used to perform texture compression on the image and text content. Finally, the texture-compressed data of the image and text content is rendered and displayed on the screen.
[0348] It should be noted that the third embodiment differs from the second embodiment in that:
[0349] (1) In the image and text browsing scenario, the electronic device will monitor the device performance status. When it is determined that the electronic device is in a high load state and / or low performance state, the adaptive compression control algorithm is called to determine the fixed bit rate compression ratio based on the image and text browsing scenario information.
[0350] (2) In the image and text browsing scenario, the electronic device will determine whether the image attribute information, user browsing operation information and / or device power consumption mode and other scenario information have changed. When it is determined that the scenario information has changed, the fixed bit rate compression ratio is adjusted according to the changed scenario information, and the adjusted fixed bit rate compression ratio is used to perform texture compression on the image and text content.
[0351] In this embodiment, after compressing the text and image content at a fixed bit rate, if the text and image browsing scene information changes, an adaptive compression control algorithm is invoked to adjust the fixed bit rate compression ratio, and the adjusted fixed bit rate compression ratio is used to perform texture compression on the text and image content. For example, invoking the adaptive compression control algorithm to adjust the fixed bit rate compression ratio when the text and image browsing scene information changes includes at least one of the following:
[0352] Case 1: Adjust the compression ratio based on changes in image attribute information.
[0353] For example, when the image attribute information is switched from a detailed image display to a multi-image display, the adaptive compression control algorithm is invoked to increase the compression ratio; when the image attribute information is switched from a multi-image display to a detailed image display, the adaptive compression control algorithm is invoked to decrease the compression ratio.
[0354] In image and text browsing scenarios, when displaying multiple images, increasing the compression ratio reduces memory bandwidth consumption, lowers power consumption, improves smoothness, and ensures visually lossless results without affecting user experience. When displaying detailed images, decreasing the compression ratio improves image quality and enhances user experience.
[0355] Scenario 2: Adjust the compression ratio based on changes in user browsing behavior information.
[0356] For example, if the browsing speed increases from slow to fast, the compression ratio is increased to ensure smooth operation; if the browsing speed decreases from fast to slow, the compression ratio is decreased to ensure the clarity of the text and images.
[0357] For example, if image editing mode is triggered, the compression ratio is increased. If image editing mode is exited, the compression ratio is decreased.
[0358] Scenario 3: Adjust the compression ratio based on changes in device power consumption mode.
[0359] When an electronic device switches from normal mode to power-saving mode, the adaptive compression control algorithm is invoked to increase the compression ratio; when the electronic device switches from power-saving mode to normal mode, the adaptive compression control algorithm is invoked to decrease the compression ratio.
[0360] For example, in image and text browsing scenarios, when an electronic device switches to power-saving mode, the compression ratio can be increased to reduce memory bandwidth consumption, lower power consumption, improve smoothness, and ensure lossless visual quality. When the electronic device switches to normal mode, the compression ratio can be reduced to improve image quality and enhance the user experience.
[0361] The above solution allows for dynamic adjustment of the compression ratio in image and text browsing scenarios based on changes in user browsing operation information, image attribute information, device power consumption mode, and hardware performance status. This effectively controls system resource usage, reduces memory bandwidth consumption, lowers CPU / GPU power consumption, and improves system performance. In particular, for electronic devices with lower performance (e.g., small memory and low CPU / GPU performance), it solves problems such as lag and insufficient battery life, greatly enhancing the user experience.
[0362] The above details the possible implementations of the adaptive compression method for image and text browsing scenarios provided in the embodiments of this application. The implementation process of the adaptive compression method for image and text browsing scenarios is described below in conjunction with software and hardware.
[0363] The electronic device includes hardware modules such as a CPU, GPU, DDR, and texture compression module, as well as software modules such as the hardware-accelerated rendering engine HWUI, the graphics processing engine Skia, and graphics API interfaces. In this embodiment, in a text and image browsing scenario, the combined action of software such as HWUI, Skia, and the graphics API, along with hardware such as the CPU and GPU, enables fixed-bitrate compression of text and image content. Furthermore, the fixed-bitrate compression ratio is adaptively adjusted based on real-time changing scene information. This effectively controls system resource usage, reduces memory bandwidth consumption, lowers power consumption, improves system performance, and solves problems such as lag and insufficient battery life, significantly enhancing the user experience.
[0364] Figure 9 A schematic block diagram of the hardware-accelerated rendering engine HWUI, the graphics processing engine Skia, the graphics API, and the GPU. Figure 10 This diagram illustrates the interaction flow between the hardware-accelerated rendering engine HWUI, the graphics processing engine Skia, and the graphics API. It combines... Figure 9 and Figure 10 Explain the view drawing process.
[0365] UI rendering for a view is typically handled by the CPU, while hardware acceleration offloads this task to the GPU. In Android, the main module responsible for hardware acceleration is HWUI. HWUI is the hardware acceleration engine for UI rendering in Android. Its primary function is to leverage the GPU to accelerate the UI rendering process, thereby improving rendering efficiency and smoothness. Based on GPU acceleration, HWUI interacts with the GPU through Skia and graphics APIs, transferring UI rendering tasks from the CPU to the GPU. This significantly improves rendering performance, especially on high-resolution screens and in complex UI scenarios. For example, graphics APIs include OpenGL and Vulkan. By utilizing the GPU for hardware-accelerated rendering, HWUI significantly improves the UI rendering performance and smoothness of the Android system.
[0366] In this embodiment, the CPU determines a fixed bitrate compression strategy through the hardware-accelerated rendering engine HWUI; the hardware-accelerated rendering engine HWUI passes the fixed bitrate compression strategy to the graphics processing engine Skia; the graphics processing engine Skia obtains texture compression parameters based on the fixed bitrate compression strategy and passes the texture compression parameters to the texture compression module through the graphics API interface; the texture compression parameters include the texture compression method and the compression ratio; the texture compression module performs fixed bitrate compression on the text and image content based on the texture compression parameters.
[0367] The texture compression module is a hardware-level compression chip, enabling it to achieve a high compression ratio and significantly reduce texture data volume while maintaining rendering quality. By using the texture compression module to compress text and image content at a fixed bit rate, it can effectively control system resource usage, reduce memory bandwidth consumption, lower power consumption, and improve system performance. This is especially beneficial for low-performance electronic devices (e.g., those with limited memory or low CPU / GPU performance), resolving issues such as lag and insufficient battery life, and greatly enhancing the user experience.
[0368] This application solution combines the software and hardware modules of electronic devices to adaptively compress text and image content at a fixed bit rate based on the current scene information. This can effectively control the occupation of system resources, reduce memory bandwidth usage, lower power consumption, improve system performance, solve problems such as lag and insufficient battery life, and greatly enhance the user experience.
[0369] Figure 11This is a flowchart illustrating the adaptive compression method for a text and image browsing scenario provided in this application embodiment. The functional modules used to implement this process include an application framework layer module, an input management service module, a power management module, a view system module, a hardware performance monitoring module, a hardware-accelerated rendering engine (HWUI), a graphics processing engine (Skia), a graphics API interface, and a texture compression module.
[0370] In this embodiment of the application, each functional module of the electronic device performs the following steps:
[0371] S400 receives user operations and responds to user operations by performing scene recognition to determine whether the current scene is a text and image browsing scene.
[0372] In steps S401 and S402, upon identifying the current scenario as a text / image browsing scenario, the application framework layer module registers a callback function with the input management service module. This callback function is used to obtain user browsing operation information within the text / image browsing scenario. The input management service module monitors the user browsing operation information and passes it to the application framework layer module.
[0373] For example, user browsing operation information includes browsing speed / frequency, browsing dwell time, and whether image editing state was triggered.
[0374] S403 and S404, the application framework layer modules, register callback functions with the hardware performance monitoring module. These callback functions are used to obtain the device performance status in the image and text browsing scenario. The hardware performance monitoring module monitors the device performance status in the image and text browsing scenario and passes the device performance status information to the application framework layer module.
[0375] For example, device performance status information may include CPU utilization, DDR utilization, DDR bandwidth, GPU load, and whether it is in a low-performance state.
[0376] S405 and S406, the application framework layer module registers a callback function with the view system module. This callback function is used to obtain the number and size of window images in the image and text browsing scenario. The view system module monitors the number and size of window images in the image and text browsing scenario and passes the image attribute information to the application framework layer module.
[0377] For example, image attribute information includes multi-image display format, thumbnail display format, and detailed image / large image display format.
[0378] Electronic devices can determine image attribute information by the number and / or size of images displayed on the interface.
[0379] For example, when the number of images displayed on the interface exceeds a certain threshold, it can be determined as a multi-image display format.
[0380] For example, when the image displayed on the interface includes one or more thumbnails, it can be determined to be a thumbnail display format.
[0381] For example, when the number of images displayed on the interface is 1 and the image size is greater than a certain size threshold, it can be determined as a detailed image display format.
[0382] S407 and S408, the application framework layer module, register a callback function with the power management module. This callback function is used to obtain device power consumption information in the image and text browsing scenario. The power management module monitors the device power consumption mode in the image and text browsing scenario and passes the device power consumption mode information to the application framework layer module.
[0383] For example, device power consumption mode information includes whether power saving mode is enabled.
[0384] S409, The application framework layer module sends graphic content drawing instructions to the hardware-accelerated rendering engine HWUI.
[0385] S410 and S411, in response to text and image content drawing commands, the hardware-accelerated rendering engine HWUI obtains text and image browsing scene information from the application framework layer module.
[0386] The image and text browsing scenario information includes image attribute information, user browsing operation information, device power consumption mode, and / or device performance status.
[0387] HWUI is a hardware-accelerated rendering engine for user interfaces (UI), a GPU-accelerated 2D graphics engine. HWUI leverages the powerful computing capabilities of the GPU to provide faster rendering speeds and a better user experience.
[0388] S412, the hardware-accelerated rendering engine HWUI, determines or updates the fixed bitrate compression strategy based on the scene information browsed by images and text.
[0389] In image and text browsing scenarios, the system automatically selects an appropriate compression strategy based on image attribute information, user browsing operation information, device power consumption mode, and device performance status.
[0390] S413, the hardware-accelerated rendering engine HWUI, transmits fixed bitrate compression strategies and drawing instructions to the graphics processing engine Skia.
[0391] The fixed bit rate compression strategy can include a fixed bit rate compression method and a compression level. The compression level can be represented by high, medium, and low, or by 1, 2, and 3.
[0392] S414, the graphics processing engine Skia sets compression parameters according to a fixed bit rate compression strategy.
[0393] In this embodiment of the application, the compression parameters (or compression attributes) include a fixed bit rate compression method and a compression ratio.
[0394] Skia, as a 2D graphics processing engine, provides basic graphics drawing functions, including the processing of graphics, text, bitmaps, etc. Skia queries the Vulkan interface to determine the current texture compression module and the bitrate compression supported by the texture format, and then determines the compression ratio based on the query results and compression level.
[0395] The texture compression module is a functional module or chip with texture compression capabilities.
[0396] The process of setting compression parameters will be explained in detail below.
[0397] The S415 graphics processing engine Skia calls the graphics API to pass compression parameters to the texture compression module.
[0398] For example, a graphics API may include an OpenGL interface and a Vulkan interface.
[0399] S416 The texture compression module compresses the text and image content at a fixed bit rate according to the set compression parameters.
[0400] The S417, hardware-accelerated rendering engine HWUI, graphics processing engine Skia, graphics API interface, and texture compression module interact to complete the texture rendering of text and image content.
[0401] In the terminal device's operating system, compression is primarily related to Skia's GPU-accelerated rendering. The system uses GrContext as the main interface for interacting with the GPU. Texture compression typically occurs before image data is uploaded to the GPU to reduce GPU memory usage and improve rendering performance.
[0402] For example, after HWUI passes the compression strategy and drawing instructions to Skia, Skia calls the Vulkan / OpenGL interface, selects parameters according to the compression strategy, and performs fixed-bitrate compression and encapsulation of the text and image content through the texture compression module. Skia then passes the compressed and encapsulated data to the GPU, which performs graphics rendering based on the compressed and encapsulated data.
[0403] For example, an ImageView can be converted into a DrawImage, which is processed as a texture in Skia and encapsulated as a TextureOp. The TextureOp is provided to the GPU for rendering.
[0404] S418, the hardware-accelerated rendering engine returns a rendering completion message to the application framework layer module.
[0405] Through the embodiments of this application, the purpose of texture compression and graphics rendering of UI graphic content can be achieved: in graphic browsing scenarios, the fixed bit rate compression ratio is dynamically adjusted according to scenario information such as image attribute information, user browsing operation information, device power consumption mode and / or device performance status, which can effectively control the occupation of system system resources, reduce memory occupation and bandwidth consumption, and reduce overall power consumption.
[0406] Set compression parameters
[0407] The following describes the specific implementation method for setting compression parameters.
[0408] It should be noted that the compression parameters that Skia passes to graphics APIs (such as Vulkan) can be in the form of a structure, which contains the fixed bit rate compression method and the specific compression ratio / compression bit rate.
[0409] In this embodiment of the application, compression parameters can be passed in when creating VkImage.
[0410] VkImage is the core object in Vulkan used to store image data, supporting texture rendering of 2D, 3D, and multi-layered images.
[0411] The following is combined with Figure 12 Explain the possible implementation methods for setting compression parameters in S414 above.
[0412] S501. Set the lossy compression parameters using the VkImageCompressionControlEXT parameter (referred to as the EXT parameter). For example, write the fixed bit rate compression flag and the compression ratio flag using this EXT parameter.
[0413] Among them, lossy compression parameters include compression method and compression ratio (or compression bit rate).
[0414] In this embodiment, the VkImageCompressionControlEXT parameter can be a structure that includes the flags parameter and the pFixedRateFlags parameter.
[0415] The flags parameter can be used as a fixed bit rate compression flag to indicate the use of a fixed bit rate compression method.
[0416] The pFixedRateFlags parameter can be used as a compression ratio flag, specifying the compression bit rate.
[0417] By setting the flags and pFixedRateFlags parameters, the lossy compression parameters can be configured.
[0418] For example, the pseudocode for setting lossy compression parameters through a structure is as follows:
[0419] VkImageCompressionControlEXT
[0420] compression_control{VK_structure_type_IMAGE_COMPRESSION_CONTROL_EXT};
[0421] compression_control.flags=VK_IMAGE_COMPRESSION_FIXED_RATE_EXPLICIT_EXT
[0422] / / Specifies the use of fixed bit rate compression.
[0423] compression_control.pFixedRateFlags=VK_IMAGE_COMPRESSION_FIXED_RATE_4BPC_BIT_EXT
[0424] / / Specifies the compression bit rate as 4 BPC
[0425] S502. Create the VkImageCreateInfo parameter and set the first information required to create the VkImage object.
[0426] After S501, the compression_control in the VkImageCompressionControlEXT parameter is passed to image_info.pNext in the VkImageCreateInfo parameter.
[0427] For example, image_info.pNext = &compression_control.
[0428] The first piece of information needed to create a VkImage is image_info.pNext.
[0429] S503, Call the VkCreateImage function and create a VkImage object based on the first information.
[0430] After S502, the VkCreateImage function is called to create a VkImage object using the first information image_info.pNext. For example, vkCreateImage(device,&image_info,nullptr,&new_image).
[0431] After creating a VkImage object, you can further implement fixed bitrate compression and texture rendering based on the VkImage object.
[0432] This explains one possible implementation of lossy compression settings. The following section describes another possible implementation for determining a compression strategy and setting compression parameters based on that strategy.
[0433] After the application framework layer module reads all the necessary content, it passes it to HWUI. HWUI manages the rendered content. Using the adaptive compression method / algorithm for the image and text browsing scenario provided in this application, HWUI determines whether fixed bitrate compression (AFRC) needs to be enabled and determines the compression level based on scenario information such as multiple images / detailed images / thumbnail images, browsing operation speed / browsing dwell time / whether it is in image editing state, device power consumption mode, and hardware performance status. This compression level can include multiple compression ratios.
[0434] It should be noted that the compression level can be represented by high, medium, and low, or by 1, 2, and 3.
[0435] HWUI can provide compression levels to Skia. Skia is a rendering engine that encapsulates low-level Vulkan / OpenGL instructions into drawing instructions (XXXOp), primarily targeting TextureOp, i.e., drawing images.
[0436] It should be noted that if the decision is to use fixed bitrate compression, Skia queries the Vulkan interface to see which compression bitrates the current texture compression module and the texture format of the image content support. Then, based on the determined compression level and the query results, it selects a suitable compression bitrate (e.g., 4 BPC) and passes this compression bitrate to the VkImageCompressionControlEXT parameter mentioned above, and performs lossy compression settings according to the above method.
[0437] This application can be applied to all image and text browsing scenarios, including but not limited to web browsing scenarios, social media application browsing scenarios, and local image browsing scenarios.
[0438] The embodiments of this application employ fixed bit rate compression to perform texture compression on image and text content, which has the following beneficial effects.
[0439] Predictable resource consumption: Because each image patch uses the same bit rate, the system can accurately predict the memory and bandwidth required for the compressed image. This is crucial in mobile devices, helping them allocate memory and processing power more efficiently.
[0440] Reduced memory bandwidth usage: Compared to uncompressed data, fixed bit rate compression technology can significantly reduce memory read and write traffic, and is especially suitable for processing high-resolution text and image content.
[0441] Visually lossless: Although fixed bitrate compression is a lossy compression technique, at higher bitrates, the image loss is almost imperceptible, hence the term "visually lossless." This makes it virtually impossible for users to perceive quality differences when compressing high-resolution videos or images.
[0442] Power optimization: By reducing memory and bandwidth usage, fixed bitrate compression can significantly reduce the power consumption of the GPU and CPU, thereby extending device battery life. This effect is particularly noticeable in power-saving modes.
[0443] Efficient image and video processing: For applications such as real-time rendering and video playback, fixed bitrate compression can provide stable memory and bandwidth usage, thereby ensuring a balance between smooth video playback and device performance.
[0444] The improvements of this application compared to the prior art include:
[0445] On the one hand, adaptive compression control based on scene recognition: the system uses scene recognition technology to dynamically analyze the complexity of the text and image content and the device status, and automatically adjusts the compression ratio to achieve an intelligent balance between performance and visual quality.
[0446] On the other hand, by using fixed bit rate compression technology (AFRC), this application significantly reduces memory bandwidth usage, lowers power consumption, and improves system performance during image and text browsing. In particular, in power-saving mode, it ensures a balance between battery life and smooth operation.
[0447] It should be noted that in the embodiments of this application, "greater than" can be replaced with "greater than or equal to", "less than or equal to" can be replaced with "less than", or "greater than or equal to" can be replaced with "greater than", and "less than" can be replaced with "less than or equal to".
[0448] The various embodiments described herein can be independent solutions or combinations thereof based on their inherent logic, and all such solutions fall within the protection scope of this application.
[0449] The foregoing mainly describes the solutions provided by the embodiments of this application from the perspective of method steps. It is understood that, in order to achieve the above functions, the electronic device implementing this method includes hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should recognize that, in conjunction with the units and algorithm steps of the various examples described in the embodiments disclosed herein, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed by hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of protection of this application.
[0450] This application embodiment can divide an electronic device into functional modules based on the above method example. For example, each function can be divided into its own functional modules, or two or more functions can be integrated into one processing module. The integrated modules can be implemented in hardware or as software functional modules. It should be noted that the module division in this application embodiment is illustrative and only represents one logical functional division. In actual implementation, other feasible division methods may exist. The following description uses the division of functional modules according to each function as an example.
[0451] This application also provides a chip coupled to a memory, which is used to read and execute computer programs or instructions stored in the memory to perform the methods in the above embodiments.
[0452] This application also provides an electronic device including a chip for reading and executing computer programs or instructions stored in a memory, causing the methods in the various embodiments to be performed.
[0453] This embodiment also provides a computer-readable storage medium storing computer instructions. When the computer instructions are executed on an electronic device, the electronic device performs the aforementioned method steps to implement the adaptive compression method for the image and text browsing scenario in the above embodiment.
[0454] This embodiment also provides a computer program product. The computer-readable storage medium stores program code. When the computer program product is run on a computer, it causes the computer to perform the above-mentioned related steps to realize the adaptive compression method for the image and text browsing scenario in the above embodiment.
[0455] In this embodiment, the electronic device, computer-readable storage medium, computer program product or chip are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can be referred to the beneficial effects of the corresponding methods provided above, and will not be repeated here.
[0456] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another apparatus, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0457] In this article, the term "and / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. The symbol " / " in this article indicates that the related objects are in an "or" relationship; for example, A / B means A or B.
[0458] The terms "first" and "second," etc., used in the specification and claims herein are used to distinguish different objects, not to describe a specific order of objects. In the description of embodiments in this application, unless otherwise stated, "multiple" means two or more; for example, multiple processing units refer to two or more processing units, etc.; multiple elements refer to two or more elements, etc.
[0459] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. An adaptive compression method for image and text browsing scenarios, characterized in that, Applied to electronic devices, the method includes: Receive the first operation performed by the user on the first interface, the first interface displaying images and text; In response to the first operation, the current user scenario is identified as an image and text browsing scenario; In the image and text browsing scenario, the image attribute information of the first interface is obtained, the user browsing operation information acting on the first interface is detected, and the device power consumption mode and device performance status are monitored. Based on the first scene information, an adaptive compression control algorithm is invoked to compress the text and image content of the first interface at a fixed bit rate. The first scene information includes at least one of the following: image attribute information of the first interface, user browsing operation information, device power consumption mode, and device performance status.
2. The method according to claim 1, characterized in that, The step of responding to the first operation by identifying the current user scenario as a text and image browsing scenario includes: Identify the view corresponding to the first interface; Identify whether the first operation meets the preset operation conditions; If the first interface includes an ImageView and a TextView, and the first operation satisfies the preset operation conditions, then the current user scenario is determined to be the image and text browsing scenario.
3. The method according to claim 1 or 2, characterized in that, The step of invoking an adaptive compression control algorithm based on the first scene information to perform fixed bit rate compression on the text and image content of the first interface includes: Based on the first scenario information, the adaptive compression control algorithm is invoked to determine a fixed bit rate compression strategy, which includes adopting a fixed bit rate compression method and a first compression level. According to the fixed bit rate compression strategy, texture compression is performed on the text and image content of the first interface.
4. The method according to claim 3, characterized in that, The first compression level corresponds to multiple alternative compression ratios; The step of performing texture compression on the text and image content of the first interface according to the fixed bit rate compression strategy includes: Based on the compression ratio supported by the view texture format corresponding to the first interface and the compression ratio supported by the hardware module in the electronic device, a first compression ratio is determined from the plurality of alternative compression ratios. The text and image content of the first interface is texture compressed using the first compression ratio.
5. The method according to claim 3 or 4, characterized in that, After determining the fixed bit rate compression strategy, the method further includes: Create compression control parameters in the form of a structure, wherein the compression control parameters include a first flag bit and a second flag bit; Write the identifier of the fixed bit rate compression method into the first flag bit, and write the identifier of the first compression level into the second flag bit; The graphics API interface of the electronic device is invoked to pass the first compression control parameters to a hardware module with texture compression capability.
6. The method according to any one of claims 3 to 5, characterized in that, The image attribute information, the user browsing operation information, the device power consumption mode, and the device performance status each correspond to a weighting coefficient. The step of calling the adaptive compression control algorithm to determine the fixed bit rate compression strategy based on the first scenario information includes: calling the adaptive compression control algorithm to perform weighted calculation based on the image attribute information, the user browsing operation information, the device power consumption mode, the device performance status, and the weight coefficient to obtain the compression level of the fixed bit rate compression method.
7. The method according to any one of claims 1 to 6, characterized in that, The step of invoking an adaptive compression control algorithm based on the first scene information to perform fixed bit rate compression on the text and image content of the first interface includes: Determine whether the electronic device is in a high-load state and / or a low-performance state; In the high-load and / or low-performance states, based on the first scenario information, the adaptive compression control algorithm is invoked to compress the text and image content of the first interface at a fixed bit rate.
8. The method according to any one of claims 1 to 7, characterized in that, After performing fixed-bitrate compression on the text and image content of the first interface, the method further includes: If the first scene information changes, the adaptive compression control algorithm is invoked to adjust the compression ratio, and the adjusted compression ratio is used to compress the text and image content at a fixed bit rate.
9. The method according to any one of claims 1 to 8, characterized in that, The adaptive compression control algorithm includes: Regarding the image attribute information, the compression ratio corresponding to the first type of image is greater than the compression ratio corresponding to the second type of image; wherein, the first type of image includes thumbnails, multiple images, images with blurring, and / or background layers; the second type of image includes large images and / or images in editing mode; For the user browsing operation information, the faster the browsing speed and / or the shorter the browsing time, the greater the compression ratio. For the device power consumption mode, the compression ratio corresponding to the power saving mode is higher than the compression ratio corresponding to the normal mode. Regarding the device performance state, the compression ratio corresponding to the low performance state is higher than the compression ratio corresponding to the high performance state.
10. The method according to any one of claims 1 to 9, characterized in that, The performance status of the monitoring equipment includes: The real-time dynamic performance parameters of the electronic device are obtained, including the CPU utilization rate, DDR memory utilization rate, DDR bandwidth and / or GPU load. Obtain the pre-configured performance parameters of the electronic device, including the amount of available DDR memory, the available range of DDR bandwidth, and the GPU frequency; The device performance status is determined based on the real-time dynamic performance parameters and the pre-configured performance parameters.
11. The method according to any one of claims 1 to 10, characterized in that, The electronic device includes a central processing unit (CPU), a texture compression module, a graphics processing unit (GPU), and double data rate synchronous dynamic random access memory (DDR). The step of invoking the adaptive compression control algorithm to compress the text and image content of the first interface at a fixed bit rate includes: The CPU calls the texture compression module and uses the adaptive compression control algorithm to compress the text and image content of the first interface at a fixed bit rate. The CPU stores the texture compressed data of the first interface in the DDR and sends the graphics drawing instructions of the first interface to the GPU.
12. The method according to claim 11, characterized in that, The electronic device also includes a hardware-accelerated rendering engine, a graphics processing engine, and a graphics API interface; The CPU invokes the texture compression module and uses the adaptive compression control algorithm to perform fixed-bit-rate compression on the text and image content of the first interface, including: The CPU determines the fixed bitrate compression strategy through the hardware-accelerated rendering engine. The hardware-accelerated rendering engine passes the fixed bitrate compression strategy to the graphics processing engine. The graphics processing engine obtains texture compression parameters based on the fixed bit rate compression strategy and passes the texture compression parameters to the texture compression module through the graphics API interface; the texture compression parameters include the compression ratio corresponding to the first interface. The texture compression module performs fixed bit rate compression on the text and image content of the first interface based on the texture compression parameters.
13. The method according to claim 12, characterized in that, The electronic device also includes an application framework layer module; The application framework layer module is used to: in the image and text browsing scenario, obtain image attribute information of the first interface, detect the user browsing operation information acting on the first interface, and monitor the device power consumption mode and the device performance status. The application framework layer module is also used to pass the graphics drawing instructions of the first interface to the hardware-accelerated rendering engine. The hardware-accelerated rendering engine determines the fixed bitrate compression strategy by: in response to the graphics drawing instructions of the first interface, the hardware-accelerated rendering engine obtains the first scene information from the application framework layer module; and the hardware-accelerated rendering engine calls the adaptive compression control algorithm to determine the fixed bitrate compression strategy based on the first scene information.
14. The method according to any one of claims 11 to 13, characterized in that, The electronic device also includes a display screen; After the CPU sends the graphics drawing instructions for the first interface to the GPU, the method further includes: In response to the graphics drawing command of the first interface sent by the CPU, the GPU reads the texture compression data of the first interface from the DDR and decompresses the texture compression data; The GPU performs texture rendering based on the decompressed texture data and transmits the texture rendering result to the display screen. The display screen shows the graphic and textual content of the first interface based on the texture rendering result.
15. An electronic device, characterized in that, The electronic device includes: one or more processors, and memory; The memory is coupled to the one or more processors, the memory being used to store computer program code, the computer program code including computer instructions, the one or more processors invoking the computer instructions to cause the electronic device to perform the method as described in any one of claims 1 to 14.
16. A chip system, characterized in that, The chip system is applied to an electronic device, the chip system including one or more processors, the one or more processors being used to invoke computer instructions to cause the electronic device to perform the method as described in any one of claims 1 to 14.
17. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by an electronic device, causes the electronic device to perform the method as described in any one of claims 1 to 14.