WO2019134244A1 - 压缩工具调用方法、装置及存储介质 - Google Patents

压缩工具调用方法、装置及存储介质 Download PDF

Info

Publication number
WO2019134244A1
WO2019134244A1 PCT/CN2018/077620 CN2018077620W WO2019134244A1 WO 2019134244 A1 WO2019134244 A1 WO 2019134244A1 CN 2018077620 W CN2018077620 W CN 2018077620W WO 2019134244 A1 WO2019134244 A1 WO 2019134244A1
Authority
WO
WIPO (PCT)
Prior art keywords
compression
file
tool
mode
type
Prior art date
Application number
PCT/CN2018/077620
Other languages
English (en)
French (fr)
Inventor
兰东平
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2019134244A1 publication Critical patent/WO2019134244A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/174Redundancy elimination performed by the file system
    • G06F16/1744Redundancy elimination performed by the file system using compression, e.g. sparse files

Definitions

  • the present application relates to the field of computers, and in particular, to a compression tool calling method, apparatus, and computer readable storage medium.
  • the present application provides a compression tool calling method, apparatus, and computer readable storage medium, the main purpose of which is to automatically select an optimal compression tool for compression according to different types of files, and optimize storage services.
  • the present application provides a compression tool calling method, including:
  • Parsing step responding to the operation of the compressed file each time the user starts, parsing the type and size of the file to be compressed, and recording the compression mode and compression tool selected by the user;
  • Recording step after the compression is completed, record the compression ratio and compression time of the compression tool for the file of the type and size in the compression mode;
  • the calculation step is: calculating the recommended value of the compression value or the compression time for each type of file for each type of file according to a preset recommended value calculation formula for each preset mode;
  • Receiving step receiving a request of the user to compress the file and a compression mode selected by the user;
  • the compression tool corresponding to the maximum recommended value of the compression rate or the maximum recommended value of the compression time is selected, and the selected compression tool is automatically called to perform a compression operation on the file.
  • the application further provides another compression tool calling method, where the method includes:
  • Parsing step responding to the operation of the compressed file each time the user starts, parsing the type and size of the file to be compressed, and recording the compression mode and compression tool selected by the user;
  • Recording step after the compression is completed, record the compression ratio and compression time of the compression tool for the file of the type and size in the compression mode;
  • a first calculating step calculating a recommended value of a compression value or a compression time for each type of file for each type of file according to a preset recommended value calculation formula for each preset mode;
  • Receiving step receiving a request of the user to compress the file and a compression mode selected by the user;
  • the generating step in the compression mode selected by the user, generating a range of values for the compression rate recommendation value or the compression time recommendation value of the file according to each compression tool, and generating a random number within the value range;
  • a second calculating step calculating a difference between the random number and a recommended value of each compression tool
  • Step Select the compression tool corresponding to the minimum difference, and automatically call the selected compression tool to perform the compression operation on the file.
  • the present application further provides an electronic device, including: a memory, a processor, and a display, where the memory stores a compression tool calling program, and the compression tool calling program is executed by the processor, and the following steps can be implemented. :
  • Parsing step responding to the operation of the compressed file each time the user starts, parsing the type and size of the file to be compressed, and recording the compression mode and compression tool selected by the user;
  • Recording step after the compression is completed, record the compression ratio and compression time of the compression tool for the file of the type and size in the compression mode;
  • the calculation step is: calculating the recommended value of the compression value or the compression time for each type of file for each type of file according to a preset recommended value calculation formula for each preset mode;
  • Receiving step receiving a request of the user to compress the file and a compression mode selected by the user;
  • Invoking step In the compressed mode, the compression tool is called to perform a compression operation according to a predetermined compression rule.
  • the present application further provides a computer readable storage medium, where the computer readable storage medium includes a compression tool calling program, and when the compression tool calling program is executed by a processor, the foregoing can be implemented as described above.
  • the compression tool calls any step in the method.
  • the compression tool calling method, the electronic device and the computer readable storage medium proposed by the application automatically receive the compression ratio recommendation value in the compressed mode selected by the user according to the type and size of the file to be compressed by receiving the request of the user to compress the file. Or the compression tool with the highest compression time recommendation value compresses the file, saving storage space and improving work efficiency.
  • FIG. 1 is a schematic diagram of a preferred embodiment of an electronic device of the present application.
  • FIG. 2 is a block diagram showing a preferred embodiment of the compression tool calling program of FIG. 1;
  • FIG. 3 is a flowchart of a first embodiment of a method for calling a compression tool according to the present application
  • FIG. 4 is a flowchart of a second embodiment of a method for calling a compression tool according to the present application
  • FIG. 5 is a flowchart of a third embodiment of a method for calling a compression tool according to the present application.
  • FIG. 6 is a flowchart of a fourth embodiment of a method for invoking a compression tool according to the present application.
  • FIG. 7 is a schematic diagram of an application environment of a method for calling a compression tool according to the present application.
  • FIG. 1 is a schematic diagram of a preferred embodiment of an electronic device 1 of the present application.
  • the electronic device 1 may be a server, a smart phone, a tablet computer, a personal computer, a portable computer, and other electronic devices having computing functions.
  • the electronic device 1 includes a memory 11, a processor 12, a display 13, a network interface 14, and a communication bus 15.
  • the network interface 14 can optionally include a standard wired interface and a wireless interface (such as a WI-FI interface).
  • Communication bus 15 is used to implement connection communication between these components.
  • the memory 11 includes at least one type of readable storage medium.
  • the at least one type of readable storage medium may be a non-volatile storage medium such as a flash memory, a hard disk, a multimedia card, a card type memory, or the like.
  • the memory 11 may be an internal storage unit of the electronic device 1, such as a hard disk of the electronic device 1.
  • the memory 11 may also be an external storage unit of the electronic device 1, such as a plug-in hard disk equipped on the electronic device 1, a smart memory card (SMC), and security. Digital (Secure Digital, SD) card, flash card (Flash Card), etc.
  • the memory 11 can be used not only for storing application software and various types of data installed in the electronic device 1, such as a compression tool calling program 10, various types of compression tools 16, and various types and sizes.
  • the recording of the compression time and compression ratio of the files in each compression tool can also be used to temporarily store the data that has been output or will be output.
  • the processor 12 in some embodiments, may be a Central Processing Unit (CPU), microprocessor or other data processing chip for running program code or processing data stored in the memory 11, such as executing a compression tool call.
  • CPU Central Processing Unit
  • microprocessor or other data processing chip for running program code or processing data stored in the memory 11, such as executing a compression tool call.
  • Display 13 can be referred to as a display screen or display unit.
  • the display 13 can be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an Organic Light-Emitting Diode (OLED) touch sensor.
  • the display 13 is for displaying information processed in the electronic device 1 and a work interface for displaying visualization, such as displaying a compressed mode selection page.
  • the electronic device 1 may further include a user interface
  • the user interface may include an input unit such as a keyboard, a voice output device such as an audio, a headphone, etc.
  • the user interface may further include a standard wired interface and a wireless interface.
  • the program code of the compression tool calling program 10 is stored in the memory 11 as a computer storage medium.
  • the processor 12 executes the program code of the compression tool calling program 10, the following steps are implemented:
  • Parsing step responding to the operation of the compressed file each time the user starts, parsing the type and size of the file to be compressed, and recording the compression mode and compression tool selected by the user;
  • Recording step after the compression is completed, record the compression ratio and compression time of the compression tool for the file of the type and size in the compression mode;
  • the calculation step is: calculating the recommended value of the compression value or the compression time for each type of file for each type of file according to a preset recommended value calculation formula for each preset mode;
  • Receiving step receiving a request of the user to compress the file and a compression mode selected by the user;
  • the compression tool corresponding to the maximum recommended value of the compression rate or the maximum recommended value of the compression time is selected, and the selected compression tool is automatically called to perform a compression operation on the file.
  • the compression tool calling program 10 responds to the operation of the compressed file by the user each time, parses the type and size of the file to be compressed, and records the compression mode and compression tool selected by the user. For example, when the user compresses the image file, the compression tool calling program automatically parses the type of the image file to be compressed and the size of the occupied space, and records the compression mode and compression tool selected by the user.
  • the file types include: multimedia files (such as audio files, video files, image files, etc.), document files (such as doc files, txt files, xls files, etc.) and executable files (such as exe file installation packages, etc.). For different types and sizes of files, different compression tools compress files with different compression ratios and compression times.
  • the compression ratios of fastlz and lz4 for 2M txt files are 14% and 18%, respectively, and the compression times are 4s and 6s, respectively.
  • the compression mode includes an extreme compression mode and an extreme compression mode. Among them, the ultimate compression mode mainly focuses on the compression ratio of the file, and the extreme compression mode mainly focuses on the compression time of the file.
  • the compression tool call program 10 records the compression ratio and compression time of the compression tool for the file of the type and size in the compression mode. For example, the user selects the ultimate compression mode, and the compression tool invoked is WinRAR. After the compression is completed, the compression mode, compression tool, file type, file size, compression ratio, and compression time are respectively: ultimate compression mode-WinRAR-picture File -4M-28%-10s.
  • the compression tool includes one or more of compression tools such as fastlz, lz4, snappy, deflate, WinRAR, WinZip, and zlib.
  • the compression tool calling program 10 calculates a recommended value of the recommended value or compression time for each type of file with respect to the compression ratio for each type of file in each compression mode every preset period according to a preset recommended value calculation formula. For example, on the last night of each month, the compression tool caller automatically calculates the formula using the preset recommended values, and calculates each file based on the compression ratio and compression time of each type of file for each type of file recorded for that month. The recommended value for each compression tool.
  • the preset recommendation value calculation formula includes:
  • the recommended value is calculated as: Where Y 1 represents the compression ratio recommended value of a certain type of file in a compression tool, X i represents the compression ratio under the compression tool in the preset period of the type file, and n is a positive integer, which represents the compression in the preset period.
  • the number of files of this type that the tool has compressed For example, in the default period, WinRAR's compression rate for doc files is 30%, 28%, and the recommended value is used to calculate the formula:
  • the recommended compression value for the doc file in WinRAR is 71.
  • the recommended value is calculated as: Y2 represents the compression time recommendation value of a certain type of file in a compression tool, and M ij /N ij represents the ratio of compression time to file size of all types of files under the compression period, M i /N j Represents the ratio of the compression time to the file size of a certain type of file under a compression tool.
  • m is a positive integer representing the number of compression tool pressures
  • n is a positive integer, representing the compression of the compression tool during the preset period. The number of files of that type.
  • there are only two compression tools, WinRAR and WinZip in the compression tool.
  • the compression time is 8s and 4s respectively, and the recommended value is used to calculate the formula:
  • the recommended compression values for the jpg image files in WinRAR and WinZip are 10 and 40 respectively.
  • the compression tool caller 10 receives the request of the user to compress the file and the compression mode selected by the user. For example, receive a 4M jpg image file and a user-selected extreme compression mode.
  • the compression tool calling program 10 automatically calls the compression tool with the largest compression recommendation value or the compression time recommendation value to perform a compression operation on the compressed file according to the compression mode selected by the user. For example, in the extreme compression mode, it is assumed that the file to be compressed is a 4M jpg image file and only two WinRAR and WinZip compression tools are used in the compression tool. The recommended compression values of the 4M jpg image file in WinRAR and WinZip are 10, 40 respectively. , then call WinZip to compress the 4M jpg image file.
  • the user may also display the recommended compression value or compression time recommendation value of the compressed file in each compression tool in the selected compression mode, and the user selects a suitable compression tool to perform the compression operation according to the business scenario.
  • the recommended compression values of the 4M jpg image files in WinRAR and WinZip are 10 and 40 respectively. Even if the compression time of WinRAR is long, if the user feels that the distortion of WinRAR compression is small, Select WinRAR to compress the file.
  • the compression tool calling method in the above embodiment automatically queries the compression rate recommendation value or the compression time recommendation value of the file to be compressed in each compression tool according to the compression mode selected by the user, and automatically invokes an optimal compression tool to compress the file. Reduce manual compression of staff and improve business processing efficiency.
  • FIG. 2 is a block diagram of a preferred embodiment of the compression tool calling program 10 of FIG. 1.
  • a module as referred to in this application refers to a series of computer program instructions that are capable of performing a particular function.
  • the compression tool calling program 10 includes: a parsing module 110, a recording module 120, a computing module 130, a receiving module 140, and a calling module 150.
  • the functions or operating steps implemented by the modules 110-150 are the same as above. Similarly, it will not be described in detail here, by way of example, for example:
  • the parsing module 110 is configured to respond to the operation of the compressed file by the user each time, parse the type and size of the file to be compressed, and record the compression mode and compression tool selected by the user;
  • the recording module 120 is configured to record, after the compression is completed, the compression ratio and the compression time of the compression tool for the file of the type and size in the compressed mode;
  • the calculation module 130 is configured to calculate, according to a preset recommended value calculation formula, a recommended value of a recommended value or a compression time of each compression tool for each type of file with respect to a compression ratio according to a preset recommendation value calculation formula;
  • the receiving module 140 is configured to receive a request for compressing a file by a user and a compression mode selected by the user;
  • the calling module 150 is configured to: in the compressed mode, select a compression tool corresponding to a maximum recommended value of the compression rate or a maximum recommended value of the compression time, and automatically invoke the selected compression tool to perform a compression operation on the file.
  • FIG. 3 it is a flowchart of the first embodiment of the compression tool calling method of the present application.
  • the method for implementing the compression tool includes: Step S10 - Step S50:
  • Step S10 is a schematic diagram of an application environment of the compression tool calling method of the present application.
  • the compression tool calling program 10 responds to the operation of the compressed file every time the user starts, parses the type and size of the file to be compressed, and records the compression selected by the user. Mode and compression tools.
  • the compression tool is stored in the compression tool library 16. For example, when the user compresses the image file, the compression tool calling program automatically parses the type of the image file to be compressed and the size of the occupied space, and records the compression mode and compression tool selected by the user.
  • the file types include: multimedia files (such as audio files, video files, image files, etc.), document files (such as doc files, txt files, xls files, etc.) and executable files (such as exe file installation packages).
  • multimedia files such as audio files, video files, image files, etc.
  • document files such as doc files, txt files, xls files, etc.
  • executable files such as exe file installation packages.
  • different compression tools compress files with different compression ratios and compression times.
  • the compression ratios of fastlz and lz4 for 2M txt files are 14% and 18%, respectively, and the compression times are 4s and 6s, respectively.
  • the compression mode includes an extreme compression mode and an extreme compression mode. Among them, the ultimate compression mode mainly focuses on the compression ratio of the file, and the extreme compression mode mainly focuses on the compression time of the file.
  • Step S20 after the compression is completed, the compression tool calling program 10 records the compression ratio and compression time of the compression tool for the file of the type and size in the compression mode.
  • the user selects the ultimate compression mode, and the compression tool invoked is WinRAR.
  • the compression mode, compression tool, file type, file size, compression ratio, and compression time are respectively: ultimate compression mode-WinRAR-picture File -4M-28%-10s.
  • the compression tool includes one or more of compression tools such as fastlz, lz4, snappy, deflate, WinRAR, WinZip, and zlib.
  • step S30 the compression tool calling program 10 calculates a recommended value of the compression value or a compression time for each type of file for each type of file according to a preset recommended value calculation formula for each preset mode. . For example, on the last night of each month, the compression tool caller automatically calculates the formula using the preset recommended values, and calculates each file based on the compression ratio and compression time of each type of file for each type of file recorded for that month. The recommended value for each compression tool.
  • the preset recommendation value calculation formula includes:
  • the recommended value is calculated as: Where Y 1 represents the compression ratio recommended value of a certain type of file in a compression tool, X i represents the compression ratio under the compression tool in the preset period of the type file, and n is a positive integer, which represents the compression in the preset period.
  • the number of files of this type that the tool has compressed For example, in the default period, WinRAR's compression rate for doc files is 30%, 28%, and the recommended value is used to calculate the formula:
  • the recommended compression value for the doc file in WinRAR is 71.
  • the recommended value is calculated as: Where Y 2 represents the compression time recommendation value of a certain type of file in a compression tool, and M ij /N ij represents the ratio of compression time to file size of all types of files under the compression period, M i /N i represents the ratio of the compression time to the file size of a certain type of file under a compression period.
  • m is a positive integer representing the number of compression tool pressures, and n is a positive integer, which represents compression using the compression tool during a preset period. The number of files of this type. Assume that there are only two compression tools, WinRAR and WinZip, in the compression tool. For the 4M jpg image file, the compression time is 8s and 4s respectively, and the recommended value is used to calculate the formula:
  • the recommended compression values for the jpg image files in WinRAR and WinZip are 10 and 40 respectively.
  • step S50 the compression tool calling program 10 automatically calls the compression tool with the largest compression recommendation value or the compression time recommendation value from the compression tool set 16 to perform a compression operation on the compressed file according to the compression mode selected by the user.
  • the compression mode selected by the user.
  • the file to be compressed is a 4M jpg image file and only two WinRAR and WinZip compression tools are used in the compression tool.
  • the recommended compression values of the 4M jpg image file in WinRAR and WinZip are 10, 40 respectively. , then call WinZip to compress the 4M jpg image file.
  • step S50 the user may also display the recommended compression value or compression time recommendation value of the compressed file in each compression tool in the selected compression mode, and the user selects a suitable compression tool to perform the compression operation according to the business scenario.
  • the recommended compression values of the 4M jpg image files in WinRAR and WinZip are 10 and 40 respectively. Even if the compression time of WinRAR is long, if the user feels that the distortion of WinRAR compression is small, Select WinRAR to compress the file.
  • the compression tool calling method in this embodiment is provided by providing a compression mode for the user, and in the compression mode selected by the user, according to the recommended value of the compression rate or the compression time recommended value of each compression tool of the file to be compressed, the call is most suitable for the compression mode.
  • the compression tool of the business scenario performs compression operations on files, saving file storage space and improving compression performance.
  • FIG. 5 it is a flowchart of the third embodiment of the compression tool calling method of the present application.
  • the compression tool calling method includes: step S10 - step S70.
  • the steps S10 to S40 are substantially the same as those in the first embodiment, and are not described herein again.
  • Step S50 in the compressed mode selected by the user, the compression tool calling program 10 generates a numerical range according to the compression ratio recommendation value or the compression time recommendation value of the file of each type according to each compression tool, and generates a random range within the numerical range. number.
  • the recommended compression values of the 2Mtxt files in the three compression tools of fastlz, lz4, and snappy are 10, 20, and 60 respectively, and the minimum value of the random number generated by the compression tool calling program 10 is 0, the maximum.
  • the value is 90 and a random number is generated, assuming the random number is 30.
  • step S60 the compression tool calling program 10 calculates the difference between the random number and the recommended value of each compression tool based on the generated random number.
  • the random number is 30, and the difference between the compression time recommended values (10, 20, 60) in the three compression tools of the 2Mtxt file in fastlz, lz4, and snappy is 20, 10, and 30, respectively.
  • step S70 the compression tool calling program 10 selects a compression tool corresponding to the minimum difference value from the compression tool set 16, and automatically invokes the compression tool to perform a compression operation on the file.
  • This automatic mode is suitable for a large number of file compression applications. For example, according to the random number 30, the difference between the recommended compression time values in the three compression tools of fastlz, lz4, and snappy is 20, 10, and 30, respectively, and the compression tool (lz4) with the smallest difference is automatically selected to compress the file.
  • Step S70 may also assign a different recommendation level to each compression tool according to the order of the difference from small to large, and display it to the user for reference selection.
  • This recommendation mode is suitable for a small number of file compression requests. For example, according to the difference of 20, 10, 30, assign the highest recommendation level to lz4, assign the next highest recommendation level to fastlz, and assign the lowest recommendation level to snappy.
  • the user can select the compression tool from the compression tool set 16 according to the recommendation level. compression.
  • the compression tool calling method in this embodiment generates a range of values according to the recommended value of each compression tool according to the file to be compressed, and generates a random number in the range, and then takes the recommended value combined with the random number.
  • the number of ways so that the compression tool with smaller recommended value also has a certain chance to be called to perform the compression operation, reducing the burden of the compression tool with a larger recommended value.
  • the embodiment of the present application further provides a computer readable storage medium, where the computer readable storage medium includes a compression tool calling program 10, and when the compression tool calling program 10 is executed by the processor, the following operations are implemented:
  • Parsing step responding to the operation of the compressed file each time the user starts, parsing the type and size of the file to be compressed, and recording the compression mode and compression tool selected by the user;
  • Recording step after the compression is completed, record the compression ratio and compression time of the compression tool for the file of the type and size in the compression mode;
  • the calculation step is: calculating the recommended value of the compression value or the compression time for each type of file for each type of file according to a preset recommended value calculation formula for each preset mode;
  • Receiving step receiving a request of the user to compress the file and a compression mode selected by the user;
  • the compression tool corresponding to the maximum recommended value of the compression rate or the maximum recommended value of the compression time is selected, and the selected compression tool is automatically called to perform a compression operation on the file.
  • the invoking step may be replaced by a displaying step of: displaying, in a mode selected by the user, a compression ratio recommendation value or a compression time recommendation value of each compression tool to the user for selecting a compression tool to perform a compression operation.
  • the application further provides another compression tool calling method, where the method includes:
  • Parsing step responding to the operation of the compressed file each time the user starts, parsing the type and size of the file to be compressed, and recording the compression mode and compression tool selected by the user;
  • Recording step after the compression is completed, record the compression ratio and compression time of the compression tool for the file of the type and size in the compression mode;
  • a first calculating step calculating a recommended value of a compression value or a compression time for each type of file for each type of file according to a preset recommended value calculation formula for each preset mode;
  • Receiving step receiving a request of the user to compress the file and a compression mode selected by the user;
  • the generating step in the compression mode selected by the user, generating a range of values for the compression rate recommendation value or the compression time recommendation value of the file according to each compression tool, and generating a random number within the value range;
  • a second calculating step calculating a difference between the random number and a recommended value of each compression tool
  • Step Select the compression tool corresponding to the minimum difference, and automatically call the selected compression tool to perform the compression operation on the file.
  • the calling step can be replaced with a display step:
  • Each compression tool is assigned a different recommendation level according to the order of the difference from small to large, and is displayed to the user to select a compression tool to perform the compression operation.
  • the recommended value calculation formula comprises:
  • Y 1 represents the compression ratio recommended value of a certain type of file in a compression tool
  • X i represents the compression ratio under the compression tool in the preset period of the type file
  • the recommended value is calculated as:
  • Y 2 represents the compression time recommendation value of a certain type of file in a compression tool
  • M ij /N ij represents the ratio of compression time to file size of all types of files under the compression period
  • M i /N i represents the ratio of the compression time to the file size of a certain type of file under a compression period
  • m is a positive integer representing the number of compression tool pressures
  • n is a positive integer, which represents compression using the compression tool during a preset period.
  • the technical solution of the present application which is essential or contributes to the prior art, may be embodied in the form of a software product stored in a storage medium (such as ROM/RAM as described above). , a disk, an optical disk, including a number of instructions for causing a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to perform the methods described in the various embodiments of the present application.
  • a terminal device which may be a mobile phone, a computer, a server, or a network device, etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

一种压缩工具调用方法、装置及存储介质,该方法包括:响应用户启动压缩文件的操作,解析待压缩文件的类型及大小,记录用户选择的压缩模式及压缩工具(S10);压缩完成后,记录在该压缩模式下,该压缩工具针对该类型、大小的文件的压缩率及压缩时间(S20);每隔预设周期,根据预设的推荐值计算公式计算每种压缩模式下,每种压缩工具针对每种类型文件关于压缩率的推荐值或压缩时间的推荐值(S30);接收用户压缩文件的请求及用户选择的压缩模式(S40);在该压缩模式下,选择压缩率的最大推荐值或压缩时间的最大推荐值对应的压缩工具,自动调用选择的压缩工具对文件进行压缩(S50)。该方法通过在用户选择的压缩模式下选择最优的压缩工具,从而实现压缩处理效果最优化。

Description

压缩工具调用方法、装置及存储介质
优先权申明
本申请要求于2018年01月05日提交中国专利局、申请号为201810010765.1,名称为“压缩工具调用方法、装置及存储介质”的中国专利申请的优先权,该中国专利申请的整体内容以参考的方式结合本申请中。
技术领域
本申请涉及计算机领域,尤其涉及一种压缩工具调用方法、装置及计算机可读存储介质。
背景技术
在一些存储业务场景中,需要对各种类型的文件进行压缩、存储,以节省存储空间。但目前的压缩工具,一方面不能同时拥有高压缩速率和高压缩率,另一方面,对不同类型的文件,不同压缩工具的压缩效果往往也存在较大的差异。这使得工作人员在压缩处理大量不同类型文件时,不能达到存储业务最优化,工作效率低。
发明内容
鉴于以上内容,本申请提供一种压缩工具调用方法、装置及计算机可读存储介质,其主要目的在于根据不同类型的文件,自动选择最优的压缩工具进行压缩,优化存储业务。
为实现上述目的,本申请提供一种压缩工具调用方法,该方法包括:
解析步骤:响应用户每次启动压缩文件的操作,解析待压缩文件的类型及大小,记录用户选择的压缩模式及压缩工具;
记录步骤:压缩完成后,记录在该压缩模式下,该压缩工具针对该类型、大小的文件的压缩率及压缩时间;
计算步骤:每隔预设周期,根据预设的推荐值计算公式计算每种压缩模式下,每种压缩工具针对每种类型文件关于压缩率的推荐值或压缩时间的推荐值;
接收步骤:接收用户压缩文件的请求及用户选择的压缩模式;
调用步骤:在该压缩模式下,选择压缩率的最大推荐值或压缩时间的最大推荐值对应的压缩工具,自动调用选择的压缩工具对文件执行压缩操作。
可选地,本申请还提供另一种压缩工具调用方法,该方法包括:
解析步骤:响应用户每次启动压缩文件的操作,解析待压缩文件的类型及大小,记录用户选择的压缩模式及压缩工具;
记录步骤:压缩完成后,记录在该压缩模式下,该压缩工具针对该类型、大小的文件的压缩率及压缩时间;
第一计算步骤:每隔预设周期,根据预设的推荐值计算公式计算每种压缩模式下,每种压缩工具针对每种类型文件关于压缩率的推荐值或压缩时间的推荐值;
接收步骤:接收用户压缩文件的请求及用户选择的压缩模式;
生成步骤:在用户选择的压缩模式下,根据每种压缩工具对这种类型的文件的压缩率推荐值或压缩时间推荐值生成一个数值范围,在该数值范围内产生一个随机数;
第二计算步骤:计算该随机数与每种压缩工具的推荐值的差值;
调用步骤:选择最小差值对应的压缩工具,自动调用选择的压缩工具对文件执行压缩操作。
此外,本申请还提供一种电子装置,该电子装置包括:存储器、处理器及显示器,所述存储器上存储压缩工具调用程序,所述压缩工具调用程序被所述处理器执行,可实现如下步骤:
解析步骤:响应用户每次启动压缩文件的操作,解析待压缩文件的类型及大小,记录用户选择的压缩模式及压缩工具;
记录步骤:压缩完成后,记录在该压缩模式下,该压缩工具针对该类型、大小的文件的压缩率及压缩时间;
计算步骤:每隔预设周期,根据预设的推荐值计算公式计算每种压缩模式下,每种压缩工具针对每种类型文件关于压缩率的推荐值或压缩时间的推荐值;
接收步骤:接收用户压缩文件的请求及用户选择的压缩模式;
调用步骤:在该压缩模式下,根据预先确定的压缩规则,调用压缩工具对该文件执行压缩操作。
此外,为实现上述目的,本申请还提供一种计算机可读存储介质,所述计算机可读存储介质中包括压缩工具调用程序,所述压缩工具调用程序被处理器执行时,可实现如上所述压缩工具调用方法中的任意步骤。
本申请提出的压缩工具调用方法、电子装置及计算机可读存储介质,通过接收用户压缩文件的请求,根据待压缩文件的类型及大小,在用户选择的压缩模式下,自动调用压缩率推荐值最大或压缩时间推荐值最大的压缩工具对该文件进行压缩,节省存储空间,提高工作效率。
附图说明
图1为本申请电子装置较佳实施例的示意图;
图2为图1中压缩工具调用程序较佳实施例的模块示意图;
图3为本申请压缩工具调用方法第一实施例的流程图;
图4为本申请压缩工具调用方法第二实施例的流程图;
图5为本申请压缩工具调用方法第三实施例的流程图;
图6为本申请压缩工具调用方法第四实施例的流程图;
图7为本申请压缩工具调用方法的应用环境示意图。
本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。
具体实施方式
应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。
如图1所示,是本申请电子装置1较佳实施例的示意图。
在本实施例中,电子装置1可以是服务器、智能手机、平板电脑、个人电脑、便携计算机以及其他具有运算功能的电子设备。
该电子装置1包括:存储器11、处理器12、显示器13、网络接口14及 通信总线15。其中,网络接口14可选地可以包括标准的有线接口、无线接口(如WI-FI接口)。通信总线15用于实现这些组件之间的连接通信。
存储器11至少包括一种类型的可读存储介质。所述至少一种类型的可读存储介质可为如闪存、硬盘、多媒体卡、卡型存储器等的非易失性存储介质。在一些实施例中,所述存储器11可以是所述电子装置1的内部存储单元,例如该电子装置1的硬盘。在另一些实施例中,所述存储器11也可以是所述电子装置1的外部存储单元,例如所述电子装置1上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。
在本实施例中,所述存储器11不仅可以用于存储安装于所述电子装置1的应用软件及各类数据,例如压缩工具调用程序10、各种类型的压缩工具16及各种类型、大小文件在各个压缩工具的压缩时间和压缩率的记录,还可以用于暂时地存储已经输出或者将要输出的数据。
处理器12在一些实施例中可以是一中央处理器(Central Processing Unit,CPU),微处理器或其它数据处理芯片,用于运行存储器11中存储的程序代码或处理数据,例如执行压缩工具调用程序10的计算机程序代码等。
显示器13可以称为显示屏或显示单元。在一些实施例中显示器13可以是LED显示器、液晶显示器、触控式液晶显示器以及有机发光二极管(Organic Light-Emitting Diode,OLED)触摸器等。显示器13用于显示在电子装置1中处理的信息以及用于显示可视化的工作界面,如显示压缩模式选择页面。
优选地,该电子装置1还可以包括用户接口,用户接口可以包括输入单元比如键盘(Keyboard)、语音输出装置比如音响、耳机等,可选地用户接口还可以包括标准的有线接口、无线接口。
在图1所示的装置实施例中,作为一种计算机存储介质的存储器11中存储压缩工具调用程序10的程序代码,处理器12执行压缩工具调用程序10的程序代码时,实现如下步骤:
解析步骤:响应用户每次启动压缩文件的操作,解析待压缩文件的类型及大小,记录用户选择的压缩模式及压缩工具;
记录步骤:压缩完成后,记录在该压缩模式下,该压缩工具针对该类型、 大小的文件的压缩率及压缩时间;
计算步骤:每隔预设周期,根据预设的推荐值计算公式计算每种压缩模式下,每种压缩工具针对每种类型文件关于压缩率的推荐值或压缩时间的推荐值;
接收步骤:接收用户压缩文件的请求及用户选择的压缩模式;
调用步骤:在该压缩模式下,选择压缩率的最大推荐值或压缩时间的最大推荐值对应的压缩工具,自动调用选择的压缩工具对文件执行压缩操作。
本实施例中,压缩工具调用程序10响应用户每次启动压缩文件的操作,解析待压缩文件的类型及大小,记录用户选择的压缩模式及压缩工具。例如,用户压缩图片文件时,压缩工具调用程序自动解析待压缩的图片文件的类型及占用空间大小,并记录该用户所选择的压缩模式及压缩工具。其中,文件类型包括:多媒体文件(如音频文件、视频文件、图像文件等)、文档类文件(如doc文件、txt文件、xls文件等)及可执行文件(如exe文件安装包等)。对于不同类型及大小的文件,不同的压缩工具压缩文件的压缩率和压缩时间各不相同。例如,fastlz、lz4针对2M的txt文件的压缩率分别为14%、18%,压缩时间分别为4s、6s。压缩模式包括极限压缩模式和极速压缩模式。其中,极限压缩模式主要侧重于文件的压缩率,极速压缩模式主要侧重于文件的压缩时间。
压缩完成后,压缩工具调用程序10记录在该压缩模式下,该压缩工具针对该类型、大小的文件的压缩率及压缩时间。例如,用户选择的是极限压缩模式,调用的压缩工具是WinRAR,则压缩完成后,记录压缩模式、压缩工具、文件类型、文件大小、压缩率及压缩时间分别为:极限压缩模式-WinRAR-图片文件-4M-28%-10s。其中,所述压缩工具包含:fastlz、lz4、snappy、deflate、WinRAR、WinZip、zlib等压缩工具的一种或几种。
压缩工具调用程序10每隔预设周期,根据预设的推荐值计算公式计算每种压缩模式下,每种压缩工具针对每种类型文件关于压缩率的推荐值或压缩时间的推荐值。例如,每个月的最后一天晚上,压缩工具调用程序自动利用预设的推荐值计算公式,根据该月记录的每种类型文件在每种压缩工具的压缩率和压缩时间,计算每个文件在每种压缩工具的推荐值。
其中,所述预设的推荐值计算公式包括:
极限压缩模式下,推荐值计算公式为:
Figure PCTCN2018077620-appb-000001
其中Y 1代表某种类型文件在某种压缩工具的压缩率推荐值,X i代表该类型文件预设周期内在该压缩工具下的压缩率,n为正整数,代表预设周期内利用该压缩工具压缩过的该类型文件的数量。例如,预设周期内,WinRAR针对doc文件的压缩率为30%、28%,则利用推荐值计算公式:
Figure PCTCN2018077620-appb-000002
算出doc文件在WinRAR的压缩率推荐值为71。
极速压缩模式下,推荐值计算公式为:
Figure PCTCN2018077620-appb-000003
Figure PCTCN2018077620-appb-000004
其中Y2代表某种类型文件在某种压缩工具的压缩时间推荐值,M ij/N ij代表预设周期内,该类型文件在所有压缩工具下压缩时间与文件大小之比,M i/N j代表预设周期内,该类型文件在某压缩工具下压缩时间与文件大小之比,m为正整数,代表压缩工具压的数量,n为正整数,代表预设周期内利用该压缩工具压缩过的该类型文件的数量。假设压缩工具中只有WinRAR和WinZip两种压缩工具,针对4M的jpg图片文件,压缩时间分别为8s、4s,则利用推荐值计算公式:
Figure PCTCN2018077620-appb-000005
算出jpg图片文件在WinRAR和WinZip的压缩时间推荐值分别为10、40。
当用户需要压缩多媒体文件时,在压缩模式选择页面选择适合的压缩模式。压缩工具调用程序10接收用户压缩文件的请求及用户选择的压缩模式。例如,接收4M的jpg图片文件和用户选择的极速压缩模式。
压缩工具调用程序10根据用户选择的压缩模式,自动调用压缩率推荐值最大或压缩时间推荐值最大的压缩工具对待压缩文件执行压缩操作。例如,在极速压缩模式下,假设待压缩文件为4M的jpg图片文件且压缩工具中只有WinRAR和WinZip两种压缩工具,4M的jpg图片文件在WinRAR和WinZip的压缩时间推荐值分别为10、40,则调用WinZip对4M的jpg图片文件进行压缩。
在另一个实施例中,还可以向用户展示在选择的压缩模式下,待压缩文件在每种压缩工具的压缩率推荐值或压缩时间推荐值,用户根据业务场景选择合适的压缩工具执行压缩操作。例如,在极速压缩模式下,显示4M的jpg图片文件在WinRAR和WinZip的压缩时间推荐值分别为10、40,即使WinRAR的压缩时间较长,但是若用户觉得WinRAR压缩的失真较小,依然可以选择WinRAR对文件进行压缩。
上述实施例提出的压缩工具调用方法,根据用户选择的压缩模式查询待 压缩文件在每个压缩工具中的压缩率推荐值或压缩时间推荐值,自动调用最优的压缩工具对文件进行压缩处理,减少工作人员的手动压缩操作,提高业务处理效率。
如图2所示,是图1中压缩工具调用程序10较佳实施例的模块示意图。本申请所称的模块是指能够完成特定功能的一系列计算机程序指令段。
在本实施例中,压缩工具调用程序10包括:解析模块110、记录模块120、计算模块130、接收模块140、调用模块150,所述模块110-150所实现的功能或操作步骤均与上文类似,此处不再详述,示例性地,例如其中:
解析模块110,用于响应用户每次启动压缩文件的操作,解析待压缩文件的类型及大小,记录用户选择的压缩模式及压缩工具;
记录模块120,用于压缩完成后,记录在该压缩模式下,该压缩工具针对该类型、大小的文件的压缩率及压缩时间;
计算模块130,用于每隔预设周期,根据预设的推荐值计算公式计算每种压缩模式下,每种压缩工具针对每种类型文件关于压缩率的推荐值或压缩时间的推荐值;
接收模块140,用于接收用户压缩文件的请求及用户选择的压缩模式;
调用模块150,用于在该压缩模式下,选择压缩率的最大推荐值或压缩时间的最大推荐值对应的压缩工具,自动调用选择的压缩工具对文件执行压缩操作。
如图3所示,是本申请压缩工具调用方法第一实施例的流程图。
在本实施例中,处理器12执行存储器11中存储的压缩工具调用程序10的计算机程序时实现压缩工具调用方法包括:步骤S10-步骤S50:
步骤S10,如图7所示,是本申请压缩工具调用方法的应用环境示意图,压缩工具调用程序10响应用户每次启动压缩文件的操作,解析待压缩文件的类型及大小,记录用户选择的压缩模式及压缩工具。其中,压缩工具存储于压缩工具库16。例如,用户压缩图片文件时,压缩工具调用程序自动解析待压缩的图片文件的类型及占用空间大小,并记录该用户所选择的压缩模式及压缩工具。其中,文件类型包括:多媒体文件(如音频文件、视频文件、图 像文件等)、文档类文件(如doc文件、txt文件、xls文件等)及可执行文件(如exe文件安装包等)。对于不同类型及大小的文件,不同的压缩工具压缩文件的压缩率和压缩时间各不相同。例如,fastlz、lz4针对2M的txt文件的压缩率分别为14%、18%,压缩时间分别为4s、6s。压缩模式包括极限压缩模式和极速压缩模式。其中,极限压缩模式主要侧重于文件的压缩率,极速压缩模式主要侧重于文件的压缩时间。
步骤S20,压缩完成后,压缩工具调用程序10记录在该压缩模式下,该压缩工具针对该类型、大小的文件的压缩率及压缩时间。例如,用户选择的是极限压缩模式,调用的压缩工具是WinRAR,则压缩完成后,记录压缩模式、压缩工具、文件类型、文件大小、压缩率及压缩时间分别为:极限压缩模式-WinRAR-图片文件-4M-28%-10s。其中,所述压缩工具包含:fastlz、lz4、snappy、deflate、WinRAR、WinZip、zlib等压缩工具的一种或几种。
步骤S30,压缩工具调用程序10每隔预设周期,根据预设的推荐值计算公式计算每种压缩模式下,每种压缩工具针对每种类型文件关于压缩率的推荐值或压缩时间的推荐值。例如,每个月的最后一天晚上,压缩工具调用程序自动利用预设的推荐值计算公式,根据该月记录的每种类型文件在每种压缩工具的压缩率和压缩时间,计算每个文件在每种压缩工具的推荐值。
其中,所述预设的推荐值计算公式包括:
极限压缩模式下,推荐值计算公式为:
Figure PCTCN2018077620-appb-000006
其中Y 1代表某种类型文件在某种压缩工具的压缩率推荐值,X i代表该类型文件预设周期内在该压缩工具下的压缩率,n为正整数,代表预设周期内利用该压缩工具压缩过的该类型文件的数量。例如,预设周期内,WinRAR针对doc文件的压缩率为30%、28%,则利用推荐值计算公式:
Figure PCTCN2018077620-appb-000007
算出doc文件在WinRAR的压缩率推荐值为71。
极速压缩模式下,推荐值计算公式为:
Figure PCTCN2018077620-appb-000008
Figure PCTCN2018077620-appb-000009
其中Y 2代表某种类型文件在某种压缩工具的压缩时间推荐值,M ij/N ij代表预设周期内,该类型文件在所有压缩工具下压缩时间与文件大小之比,M i/N i代表预设周期内,该类型文件在某压缩工具下压缩时间与文件大小之比,m为正整数,代表压缩工具压的数量,n为正整数,代表预设周期内利用该压缩工具压缩过的该类型文件的数量。假设压缩工具中只有WinRAR和 WinZip两种压缩工具,针对4M的jpg图片文件,压缩时间分别为8s、4s,则利用推荐值计算公式:
Figure PCTCN2018077620-appb-000010
算出jpg图片文件在WinRAR和WinZip的压缩时间推荐值分别为10、40。
步骤S50,压缩工具调用程序10根据用户选择的压缩模式,从压缩工具集16中自动调用压缩率推荐值最大或压缩时间推荐值最大的压缩工具对待压缩文件执行压缩操作。例如,在极速压缩模式下,假设待压缩文件为4M的jpg图片文件且压缩工具中只有WinRAR和WinZip两种压缩工具,4M的jpg图片文件在WinRAR和WinZip的压缩时间推荐值分别为10、40,则调用WinZip对4M的jpg图片文件进行压缩。
在另一个实施例中,如图4所示,是本申请压缩工具调用方法第二实施例的流程图。步骤S50还可以是向用户展示在选择的压缩模式下,待压缩文件在每种压缩工具的压缩率推荐值或压缩时间推荐值,用户根据业务场景选择合适的压缩工具执行压缩操作。例如,在极速压缩模式下,显示4M的jpg图片文件在WinRAR和WinZip的压缩时间推荐值分别为10、40,即使WinRAR的压缩时间较长,但是若用户觉得WinRAR压缩的失真较小,依然可以选择WinRAR对文件进行压缩。
本实施例提出的压缩工具调用方法,通过为用户提供压缩模式,在用户选择的压缩模式下,根据待压缩文件的在每个压缩工具的压缩率推荐值或压缩时间推荐值,调用最适合该业务场景的压缩工具对文件执行压缩操作,节省文件存储空间,提高压缩性能。
如图5所示,是本申请压缩工具调用方法第三实施例的流程图。
在本实施例中,压缩工具调用方法包括:步骤S10-步骤S70。其中步骤S10-步骤S40与第一实施例中的内容大致相同,这里不再赘述。
步骤S50,在用户选择的压缩模式下,压缩工具调用程序10根据每种压缩工具对这种类型的文件的压缩率推荐值或压缩时间推荐值生成一个数值范围,在该数值范围内产生一个随机数。例如,在极速压缩模式下,2Mtxt文件在fastlz、lz4、snappy三种压缩工具中的压缩时间推荐值分别为10、20、60,则压缩工具调用程序10生成的随机数最小值为0,最大值为90,并产生一个随机数,假设该随机数为30。
步骤S60,压缩工具调用程序10根据产生的随机数,计算该随机数与每种压缩工具的推荐值的差值。例如,随机数为30,与2Mtxt文件在fastlz、lz4、snappy三种压缩工具中的压缩时间推荐值(10、20、60)的差值分别为20、10、30。
步骤S70,压缩工具调用程序10从压缩工具集16中选择最小差值对应的压缩工具,自动调用该压缩工具对文件执行压缩操作。该自动模式适用于大量文件压缩申请。例如,根据随机数30,与fastlz、lz4、snappy三种压缩工具中的压缩时间推荐值的差值分别为20、10、30,自动选择差值最小的压缩工具(lz4)对文件进行压缩。
在另一个实施例中,如图6所示,是本申请压缩工具调用方法第四实施例的流程图。步骤S70还可以是根据差值从小到大的顺序给每种压缩工具分配不同的推荐级别,并展示给用户参考选择。该推荐模式适用于少量文件压缩请求。例如,根据差值为20、10、30,给lz4分配最高推荐级别,给fastlz分配次高推荐级别,给snappy分配最低推荐级别,用户可根据推荐级别从压缩工具集16中选择压缩工具进行文件压缩。
相比于第一实施例,本实施例提出的压缩工具调用方法,根据待压缩文件在每种压缩工具的推荐值生成一个数值范围,并在范围内产生一个随机数,然后采取推荐值结合随机数的方式,使得推荐值较小的压缩工具也有一定几率被调用执行压缩操作,减少推荐值较大的压缩工具的负担。
此外,本申请实施例还提出一种计算机可读存储介质,所述计算机可读存储介质中包括压缩工具调用程序10,所述压缩工具调用程序10被处理器执行时实现如下操作:
解析步骤:响应用户每次启动压缩文件的操作,解析待压缩文件的类型及大小,记录用户选择的压缩模式及压缩工具;
记录步骤:压缩完成后,记录在该压缩模式下,该压缩工具针对该类型、大小的文件的压缩率及压缩时间;
计算步骤:每隔预设周期,根据预设的推荐值计算公式计算每种压缩模式下,每种压缩工具针对每种类型文件关于压缩率的推荐值或压缩时间的推荐值;
接收步骤:接收用户压缩文件的请求及用户选择的压缩模式;
调用步骤:在该压缩模式下,选择压缩率的最大推荐值或压缩时间的最大推荐值对应的压缩工具,自动调用选择的压缩工具对文件执行压缩操作。
可选地,所述调用步骤可以替换为展示步骤:在用户选择的模式下,向用户展示每种压缩工具的压缩率推荐值或压缩时间推荐值,供用户参考选择压缩工具执行压缩操作。
可选地,本申请还提供另一种压缩工具调用方法,该方法包括:
解析步骤:响应用户每次启动压缩文件的操作,解析待压缩文件的类型及大小,记录用户选择的压缩模式及压缩工具;
记录步骤:压缩完成后,记录在该压缩模式下,该压缩工具针对该类型、大小的文件的压缩率及压缩时间;
第一计算步骤:每隔预设周期,根据预设的推荐值计算公式计算每种压缩模式下,每种压缩工具针对每种类型文件关于压缩率的推荐值或压缩时间的推荐值;
接收步骤:接收用户压缩文件的请求及用户选择的压缩模式;
生成步骤:在用户选择的压缩模式下,根据每种压缩工具对这种类型的文件的压缩率推荐值或压缩时间推荐值生成一个数值范围,在该数值范围内产生一个随机数;
第二计算步骤:计算该随机数与每种压缩工具的推荐值的差值;
调用步骤:选择最小差值对应的压缩工具,自动调用选择的压缩工具对文件执行压缩操作。
可选地,所述调用步骤可以替换为展示步骤:
根据差值从小到大的顺序给每种压缩工具分配不同的推荐级别,并展示给用户参考选择压缩工具,执行压缩操作。
优选地,所述推荐值计算公式包括:
极限压缩模式下,推荐值计算公式为:
Figure PCTCN2018077620-appb-000011
其中Y 1代表某种类型文件在某种压缩工具的压缩率推荐值,X i代表该类型文件预设周期内在该压缩工具下的压缩率,n为正整数,代表预设周期内利用该压缩工具压缩过的该类型文件的数量,其中i=(1,2,…,n);
极速压缩模式下,推荐值计算公式为:
Figure PCTCN2018077620-appb-000012
其中Y 2代表某种类型文件在某种压缩工具的压缩时间推荐值,M ij/N ij代表预设周期内,该类型文件在所有压缩工具下压缩时间与文件大小之比,M i/N i代表预设周期内,该类型文件在某压缩工具下压缩时间与文件大小之比,m为正整数,代表压缩工具压的数量,n为正整数,代表预设周期内利用该压缩工具压缩过的该类型文件的数量,其中i=(1,2,…,n),j=(1,2,…,m)。
本申请之计算机可读存储介质的具体实施方式与上述压缩工具调用方法的具体实施方式大致相同,在此不再赘述。
上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在如上所述的一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,或者网络设备等)执行本申请各个实施例所述的方法。
以上仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。

Claims (20)

  1. 一种压缩工具调用方法,其特征在于,所述方法包括:
    解析步骤:响应用户每次启动压缩文件的操作,解析待压缩文件的类型及大小,记录用户选择的压缩模式及压缩工具;
    记录步骤:压缩完成后,记录在该压缩模式下,该压缩工具针对该类型、大小的文件的压缩率及压缩时间;
    计算步骤:每隔预设周期,根据预设的推荐值计算公式计算每种压缩模式下,每种压缩工具针对每种类型文件关于压缩率的推荐值或压缩时间的推荐值;
    接收步骤:接收用户压缩文件的请求及用户选择的压缩模式;
    调用步骤:在该压缩模式下,选择压缩率的最大推荐值或压缩时间的最大推荐值对应的压缩工具,自动调用选择的压缩工具对文件执行压缩操作。
  2. 根据权利要求1所述的压缩工具调用方法,其特征在于,所述预设的推荐值计算公式包括:极限压缩模式的推荐值计算公式和极速压缩模式的推荐值计算公式。
  3. 根据权利要求1所述的压缩工具调用方法,其特征在于,所述极限压缩模式的推荐值计算公式为:
    Figure PCTCN2018077620-appb-100001
    其中Y 1代表某种类型文件在某种压缩工具的压缩率推荐值,X i代表该类型文件预设周期内在该压缩工具下的压缩率,n为正整数,代表预设周期内利用该压缩工具压缩过的该类型文件的数量,其中i=(1,2,…,n)。
  4. 根据权利要求3所述的压缩工具调用方法,其特征在于,所述极速压缩模式的推荐值计算公式为:
    Figure PCTCN2018077620-appb-100002
    其中Y 2代表某种类型文件在某种压缩工具的压缩时间推荐值,M ij/N ij代表预设周期内,该类型文件在所有压缩工具下压缩时间与文件大小之比,M i/N i代表预设周期内,该类型文件在某压缩工具下压缩时间与文件大小之比,m为正整数,代表压缩工具压的数量,n为正整数,代表预设周期内利用该压缩工具压缩过的该类型文件的数量,其中i=(1,2,…,n),j=(1,2,…,m)。
  5. 根据权利要求1所述的压缩工具调用方法,其特征在于,所述调用步 骤可以替换为展示步骤:在用户选择的模式下,向用户展示每种压缩工具的压缩率推荐值或压缩时间推荐值,供用户参考选择压缩工具执行压缩操作。
  6. 一种压缩工具调用方法,其特征在于,所述方法包括:
    解析步骤:响应用户每次启动压缩文件的操作,解析待压缩文件的类型及大小,记录用户选择的压缩模式及压缩工具;
    记录步骤:压缩完成后,记录在该压缩模式下,该压缩工具针对该类型、大小的文件的压缩率及压缩时间;
    第一计算步骤:每隔预设周期,根据预设的推荐值计算公式计算每种压缩模式下,每种压缩工具针对每种类型文件关于压缩率的推荐值或压缩时间的推荐值;
    接收步骤:接收用户压缩文件的请求及用户选择的压缩模式;
    生成步骤:在用户选择的压缩模式下,根据每种压缩工具对这种类型的文件的压缩率推荐值或压缩时间推荐值生成一个数值范围,在该数值范围内产生一个随机数;
    第二计算步骤:计算该随机数与每种压缩工具的推荐值的差值;
    调用步骤:选择最小差值对应的压缩工具,自动调用选择的压缩工具对文件执行压缩操作。
  7. 根据权利要求6所述的压缩工具调用方法,其特征在于,所述调用步骤可以替换为展示步骤:
    根据差值从小到大的顺序给每种压缩工具分配不同的推荐级别,并展示给用户参考选择压缩工具,执行压缩操作。
  8. 一种电子装置,其特征在于,所述装置包括:存储器、处理器及显示器,所述存储器上存储有压缩工具调用程序,所述压缩工具调用程序被所述处理器执行,可实现如下步骤:
    解析步骤:响应用户每次启动压缩文件的操作,解析待压缩文件的类型及大小,记录用户选择的压缩模式及压缩工具;
    记录步骤:压缩完成后,记录在该压缩模式下,该压缩工具针对该类型、大小的文件的压缩率及压缩时间;
    计算步骤:每隔预设周期,根据预设的推荐值计算公式计算每种压缩模式下,每种压缩工具针对每种类型文件关于压缩率的推荐值或压缩时间的推 荐值;
    接收步骤:接收用户压缩文件的请求及用户选择的压缩模式;
    调用步骤:在该压缩模式下,根据预先确定的压缩规则,调用压缩工具对该文件执行压缩操作。
  9. 根据权利要求8所述的电子装置,其特征在于,所述预设的推荐值计算公式包括:极限压缩模式的推荐值计算公式和极速压缩模式的推荐值计算公式。
  10. 根据权利要求8所述的电子装置,其特征在于,所述极限压缩模式的推荐值计算公式为:
    Figure PCTCN2018077620-appb-100003
    其中Y 1代表某种类型文件在某种压缩工具的压缩率推荐值,X i代表该类型文件预设周期内在该压缩工具下的压缩率,n为正整数,代表预设周期内利用该压缩工具压缩过的该类型文件的数量,其中i=(1,2,…,n)。
  11. 根据权利要求10所述的电子装置,其特征在于,所述极速压缩模式的推荐值计算公式为:
    Figure PCTCN2018077620-appb-100004
    其中Y 2代表某种类型文件在某种压缩工具的压缩时间推荐值,M ij/N ij代表预设周期内,该类型文件在所有压缩工具下压缩时间与文件大小之比,M i/N i代表预设周期内,该类型文件在某压缩工具下压缩时间与文件大小之比,m为正整数,代表压缩工具压的数量,n为正整数,代表预设周期内利用该压缩工具压缩过的该类型文件的数量,其中i=(1,2,…,n),j=(1,2,…,m)。
  12. 根据权利要求8所述的电子装置,其特征在于,所述预先确定的压缩规则包括:选择压缩率的最大推荐值或压缩时间的最大推荐值对应的压缩工具。
  13. 根据权利要求8所述的电子装置,其特征在于,所述预先确定的压缩规则包括:
    在用户选择的压缩模式下,根据每种压缩工具对这种类型的文件的压缩率推荐值或压缩时间推荐值生成一个数值范围,在该数值范围内产生一个随机数;
    计算该随机数与每种压缩工具的推荐值的差值,选择最小差值对应的压 缩工具。
  14. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中包括压缩工具调用程序,所述统压缩工具调用程序被处理器执行时实现如下步骤:
    解析步骤:响应用户每次启动压缩文件的操作,解析待压缩文件的类型及大小,记录用户选择的压缩模式及压缩工具;
    记录步骤:压缩完成后,记录在该压缩模式下,该压缩工具针对该类型、大小的文件的压缩率及压缩时间;
    计算步骤:每隔预设周期,根据预设的推荐值计算公式计算每种压缩模式下,每种压缩工具针对每种类型文件关于压缩率的推荐值或压缩时间的推荐值;
    接收步骤:接收用户压缩文件的请求及用户选择的压缩模式;
    调用步骤:在该压缩模式下,选择压缩率的最大推荐值或压缩时间的最大推荐值对应的压缩工具,自动调用选择的压缩工具对文件执行压缩操作。
  15. 根据权利要求14所述的计算机可读存储介质,其特征在于,所述预设的推荐值计算公式包括:极限压缩模式的推荐值计算公式和极速压缩模式的推荐值计算公式。
  16. 根据权利要求14所述的计算机可读存储介质,其特征在于,所述极限压缩模式的推荐值计算公式为:
    Figure PCTCN2018077620-appb-100005
    其中Y 1代表某种类型文件在某种压缩工具的压缩率推荐值,X i代表该类型文件预设周期内在该压缩工具下的压缩率,n为正整数,代表预设周期内利用该压缩工具压缩过的该类型文件的数量,其中i=(1,2,…,n)。
  17. 根据权利要求16所述的计算机可读存储介质,其特征在于,所述极速压缩模式的推荐值计算公式为:
    Figure PCTCN2018077620-appb-100006
    其中Y 2代表某种类型文件在某种压缩工具的压缩时间推荐值,M ij/N ij代表预设周期内,该类型文件在所有压缩工具下压缩时间与文件大小之比,M i/N i代表预设周期内,该类型文件在某压缩工具下压缩时间与文件大小之比,m为正整数,代表压缩工具压的数量,n为正整数,代表预设周期内利用该压 缩工具压缩过的该类型文件的数量,其中i=(1,2,…,n),j=(1,2,…,m)。
  18. 根据权利要求14所述的计算机可读存储介质,其特征在于,所述调用步骤可以替换为展示步骤:在用户选择的模式下,向用户展示每种压缩工具的压缩率推荐值或压缩时间推荐值,供用户参考选择压缩工具执行压缩操作。
  19. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中包括压缩工具调用程序,所述统压缩工具调用程序被处理器执行时实现如下步骤:
    解析步骤:响应用户每次启动压缩文件的操作,解析待压缩文件的类型及大小,记录用户选择的压缩模式及压缩工具;
    记录步骤:压缩完成后,记录在该压缩模式下,该压缩工具针对该类型、大小的文件的压缩率及压缩时间;
    第一计算步骤:每隔预设周期,根据预设的推荐值计算公式计算每种压缩模式下,每种压缩工具针对每种类型文件关于压缩率的推荐值或压缩时间的推荐值;
    接收步骤:接收用户压缩文件的请求及用户选择的压缩模式;
    生成步骤:在用户选择的压缩模式下,根据每种压缩工具对这种类型的文件的压缩率推荐值或压缩时间推荐值生成一个数值范围,在该数值范围内产生一个随机数;
    第二计算步骤:计算该随机数与每种压缩工具的推荐值的差值;
    调用步骤:选择最小差值对应的压缩工具,自动调用选择的压缩工具对文件执行压缩操作。
  20. 根据权利要求19所述的计算机可读存储介质,其特征在于,所述调用步骤可以替换为展示步骤:
    根据差值从小到大的顺序给每种压缩工具分配不同的推荐级别,并展示给用户参考选择压缩工具,执行压缩操作。
PCT/CN2018/077620 2018-01-05 2018-02-28 压缩工具调用方法、装置及存储介质 WO2019134244A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810010765.1A CN108427704B (zh) 2018-01-05 2018-01-05 压缩工具调用方法、装置及存储介质
CN201810010765.1 2018-01-05

Publications (1)

Publication Number Publication Date
WO2019134244A1 true WO2019134244A1 (zh) 2019-07-11

Family

ID=63155843

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/077620 WO2019134244A1 (zh) 2018-01-05 2018-02-28 压缩工具调用方法、装置及存储介质

Country Status (2)

Country Link
CN (1) CN108427704B (zh)
WO (1) WO2019134244A1 (zh)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112835479A (zh) * 2019-11-25 2021-05-25 腾讯科技(深圳)有限公司 一种压缩文件查看方法、装置、设备及可读存储介质
CN111683189B (zh) * 2020-05-14 2023-04-07 苏州达家迎信息技术有限公司 图片压缩方法、系统、终端、及存储介质
CN111817722A (zh) * 2020-07-09 2020-10-23 北京奥星贝斯科技有限公司 数据压缩方法、装置及计算机设备

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7420992B1 (en) * 2005-03-17 2008-09-02 Packeteer, Inc. Adaptive network traffic compression mechanism including dynamic selection of compression algorithms
CN102684705A (zh) * 2012-05-30 2012-09-19 奇智软件(北京)有限公司 数据压缩方法及装置
CN102761540A (zh) * 2012-05-30 2012-10-31 北京奇虎科技有限公司 数据压缩方法、装置、系统以及服务器
CN102761339A (zh) * 2012-05-30 2012-10-31 北京奇虎科技有限公司 数据压缩方法及装置

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101095284B (zh) * 2004-12-28 2012-04-18 卡西欧电子工业株式会社 用于有选择地压缩和解压缩数据的设备与方法
CN100573385C (zh) * 2007-06-01 2009-12-23 华南理工大学 一种分布式双层实时压缩方法及系统
CN102957906A (zh) * 2011-08-29 2013-03-06 广州九游信息技术有限公司 图像分类压缩方法和系统
CN103761153B (zh) * 2012-05-02 2018-02-27 北京奇虎科技有限公司 压缩工具资源调用方法及装置
CN102820888B (zh) * 2012-06-05 2016-02-03 大唐移动通信设备有限公司 一种数据压缩方法和系统
GB2530012A (en) * 2014-08-05 2016-03-16 Illumina Cambridge Ltd Methods and systems for data analysis and compression

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7420992B1 (en) * 2005-03-17 2008-09-02 Packeteer, Inc. Adaptive network traffic compression mechanism including dynamic selection of compression algorithms
CN102684705A (zh) * 2012-05-30 2012-09-19 奇智软件(北京)有限公司 数据压缩方法及装置
CN102761540A (zh) * 2012-05-30 2012-10-31 北京奇虎科技有限公司 数据压缩方法、装置、系统以及服务器
CN102761339A (zh) * 2012-05-30 2012-10-31 北京奇虎科技有限公司 数据压缩方法及装置

Also Published As

Publication number Publication date
CN108427704B (zh) 2022-08-09
CN108427704A (zh) 2018-08-21

Similar Documents

Publication Publication Date Title
US9292153B1 (en) Systems and methods for providing efficient and focused visualization of data
US20220156447A1 (en) Adaptive Column Selection
WO2019134244A1 (zh) 压缩工具调用方法、装置及存储介质
WO2019134340A1 (zh) 薪资计算方法、应用服务器及计算机可读存储介质
US9721015B2 (en) Providing a query results page
WO2021068765A1 (zh) web页面截屏方法、装置、设备及计算机可读存储介质
CN107329976B (zh) 网页分页方法、装置、计算机设备及计算机可读存储介质
CN105631035A (zh) 数据存储方法和装置
EP2874054A1 (en) Application text adjusting method, device, and terminal
US10437440B2 (en) Analytic data export tool
US20130024766A1 (en) System and method of context aware adaption of content for a mobile device
CN110929131A (zh) 数据导出方法、装置、设备及存储介质
US20190026929A1 (en) Organizing images automatically into image grid layout
CN109614600B (zh) 报表展示方法、装置及计算机存储介质
CN105653674B (zh) 智能终端的文件管理方法及系统
CN113934955A (zh) 浏览器生成显示ppt文件的方法、浏览器及存储介质
WO2019136813A1 (zh) Api文件管理方法、服务器及存储介质
US10162500B2 (en) Dynamically render large dataset in client application
US11068853B2 (en) Providing calendar utility to capture calendar event
US20180088758A1 (en) Preserve input focus in virtualized dataset
US20150292890A1 (en) Method and apparatus for displaying road map
CN108052521B (zh) 协调数据显示方法、应用服务器及存储介质
CN110888901B (zh) 系统管理方法、装置、计算机设备和存储介质
CN111143293B (zh) 一种元数据获取方法、装置、设备及计算机可读存储介质
WO2017000696A1 (zh) 交互处理方法及装置

Legal Events

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

Ref document number: 18898913

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 20/10/2020)

122 Ep: pct application non-entry in european phase

Ref document number: 18898913

Country of ref document: EP

Kind code of ref document: A1