CN102761540B - Data compression method, device and system and server - Google Patents
Data compression method, device and system and server Download PDFInfo
- Publication number
- CN102761540B CN102761540B CN201210175371.4A CN201210175371A CN102761540B CN 102761540 B CN102761540 B CN 102761540B CN 201210175371 A CN201210175371 A CN 201210175371A CN 102761540 B CN102761540 B CN 102761540B
- Authority
- CN
- China
- Prior art keywords
- compression
- mode
- compress mode
- compress
- file type
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 35
- 238000013144 data compression Methods 0.000 title claims abstract description 31
- 238000007906 compression Methods 0.000 claims abstract description 329
- 230000006835 compression Effects 0.000 claims abstract description 329
- 230000001360 synchronised effect Effects 0.000 claims description 14
- 239000002699 waste material Substances 0.000 description 8
- 230000013011 mating Effects 0.000 description 4
- 241001269238 Data Species 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000006837 decompression Effects 0.000 description 1
- 238000005457 optimization Methods 0.000 description 1
Landscapes
- Information Transfer Between Computers (AREA)
- Compression, Expansion, Code Conversion, And Decoders (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention discloses a data compression method, device and system and a server. The data compression method comprises a calling module, an acquisition module and a compression module, wherein the calling module is used for calling a pre-stored compression mode configuration table including the corresponding relationship between file types and compression modes; the acquisition module is used for acquiring the file types of data and determining whether the compression modes corresponding to the file types exist or not according to the compression mode configuration table, and if yes, acquiring the compression modes corresponding to the file types; and the compression module is used for compressing data to be compressed according to the compression modes acquired by the acquisition module. By virtue of the technical scheme provided by the invention, suitable compression modes can be automatically configured for users, and the compression speed is increased under the condition that the compression ratio is almost not lost, so that both the compression time and the system resource are saved.
Description
Technical field
The present invention relates to field of computer technology, particularly relate to a kind of data compression method, device, system and server.
Background technology
In the prior art, tool of compression changes file content and data by certain compression algorithm, makes data take less memory space.Particularly, ordinary file generally all comprises certain repeating data, the data of these repetitions often occupy the memory space of many times, tool of compression needs these repeating datas in locating file, by suitable algorithm, data are rebuild, allow a plurality of repeating datas only take a memory space, when decompressing, by corresponding decompression algorithm, the file after compression is reduced, this compression algorithm generally belongs to Lossless Compression again.For example, in text, comprise a plurality of identical words " People's Republic of China (PRC) ", after compressing by tool of compression, only need take a memory space and store, thereby reach the object of dwindling file.
In addition, tool of compression not only can help user to save space, also a plurality of files can be broken into a compressed package, to facilitate user ID, transmit and to share simultaneously.At present, in prior art, there is many moneys tool of compression, for example: winzip tool of compression, winrar tool of compression, 7-zip tool of compression etc.; The compression algorithm corresponding with tool of compression also has multiple, such as: rar form, zip form, 7z form, cab form etc.
Above-mentioned each tool of compression and compression algorithm have features.For example: the advantage of zip form is to use extensively, and compression speed is fast, but compression ratio is less; Rar form is conventionally high than the compression ratio of zip form, but compression speed is slower, and winrar tool of compression, for compressing special optimization algorithm by executive program on text, sound and image 32 Wei He64Wei Intel (Intel) microprocessor, has further improved compression ratio; 7z form is conventionally all high than zip form and rar format compression rate, and compression time is also all long than zip form and rar form simultaneously.
In the prior art, the data of some file format are to have carried out overcompression, for example, the video file of rmvb form, Fig. 1 is used compressed software to carry out the schematic diagram of parameter configuration in prior art, when user uses tool of compression to carry out compressing file, the All Files that tool of compression need to be selected user all compresses.But the file format that the file format of having compressed for some or redundant information are fewer, after compressing, cannot reduce file volume substantially by tool of compression, or the file volume reducing is very limited.If the data for this class file format are compressed, not only do not reach the object of compressed file, also can waste a lot of compression times, and, when these file formats of compression, also waste the system resources such as more CPU, internal memory, but do not reached good compression effectiveness.
Summary of the invention
The invention provides a kind of data compression method, device, system and server, to solve the compression time that in prior art, the file format of having compressed or redundant information is fewer compressed again and caused and the problem of system resource waste.
The invention provides a kind of data compression method, comprising: call pre-stored compress mode allocation list, wherein, compress mode allocation list comprises: the corresponding relation between file type and compress mode; Obtain the file type of data, according to compress mode allocation list, determine whether to exist the compress mode corresponding with file type, if existed, obtain the compress mode corresponding with file type; According to the compress mode of obtaining, treating packed data compresses.
Preferably, said method also comprises: the information in compress mode allocation list and server sync, server is added up the mean pressure shrinkage of each file type, according to mean pressure shrinkage, file type in compress mode allocation list and the corresponding relation between compress mode is set.
Preferably, above-mentioned compress mode allocation list specifically comprises: file type, compression algorithm, statistics complete the one-to-one relationship between identifier, mean pressure shrinkage and compress mode;
Preferably, above-mentioned data to be compressed comprise one or more files.
Preferably, above-mentioned compress mode comprises: standard compression mode, Fast Compression mode and store compressed mode, wherein, standard compression mode adopts the compression algorithm of acquiescence to compress file, Fast Compression mode adopts the shortest compression algorithm of compression time to compress file, and store compressed mode adopts directly file is stored in to the mode in compressed package.
Preferably, said method also comprises: in the situation that not there is not the compress mode corresponding with file type, adopting standard compression mode to treat packed data compresses, and current compression parameters information is sent to server, wherein, compression parameters information comprises: file type, compression algorithm, file size, quantity of documents and compression ratio.
Preferably, described server is added up the mean pressure shrinkage of each file type, the file type and the corresponding relation between compress mode that according to mean pressure shrinkage, arrange in described compress mode allocation list are concrete: server is stored the compression parameters information receiving, in the situation that the quantity of the compression parameters information of same file type reaches predetermined threshold, compression parameters information is added up, calculating is under different compression algorithms, the mean pressure shrinkage of this document type, and determine corresponding compress mode according to mean pressure shrinkage; Server is stored in different compression algorithms, corresponding mean pressure shrinkage and corresponding compress mode in position corresponding with file type in compress mode allocation list; Server is synchronized to compress mode allocation list in subscriber computer.
Preferably, according to compress mode allocation list, determine whether to exist the compress mode corresponding with file type also to comprise: according to compress mode allocation list, to obtain the statistics corresponding with file type and complete identifier, in statistics, complete identifier and represent in completed situation, determine the existence compress mode corresponding with file type in compress mode allocation list.
Preferably, said method also comprises: in statistics, complete identifier and represent in uncompleted situation, adopting standard compression mode to treat packed data compresses, and current compression parameters information is sent to server, wherein, compression parameters information comprises: file type, compression algorithm, file size, quantity of documents and compression ratio.
Preferably, described server is added up the mean pressure shrinkage of each file type, according to mean pressure shrinkage, file type in described compress mode allocation list is set and the corresponding relation between compress mode specifically comprises: server is stored the compression parameters information receiving, in the situation that the quantity of the compression parameters information of same file type reaches predetermined threshold, compression parameters information is added up, calculating is under different compression algorithms, the mean pressure shrinkage of this document type, and determine corresponding compress mode according to mean pressure shrinkage; Server is stored in different compression algorithms, corresponding mean pressure shrinkage and corresponding compress mode in position corresponding with file type in compress mode allocation list, and in compress mode allocation list, the statistics corresponding with this document type completes identifier and be set to complete; Server is synchronized to compress mode allocation list in subscriber computer.
Preferably, according to mean pressure shrinkage, determine that corresponding compress mode specifically comprises: in mean pressure shrinkage, be more than or equal to 95% and be less than or equal to 100% in the situation that, determine that compress mode is store compressed mode; In mean pressure shrinkage, be more than or equal to 90% and be less than 95% in the situation that, determine that compress mode is Fast Compression mode; In the situation that mean pressure shrinkage is less than 90%, determine that compress mode is standard compression mode, certainly, be not limited to above-mentioned lifted numerical value, those skilled in the art can also adopt other mean pressure shrinkage numerical value according to specific needs, determine corresponding compress mode.
The present invention also provides a kind of data compression device, comprising: calling module, and for calling pre-stored compress mode allocation list, wherein, compress mode allocation list comprises: the corresponding relation between file type and compress mode; Acquisition module, for obtaining the file type of data, determines whether to exist the compress mode corresponding with file type according to compress mode allocation list, if existed, obtains the compress mode corresponding with file type; Compression module, treats packed data for the compress mode of obtaining according to acquisition module and compresses.
Preferably, above-mentioned compress mode allocation list specifically comprises: file type, compression algorithm, statistics complete the one-to-one relationship between identifier, mean pressure shrinkage and compress mode;
Preferably, above-mentioned data to be compressed comprise one or more files;
Preferably, above-mentioned compress mode comprises: standard compression mode, Fast Compression mode and store compressed mode, wherein, standard compression mode adopts the compression algorithm of acquiescence to compress file, Fast Compression mode adopts the shortest compression algorithm of compression time to compress file, and store compressed mode adopts directly file is stored in to the mode in compressed package.
Preferably, above-mentioned compression module also for: in the situation that not there is not the compress mode corresponding with file type, adopting standard compression mode to treat packed data compresses, and current compression parameters information is sent to server, wherein, compression parameters information comprises: file type, compression algorithm, file size, quantity of documents and compression ratio.
Preferably, above-mentioned acquisition module also for: according to compress mode allocation list, obtain the statistics corresponding with file type and complete identifier, in statistics, complete identifier and represent in completed situation, determine in compress mode configuration and have the compress mode corresponding with file type; Compression module also for: in statistics, complete identifier and represent in uncompleted situation, adopting standard compression mode to treat packed data compresses, and current compression parameters information is sent to server, wherein, compression parameters information comprises: file type, compression algorithm, file size, quantity of documents and compression ratio.
The present invention also provides a kind of server, comprise: processing module, for the compression parameters information receiving is stored, in the situation that the quantity of the compression parameters information of same file type reaches predetermined threshold, compression parameters information is added up, calculating under different compression algorithms, the mean pressure shrinkage of this document type, and determine corresponding compress mode according to mean pressure shrinkage; Memory module, for being stored in different compression algorithms, corresponding mean pressure shrinkage and corresponding compress mode in the compress mode allocation list position corresponding with file type; Synchronization module, for being synchronized to subscriber computer by compress mode allocation list.
Preferably, above-mentioned processing module specifically for: in mean pressure shrinkage, be more than or equal to 95% and be less than or equal to 100% in the situation that, determine that compress mode is store compressed mode; In mean pressure shrinkage, be more than or equal to 90% and be less than 95% in the situation that, determine that compress mode is Fast Compression mode; In the situation that mean pressure shrinkage is less than 90%, determine that compress mode is standard compression mode.
Preferably, above-mentioned memory module also for: after in different compression algorithms, corresponding mean pressure shrinkage and corresponding compress mode are stored in to the compress mode allocation list position corresponding with file type, in compress mode allocation list, the statistics corresponding with this document type completes identifier and is set to complete.
Preferably, above-mentioned server is cloud server.
The present invention also provides a kind of data compression system, comprising: above-mentioned data compression device and above-mentioned server.
Beneficial effect of the present invention is as follows:
By automatically obtaining the compress mode of mating with the file type of needs compression according to compress mode allocation list, file is compressed, the compression time that in prior art, the file format of having compressed or redundant information is fewer compressed again and caused and the problem of system resource waste have been solved, in the situation that there is file or the fewer file of redundant information having compressed in the data of needs compression, can be automatically for user configures suitable compress mode, in the situation that substantially not losing compression ratio, promote compression speed, in addition, present stage, all kinds file increased gradually, utilizing high in the clouds statistics to upgrade compress mode allocation list makes the technical scheme of the embodiment of the present invention more be suitable for application.
Accompanying drawing explanation
Fig. 1 is used compressed software to carry out the schematic diagram of parameter configuration in prior art;
Fig. 2 is the flow chart of the data compression method of the embodiment of the present invention;
Fig. 3 is the structural representation of the data compression device of the embodiment of the present invention;
Fig. 4 is the structural representation of the server of the embodiment of the present invention;
Fig. 5 is the structural representation of the data compression system of the embodiment of the present invention.
Embodiment
In order to solve the compression time that in prior art, the file format of having compressed or redundant information is fewer compressed again and caused and the problem of system resource waste, the invention provides a kind of data compression method, device, system and server, the embodiment of the present invention is not in the situation that substantially losing compression ratio, promote compression speed, when file that particularly compressed or that redundant information is fewer is more, the compression speed of lifting is more obvious.Below in conjunction with accompanying drawing and embodiment, the present invention is further elaborated.Should be appreciated that specific embodiment described herein, only in order to explain the present invention, does not limit the present invention.
Embodiment of the method
According to embodiments of the invention, a kind of data compression method is provided, Fig. 2 is the flow chart of the data compression method of the embodiment of the present invention, as shown in Figure 2, according to the data compression method of the embodiment of the present invention, comprises following processing:
Step 201, calls pre-stored compress mode allocation list, and wherein, described compress mode allocation list comprises: the corresponding relation between file type and compress mode;
Particularly, above-mentioned compress mode allocation list can be stored in this locality, and preferably, above-mentioned compress mode allocation list also comprises: file type, compression algorithm, statistics complete the one-to-one relationship between identifier, mean pressure shrinkage and compress mode.
Step 202, obtains the file type of data, according to compress mode allocation list, determines whether to exist the compress mode corresponding with file type, if the compress mode corresponding with file type obtained in existence;
In step 202, if do not comprise while having added up identifier in compress mode allocation list,, in the situation that not there is not the compress mode corresponding with described file type, adopt described standard compression mode to compress described data to be compressed, and current compression parameters information is sent to server, wherein, described compression parameters information comprises: file type, compression algorithm, file size, quantity of documents and compression ratio.
In step 202, if comprised while having added up identifier at compress mode allocation list, according to compress mode allocation list, determine whether to exist the compress mode corresponding with file type also to comprise: according to compress mode allocation list, to obtain the statistics corresponding with file type and (for example complete identifier, 1 represents to have completed statistics, 0 has represented statistics), in statistics, complete identifier and represent in completed situation, determine the existence compress mode corresponding with file type in compress mode allocation list.
In statistics, completing identifier represents in uncompleted situation, need to adopt standard compression mode to treat packed data compresses, and current compression parameters information is sent to server, wherein, compression parameters information comprises: file type, compression algorithm, file size, quantity of documents and compression ratio.
Preferably, above-mentioned compress mode comprises: standard compression mode, Fast Compression mode and store compressed mode, in actual applications, can also comprise high-quality compress mode.Wherein, standard compression mode adopts the compression algorithm of tool of compression acquiescence to compress file, Fast Compression mode adopts the shortest compression algorithm of compression time to compress file, store compressed mode adopts directly file is stored in to the mode in compressed package, file is not compressed, high-quality compress mode adopts the minimum compression algorithm of compression ratio to compress file.
In actual applications, except comprising standard compression mode, Fast Compression mode, store compressed mode and high-quality compress mode, compress mode can also comprise: very fast compress mode, better quality compress mode etc.The compression time of very fast compress mode is greater than Fast Compression mode, but is less than standard compression mode, and the compression volume of better quality compress mode is greater than high-quality compress mode, but is less than standard compression mode.
Step 203, treats packed data according to the compress mode of obtaining and compresses.
In embodiments of the present invention, above-mentioned data to be compressed can comprise one or more files.
It should be noted that, if data comprise the file of a plurality of different file types, need to be for different file types, perform step respectively 202 and step 203 in processing.Because a plurality of files finally need compressed package of boil down to, therefore, when selecting compress mode according to compress mode allocation list, need to select the compress mode that compression algorithm is identical.For example, the file of 3 different file types need to be compressed, for these 3 files, use respectively 3 kinds of different compress modes to compress corresponding file, still, last compression algorithm must be identical, for example, the compressed package that is .rar form by 3 compressing files.
Informational needs in compress mode allocation list and server sync, server is added up the mean pressure shrinkage of each file type, according to mean pressure shrinkage, file type in compress mode allocation list and the corresponding relation between compress mode is set.Above-mentioned server can be cloud server.
Particularly, in compress mode allocation list, do not comprise while having added up identifier, described server comprises following processing: 1, the described compression parameters information receiving is stored, in the situation that the quantity of the compression parameters information of same file type reaches predetermined threshold, described compression parameters information is added up, calculating under different compression algorithms, the mean pressure shrinkage of this document type, and determine corresponding compress mode according to described mean pressure shrinkage; 2, described server is stored in described different compression algorithm, corresponding mean pressure shrinkage and corresponding compress mode in position corresponding with described file type in described compress mode allocation list; 3, described server is synchronized to described compress mode allocation list in subscriber computer.
At compress mode allocation list, comprise while having added up identifier, in statistics, completing identifier represents in uncompleted situation, after current compression parameters information is sent to server, server is stored the compression parameters information receiving, quantity in the compression parameters information of same file type (for example reaches predetermined threshold, 10000) situation under, compression parameters information is added up, calculating is under different compression algorithms, the mean pressure shrinkage of this document type, and determine corresponding compress mode according to mean pressure shrinkage; Finally, server is stored in different compression algorithms, corresponding mean pressure shrinkage and corresponding compress mode in position corresponding with file type in compress mode allocation list, and in compress mode allocation list, the statistics corresponding with this document type completes identifier and be set to complete, and compress mode allocation list is synchronized in subscriber computer.
Preferably, in actual applications, server can not be synchronized to compress mode allocation list in user's computer yet, but is kept in server, when tool of compression need to call this compress mode allocation list, can from server, obtain.
In above-mentioned processing, in mean pressure shrinkage, be more than or equal to 95% and be less than or equal to 100% in the situation that, determine that compress mode is store compressed mode; In mean pressure shrinkage, be more than or equal to 90% and be less than 95% in the situation that, determine that compress mode is Fast Compression mode; In the situation that mean pressure shrinkage is less than 90%, determine that compress mode is standard compression mode.
Example 1, when data are compressed, the mean pressure shrinkage of the file of rmvb form is wherein between 95%-100%, therefore, file for rmvb form need to be used store compressed mode to compress, the mean pressure shrinkage of alternative document is less than 90%, uses zip compression algorithm and standard compression mode to compress alternative document.
Example 2, when data are compressed, the mean pressure shrinkage of the file of mp3 form is wherein between 90%-95%, therefore, file for mp3 form need to be used zip compression algorithm and Fast Compression mode to compress, the mean pressure shrinkage of alternative document is less than 90%, uses zip compression algorithm and standard compression mode to compress alternative document.
Example 3, when the file of jpg form is compressed, the mean pressure shrinkage of the file of jpg form, between 90%-95%, therefore, need to be used 7z compression algorithm and Fast Compression mode to compress for the file of jpg form.
From above-mentioned example, can find out, the embodiment of the present invention, in the situation that compression ratio loss is not more than 5%, can improve compression speed as much as possible.
Below embodiment of the present invention technique scheme is elaborated.According to the data compression method of the embodiment of the present invention, comprise following processing:
Step 1, user are when using tool of compression and compress mode to be set to " standard compression mode ", and the file of the compression algorithm of recording user, file format, this form is size, quantity of documents and compression ratio always;
Step 2, is dealt into server by the above-mentioned information of record;
Step 3, server is by calculating under different compression algorithms, the mean pressure shrinkage of respective file form;
Step 4, server calculates an allocation list (above-mentioned compress mode allocation list) according to data: the file format by mean pressure shrinkage between 95% and 100% adds " storage " compress mode list of this compression algorithm, and the file format by mean pressure shrinkage between 90% and 95% adds " the fastest " compress mode list of this compression algorithm.
Step 5, is synchronized to this allocation list on subscriber computer, this allocation list of tool of compression meeting Automatically invoked during user's compressed file next time, thus reach substantially not damaging under the prerequisite of compression ratio (error is controlled in 5%), promote widely compression speed.
It should be noted that, the above-mentioned mean pressure shrinkage numerical value interval corresponding with compress mode can be not limited only to 90% of embodiment above, 95% etc., compress mode is also not limited to above-mentioned mention several, server can be different from above-described embodiment according to different demand settings mean pressure shrinkage numerical value, for example, 85%, 70% etc., corresponding with various compress modes.
In sum, technical scheme by means of the embodiment of the present invention, by automatically obtaining the compress mode of mating with the file type of needs compression according to compress mode allocation list, file is compressed, solved the problem of the compression time waste of in prior art, the file format of having compressed or redundant information is fewer being compressed again and being caused, in the situation that there is file or the fewer file of redundant information having compressed in the data of needs compression, can be automatically for user configures suitable compress mode, in the situation that substantially not losing compression ratio, promote compression speed, in addition, present stage, all kinds file increased gradually, utilizing high in the clouds statistics to upgrade compress mode allocation list makes the technical scheme of the embodiment of the present invention more be suitable for application.
Device embodiment mono-
According to embodiments of the invention, a kind of data compression device is provided, Fig. 3 is the structural representation of the data compression device of the embodiment of the present invention, as shown in Figure 3, according to the data compression device of the embodiment of the present invention, comprise: calling module 30, acquisition module 32 and compression module 34, below be described in detail the modules of the embodiment of the present invention.
Calling module 30, for calling pre-stored compress mode allocation list, wherein, described compress mode allocation list comprises: the corresponding relation between file type and compress mode;
Particularly, above-mentioned compress mode allocation list can be stored in this locality, and compress mode allocation list specifically comprises: file type, compression algorithm, statistics complete the one-to-one relationship between identifier, mean pressure shrinkage and compress mode.
Acquisition module 32, for obtaining the file type of data, determines whether to exist the compress mode corresponding with file type according to compress mode allocation list, if existed, obtains the compress mode corresponding with file type;
At compress mode allocation list, comprise while having added up identifier, acquisition module 32 also for: according to described compress mode allocation list, obtain the statistics corresponding with described file type and complete identifier, in described statistics, complete identifier and represent in completed situation, determine in described compress mode configuration and have the compress mode corresponding with described file type.
Preferably, in embodiments of the present invention, in statistics, completing identifier represents in uncompleted situation, compression module 33 also for: adopt standard compression mode to treat packed data and compress, and current compression parameters information is sent to server, wherein, compression parameters information comprises: file type, compression algorithm, file size, quantity of documents and compression ratio.
Above-mentioned compress mode comprises: standard compression mode, Fast Compression mode, store compressed mode and high-quality compress mode.Wherein, standard compression mode adopts the compression algorithm of tool of compression acquiescence to compress file, Fast Compression mode adopts the shortest compression algorithm of compression time to compress file, store compressed mode adopts directly file is stored in to the mode in compressed package, and high-quality compress mode adopts the minimum compression algorithm of compression ratio to compress file.
In actual applications, except comprising standard compression mode, Fast Compression mode, store compressed mode and high-quality compress mode, compress mode can also comprise: very fast compress mode, better quality compress mode etc.The compression time of very fast compress mode is greater than Fast Compression mode, but is less than standard compression mode, and the compression volume of better quality compress mode is greater than high-quality compress mode, but is less than standard compression mode.
Compression module 34, treats packed data for the compress mode of obtaining according to acquisition module 32 and compresses.
Described compression module also for: in the situation that not there is not the compress mode corresponding with described file type, adopt described standard compression mode to compress described data to be compressed, and current compression parameters information is sent to server, wherein, described compression parameters information comprises: file type, compression algorithm, file size, quantity of documents and compression ratio.
In embodiments of the present invention, above-mentioned data to be compressed can comprise one or more files.
It should be noted that, if data comprise the file of a plurality of different file types, acquisition module 32 and compression module 34 need to be processed respectively the file of different file types.Because a plurality of files finally need compressed package of boil down to, therefore, acquisition module 32, when selecting compress mode according to compress mode allocation list, need to be selected the compress mode that compression algorithm is identical.For example, the file of 3 different file types need to be compressed, for these 3 files, use respectively 3 kinds of different compress modes to compress corresponding file, still, last compression algorithm must be identical, for example, the compressed package that is .rar form by 3 compressing files.
Example 1, when data are compressed, the mean pressure shrinkage of the file of rmvb form is wherein between 95%-100%, therefore, file for rmvb form need to be used store compressed mode to compress, the mean pressure shrinkage of alternative document is less than 90%, uses zip compression algorithm and standard compression mode to compress alternative document.
Example 2, when data are compressed, the mean pressure shrinkage of the file of mp3 form is wherein between 90%-95%, therefore, file for mp3 form need to be used zip compression algorithm and Fast Compression mode to compress, the mean pressure shrinkage of alternative document is less than 90%, uses zip compression algorithm and standard compression mode to compress alternative document.
Example 3, when the file of jpg form is compressed, the mean pressure shrinkage of the file of jpg form, between 90%-95%, therefore, need to be used 7z compression algorithm and Fast Compression mode to compress for the file of jpg form.
Below in conjunction with example, embodiment of the present invention technique scheme is elaborated.According to the data compression method of the embodiment of the present invention, comprise following processing:
Step 1, user are when using tool of compression and compress mode to be set to " standard compression mode ", and the file of the compression algorithm of compression module 34 recording users, file format, this form is size, quantity of documents and compression ratio always;
Step 2, compression module 34 is dealt into server by the above-mentioned information of record;
Step 3, server is by calculating under different compression algorithms, the mean pressure shrinkage of respective file form;
Step 4, server calculates an allocation list (above-mentioned compress mode allocation list) according to data: the file format by mean pressure shrinkage between 95% and 100% adds " storage " compress mode list of this compression algorithm, and the file format by mean pressure shrinkage between 90% and 95% adds " the fastest " compress mode list of this compression algorithm.
Step 5, is synchronized to this allocation list on subscriber computer, calling module 30 these allocation lists of meeting Automatically invoked during user's compressed file next time, thus reach substantially not damaging under the prerequisite of compression ratio (error is controlled in 5%), promote widely compression speed.
It should be noted that, above-mentioned server can be cloud server.
In sum, technical scheme by means of the embodiment of the present invention, by automatically obtaining the compress mode of mating with the file type of needs compression according to compress mode allocation list, file is compressed, solved the problem of the compression time waste of in prior art, the file format of having compressed or redundant information is fewer being compressed again and being caused, in the situation that there is file or the fewer file of redundant information having compressed in the data of needs compression, can be automatically for user configures suitable compress mode, in the situation that substantially not losing compression ratio, promote compression speed.
Device embodiment bis-
According to embodiments of the invention, a kind of server is provided, Fig. 4 is the structural representation of the server of the embodiment of the present invention, as shown in Figure 4, according to the server of the embodiment of the present invention, comprise: processing module 40, memory module 42 and synchronization module 44, below be described in detail the modules of the embodiment of the present invention.
Processing module 40, for the compression parameters information receiving is stored, in the situation that the quantity of the compression parameters information of same file type reaches predetermined threshold, compression parameters information is added up, calculating is under different compression algorithms, the mean pressure shrinkage of this document type, and determine corresponding compress mode according to mean pressure shrinkage;
Preferably, above-mentioned processing module 40 specifically for: in mean pressure shrinkage, be more than or equal to 95% and be less than or equal to 100% in the situation that, determine that compress mode is store compressed mode; In mean pressure shrinkage, be more than or equal to 90% and be less than 95% in the situation that, determine that compress mode is Fast Compression mode; In the situation that mean pressure shrinkage is less than 90%, determine that compress mode is standard compression mode.
Memory module 42, for being stored in different compression algorithms, corresponding mean pressure shrinkage and corresponding compress mode in the compress mode allocation list position corresponding with file type;
Memory module 42 also for: after in different compression algorithms, corresponding mean pressure shrinkage and corresponding compress mode are stored in to the compress mode allocation list position corresponding with file type, in compress mode allocation list, the statistics corresponding with this document type completes identifier and is set to complete.
Synchronization module 44, for being synchronized to subscriber computer by compress mode allocation list.
It should be noted that, above-mentioned server can be cloud server.
Below technique scheme is elaborated.
Server is stored the compression parameters information receiving, quantity in the compression parameters information of same file type (for example reaches predetermined threshold, 10000) situation under, compression parameters information is added up, calculating is under different compression algorithms, the mean pressure shrinkage of this document type, and determine corresponding compress mode according to mean pressure shrinkage; Finally, server is stored in different compression algorithms, corresponding mean pressure shrinkage and corresponding compress mode in position corresponding with file type in compress mode allocation list, and in compress mode allocation list, the statistics corresponding with this document type completes identifier and be set to complete, and compress mode allocation list is synchronized in subscriber computer.
Preferably, in actual applications, server can not be synchronized to compress mode allocation list in user's computer yet, but is kept in server, when tool of compression need to call this compress mode allocation list, can from server, obtain.
In above-mentioned processing, in mean pressure shrinkage, be more than or equal to 95% and be less than or equal to 100% in the situation that, determine that compress mode is store compressed mode; In mean pressure shrinkage, be more than or equal to 90% and be less than 95% in the situation that, determine that compress mode is Fast Compression mode; In the situation that mean pressure shrinkage is less than 90%, determine that compress mode is standard compression mode.
Example 1, when data are compressed, the mean pressure shrinkage of the file of rmvb form is wherein between 95%-100%, therefore, file for rmvb form need to be used store compressed mode to compress, the mean pressure shrinkage of alternative document is less than 90%, uses zip compression algorithm and standard compression mode to compress alternative document.
Example 2, when data are compressed, the mean pressure shrinkage of the file of mp3 form is wherein between 90%-95%, therefore, file for mp3 form need to be used zip compression algorithm and Fast Compression mode to compress, the mean pressure shrinkage of alternative document is less than 90%, uses zip compression algorithm and standard compression mode to compress alternative document.
Example 3, when the file of jpg form is compressed, the mean pressure shrinkage of the file of jpg form, between 90%-95%, therefore, need to be used 7z compression algorithm and Fast Compression mode to compress for the file of jpg form.
From above-mentioned example, can find out, the embodiment of the present invention, in the situation that compression ratio loss is not more than 5%, can improve compression speed as much as possible.
System embodiment
According to embodiments of the invention, a kind of data compression system is provided, Fig. 5 is the structural representation of the data compression system of the embodiment of the present invention, as shown in Figure 5, according to the data compression system of the embodiment of the present invention, comprises: data compression device 50 and server 52.The handling process of data compression device 50 and server 52 has been described in detail in said apparatus embodiment mono-and device embodiment bis-, the technical scheme of the embodiment of the present invention can be understood with reference to said apparatus embodiment mono-and device embodiment bis-, does not repeat them here.
In sum, technical scheme by means of the embodiment of the present invention, by automatically obtaining the compress mode of mating with the file type of needs compression according to compress mode allocation list, file is compressed, solved the problem of the compression time waste of in prior art, the file format of having compressed or redundant information is fewer being compressed again and being caused, in the situation that there is file or the fewer file of redundant information having compressed in the data of needs compression, can be automatically for user configures suitable compress mode, in the situation that substantially not losing compression ratio, promote compression speed, in addition, present stage, all kinds file increased gradually, utilizing high in the clouds statistics to upgrade compress mode allocation list makes the technical scheme of the embodiment of the present invention more be suitable for application.
Although be example object, the preferred embodiments of the present invention are disclosed, it is also possible those skilled in the art will recognize various improvement, increase and replacement, therefore, scope of the present invention should be not limited to above-described embodiment.
Claims (19)
1. a data compression device, its feature exists, and comprising:
Calling module, for calling pre-stored compress mode allocation list, wherein, described compress mode allocation list specifically comprises: file type, compression algorithm, statistics complete the one-to-one relationship between identifier, mean pressure shrinkage and compress mode;
Acquisition module, for obtaining the file type of described data, determines whether to exist the compress mode corresponding with described file type according to described compress mode allocation list, if existed, obtains the compress mode corresponding with described file type;
Compression module, treats packed data for the compress mode of obtaining according to described acquisition module and compresses.
2. device as claimed in claim 1, is characterized in that,
Described data to be compressed comprise one or more files.
3. device as claimed in claim 1, it is characterized in that, described compress mode comprises: standard compression mode, Fast Compression mode and store compressed mode, wherein, described standard compression mode adopts the compression algorithm of acquiescence to compress file, described Fast Compression mode adopts the shortest compression algorithm of compression time to compress file, and described store compressed mode adopts directly file is stored in to the mode in compressed package.
4. device as claimed in claim 1, is characterized in that,
Described compression module also for: in the situation that not there is not the compress mode corresponding with described file type, adopt standard compression mode to compress described data to be compressed, and current compression parameters information is sent to server, wherein, described compression parameters information comprises: file type, compression algorithm, file size, quantity of documents and compression ratio.
5. device as claimed in claim 2, is characterized in that,
Described acquisition module also for: according to described compress mode allocation list, obtain the statistics corresponding with described file type and complete identifier, in described statistics, complete identifier and represent in completed situation, determine in described compress mode configuration and have the compress mode corresponding with described file type;
Described compression module also for: in described statistics, complete identifier and represent in uncompleted situation, adopt described standard compression mode to compress described data to be compressed, and current compression parameters information is sent to server, wherein, described compression parameters information comprises: file type, compression algorithm, file size, quantity of documents and compression ratio.
6. a server, is characterized in that, comprising:
Processing module, for the compression parameters information receiving is stored, in the situation that the quantity of the compression parameters information of same file type reaches predetermined threshold, described compression parameters information is added up, calculating is under different compression algorithms, the mean pressure shrinkage of this document type, and determine corresponding compress mode according to described mean pressure shrinkage;
Memory module, for being stored in described different compression algorithm, corresponding mean pressure shrinkage and corresponding compress mode in the compress mode allocation list position corresponding with described file type;
Synchronization module, for being synchronized to subscriber computer by described compress mode allocation list.
7. server as claimed in claim 6, is characterized in that, described processing module specifically for: in described mean pressure shrinkage, be more than or equal to 95% and be less than or equal to 100% in the situation that, determine that described compress mode is store compressed mode; In described mean pressure shrinkage, be more than or equal to 90% and be less than 95% in the situation that, determine that described compress mode is Fast Compression mode; In the situation that described mean pressure shrinkage is less than 90%, determine that described compress mode is standard compression mode;
Described memory module also for: after in described different compression algorithm, corresponding mean pressure shrinkage and corresponding compress mode are stored in to the compress mode allocation list position corresponding with described file type, in described compress mode allocation list, the statistics corresponding with this document type completes identifier and is set to complete.
8. server as claimed in claim 6, is characterized in that, described server is cloud server.
9. a data compression system, is characterized in that, comprising: the server described in the data compression device described in claim 1 to 5 any one and claim 6 to 8 any one.
10. a data compression method, is characterized in that, comprising:
Call pre-stored compress mode allocation list, wherein, described compress mode allocation list specifically comprises: file type, compression algorithm, statistics complete the one-to-one relationship between identifier, mean pressure shrinkage and compress mode;
Obtain the file type of described data, according to described compress mode allocation list, determine whether to exist the compress mode corresponding with described file type, if existed, obtain the compress mode corresponding with described file type;
According to the compress mode of obtaining, treating packed data compresses.
11. methods as claimed in claim 10, is characterized in that, described method also comprises:
Information and server sync in described compress mode allocation list, described server is added up the mean pressure shrinkage of each file type, according to mean pressure shrinkage, file type in described compress mode allocation list and the corresponding relation between compress mode is set.
12. methods as described in claim 10 or 11, is characterized in that,
Described data to be compressed comprise one or more files.
13. methods as claimed in claim 12, it is characterized in that, described compress mode comprises: standard compression mode, Fast Compression mode and store compressed mode, wherein, described standard compression mode adopts the compression algorithm of acquiescence to compress file, described Fast Compression mode adopts the shortest compression algorithm of compression time to compress file, and described store compressed mode adopts directly file is stored in to the mode in compressed package.
14. methods as claimed in claim 10, is characterized in that, described method also comprises:
In the situation that not there is not the compress mode corresponding with described file type, adopt standard compression mode to compress described data to be compressed, and current compression parameters information is sent to server, wherein, described compression parameters information comprises: file type, compression algorithm, file size, quantity of documents and compression ratio.
15. methods as claimed in claim 11, is characterized in that, described server is added up the mean pressure shrinkage of each file type, according to mean pressure shrinkage, file type in described compress mode allocation list are set and the corresponding relation between compress mode specifically comprises:
Described server is stored the described compression parameters information receiving, in the situation that the quantity of the compression parameters information of same file type reaches predetermined threshold, described compression parameters information is added up, calculating is under different compression algorithms, the mean pressure shrinkage of this document type, and determine corresponding compress mode according to described mean pressure shrinkage;
Described server is stored in described different compression algorithm, corresponding mean pressure shrinkage and corresponding compress mode in position corresponding with described file type in described compress mode allocation list;
Described server is synchronized to described compress mode allocation list in subscriber computer.
16. methods as claimed in claim 12, is characterized in that, according to described compress mode allocation list, determine whether to exist the compress mode corresponding with described file type also to comprise:
According to described compress mode allocation list, obtain the statistics corresponding with described file type and complete identifier, in described statistics, complete identifier and represent in completed situation, determine the existence compress mode corresponding with described file type in described compress mode allocation list.
17. methods as claimed in claim 16, is characterized in that, described method also comprises:
In described statistics, completing identifier represents in uncompleted situation, adopt standard compression mode to compress described data to be compressed, and current compression parameters information is sent to server, wherein, described compression parameters information comprises: file type, compression algorithm, file size, quantity of documents and compression ratio.
18. methods as claimed in claim 17, is characterized in that, described server is added up the mean pressure shrinkage of each file type, according to mean pressure shrinkage, file type in described compress mode allocation list are set and the corresponding relation between compress mode specifically comprises:
Described server is stored the described compression parameters information receiving, in the situation that the quantity of the compression parameters information of same file type reaches predetermined threshold, described compression parameters information is added up, calculating is under different compression algorithms, the mean pressure shrinkage of this document type, and determine corresponding compress mode according to described mean pressure shrinkage;
Described server is stored in described different compression algorithm, corresponding mean pressure shrinkage and corresponding compress mode in position corresponding with described file type in described compress mode allocation list, and in described compress mode allocation list, the statistics corresponding with this document type completes identifier and be set to complete;
Described server is synchronized to described compress mode allocation list in subscriber computer.
19. methods as described in claim 15 or 18, is characterized in that, according to described mean pressure shrinkage, determine that corresponding compress mode specifically comprises:
In described mean pressure shrinkage, be more than or equal to 95% and be less than or equal to 100% in the situation that, determine that described compress mode is store compressed mode;
In described mean pressure shrinkage, be more than or equal to 90% and be less than 95% in the situation that, determine that described compress mode is Fast Compression mode;
In the situation that described mean pressure shrinkage is less than 90%, determine that described compress mode is standard compression mode.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210175371.4A CN102761540B (en) | 2012-05-30 | 2012-05-30 | Data compression method, device and system and server |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210175371.4A CN102761540B (en) | 2012-05-30 | 2012-05-30 | Data compression method, device and system and server |
Publications (2)
Publication Number | Publication Date |
---|---|
CN102761540A CN102761540A (en) | 2012-10-31 |
CN102761540B true CN102761540B (en) | 2014-11-19 |
Family
ID=47055861
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201210175371.4A Active CN102761540B (en) | 2012-05-30 | 2012-05-30 | Data compression method, device and system and server |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN102761540B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US10303148B2 (en) | 2014-10-29 | 2019-05-28 | Siemens Aktiengesellschaft | Automatic compression algorithm selection and parameter tuning based on contextual knowledge |
Families Citing this family (25)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103019654B (en) * | 2012-11-28 | 2015-01-14 | 清华大学 | Coupling communication method for earth system models |
CN103023511B (en) * | 2012-12-05 | 2016-06-08 | 云之朗科技有限公司 | The compaction coding method of a kind of application and device |
US20140215170A1 (en) * | 2013-01-31 | 2014-07-31 | Futurewei Technologies, Inc. | Block Compression in a Key/Value Store |
CN103873860B (en) * | 2014-03-18 | 2017-12-22 | 深信服网络科技(深圳)有限公司 | Document transmission method and device |
CN105446975B (en) * | 2014-06-23 | 2019-03-15 | 广州爱九游信息技术有限公司 | A kind of file packing method and device |
CN104216814B (en) * | 2014-09-22 | 2017-01-18 | 北京国双科技有限公司 | Log compression monitoring method and log compression monitoring device |
CN105718478A (en) * | 2014-12-03 | 2016-06-29 | 北京奇虎科技有限公司 | Data storage method and device |
CN104468044A (en) * | 2014-12-05 | 2015-03-25 | 北京国双科技有限公司 | Data compression method and device applied to network transmission |
CN106919617B (en) * | 2015-12-25 | 2020-09-04 | 北京奇虎科技有限公司 | Compression storage method and device |
EP3229444B1 (en) * | 2015-12-29 | 2019-10-16 | Huawei Technologies Co., Ltd. | Server and method for compressing data by server |
CN105760245B (en) * | 2016-02-03 | 2019-03-26 | 华为技术有限公司 | A kind of method and device of storing data |
CN106341482B (en) * | 2016-09-22 | 2019-07-30 | 江苏赞奇科技股份有限公司 | Cloud rendering mixing compression transmission System and method for based on file type |
US10097202B1 (en) * | 2017-06-20 | 2018-10-09 | Samsung Electronics Co., Ltd. | SSD compression aware |
CN108197168A (en) * | 2017-12-18 | 2018-06-22 | 中国移动通信集团广东有限公司 | A kind of data compression method, equipment and computer readable storage medium |
CN108427704B (en) * | 2018-01-05 | 2022-08-09 | 平安科技(深圳)有限公司 | Compression tool calling method and device and storage medium |
CN109325006A (en) * | 2018-08-23 | 2019-02-12 | 郑州云海信息技术有限公司 | A kind of method and apparatus for compressing the method and apparatus stored, decompression downloading |
CN110232050A (en) * | 2019-04-24 | 2019-09-13 | 深圳点猫科技有限公司 | The method and electronic equipment that a kind of language based on programming compresses file |
CN110286917A (en) * | 2019-05-21 | 2019-09-27 | 深圳壹账通智能科技有限公司 | File packing method, device, equipment and storage medium |
CN112311720B (en) * | 2019-07-23 | 2022-10-14 | 腾讯科技(深圳)有限公司 | Data transmission method and device |
CN111817722A (en) * | 2020-07-09 | 2020-10-23 | 北京奥星贝斯科技有限公司 | Data compression method and device and computer equipment |
CN111949629B (en) * | 2020-07-22 | 2024-03-22 | 金钱猫科技股份有限公司 | File storage method and terminal oriented to edge cloud |
CN113301123B (en) * | 2021-04-30 | 2024-04-05 | 阿里巴巴创新公司 | Data stream processing method, device and storage medium |
CN113590027B (en) * | 2021-06-30 | 2022-10-11 | 展讯半导体(南京)有限公司 | Data storage method, data acquisition method, system, device and medium |
CN113836101B (en) * | 2021-09-27 | 2024-08-23 | 维沃移动通信有限公司 | Compression method and device and electronic equipment |
CN114697070B (en) * | 2021-12-31 | 2024-04-02 | 成都思维世纪科技有限责任公司 | Method and system for dynamically compressing and storing HTTP protocol traffic |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1584875A (en) * | 2004-06-01 | 2005-02-23 | 北京九州计算机网络有限公司 | Ergodic compressing and decompressing method for batched computer document |
CN1731364A (en) * | 2005-08-05 | 2006-02-08 | 北京九州软件有限公司 | Method for compression and search of database backup data |
CN101957836A (en) * | 2010-09-03 | 2011-01-26 | 清华大学 | Configurable real-time transparent compressing method in file system |
-
2012
- 2012-05-30 CN CN201210175371.4A patent/CN102761540B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1584875A (en) * | 2004-06-01 | 2005-02-23 | 北京九州计算机网络有限公司 | Ergodic compressing and decompressing method for batched computer document |
CN1731364A (en) * | 2005-08-05 | 2006-02-08 | 北京九州软件有限公司 | Method for compression and search of database backup data |
CN101957836A (en) * | 2010-09-03 | 2011-01-26 | 清华大学 | Configurable real-time transparent compressing method in file system |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US10303148B2 (en) | 2014-10-29 | 2019-05-28 | Siemens Aktiengesellschaft | Automatic compression algorithm selection and parameter tuning based on contextual knowledge |
Also Published As
Publication number | Publication date |
---|---|
CN102761540A (en) | 2012-10-31 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN102761540B (en) | Data compression method, device and system and server | |
CN102684705B (en) | Method and device for data compression | |
CN102761339B (en) | Data compression method and device | |
US9710929B2 (en) | Method and apparatus for lossless image compression | |
US20160034488A1 (en) | Method and apparatus for modifying compressed files | |
WO2021057619A1 (en) | Memory reclamation method and apparatus, electronic device, and storage medium | |
WO2016095149A1 (en) | Data compression and storage method and device, and distributed file system | |
CN104284076A (en) | Method and device for processing preview image and mobile terminal | |
WO2021203918A8 (en) | Method for processing model parameters, and apparatus | |
CN105630923A (en) | Method for realizing archives administration informatization | |
CN102647470A (en) | Cloud download method in on-line application platform and on-line application platform system | |
CN101667139A (en) | Service program invocation method based on aggregate type object, device and system therefor | |
CN105718569A (en) | Method, device and system for uploading compound document | |
CN104092754A (en) | File storage system and method | |
CN106341482B (en) | Cloud rendering mixing compression transmission System and method for based on file type | |
CN105843631B (en) | A method of improving system firmware burn writing speed | |
CN102999626A (en) | Data compression/decompression device, as well as method and system thereof | |
CN102752312B (en) | Method for decompressing swf files in batches | |
CN105007083A (en) | Method for storing output result of LZ77 compression algorithm | |
CN103268619A (en) | Method and device for batch compression for picture data in swf document | |
CN103034702A (en) | Device, method and system for data compression/decompression | |
CN114666406B (en) | Electric power Internet of things data compression method and device based on object model | |
CN103246711A (en) | Method and device generating snapshots of binary large object type data | |
US8781236B2 (en) | Processing graphical data representing a sequence of images for compression | |
CN103412946A (en) | DTU parameter configuration method and system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
TR01 | Transfer of patent right | ||
TR01 | Transfer of patent right |
Effective date of registration: 20220725 Address after: Room 801, 8th floor, No. 104, floors 1-19, building 2, yard 6, Jiuxianqiao Road, Chaoyang District, Beijing 100015 Patentee after: BEIJING QIHOO TECHNOLOGY Co.,Ltd. Address before: 100088 room 112, block D, 28 new street, new street, Xicheng District, Beijing (Desheng Park) Patentee before: BEIJING QIHOO TECHNOLOGY Co.,Ltd. Patentee before: Qizhi software (Beijing) Co.,Ltd. |