Compression method, device and electronic equipment

By using a combination of two compression methods for the installation package of the Android system, the larger files are initially compressed and split in 7z format, and then the sub-files are compressed in zip format, which solves the problem caused by the installation package being too large. Download and transfer issues are eliminated, and the size of the compressed package is significantly reduced.

CN113836101BActive Publication Date: 2024-08-23VIVO MOBILE COMM CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111135807.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-27
Publication Date
2024-08-23
Estimated Expiration
2041-09-27

AI Technical Summary

Technical Problem

Due to the limitations of file compression technology, current application installation packages are getting larger and larger, which increases the user's download burden and network transmission traffic. Especially after the Android system switches to 64-bit applications in the future, the size of the compressed package will further increase, resulting in The problem is even more serious.

Method used

Two compression methods are used: one is to perform preliminary compression on files whose size exceeds the threshold to obtain the first compressed file, and then further compress the files whose size does not exceed the threshold and the first compressed file to generate a target compressed package. Specifically, the 7z format is used to initially compress larger files and split into sub-files, and then the zip format is used to compress these sub-files and small files.

Benefits of technology

Significantly reduce the size of the compressed package, improve user experience, and avoid the problem of too large compressed packages in the existing technology. For example, the APK size directly compressed by zip is reduced from 105M to 71M.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113836101B
    Figure CN113836101B
Patent Text Reader

Abstract

The present application discloses a compression method, device and electronic device, belonging to the field of data processing technology. The method comprises: compressing a first file whose size exceeds a threshold value according to a first compression method to obtain a first compressed file; compressing a second file whose size does not exceed the threshold value and the first compressed file according to a second compression method to obtain a target compressed package.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of data processing technology, and specifically relates to a compression method, device and electronic equipment. Background Art

[0002] The functions of most current applications are becoming more and more complex, resulting in larger installation packages. The larger installation packages will reduce users' desire to download the installation packages, increase network transmission traffic, and increase download failure rates.

[0003] The production of installation packages (such as APK, etc.) relies on file compression technology. When the compressed package is large, the installation package is also necessarily large.

[0004] In the future, the Android system will only use 64-bit applications, and the size of the compressed package will further increase by 30% to 50%. The problems caused by the larger compressed package will become more serious. Summary of the invention

[0005] The purpose of the embodiments of the present application is to provide a compression method, device and electronic device that can solve the problem of large compressed packages.

[0006] In a first aspect, an embodiment of the present application provides a compression method, the method comprising:

[0007] Compressing a first file whose size exceeds a threshold value according to a first compression method to obtain a first compressed file;

[0008] The second file whose size does not exceed the threshold and the first compressed file are compressed according to the second compression method to obtain a target compressed package.

[0009] In a second aspect, an embodiment of the present application provides a decompression method, the method comprising:

[0010] Decompressing the target compressed package according to the second decompression method to obtain a second file whose size before compression does not exceed the threshold, and the first compressed file;

[0011] The first compressed file is decompressed according to a first decompression method to obtain a first file whose size before compression exceeds a threshold.

[0012] In a third aspect, an embodiment of the present application provides a compression device, the device comprising:

[0013] A first compression module, used for compressing a first file whose size exceeds a threshold according to a first compression method to obtain a first compressed file;

[0014] The second compression module is used to compress the second file whose size does not exceed the threshold and the first compressed file according to a second compression method to obtain a target compressed package.

[0015] In a fourth aspect, an embodiment of the present application provides a decompression device, the device comprising:

[0016] A second decompression module, used for decompressing the target compressed package according to a second decompression method to obtain a second file whose size before compression does not exceed a threshold, and the first compressed file;

[0017] The first decompression module is used to decompress the first compressed file according to a first decompression method to obtain a first file whose size before compression exceeds a threshold.

[0018] In a fifth aspect, an embodiment of the present application provides an electronic device, which includes a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the method described in the first aspect or the second aspect.

[0019] In a sixth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the steps of the method described in the first aspect or the second aspect are implemented.

[0020] In the seventh aspect, an embodiment of the present application provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the method described in the first aspect or the second aspect.

[0021] The compression method, device and electronic device provided in the embodiments of the present application reduce the file size by compressing a larger file through a first compression method, and then compressing a smaller file and the first compressed file through a second compression method to obtain a compressed package. Compared with the technical solution in the prior art of directly compressing files to generate compressed packages, the size of the compressed package can be significantly reduced, thereby improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1 It is a flowchart of the compression method provided in the embodiment of the present application;

[0023] Figure 2 It is a flowchart of the decompression method provided in the embodiment of the present application;

[0024] Figure 3 is a schematic diagram of the structure of a compression device provided in an embodiment of the present application;

[0025] Figure 4 is a schematic diagram of the structure of a decompression device provided in an embodiment of the present application;

[0026] Figure 5is a schematic structural diagram of an electronic device according to an embodiment of the present application;

[0027] Figure 6 It is a schematic diagram of the hardware structure of an electronic device implementing an embodiment of the present application. DETAILED DESCRIPTION

[0028] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.

[0029] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.

[0030] The compression method, device and electronic device provided in the embodiments of the present application are described in detail below with reference to the accompanying drawings through specific embodiments and their application scenarios.

[0031] Figure 1 Schematic diagram of the compression method provided in the embodiment of the present application. Figure 1 , the present application embodiment provides a compression method, which may include:

[0032] Step 110: compress the first file whose size exceeds a threshold according to a first compression method to obtain a first compressed file;

[0033] Step 120: compress the second file whose size does not exceed the threshold and the first compressed file according to the second compression method to obtain a target compressed package.

[0034] It should be noted that the execution subject of the compression method provided in the embodiment of the present application can be an electronic device, a component in an electronic device, an integrated circuit, or a chip. The electronic device can be a mobile electronic device or a non-mobile electronic device. For example, the mobile electronic device can be a mobile phone, a tablet computer, a laptop computer, a palmtop computer, an in-vehicle electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook or a personal digital assistant (PDA), etc., and the non-mobile electronic device can be a server, a network attached storage (NAS), a personal computer (PC), a television (TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.

[0035] First, it can be determined whether there is a first file whose size exceeds a threshold value among the files to be compressed. The threshold value can be, for example, 10M, 20M, etc., and its specific size can be adjusted according to actual conditions, which is not specifically limited in the embodiment of the present application.

[0036] The size of the files to be compressed can be judged one by one to determine whether the size of each file to be compressed exceeds the threshold. For example, assuming that the threshold is 10M, and the size of the file A to be compressed is 11M, it can be determined that the file A to be compressed is the first file. At this time, the file A to be compressed can be put into the first file set in the form of a key-value pair (key=O1, value=S1). If the size of the file B to be compressed is 7M, it can be determined that the file B to be compressed is the second file. At this time, the file B to be compressed can be put into the second file set in the form of a key-value pair (key=U1, value=V1).

[0037] The key in the key-value pair is the file number, and the value is the file size.

[0038] By determining the size of the files to be compressed one by one, the first file set F{(key=O1, value=S1),(key=O2, value=S2),...,(key=O n ,value=S n )}, where n is the number of first files; and the second file set S{(key=U1,value=V1),(key=U2,value=V2),……,(key=U m ,value=V m )}, where m is the number of second files.

[0039] After the first file set F and the second file set S are determined, each first file in the first file set F may be compressed according to a first compression method in step 110 to obtain each first compressed file.

[0040] It should be noted that the first compression method can be a compression method in 7z (7-zip) format. The compression method in 7z format has the advantage of high compression efficiency. For example, for a file to be compressed with a size of 179M, after compression in zip format, the size of the zip compressed package is 96M; while after compression in 7z format, the size of the 7z compressed package is only 64.2M. It can be seen that the compression efficiency of 7z format can be improved by more than 30% compared with that of zip format.

[0041] In step 120, each second file in the second file set S and each first compressed file obtained in step 110 may be compressed according to a second compression method, thereby obtaining a target compressed package.

[0042] Among them, the target compressed package can be used to make an APK installation package, and the second compression method can be a compression method in zip format.

[0043] It should be noted that the Android system uses the zip format compression method to generate the APK installation package by default. Therefore, after the second file and the 7z compression package (the first compressed file) are compressed using the zip format compression method, the APK installation package can still be generated normally, and the function of the APK installation package will not be affected in any way.

[0044] The compression method provided in the embodiment of the present application reduces the file size by compressing a larger file through a first compression method, and then compresses the smaller file and the first compressed file through a second compression method to obtain a compressed package. Compared with the technical solution in the prior art of directly compressing files to generate compressed packages, the size of the compressed package can be significantly reduced, thereby improving the user experience.

[0045] In one embodiment, compressing the first file whose size exceeds the threshold according to the first compression mode may include:

[0046] Splitting the first file into multiple sub-files according to the size of the first file and a threshold;

[0047] Each sub-file is compressed separately according to the first compression method.

[0048] For the first file O [i] According to S [i] The specific size and threshold T of O [i] Split into multiple sub-files [i][1] =S[i][1] , O [i][2] =S [i][2] , ... O [i][j] =S [i][j] Then, according to the first compression method, O [i][1] , O [i][2] , ... O [i][j] Compress and get O' [i][1] =S' [i][1] , O' [i][2] =S' [i][2] , ... O' [i][j] =S' [i][j] .

[0049] Where i = 1, 2, ..., n; j is determined by S [i] Confirm with T; O [i][j] O [i] Sub-file of O' [i][j] O after the first compression [i][j] .

[0050] The compression method provided in the embodiment of the present application can further reduce the size of the file to be compressed by splitting the first file into multiple sub-files and then compressing each sub-file separately according to the first compression method, thereby improving the compression efficiency of the compressed package.

[0051] In one embodiment, splitting the first file into multiple sub-files according to the size of the first file and a threshold value may include:

[0052] The quotient of the size of the first file and the threshold is rounded up to obtain the target number;

[0053] Split the first file into the target number of sub-files.

[0054] It is understandable that if S [i] / T=R, then when R is an integer, the target number j=R; when R is a decimal, j is R rounded up.

[0055] For example, when S [i] When 30M and T is 10M, R = 30 / 10 = 3, then j = 3. Therefore, O [i] Split into multiple sub-files [i][1] =S [i][1] , O [i][2] =S [i][2] , O [i][3] =S [i][3] , and then according to the first compression method, O [i][1] , O [i][2] , O [i][3] Compress and get O' [i][1] =S'[i][1] , O' [i][2] =S' [i][2] , O' [i][3] =S' [i][3] .

[0056] When S [i] When 32M and T is 10M, R = 32 / 10 = 3.2, then j = 4. Therefore, O [i] Split into multiple sub-files [i][1] =S [i][1] , O [i][2] =S [i][2] , O [i][3] =S [i][3] , O [i][4] =S [i][4] , and then according to the first compression method, O [i][1] , O [i][2] , O [i][3] , O [i][4] Compress and get O' [i][1] =S' [i][1] , O' [i][2] =S' [i][2] , O' [i][3] =S' [i][3] , O' [i][4] =S' [i][4] .

[0057] The compression method provided in the embodiment of the present application determines how many sub-files the first file is split into for the first compression by rounding up the quotient of the size of the first file and a threshold value, and can accurately and quickly determine the specific implementation method of the first compression, thereby improving the efficiency of obtaining the compressed package.

[0058] In one embodiment, splitting the first file into a target number of sub-files includes any of the following:

[0059] Split the first file into j sub-files of equal size;

[0060] The first file is split into j sub-files, wherein the size of at least j-1 sub-files is equal to the threshold.

[0061] According to the size S of the first file [i] After the target number j is determined by the threshold T, the first file O can be sent to the server in any of the following ways: [i] Split into j sub-files O [i][1] , O [i][2] , ... O [i][j] :

[0062] Method 1: Copy the first file O [i] Split into j equal-sized sub-files O[i][1] , O [i][2] , ... O [i][j] .

[0063] For example, when S [i] =32M, j=4, O [i] Split into O [i][1] , O [i][2] , O [i][3] and O [i][4] , and S [i][1] =S [i][2] =S [i][3] =S [i][4] =8M.

[0064] Method 2: Copy the first file O [i] Split into j sub-files O [i][1] , O [i][2] , ... O [i][j] , and the size of at least j-1 sub-files is equal to the threshold.

[0065] For example, when S [i] =32M, j=4, O [i] Split into O [i][1] , O [i][2] , O [i][3] and O [i][4] , and S [i][1] =S [i][2] =S [i][3] =30M,S [i][4] =2M.

[0066] When S [i] =40M, j=4, O [i] Split into O [i][1] , O [i][2] , O [i][3] and O [i][4] , and S [i][1] =S [i][2] =S [i][3] =S [i][4] =10M.

[0067] The compression method provided in the embodiment of the present application splits the first file into a number of sub-files for first compression in a variety of ways, which can meet the compression requirements in various scenarios, thereby ensuring the compression efficiency of the compressed package.

[0068] In an actual application example, the size of the APK directly compressed and packaged using zip is 105M.

[0069] After the same file is packaged using the compression method provided in the embodiment of the present application, the resulting APK size is only 71M.

[0070] The threshold is set to 5M, that is, files larger than 5M are split and compressed in 7z format. This way, a 50M so file can be split into 10 5M files and compressed in 7z format. Finally, the 50M so file is compressed to about 16M, reducing 34M.

[0071] It can be seen that the compression method provided in the embodiment of the present application can significantly reduce the size of the compressed package, effectively avoiding various problems caused by the large compressed package in the prior art.

[0072] Figure 2 Schematic diagram of the decompression method provided in the embodiment of the present application. Figure 2 Based on the above compression method embodiment, the present application embodiment further provides a decompression method, which may include:

[0073] Step 210: decompress the target compressed package according to the second decompression method to obtain a second file whose size before compression does not exceed the threshold, and the first compressed file;

[0074] Step 220: Decompress the first compressed file according to the first decompression method to obtain a first file whose size before compression exceeds a threshold.

[0075] It should be noted that the execution subject of the decompression method provided in the embodiment of the present application can be an electronic device, a component in an electronic device, an integrated circuit, or a chip. The electronic device can be a mobile electronic device or a non-mobile electronic device. Exemplarily, the mobile electronic device can be a mobile phone, a tablet computer, a laptop computer, a palmtop computer, an in-vehicle electronic device, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant, PDA), etc., and the non-mobile electronic device can be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.

[0076] It should be noted that when decompressing the target compressed package compressed by the above compression method, the target compressed package can be first decompressed using the second decompression method to obtain a second file whose size before compression does not exceed the threshold, and the first compressed file.

[0077] The second decompression method may be a zip decompression method.

[0078] After the second file and the first compressed file are determined in step 210, the first compressed file may be decompressed according to the first decompression method in step 220 to obtain a first file whose size before compression exceeds the threshold. [i] .

[0079] The first decompression method may be a 7z format decompression method.

[0080] The decompression method provided in the embodiment of the present application can smoothly decompress a target compressed package whose file size is significantly smaller than that of an existing compressed package, by obtaining a second file whose size before compression does not exceed a threshold value and a first compressed file according to a second decompression method, and then decompressing the first compressed file according to the first decompression method to obtain a first file whose size before compression exceeds a threshold value. This effectively avoids various problems caused by the large compressed package in the prior art.

[0081] In one embodiment, decompressing the first compressed file according to the first decompression mode to obtain the first file whose size before compression exceeds the threshold may include:

[0082] Decompressing the first compressed file according to the first decompression method to obtain each sub-file of the first file;

[0083] Concatenate each sub-file into the first file.

[0084] The first compressed file (7z compressed package) can be first decompressed by 7z format decompression to obtain each compressed sub-file O' [i][1] =S' [i][1] , O' [i][2] =S' [i][2] ,……,O' [i][j] =S' [i][j] Then enable K decompression threads to perform decompression on O' [i][1] =S' [i][1] , O' [i][2] =S' [i][2] ,……,O' [i][j] =S' [i][j] - Decompress to get each sub-file O [i][1] =S [i][1] , O [i][2] =S [i][2] ,……,O [i][j] =S [i][j] .

[0085] Where K is the number of compressed sub-files.

[0086] After that, a new target empty file can be created, and K decompression threads can be used to decompress each sub-file O in the target empty file at the same time. [i][1] =S [i][1] , O [i][2] =S [i][2] ,……,O [i][j] =S [i][j] Copy and splice in the order before compression to form the first file O [i] =S [i] .

[0087] The size of the target empty file is not less than that of each first file. [i] The sum of the sizes of .

[0088] The decompression method provided in the embodiment of the present application can completely restore the first file before compression by decompressing the first compressed file according to the first decompression method to obtain sub-files of the first file, and then splicing the sub-files into the first file, thereby ensuring that the function of the target compressed package will not be affected.

[0089] It should be noted that the compression method provided in the embodiment of the present application can be executed by a compression device or a control module in the compression device for executing the compression method. In the embodiment of the present application, the compression device provided in the embodiment of the present application is described by taking the compression device executing the compression method as an example.

[0090] Figure 3 Schematic diagram of the structure of the compression device provided in the embodiment of the present application. Figure 3 , the compression device provided in the embodiment of the present application may include:

[0091] A first compression module 310, configured to compress a first file whose size exceeds a threshold value according to a first compression method to obtain a first compressed file;

[0092] The second compression module 320 is used to compress the second file whose size does not exceed the threshold and the first compressed file according to a second compression method to obtain a target compressed package.

[0093] The compression device provided in the embodiment of the present application compresses a larger file by a first compression method to reduce the file size, and then compresses the smaller file and the first compressed file by a second compression method to obtain a compressed package. Compared with the technical solution in the prior art that directly compresses the file to generate a compressed package, the size of the compressed package can be significantly reduced, thereby improving the user experience.

[0094] In one embodiment, the first compression module 310 is specifically used for:

[0095] Splitting the first file into a plurality of sub-files according to the size of the first file and the threshold;

[0096] Each sub-file is compressed separately according to the first compression method.

[0097] In one embodiment, the first compression module 310 is specifically used for:

[0098] Rounding up the quotient of the size of the first file and the threshold to obtain a target number;

[0099] The first file is split into the target number of sub-files.

[0100] In one embodiment, the first compression module 310 is specifically configured to perform any of the following:

[0101] Splitting the first file into j sub-files of equal size;

[0102] Splitting the first file into j sub-files, wherein the size of at least j-1 sub-files is equal to the threshold;

[0103] Wherein, j is the target number.

[0104] In one embodiment, the first compression method is a 7z format compression method, and the second compression method is a zip format compression method.

[0105] The packaging compression device in the embodiment of the present application can be a device, or a component, integrated circuit, or chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. For example, the mobile electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), etc. The non-mobile electronic device can be a server, a network attached storage (NAS), a personal computer (PC), a television (TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.

[0106] The packaging and compression device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.

[0107] The packaging and compression device provided in the embodiment of the present application can achieve Figure 1 To avoid repetition, the various processes implemented by the method embodiment are not described here.

[0108] It should be noted that the decompression method provided in the embodiment of the present application can be executed by a decompression device or a control module in the decompression device for executing the decompression method. In the embodiment of the present application, the decompression device provided in the embodiment of the present application is described by taking the decompression method executed by the decompression device as an example.

[0109] Figure 4 Schematic diagram of the structure of the decompression device provided in the embodiment of the present application. Figure 4 , the decompression device provided in the embodiment of the present application may include:

[0110] The second decompression module 410 is used to decompress the target compressed package according to the second decompression method to obtain a second file whose size before compression does not exceed the threshold, and the first compressed file;

[0111] The first decompression module 420 is configured to decompress the first compressed file according to a first decompression method to obtain a first file whose size before compression exceeds a threshold.

[0112] The decompression device provided in the embodiment of the present application can smoothly decompress a target compressed package whose file size is significantly smaller than that of an existing compressed package by obtaining a second file whose size before compression does not exceed a threshold value and a first compressed file according to a second decompression method, and then decompressing the first compressed file according to the first decompression method to obtain a first file whose size before compression exceeds the threshold value, thereby effectively avoiding various problems caused by the large compressed package in the prior art.

[0113] In one embodiment, the first decompression module 420 is specifically used for:

[0114] Decompressing the first compressed file according to the first decompression method to obtain each sub-file of the first file;

[0115] The sub-files are concatenated into the first file.

[0116] The decompression device in the embodiment of the present application can be a device, or a component, integrated circuit, or chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. Exemplarily, the mobile electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), etc. The non-mobile electronic device can be a server, a network attached storage (NAS), a personal computer (PC), a television (TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.

[0117] The decompression device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.

[0118] The decompression device provided in the embodiment of the present application can achieve Figure 2 To avoid repetition, the various processes implemented by the method embodiment are not described here.

[0119] Alternatively, if Figure 5 As shown, an embodiment of the present application also provides an electronic device 500, including a processor 501, a memory 502, and a program or instruction stored in the memory 502 and executable on the processor 501. When the program or instruction is executed by the processor 501, each process of the above-mentioned compression method embodiment or the above-mentioned decompression method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

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

[0121] Figure 6 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of the present application.

[0122] The electronic device 600 includes but is not limited to: a radio frequency unit 601, a network module 602, an audio output unit 603, an input unit 604, a sensor 605, a display unit 606, a user input unit 607, an interface unit 608, a memory 609, and a processor 610.

[0123] Those skilled in the art will appreciate that the electronic device 600 may also include a power source (such as a battery) for supplying power to each component, and the power source may be logically connected to the processor 610 through a power management system, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management system. Figure 6 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be described in detail here.

[0124] The processor 610 is configured to compress the first file whose size exceeds the threshold according to the first compression method to obtain a first compressed file;

[0125] The second file whose size does not exceed the threshold and the first compressed file are compressed according to the second compression method to obtain a target compressed package.

[0126] The electronic device 600 provided in the embodiment of the present application compresses a larger file by a first compression method to reduce the file size, and then compresses the smaller file and the first compressed file by a second compression method to obtain a compressed package. Compared with the technical solution in the prior art of directly compressing files to generate compressed packages, the size of the compressed package can be significantly reduced, thereby improving the user experience.

[0127] Optionally, the processor 610 is further configured to:

[0128] Splitting the first file into a plurality of sub-files according to the size of the first file and the threshold;

[0129] Each sub-file is compressed separately according to the first compression method.

[0130] Optionally, the processor 610 is further configured to:

[0131] Rounding up the quotient of the size of the first file and the threshold to obtain a target number;

[0132] The first file is split into the target number of sub-files.

[0133] Optionally, the processor 610 is further configured to perform any of the following:

[0134] Splitting the first file into j sub-files of equal size;

[0135] Splitting the first file into j sub-files, wherein the size of at least j-1 sub-files is equal to the threshold;

[0136] Wherein, j is the target number.

[0137] Optionally, the first compression method is a 7z format compression method, and the second compression method is a zip format compression method.

[0138] Optionally, the processor 610 is further configured to:

[0139] Decompressing the target compressed package according to the second decompression method to obtain a second file whose size before compression does not exceed the threshold, and the first compressed file;

[0140] The first compressed file is decompressed according to a first decompression method to obtain a first file whose size before compression exceeds a threshold.

[0141] Optionally, the processor 610 is further configured to:

[0142] Decompressing the first compressed file according to a first decompression method to obtain each sub-file of the first file;

[0143] The sub-files are concatenated into the first file.

[0144] It should be understood that in the embodiment of the present application, the input unit 604 may include a graphics processor (GPU) 6041 and a microphone 6042, and the graphics processor 6041 processes the image data of the static picture or video obtained by the image capture device (such as a camera) in the video capture mode or the image capture mode. The display unit 606 may include a display panel 6061, and the display panel 6061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 607 includes a touch panel 6071 and other input devices 6072. The touch panel 6071 is also called a touch screen. The touch panel 6071 may include two parts: a touch detection device and a touch controller. Other input devices 6072 may include but are not limited to a physical keyboard, a function key (such as a volume control button, a switch button, etc.), a trackball, a mouse, and a joystick, which will not be repeated here. The memory 609 can be used to store software programs and various data, including but not limited to applications and operating systems. The processor 610 can integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, the user interface, and the application program, and the modem processor mainly processes wireless communication. It is understandable that the above-mentioned modem processor may not be integrated into the processor 610.

[0145] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, each process of the above-mentioned compression method embodiment or the above-mentioned decompression method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

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

[0147] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned compression method embodiment or the above-mentioned decompression method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0148] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.

[0149] It should be noted that, in this article, the term "comprises", "includes" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "including one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the method and device in the embodiment of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.

[0150] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0151] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.

Claims

1. A compression method, It is characterized in that include: Compressing a first file whose size exceeds a threshold value according to a first compression method to obtain a first compressed file; Compressing the second file whose size does not exceed the threshold and the first compressed file according to a second compression method to obtain a target compressed package; The first compression method and the second compression method are different compression methods.

2. The compression method according to claim 1, It is characterized in that The step of compressing the first file whose size exceeds the threshold according to the first compression method includes: Splitting the first file into a plurality of sub-files according to the size of the first file and the threshold; Each sub-file is compressed separately according to the first compression method.

3. The compression method according to claim 2, It is characterized in that The step of splitting the first file into a plurality of sub-files according to the size of the first file and the threshold comprises: Rounding up the quotient of the size of the first file and the threshold to obtain a target number; The first file is split into the target number of sub-files.

4. The compression method according to claim 3, It is characterized in that The step of splitting the first file into the target number of sub-files includes any of the following: Splitting the first file into j sub-files of equal size; Splitting the first file into j sub-files, wherein the size of at least j-1 sub-files is equal to the threshold; Wherein, j is the target number.

5. The compression method according to any one of claims 1 to 4, It is characterized in that The first compression method is a 7z format compression method, and the second compression method is a zip format compression method.

6. A decompression method, It is characterized in that include: Decompressing the target compressed package according to the second decompression method to obtain a second file whose size before compression does not exceed the threshold, and the first compressed file; Decompressing the first compressed file according to a first decompression method to obtain a first file whose size before compression exceeds a threshold; The first decompression method and the second decompression method are different decompression methods.

7. The decompression method according to claim 6, It is characterized in that The decompressing the first compressed file according to the first decompression mode to obtain the first file whose size before compression exceeds the threshold includes: Decompressing the first compressed file according to a first decompression method to obtain each sub-file of the first file; The sub-files are concatenated into the first file.

8. A compression device, It is characterized in that include: A first compression module, used for compressing a first file whose size exceeds a threshold according to a first compression method to obtain a first compressed file; A second compression module, used for compressing a second file whose size does not exceed the threshold and the first compressed file according to a second compression method to obtain a target compressed package; The first compression method and the second compression method are different compression methods.

9. A decompression device, It is characterized in that include: A second decompression module, used for decompressing the target compressed package according to a second decompression method to obtain a second file whose size before compression does not exceed a threshold, and the first compressed file; A first decompression module, configured to decompress the first compressed file according to a first decompression method to obtain a first file whose size before compression exceeds a threshold; The first decompression method and the second decompression method are different decompression methods.

10. An electronic device, It is characterized in that It includes a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the compression method as described in any one of claims 1 to 5, or implements the steps of the compression method as described in claim 6 or 7.

11. A readable storage medium, It is characterized in that The readable storage medium stores a program or instruction, and when the program or instruction is executed by the processor, the steps of the compression method according to any one of claims 1 to 5 are implemented, or the steps of the compression method according to claim 6 or 7 are implemented.