Data compression method and device, electronic equipment and storage medium
By selecting an appropriate compression algorithm based on operating parameters in electronic devices, the problem of efficiency and performance imbalance caused by fixed compression algorithms is solved, achieving a balance between compression efficiency and device performance under different conditions, thereby improving device performance and user experience.
Patent Information
- Application Number
- CN202310533446.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-11
- Publication Date
- 2024-11-12
AI Technical Summary
The data compression algorithms of existing electronic devices are fixed, which makes it impossible to balance compression efficiency and device performance, especially when resources are scarce or plentiful, making it difficult to flexibly choose a suitable compression algorithm.
Based on the current operating parameters of the electronic device, a suitable compression algorithm is selected from at least two candidate compression algorithms for data compression. Taking into account the negative correlation between compression ratio and compression speed, the compression algorithm is dynamically adjusted to adapt to the device status.
It achieves a balance between compression efficiency and performance under different device conditions, improves the overall performance of the device and the user experience, and avoids resource waste and delay.
Smart Images

Figure CN118944674A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of data compression, and more specifically, to a data compression method, device, electronic device and storage medium. Background Art
[0002] With the development of science and technology, electronic devices are used more and more widely and have more and more functions, becoming one of the necessities in people's daily life. Among them, electronic devices can compress data according to needs, but current electronic devices are generally configured with a compression algorithm, that is, the compression of data is all done with this compression algorithm, resulting in a fixed compression algorithm used, causing the problem of unbalanced data compression efficiency and electronic device performance. Summary of the invention
[0003] In view of the above problems, the present application proposes a data compression method, device, electronic device and storage medium to solve the above problems.
[0004] In a first aspect, an embodiment of the present application provides a data compression method, which is applied to an electronic device, and the method includes: determining the data to be compressed, and determining the current operating parameters of the electronic device; determining, from at least two compression algorithms to be selected, a compression algorithm to be selected corresponding to the current operating parameters as the current compression algorithm, wherein the compression parameters corresponding to the at least two compression algorithms to be selected are different, and the compression parameters include a compression rate and a compression speed that are negatively correlated; and compressing the data to be compressed based on the current compression algorithm.
[0005] In a second aspect, an embodiment of the present application provides a data compression device, which is applied to an electronic device, and the device includes: an information determination module, which is used to determine the data to be compressed and determine the current operating parameters of the electronic device; a compression algorithm determination module, which is used to determine the compression algorithm to be selected corresponding to the current operating parameters from at least two compression algorithms to be selected as the current compression algorithm, wherein the compression parameters corresponding to the at least two compression algorithms to be selected are different, and the compression parameters include a compression rate and a compression speed that are negatively correlated; a data compression processing module, which is used to compress the data to be compressed based on the current compression algorithm.
[0006] In a third aspect, an embodiment of the present application provides an electronic device, comprising a memory and a processor, wherein the memory is coupled to the processor, the memory stores instructions, and when the instructions are executed by the processor, the processor executes the above method.
[0007] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which a program code is stored, and the program code can be called by a processor to execute the above method.
[0008] The data compression method, device, electronic device and storage medium provided in the embodiments of the present application determine the data to be compressed and the current operating parameters of the electronic device, and determine the compression algorithm to be selected corresponding to the current operating parameters from at least two compression algorithms to be selected as the current compression algorithm, wherein the compression parameters corresponding to the at least two compression algorithms to be selected are different, and the compression parameters include a compression ratio and a compression speed that are negatively correlated, and the data to be compressed is compressed based on the current compression algorithm, so that by combining the operating parameters of the electronic device, an adaptive compression algorithm is selected from at least two compression algorithms to be selected, and the data to be compressed is compressed, so as to achieve a balance between compression efficiency and performance of the electronic device. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.
[0010] Figure 1 A schematic diagram of a flow chart of a data compression method provided by an embodiment of the present application is shown;
[0011] Figure 2 A schematic diagram of a flow chart of a data compression method provided by an embodiment of the present application is shown;
[0012] Figure 3 This application shows Figure 2 The flowchart of step S220 of the data compression method shown is as follows;
[0013] Figure 4 This application shows Figure 3 The flowchart of step S221 of the data compression method shown is as follows;
[0014] Figure 5 A schematic diagram of a flow chart of a data compression method provided by an embodiment of the present application is shown;
[0015] Figure 6 A schematic diagram of a flow chart of a data compression method provided by an embodiment of the present application is shown;
[0016] Figure 7 This application shows Figure 6 The flowchart of step S450 of the data compression method shown is as follows;
[0017] Figure 8 A schematic diagram of a flow chart of a data compression method provided by an embodiment of the present application is shown;
[0018] Fig. 9 A module block diagram of a data compression device provided by an embodiment of the present application is shown;
[0019] Fig.10 A block diagram of an electronic device according to an embodiment of the present application for executing a data compression method according to an embodiment of the present application is shown;
[0020] Fig.11 A storage unit for storing or carrying program codes for implementing a data compression method according to an embodiment of the present application is shown. DETAILED DESCRIPTION
[0021] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.
[0022] At present, for data compression schemes, a predetermined lossless compression algorithm is generally used for compression, that is, no matter what the operating state of the electronic device is, a predetermined compression algorithm is used to compress the data. This method lacks an intelligent mechanism and cannot flexibly select a compression algorithm according to the actual situation of the electronic device. In particular, when the resources of the electronic device are tight, if a compression algorithm with a faster compression speed can be selected, the data compression processing can be realized faster to relieve the pressure of the electronic device. On the contrary, when the resources of the electronic device are sufficient, if a compression algorithm with a higher compression rate can be selected, the data storage space can be better saved. Therefore, if only one fixed compression algorithm is used, the compression algorithm used will be fixed, resulting in the problem of an unbalanced relationship between data compression efficiency and the performance of the electronic device.
[0023] In view of the above problems, the inventors have discovered after long-term research and proposed the data compression method, device, electronic device and storage medium provided in the embodiments of the present application. By combining the operating parameters of the electronic device, an adaptive compression algorithm is selected from at least two compression algorithms to be selected, and the compressed data is compressed, so as to achieve a balance between compression efficiency and performance of the electronic device. The specific data compression method is described in detail in the subsequent embodiments.
[0024] See also Figure 1 , Figure 1The flowchart of a data compression method provided by an embodiment of the present application is shown. The method is used to select an adaptive compression algorithm from at least two compression algorithms to be selected by combining the operating parameters of the electronic device, and compress the data to be compressed, so as to achieve a balance between the compression efficiency and the performance of the electronic device. In a specific embodiment, the data compression method is applied to Fig. 9 The data compression device 200 and the electronic device 100 equipped with the data compression device 200 are shown in FIG. Fig.10 ). The following will take an electronic device as an example to illustrate the specific process of this embodiment. Of course, it can be understood that the electronic device used in this embodiment may include a smart phone, a tablet computer, a wearable electronic device, etc., which is not limited here. Figure 1 The process shown is described in detail, and the data compression method may specifically include the following steps:
[0025] Step S110: determining the data to be compressed and determining the current operating parameters of the electronic device.
[0026] Optionally, the data to be compressed may include data in the memory of the electronic device, data in the hard disk of the electronic device, data in a database, data involved in a cloud computing environment, data involved in processing a large-scale data set, data involved in the electronic device, data involved in a large data center, etc., which are not limited here. When the data to be compressed is memory data of the electronic device, the data to be compressed may be data in the virtual memory of the operating system of the electronic device.
[0027] In some embodiments, data to be compressed may be determined. Among them, data to be compressed may be determined, and the data to be compressed may be determined as data to be compressed. Optionally, when the data to be compressed is data in a memory of an electronic device, all data in the memory of the electronic device may be determined as data to be compressed, or part of the data in the memory of the electronic device may be determined as data to be compressed, which is not limited here.
[0028] In some embodiments, the current operating parameters of the electronic device can be determined, wherein the current operating parameters of the electronic device can be used to reflect the current operating state of the electronic device. As a method, the electronic device can be provided with an operating parameter detection module, and the current operating parameters of the electronic device can be detected by the operating parameter detection module of the electronic device. Optionally, the current operating parameters of the electronic device may include: the usage rate of the central processor of the electronic device, the device temperature of the electronic device, the memory pressure level of the electronic device, the remaining power of the electronic device, the model of the electronic device, the brand of the electronic device, the production date of the electronic device, etc., which are not limited here.
[0029] Step S120: Determine, from at least two compression algorithms to be selected, a compression algorithm to be selected corresponding to the current operating parameters as the current compression algorithm, wherein the compression parameters corresponding to the at least two compression algorithms to be selected are different, and the compression parameters include a compression ratio and a compression speed that are negatively correlated.
[0030] Optionally, at least two selected compression algorithms may be pre-set and stored in the electronic device, wherein the compression parameters corresponding to the at least two compression algorithms to be selected are different, and the compression parameters include a compression rate and a compression speed that are negatively correlated. For example, the at least two compression algorithms to be selected may include a first compression algorithm to be selected and a second compression algorithm to be selected, the first compression algorithm to be selected corresponds to a first compression parameter, and the second compression algorithm to be selected corresponds to a second compression parameter, if the compression rate included in the first compression parameter is higher than the compression rate included in the second compression parameter, then the compression speed included in the first compression parameter is slower than the compression speed included in the second compression parameter; if the compression rate included in the first compression parameter is lower than the compression rate included in the second compression parameter, then the compression speed included in the first compression parameter is faster than the compression speed included in the second compression parameter.
[0031] It is understandable that the faster the electronic device compresses data, the less the consumption of the central processing unit of the electronic device, and the slower the electronic device compresses data, the more the consumption of the central processing unit of the electronic device. The consumption of the central processing unit of the electronic device may include the occupancy time of the central processing unit of the electronic device and / or the power consumption of the central processing unit of the electronic device. Based on this, at least two compression algorithms to be selected have different trade-offs between compression rate and consumption of the central processing unit, and the compression algorithm with a high compression rate consumes more corresponding central processing unit, and the compression algorithm with a low compression rate consumes less corresponding central processing unit.
[0032] In this embodiment, when determining the current operating parameters of the electronic device, the compression algorithm to be selected corresponding to the current operating parameters can be determined from at least two compression algorithms to be selected, and the compression algorithm to be selected corresponding to the current operating parameters can be determined as the current compression algorithm.
[0033] In some embodiments, the electronic device may pre-set and store a mapping relationship, which may include a correspondence between at least two compression algorithms to be selected and at least two operating parameters, wherein the correspondence may include: one compression algorithm to be selected corresponds to one operating parameter, one compression algorithm to be selected corresponds to multiple operating parameters, etc., which are not limited here. Based on this, when the current operating parameter is obtained, the compression algorithm to be selected that has a corresponding relationship with the current operating parameter can be determined as the current compression algorithm based on the mapping relationship.
[0034] For example, assuming that at least two compression algorithms to be selected include a first compression algorithm to be selected and a second compression algorithm to be selected, and at least two operating parameters include a first operating parameter and a second operating parameter, and there is a corresponding relationship between the first compression algorithm to be selected and the first operating parameter, and there is a corresponding relationship between the second compression algorithm to be selected and the second operating parameter. Then, if it is determined that the current operating parameter is the first operating parameter, the first compression algorithm to be selected can be determined as the current compression algorithm based on the mapping relationship; if it is determined that the current operating parameter is the second operating parameter, the second compression algorithm to be selected can be determined as the current compression algorithm based on the mapping relationship.
[0035] It is understandable that, by setting at least two compression algorithms to be selected and selecting the current compression algorithm corresponding to the current operating parameters of the electronic device, it is possible to adjust the selection of the compression algorithm according to the operating conditions of the electronic device to achieve a more efficient and resource-saving compression process. Specifically, according to the operating parameters of the electronic device, a suitable compression algorithm can be used to compress the data to be compressed, which can improve the overall performance of the electronic device system and avoid excessive occupation of the central processor and storage resources of the electronic device; according to the characteristics of the compression algorithm and the operating parameters of the electronic device, selecting a suitable compression algorithm can save system resources and avoid unnecessary waste of computing resources; by dynamically selecting a suitable compression algorithm, the response time of the application can be reduced and the user experience can be improved.
[0036] Step S130: compressing the data to be compressed based on the current compression algorithm.
[0037] In this embodiment, when the current compression algorithm is determined, the data to be compressed can be compressed based on the current compression algorithm.
[0038] In some embodiments, when compressing the data to be compressed based on the current compression algorithm, the compressed operating parameters of the electronic device can also be determined, and the parameter relationship between the compressed operating parameters and the current operating parameters can be determined. The improvement of the operating state of the electronic device is determined based on the parameter relationship. If it is determined based on the improvement that the operating state of the electronic device is improved (such as the temperature of the electronic device is reduced and the memory pressure level of the electronic device is reduced), it can be determined that the selected compression algorithm is reasonable, and the compression algorithm can be selected based on the selection method in the future; if it is determined based on the improvement that the operating state of the electronic device is not improved (such as the temperature of the electronic device is increased or the memory pressure level of the electronic device is unchanged), it can be determined that the selected compression algorithm is unreasonable, and the compression algorithm selection method can be adjusted in the future.
[0039] Optionally, the data compression method of this embodiment can be applied to database management. Using different compression algorithms to perform different types of data compression in the database can improve the storage efficiency and reading speed of the database.
[0040] Optionally, the data compression method of this embodiment can be applied to cloud computing, and different compression algorithms can be dynamically selected on different computing nodes in a cloud computing environment according to the system load, thereby improving the performance and scalability of the entire cluster.
[0041] Optionally, the data compression method of this embodiment can be applied to big data processing. When processing large-scale data sets, using different compression algorithms to compress the data can reduce storage space and data transmission time and improve data processing efficiency.
[0042] Optionally, the data compression method of this embodiment may be applied to electronic devices, where different compression algorithms are selected according to different device states, thereby saving power and improving device performance.
[0043] Optionally, the data compression method of this embodiment can be applied to data center management. In a large data center, different compression algorithms can be selected according to the status and load of each node to improve the performance and efficiency of the entire data center.
[0044] Optionally, the data compression method of this embodiment can be applied to the operating system of an electronic device. In the operating system of the electronic device, different compression algorithms are selected according to different device states to compress data on the virtual memory of the operating system, thereby achieving a balance between compression efficiency and performance of the electronic device.
[0045] A data compression method provided by an embodiment of the present application determines the data to be compressed and the current operating parameters of the electronic device, and determines the compression algorithm to be selected corresponding to the current operating parameters from at least two compression algorithms to be selected as the current compression algorithm, wherein the compression parameters corresponding to the at least two compression algorithms to be selected are different, and the compression parameters include a compression ratio and a compression speed that are negatively correlated, and the data to be compressed is compressed based on the current compression algorithm, so that by combining the operating parameters of the electronic device, an adaptive compression algorithm is selected from at least two compression algorithms to be selected, and the data to be compressed is compressed, so as to achieve a balance between compression efficiency and performance of the electronic device.
[0046] See also Figure 2 , Figure 2 The flowchart of the data compression method provided by an embodiment of the present application is shown in FIG. Figure 2 The process shown is described in detail, and the data compression method may specifically include the following steps:
[0047] Step S210: determining the data to be compressed and determining the current operating parameters of the electronic device.
[0048] The specific description of step S210 can be found in step S110 and will not be repeated here.
[0049] Step S220: Determine an operation score of the electronic device based on the current operation parameters.
[0050] In this embodiment, when the current operating parameters are obtained, the operating score of the electronic device can be determined based on the current operating parameters.
[0051] In some implementations, the number of current operating parameters may be one, and when the number of current operating parameters is one, the operation score of the electronic device may be determined based on the one current operating parameter. The number of current operating parameters may be multiple, and the operation score of the electronic device may be determined based on the multiple current operating parameters.
[0052] In some embodiments, the electronic device may be pre-set and stored with a scoring algorithm, and when the current operating parameter is obtained, the current operating parameter may be calculated based on the scoring algorithm to obtain the operating score of the electronic device. For example, if the current operating parameter of the electronic device is the device temperature of the electronic device, the device temperature may be calculated based on the scoring algorithm to obtain the operating score of the electronic device; if the current operating parameter of the electronic device is the device temperature of the electronic device and the usage rate of the central processing unit, the device temperature and the usage rate of the central processing unit may be calculated based on the scoring algorithm to obtain the operating score of the electronic device.
[0053] See also Figure 3 , Figure 3 This application shows Figure 2 The following is a flow chart of step S220 of the data compression method. Figure 3 The process shown is described in detail. In this embodiment, the number of the current operating parameters is multiple, and the method may specifically include the following steps:
[0054] Step S221: Determine the weight values corresponding to each of the multiple current operating parameters.
[0055] Optionally, there are multiple current operating parameters, for example, the current operating parameters may include the device temperature of the electronic device, the usage rate of the central processing unit of the electronic device, the memory pressure level of the memory of the electronic device, etc.
[0056] In some implementations, when multiple current operating parameters of the electronic device are determined, weight values corresponding to the multiple current operating parameters may be determined, wherein the sum of the weight values corresponding to the multiple current operating parameters may be 1.
[0057] As an implementable manner, when a plurality of current operating parameters of the electronic device are determined, the weight values corresponding to the plurality of current operating parameters may be determined based on experience.
[0058] As another feasible method, when determining multiple current operating parameters of an electronic device, the influence degree corresponding to each of the multiple current operating parameters can be determined, and based on the influence program corresponding to each of the multiple current operating parameters, the weight value corresponding to each of the multiple current operating parameters can be determined.
[0059] As another feasible method, when determining multiple current operating parameters of an electronic device, the priorities corresponding to each of the multiple current operating parameters can be determined, and based on the priorities corresponding to each of the multiple current operating parameters, the weight values corresponding to each of the multiple current operating parameters can be determined.
[0060] See also Figure 4 , Figure 4 This application shows Figure 3 The data compression method shown in step S221 is a flow chart. Figure 4 The process shown is described in detail, and the method may specifically include the following steps:
[0061] Step S2211: Determine the device model of the electronic device.
[0062] Among them, different models of electronic devices have different sensitivities to various operating parameters. For example, a certain model of electronic device is more sensitive to changes in device temperature, so the weight value corresponding to the device temperature of this model of electronic device can be larger; a certain model of electronic device is more sensitive to the usage rate of the central processing unit of the electronic device, so the weight value corresponding to the usage rate of the central processing unit of this model of electronic device can be larger, etc., which are not limited here.
[0063] In this embodiment, the device model of the electronic device can be determined. As an implementable manner, the device model of the electronic device can be burned into the local of the electronic device when the electronic device is factory set, based on which, the device model of the electronic device can be obtained from the local of the electronic device. As another implementable manner, the electronic device can communicate with the manufacturer server of the corresponding manufacturer, and the manufacturer server stores the device model of the electronic device, based on which, the device model of the electronic device can be obtained from the manufacturer server of the electronic device through communication with the manufacturer server.
[0064] Step S2212: Based on the device model, determine the weight values corresponding to each of the multiple current operating parameters.
[0065] In some implementations, when the device model of the electronic device is obtained, weight values corresponding to each of the plurality of current operating parameters may be determined based on the device model, and the adaptability of the determined weight values may be improved.
[0066] Step S222: Calculate the multiple current operating parameters and the weight values corresponding to the multiple current operating parameters in a linear weighted manner to obtain the operating score corresponding to the electronic device.
[0067] In some embodiments, when the weight values corresponding to each of the multiple current operating parameters are determined, the multiple current operating parameters and the weight values corresponding to each of the multiple current operating parameters can be calculated in a linear weighted manner to obtain an operating score corresponding to the electronic device.
[0068] As an implementable method, when the weight values corresponding to multiple current operating parameters are determined, the multiple current operating parameters can be multiplied by the corresponding weight values to obtain the weighted parameters corresponding to the multiple current operating parameters. Then, the weighted parameters corresponding to the multiple current operating parameters are added to obtain the corresponding operation score of the electronic device.
[0069] Step S230: Determine, from the at least two compression algorithms to be selected, a compression algorithm to be selected corresponding to the running score as the current compression algorithm, wherein the compression parameters corresponding to the at least two compression algorithms to be selected are different, and the compression parameters include a compression ratio and a compression speed that are negatively correlated.
[0070] In this embodiment, when determining the operation score of the electronic device, a compression algorithm to be selected corresponding to the operation score can be determined from at least two compression algorithms to be selected, and the compression algorithm to be selected corresponding to the operation score can be determined as the current compression algorithm.
[0071] In some embodiments, the electronic device may pre-set and store a mapping relationship, which may include a correspondence between at least two compression algorithms to be selected and at least two operation scores, wherein the correspondence may include: one compression algorithm to be selected corresponds to one operation score, one compression algorithm to be selected corresponds to multiple operation scores, etc., which are not limited here. Based on this, when the operation score is obtained, the compression algorithm to be selected that has a corresponding relationship with the operation score can be determined as the current compression algorithm based on the mapping relationship.
[0072] It can be understood that the higher the operation score, the greater the system pressure of the electronic device, for example, the greater the memory pressure, the higher the device temperature, etc., and a compression algorithm with a faster compression speed can be used; conversely, the lower the operation score, the smaller the system pressure of the electronic device, for example, the lower the memory pressure, the lower the device temperature, etc., and a compression algorithm with a higher compression rate can be used.
[0073] Step S240: compressing the data to be compressed based on the current compression algorithm.
[0074] For the detailed description of step S240, please refer to step S130, which will not be repeated here.
[0075] The data compression method provided by an embodiment of the present application determines the data to be compressed and the current operating parameters of the electronic device, determines the operating score of the electronic device based on the current operating parameters, and determines the compression algorithm to be selected corresponding to the operating score from at least two compression algorithms to be selected as the current compression algorithm, wherein the compression parameters corresponding to the at least two compression algorithms to be selected are different, and the compression parameters include a compression rate and a compression speed that are negatively correlated, and compresses the data to be compressed based on the current compression algorithm. Compared to Figure 1 The data compression method shown in this embodiment also determines the operation score of the electronic device based on the current operation parameters of the electronic device, and selects a compression algorithm based on the operation score, thereby improving the accuracy of the selected compression algorithm.
[0076] See also Figure 5 , Figure 5 The flowchart of the data compression method provided by an embodiment of the present application is shown in FIG. Figure 5 The process shown is described in detail. In this embodiment, the data to be compressed is data in the memory of the electronic device, the current operating parameters include a first current operating parameter and a second current operating parameter, and the resource tension corresponding to the first current operating parameter is lower than the resource tension corresponding to the second current operating parameter. The data compression method may specifically include the following steps:
[0077] Step S310: determine the data to be compressed and determine the current operating parameters of the electronic device.
[0078] The specific description of step S310 can be found in step S110 , which will not be repeated here.
[0079] Step S320: If the current operating parameter is the first current operating parameter, then determining, from the at least two compression algorithms to be selected, a compression algorithm to be selected corresponding to the first current operating parameter as the first current compression algorithm.
[0080] Optionally, the data to be compressed is data in the memory of the electronic device, for example, the data to be compressed is data in the virtual memory of the operating system of the electronic device. Based on this, the current operating parameters may include one or a combination of the usage rate of the central processing unit of the electronic device, the device temperature of the electronic device, and the pressure level of the memory of the electronic device.
[0081] Optionally, the current operating parameters include a first current operating parameter and a second current operating parameter, and the resource tension level corresponding to the first current operating parameter is lower than the resource tension level corresponding to the second current operating parameter, for example, the first current operating parameter includes a first memory pressure level, the second current operating parameter includes a second memory pressure level, and the first memory pressure level is lower than the second memory pressure level; or, the first current operating parameter includes a first CPU usage rate, the second current operating parameter includes a second CPU usage rate, and the first CPU usage rate is lower than the second CPU usage rate. Based on this, the resource tension level corresponding to the first current operating parameter is lower than the resource tension level corresponding to the second current operating parameter.
[0082] Optionally, the current compression algorithm may include a first current compression algorithm and a second current compression algorithm, the compression rate corresponding to the first current compression algorithm is higher than the compression rate corresponding to the second current compression algorithm, and accordingly, the compression speed corresponding to the first current compression algorithm is slower than the compression speed corresponding to the second current compression algorithm.
[0083] In this embodiment, if the current operating parameter is the first current operating parameter, the compression algorithm to be selected corresponding to the first current operating parameter can be determined from at least two compression algorithms to be selected, and the compression algorithm to be selected corresponding to the first current operating parameter can be determined as the first current compression algorithm. It can be understood that, since the resource tension represented by the first current operating parameter is relatively high, the compression rate corresponding to the first current compression algorithm corresponding to the first current operating parameter is relatively high, and accordingly, the compression speed corresponding to the first current compression algorithm corresponding to the first current operating parameter is relatively slow.
[0084] In some embodiments, if the current operating parameter is a first current operating parameter, the compression algorithm to be selected corresponding to the first current operating parameter can be determined as the first current compression algorithm based on a mapping relationship pre-set and stored in the electronic device, including the correspondence between at least two compression algorithms to be selected and at least two operating parameters.
[0085] Step S330: If the current operating parameter is the second current operating parameter, then determine the compression algorithm to be selected corresponding to the second current operating parameter from the at least two compression algorithms to be selected as the second current compression algorithm, wherein the compression rate corresponding to the first current compression algorithm is higher than the compression rate corresponding to the second current compression algorithm, and the compression speed corresponding to the first current compression algorithm is slower than the compression speed corresponding to the second current compression algorithm.
[0086] In this embodiment, if the current operating parameter is the second current operating parameter, the compression algorithm to be selected corresponding to the second current operating parameter can be determined from at least two compression algorithms to be selected, and the compression algorithm to be selected corresponding to the second current operating parameter can be determined as the second current compression algorithm. It can be understood that, since the resource tension represented by the second current operating parameter is relatively low, the compression rate corresponding to the second current compression algorithm corresponding to the second current operating parameter is relatively low, and accordingly, the compression speed corresponding to the second current compression algorithm corresponding to the second current operating parameter is relatively fast.
[0087] In some embodiments, if the current operating parameter is the second current operating parameter, the compression algorithm to be selected corresponding to the second current operating parameter can be determined as the second current compression algorithm based on a mapping relationship pre-set and stored in the electronic device, including the correspondence between at least two compression algorithms to be selected and at least two operating parameters.
[0088] Step S340: compressing the data to be compressed based on the current compression algorithm.
[0089] For the detailed description of step S340, please refer to step S130, which will not be repeated here.
[0090] A data compression method provided in an embodiment of the present application determines the data to be compressed and determines the current operating parameters of the electronic device. If the current operating parameter is the first current operating parameter, then the compression algorithm to be selected corresponding to the first current operating parameter is determined from at least two compression algorithms to be selected as the first current compression algorithm. If the current operating parameter is the second current operating parameter, then the compression algorithm to be selected corresponding to the second current operating parameter is determined from at least two compression algorithms to be selected as the second current compression algorithm. The resource tension level corresponding to the first current operating parameter is lower than the resource tension level corresponding to the second current operating parameter, the compression rate corresponding to the first current compression algorithm is higher than the compression rate corresponding to the second current compression algorithm, and the compression speed corresponding to the first current compression algorithm is slower than the compression speed corresponding to the second current compression algorithm. Compared to Figure 1The data compression algorithm shown in the figure can select an adaptive compression algorithm according to the degree of resource shortage in this embodiment, so as to achieve a balance between compression efficiency and performance of the electronic device when memory is recycled.
[0091] See also Figure 6 , Figure 6 The flowchart of the data compression method provided by an embodiment of the present application is shown in FIG. Figure 6 The process shown is described in detail, and the data compression method may specifically include the following steps:
[0092] Step S410: determine the data to be compressed and determine the current operating parameters of the electronic device.
[0093] Step S420: Determine, from at least two compression algorithms to be selected, a compression algorithm to be selected corresponding to the current operating parameters as the current compression algorithm, wherein the compression parameters corresponding to the at least two compression algorithms to be selected are different, and the compression parameters include a compression ratio and a compression speed that are negatively correlated.
[0094] Step S430: compressing the data to be compressed based on the current compression algorithm.
[0095] For the detailed description of step S410 to step S430 , please refer to step S110 to step S130 , which will not be repeated here.
[0096] Step S440: If the current operating parameters of the electronic device change, determine the changed operating parameters of the electronic device.
[0097] In this embodiment, after the data to be compressed is compressed based on the current compression algorithm, it can be determined whether the current operating parameters of the electronic device have changed. For example, if the current operating parameters include the device temperature of the electronic device, it can be determined whether the device temperature of the electronic device has changed after the data to be compressed is compressed based on the current compression algorithm; if the current operating parameters include the device temperature of the electronic device and the usage rate of the central processing unit, it can be determined whether the device temperature of the electronic device and / or the usage rate of the central processing unit has changed after the data to be compressed is compressed based on the current compression algorithm.
[0098] As a method, after compressing the data to be compressed based on the current compression algorithm, changes in the current operating parameters of the electronic device can be detected. If it is detected that there is a difference between the current operating parameters of the electronic device and the previous ones, it can be determined that the current operating parameters of the electronic device have changed. If it is detected that there is no difference between the current operating parameters of the electronic device and the previous ones, it can be determined that the current operating parameters of the electronic device have not changed.
[0099] As another way, after the data to be compressed is compressed based on the current compression algorithm, changes in current operating parameters of the electronic device can be detected. If it is detected that there is a difference between the current operating parameters of the electronic device and the previous ones, it can be determined whether the difference reaches a preset difference. If it is determined that the difference reaches a difference threshold, it can be determined that the current operating parameters of the electronic device have changed. If it is determined that the difference does not reach the difference threshold, it can be determined that the current operating parameters of the electronic device have not changed.
[0100] In some embodiments, if it is determined that the current operating parameters of the electronic device have changed, the changed operating parameters of the electronic device can be determined. Among them, the changed operating parameters of the electronic device can be used to reflect the changed operating state of the electronic device. As a way, the electronic device can be provided with an operating parameter detection module, and the changed operating parameters of the electronic device can be detected by the operating parameter detection module of the electronic device. Optionally, the changed operating parameters of the electronic device may include: the usage rate of the central processing unit of the electronic device, the device temperature of the electronic device, the memory pressure level of the electronic device, the remaining power of the electronic device, the model of the electronic device, the brand of the electronic device, the production date of the electronic device, etc., which are not limited here.
[0101] In some implementations, if it is determined that the current operating parameters of the electronic device have not changed, the data to be compressed may continue to be compressed based on the current compression algorithm.
[0102] Step S450: Determine, from the at least two compression algorithms to be selected, a compression algorithm to be selected corresponding to the changed operating parameters as a target compression algorithm.
[0103] In this embodiment, when determining the changed operating parameters of the electronic device, the compression algorithm to be selected corresponding to the changed operating parameters can be determined from at least two compression algorithms to be selected, and the compression algorithm to be selected corresponding to the changed operating parameters can be determined as the target compression algorithm.
[0104] In some embodiments, when determining the changed operating parameters of an electronic device, a compression algorithm to be selected that has a corresponding relationship with the changed operating parameters can be determined as a target compression algorithm based on a mapping relationship including a correspondence between at least two compression algorithms to be selected and at least two operating parameters.
[0105] It can be understood that, when the operating parameters of the electronic device change, this embodiment reselects the target compression algorithm from the at least two compression algorithms to be selected to adapt to the changed operating parameters, thereby improving the data compression effect.
[0106] See also Figure 7 , Figure 7 This application shows Figure 6 The data compression method shown in step S450 is a flow chart. Figure 7 The process shown is described in detail, and the method may specifically include the following steps:
[0107] Step S451: Determine the difference between the changed operating parameter and the current operating parameter. In some embodiments, when the changed operating parameter is determined, the difference between the changed operating parameter and the current operating parameter can be determined. Optionally, the difference between the changed operating parameter and the current operating parameter can be obtained by taking the absolute value after subtracting the current operating parameter from the changed operating parameter; or, the difference between the changed operating parameter and the current operating parameter can be obtained by taking the absolute value after subtracting the changed operating parameter from the current operating parameter.
[0108] For example, if the operating parameters include the device temperature of the electronic device, the difference between the changed device temperature and the current device temperature can be determined; if the operating parameters include the usage rate of the central processing unit of the electronic device, the difference between the changed usage rate of the central processing unit and the current usage rate of the central processing unit can be determined, etc., without limitation here.
[0109] Step S452: If the difference reaches the target difference threshold, then determine the compression algorithm to be selected corresponding to the changed operating parameters from the at least two compression algorithms to be selected as the target compression algorithm.
[0110] In some embodiments, the electronic device may pre-set and store a target difference threshold value, which is used as a basis for determining the difference between the changed operating parameter and the current operating parameter. Therefore, in this embodiment, when the difference between the changed operating parameter and the current operating parameter is obtained, the difference may be compared with the target difference threshold value to determine whether the difference reaches the target difference threshold value.
[0111] Among them, if it is determined that the difference reaches the target difference threshold, it can be determined that the operating parameters of the electronic device have changed, and the compression algorithm to be selected corresponding to the changed operating parameters can be determined from at least two compression algorithms to be selected, and the compression algorithm to be selected corresponding to the changed operating parameters can be determined as the target compression algorithm.
[0112] If it is determined that the difference does not reach the target difference threshold, it can be determined that the operating parameters of the electronic device have not changed, and the data to be compressed continues to be compressed based on the current compression algorithm.
[0113] In some embodiments, the parameter interval to which the current operating parameter belongs can be determined, and the difference threshold corresponding to the parameter interval can be determined from multiple difference thresholds, and the difference threshold corresponding to the parameter interval can be determined as the target difference threshold. It can be understood that when the operating parameters of the electronic device are in different parameter intervals, the perception sensitivity of the user corresponding to the electronic device is different. For example, when the device temperature of the electronic device is in the 20-degree interval, slight temperature changes will cause the user's perception to be different, while when the device temperature of the electronic device is in the 30-degree interval, slight temperature changes will not cause the user's perception to be different. Based on this, different and adapted difference thresholds can be used as target difference thresholds according to the different parameter intervals described by the operating parameters, so as to achieve a balance between data processing effect and device performance effect.
[0114] As an implementable manner, the electronic device may pre-set and store a mapping relationship, and the mapping relationship may include a correspondence between multiple parameter intervals and multiple difference thresholds, wherein the correspondence may include: one parameter interval corresponds to one difference threshold, multiple parameter intervals correspond to one difference threshold, etc., which are not limited here. Based on this, when the parameter interval to which the current operating parameter belongs is obtained, the difference threshold that has a corresponding relationship with the parameter interval to which the current operating parameter belongs can be determined based on the mapping relationship as the target difference threshold.
[0115] Step S460: compressing the data to be compressed based on the target compression algorithm.
[0116] In this embodiment, when a target compression algorithm is determined, the data to be compressed may be compressed based on the target compression algorithm.
[0117] A data compression method provided by an embodiment of the present application determines the data to be compressed and the current operating parameters of the electronic device, and determines the compression algorithm to be selected corresponding to the current operating parameters from at least two compression algorithms to be selected as the current compression algorithm, wherein at least two compression algorithms to be selected each have different corresponding compression parameters, and the compression parameters include a compression ratio and a compression speed that are negatively correlated, and compresses the data to be compressed based on the current compression algorithm. If the current operating parameters of the electronic device change, the operating parameters of the electronic device after the change are determined, and the compression algorithm to be selected corresponding to the changed operating parameters from at least two compression algorithms to be selected is determined as the target compression algorithm, and the data to be compressed is compressed based on the target compression algorithm. Compared to Figure 1 The data compression method shown in this embodiment also re-determines the compression algorithm when the current operating parameters of the electronic device change to adapt to the current operating parameters and improve the data compression effect.
[0118] See also Figure 8 , Figure 8 The flowchart of the data compression method provided by an embodiment of the present application is shown in FIG. Figure 8 The process shown is described in detail, and the data compression method may specifically include the following steps:
[0119] Step S510: determine the data to be compressed, and determine the current operating parameters of the electronic device.
[0120] For the detailed description of step S510, please refer to step S110, which will not be repeated here.
[0121] Step S520: Determine the data type of the data to be compressed.
[0122] In this embodiment, when the data to be compressed is determined, the data type of the data to be compressed can be obtained.
[0123] In some implementations, an application corresponding to the data to be compressed may be obtained, and the data type of the data to be compressed may be determined based on the application corresponding to the data to be compressed.
[0124] In some implementations, a suffix corresponding to the data to be compressed may be detected, and the data type of the data to be compressed may be determined based on the suffix corresponding to the data to be compressed.
[0125] Optionally, the data type of the data to be compressed may include: text type, picture type, video type, file page type, anonymous page type, etc., which are not limited here.
[0126] Step S530: Determine, from the at least two compression algorithms to be selected, a compression algorithm to be selected corresponding to the data type and the current operating parameters as the current compression algorithm, wherein the compression parameters corresponding to the at least two compression algorithms to be selected are different, and the compression parameters include a compression rate and a compression speed that are negatively correlated.
[0127] In this embodiment, when the data type corresponding to the data to be compressed and the current operating parameters of the electronic device are determined, the compression algorithm to be selected corresponding to the data type and the current operating parameters can be determined from at least two compression algorithms to be selected, and the compression algorithm to be selected corresponding to the data type and the current operating parameters can be determined as the current compression algorithm, thereby improving the adaptability of the determined current compression algorithm and improving the data compression effect.
[0128] In some embodiments, the electronic device may pre-set and store a mapping relationship, which may include a correspondence between at least two compression algorithms to be selected, at least two data types, and at least two operating parameters, wherein the correspondence may include: one compression algorithm to be selected corresponds to one operating parameter and one data type, one compression algorithm to be selected corresponds to multiple operating parameters and multiple data types, one compression algorithm to be selected corresponds to multiple operating parameters and one data type, one compression algorithm to be selected corresponds to one operating parameter and multiple data types, etc., which are not limited here. Based on this, when the current operating parameter and the data type corresponding to the data to be compressed are obtained, the compression algorithm to be selected that has a corresponding relationship with the current operating parameter and the data type corresponding to the data to be compressed can be determined as the current compression algorithm based on the mapping relationship.
[0129] For example, if the data type of the data to be compressed is a file page type, the third current compression algorithm may be determined, and if the data type of the data to be compressed is an anonymous page type, the fourth current compression algorithm may be determined. The compression rate corresponding to the third current compression algorithm is higher than the compression rate corresponding to the fourth current compression algorithm, and the compression speed corresponding to the third current compression algorithm is slower than the compression speed corresponding to the fourth current compression algorithm.
[0130] Step S540: compressing the data to be compressed based on the current compression algorithm.
[0131] For the detailed description of step S540, please refer to step S130, which will not be repeated here.
[0132] The data compression method provided by an embodiment of the present application determines the data to be compressed, determines the current operating parameters of the electronic device, determines the data type of the data to be compressed, and determines the compression algorithm to be selected corresponding to the data type and the current operating parameters from at least two compression algorithms to be selected as the current compression algorithm, wherein at least two compression algorithms to be selected have different corresponding compression parameters, and the compression parameters include a compression ratio and a compression speed that are negatively correlated, and compresses the data to be compressed based on the current compression algorithm. Compared to Figure 1 The data compression method shown in the embodiment also determines the data type of the data to be compressed, and selects a compression algorithm according to the data type and current operating parameters, thereby improving the accuracy of the selected compression algorithm.
[0133] See also Fig. 9 , Fig. 9 The data compression device 200 is applied to the above electronic device. Fig. 9The data compression device 200 includes: an information determination module 210, a compression algorithm determination module 220 and a data compression processing module 230, wherein:
[0134] The information determination module 210 is used to determine the data to be compressed and determine the current operating parameters of the electronic device.
[0135] The compression algorithm determination module 220 is used to determine a compression algorithm to be selected corresponding to the current operating parameters from at least two compression algorithms to be selected as the current compression algorithm, wherein the compression parameters corresponding to the at least two compression algorithms to be selected are different, and the compression parameters include a compression ratio and a compression speed that are negatively correlated.
[0136] Furthermore, the compression algorithm determination module 220 includes: a score determination submodule and a first compression algorithm determination submodule, wherein:
[0137] The score determination submodule is used to determine the operation score of the electronic device based on the current operation parameters.
[0138] Furthermore, if there are multiple current operating parameters, the score determination submodule includes: a weight value determination unit and a score determination unit, wherein:
[0139] The weight value determination unit is used to determine the weight values corresponding to each of the multiple current operating parameters.
[0140] Further, the weight value determination unit includes: a device model determination subunit and a weight value determination subunit, wherein:
[0141] The device model determination subunit is used to determine the device model of the electronic device.
[0142] The weight value determination subunit is used to determine the weight values corresponding to each of the multiple current operating parameters based on the device model.
[0143] The score determination unit is used to calculate the multiple current operating parameters and the weight values corresponding to the multiple current operating parameters in a linear weighted manner to obtain the operation score corresponding to the electronic device.
[0144] The first compression algorithm determination submodule is used to determine, from the at least two compression algorithms to be selected, a compression algorithm to be selected corresponding to the running score as the current compression algorithm.
[0145] Further, the data to be compressed is data in the memory of the electronic device, the current operating parameters include a first current operating parameter and a second current operating parameter, and the resource tension corresponding to the first current operating parameter is lower than the resource tension corresponding to the second current operating parameter, and the compression algorithm determination module 220 includes: a second compression algorithm determination submodule and a third compression algorithm determination submodule, wherein:
[0146] The second compression algorithm determination submodule is used to determine, if the current operating parameter is the first current operating parameter, from the at least two compression algorithms to be selected, a compression algorithm to be selected corresponding to the first current operating parameter as the first current compression algorithm.
[0147] A third compression algorithm determination submodule is used to determine, if the current operating parameter is the second current operating parameter, from the at least two compression algorithms to be selected, a compression algorithm to be selected corresponding to the second current operating parameter as the second current compression algorithm, wherein the compression rate corresponding to the first current compression algorithm is higher than the compression rate corresponding to the second current compression algorithm, and the compression speed corresponding to the first current compression algorithm is slower than the compression speed corresponding to the second current compression algorithm.
[0148] Furthermore, the compression algorithm determination module 220 includes: a data type determination submodule and a fourth compression algorithm determination submodule, wherein:
[0149] The data type determination submodule is used to determine the data type of the data to be compressed.
[0150] The fourth compression algorithm determination submodule is used to determine, from the at least two compression algorithms to be selected, a compression algorithm to be selected corresponding to the data type and the current operating parameters as the current compression algorithm.
[0151] Further, the compression algorithm determination module 220 includes: a fifth compression algorithm determination submodule, wherein:
[0152] The fifth compression algorithm determination submodule is used to determine, based on a mapping relationship, from the at least two compression algorithms to be selected, a compression algorithm to be selected corresponding to the current operating parameters as the current compression algorithm, wherein the mapping relationship includes a correspondence between at least two compression algorithms to be selected and at least two operating parameters.
[0153] The data compression processing module 230 is used to compress the data to be compressed based on the current compression algorithm.
[0154] Furthermore, the data compression device 200 further includes: an operation parameter determination module, a target compression algorithm determination module and a compression processing module, wherein:
[0155] The operating parameter determination module is used to determine the changed operating parameters of the electronic device if the current operating parameters of the electronic device change.
[0156] The target compression algorithm determination module is used to determine the compression algorithm to be selected corresponding to the changed operating parameters from the at least two compression algorithms to be selected as the target compression algorithm.
[0157] Furthermore, the target compression algorithm determination module includes: a difference determination submodule and a target compression algorithm determination submodule, wherein:
[0158] The difference determination submodule is used to determine the difference between the changed operating parameter and the current operating parameter.
[0159] The target compression algorithm determination submodule is used to determine, if the difference reaches a target difference threshold, a compression algorithm to be selected corresponding to the changed operating parameters from the at least two compression algorithms to be selected as the target compression algorithm.
[0160] Furthermore, the target compression algorithm determination module further includes: a parameter determination submodule and a target difference threshold determination submodule, wherein:
[0161] The parameter determination submodule is used to determine the parameter interval to which the current operating parameter belongs.
[0162] The target difference threshold determination submodule is used to determine, from a plurality of difference thresholds, a difference threshold corresponding to the parameter interval as the target difference threshold.
[0163] A compression processing module is used to perform compression processing on the data to be compressed based on the target compression algorithm.
[0164] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and modules can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here.
[0165] In several embodiments provided in the present application, the coupling between modules may be electrical, mechanical or other forms of coupling.
[0166] In addition, each functional module in each embodiment of the present application can be integrated into a processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The above integrated modules can be implemented in the form of hardware or software functional modules.
[0167] See also Fig.10, which shows a structural block diagram of an electronic device 100 provided in an embodiment of the present application. The electronic device 100 may be an electronic device capable of running applications, such as a smart phone, a tablet computer, an e-book, etc. The electronic device 100 in the present application may include one or more of the following components: a processor 110, a memory 120, and one or more applications, wherein the one or more applications may be stored in the memory 120 and configured to be executed by one or more processors 110, and the one or more programs are configured to execute the method described in the aforementioned method embodiment.
[0168] Among them, the processor 110 may include one or more processing cores. The processor 110 uses various interfaces and lines to connect various parts of the entire electronic device 100, and executes various functions and processes data of the electronic device 100 by running or executing instructions, programs, code sets or instruction sets stored in the memory 120, and calling data stored in the memory 120. Optionally, the processor 110 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor 110 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing the content to be displayed; and the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 110, but may be implemented separately through a communication chip.
[0169] The memory 120 may include a random access memory (RAM) or a read-only memory (ROM). The memory 120 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 120 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing functions (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the following various method embodiments, etc. The data storage area may also store data (such as a phone book, audio and video data, chat record data) created by the electronic device 100 during use.
[0170] See also Fig.11, which shows a block diagram of a computer-readable storage medium provided in an embodiment of the present application. The computer-readable medium 300 stores program codes, which can be called by a processor to execute the method described in the above method embodiment.
[0171] The computer readable storage medium 300 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read-only memory), an EPROM, a hard disk, or a ROM. Optionally, the computer readable storage medium 300 includes a non-transitory computer-readable storage medium. The computer readable storage medium 300 has storage space for program code 310 that performs any method steps in the above method. These program codes can be read from or written to one or more computer program products. The program code 310 can be compressed, for example, in an appropriate form.
[0172] In summary, the data compression method, device, electronic device and storage medium provided in the embodiments of the present application determine the data to be compressed and the current operating parameters of the electronic device, and determine the compression algorithm to be selected corresponding to the current operating parameters from at least two compression algorithms to be selected as the current compression algorithm, wherein the compression parameters corresponding to the at least two compression algorithms to be selected are different, and the compression parameters include a negatively correlated compression rate and compression speed, and the data to be compressed is compressed based on the current compression algorithm, so that by combining the operating parameters of the electronic device, an adaptive compression algorithm is selected from at least two compression algorithms to be selected, and the data to be compressed is compressed, so as to achieve a balance between compression efficiency and the performance of the electronic device.
[0173] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A data compression method, It is characterized in that Applied to electronic equipment, the method comprises: Determining data to be compressed, and determining current operating parameters of the electronic device; Determine, from at least two compression algorithms to be selected, a compression algorithm to be selected corresponding to the current operating parameter as the current compression algorithm, wherein the compression parameters corresponding to the at least two compression algorithms to be selected are different, and the compression parameters include a compression ratio and a compression speed that are negatively correlated; The data to be compressed is compressed based on the current compression algorithm.
2. The method according to claim 1, It is characterized in that The step of determining, from at least two compression algorithms to be selected, a compression algorithm to be selected corresponding to the current operating parameters as the current compression algorithm comprises: Determining an operation score of the electronic device based on the current operation parameter; From the at least two compression algorithms to be selected, a compression algorithm to be selected corresponding to the running score is determined as the current compression algorithm.
3. The method according to claim 2, It is characterized in that If there are multiple current operating parameters, determining the operating score of the electronic device based on the current operating parameters includes: Determine a weight value corresponding to each of the plurality of current operating parameters; The multiple current operating parameters and the weight values corresponding to the multiple current operating parameters are calculated in a linear weighted manner to obtain the operating score corresponding to the electronic device.
4. The method according to claim 3, It is characterized in that The determining of the weight values corresponding to the plurality of current operating parameters respectively includes: determining a device model of the electronic device; Based on the device model, the weight values corresponding to each of the multiple current operating parameters are determined.
5. The method according to claim 1, It is characterized in that The data to be compressed is data in the memory of the electronic device, the current operating parameters include a first current operating parameter and a second current operating parameter, and the resource tension level corresponding to the first current operating parameter is lower than the resource tension level corresponding to the second current operating parameter, and determining the compression algorithm to be selected corresponding to the current operating parameter from at least two compression algorithms to be selected as the current compression algorithm includes: If the current operating parameter is the first current operating parameter, determining, from the at least two compression algorithms to be selected, a compression algorithm to be selected corresponding to the first current operating parameter as the first current compression algorithm; or If the current operating parameter is the second current operating parameter, then the compression algorithm to be selected corresponding to the second current operating parameter is determined from the at least two compression algorithms to be selected as the second current compression algorithm, wherein the compression rate corresponding to the first current compression algorithm is higher than the compression rate corresponding to the second current compression algorithm, and the compression speed corresponding to the first current compression algorithm is slower than the compression speed corresponding to the second current compression algorithm.
6. The method according to claim 5, It is characterized in that The current operating parameter includes one or a combination of the usage rate of the central processing unit of the electronic device, the device temperature of the electronic device, and the pressure level of the memory of the electronic device.
7. The method according to any one of claims 1 to 6, It is characterized in that After compressing the data to be compressed based on the current compression algorithm, the method further includes: If the current operating parameters of the electronic device change, determining the changed operating parameters of the electronic device; Determining, from the at least two compression algorithms to be selected, a compression algorithm to be selected corresponding to the changed operating parameter as a target compression algorithm; The data to be compressed is compressed based on the target compression algorithm.
8. The method according to claim 7, It is characterized in that The step of determining, from the at least two compression algorithms to be selected, a compression algorithm to be selected corresponding to the changed operating parameters as a target compression algorithm includes: determining a difference between the changed operating parameter and the current operating parameter; If the difference reaches the target difference threshold, then the compression algorithm to be selected corresponding to the changed operating parameter is determined from the at least two compression algorithms to be selected as the target compression algorithm.
9. The method according to claim 8, It is characterized in that The method further comprises: Determining the parameter interval to which the current operating parameter belongs; From a plurality of difference thresholds, a difference threshold corresponding to the parameter interval is determined as the target difference threshold.
10. The method according to any one of claims 1 to 6, It is characterized in that The step of determining, from at least two compression algorithms to be selected, a compression algorithm to be selected corresponding to the current operating parameters as the current compression algorithm comprises: Determining the data type of the data to be compressed; From the at least two compression algorithms to be selected, a compression algorithm to be selected corresponding to the data type and the current operating parameter is determined as the current compression algorithm.
11. The method according to any one of claims 1 to 6, It is characterized in that The step of determining, from at least two compression algorithms to be selected, a compression algorithm to be selected corresponding to the current operating parameters as the current compression algorithm comprises: Based on a mapping relationship, a compression algorithm to be selected corresponding to the current operating parameters is determined from the at least two compression algorithms to be selected as the current compression algorithm, wherein the mapping relationship includes a correspondence between at least two compression algorithms to be selected and at least two operating parameters.
12. A data compression device, It is characterized in that Applied to electronic equipment, the device comprises: An information determination module, used to determine the data to be compressed and to determine the current operating parameters of the electronic device; A compression algorithm determination module, used to determine, from at least two compression algorithms to be selected, a compression algorithm to be selected corresponding to the current operating parameters as a current compression algorithm, wherein the compression parameters corresponding to the at least two compression algorithms to be selected are different, and the compression parameters include a compression ratio and a compression speed that are negatively correlated; The data compression processing module is used to compress the data to be compressed based on the current compression algorithm.
13. An electronic device, It is characterized in that The method comprises a memory and a processor, wherein the memory is coupled to the processor, the memory stores instructions, and when the instructions are executed by the processor, the processor executes the method according to any one of claims 1 to 11.
14. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores program codes, which can be called by a processor to execute the method according to any one of claims 1 to 11.
