WO2018214140A1 - Data compression method and data decompression method, and related device - Google Patents

Data compression method and data decompression method, and related device Download PDF

Info

Publication number
WO2018214140A1
WO2018214140A1 PCT/CN2017/086062 CN2017086062W WO2018214140A1 WO 2018214140 A1 WO2018214140 A1 WO 2018214140A1 CN 2017086062 W CN2017086062 W CN 2017086062W WO 2018214140 A1 WO2018214140 A1 WO 2018214140A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
predetermined
repeated
file
compressed
Prior art date
Application number
PCT/CN2017/086062
Other languages
French (fr)
Chinese (zh)
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 深圳配天智能技术研究院有限公司
Priority to PCT/CN2017/086062 priority Critical patent/WO2018214140A1/en
Priority to CN201780091030.XA priority patent/CN110799959B/en
Publication of WO2018214140A1 publication Critical patent/WO2018214140A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03MCODING; DECODING; CODE CONVERSION IN GENERAL
    • H03M7/00Conversion of a code where information is represented by a given sequence or number of digits to a code where the same, similar or subset of information is represented by a different sequence or number of digits
    • H03M7/30Compression; Expansion; Suppression of unnecessary data, e.g. redundancy reduction
    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03MCODING; DECODING; CODE CONVERSION IN GENERAL
    • H03M7/00Conversion of a code where information is represented by a given sequence or number of digits to a code where the same, similar or subset of information is represented by a different sequence or number of digits
    • H03M7/30Compression; Expansion; Suppression of unnecessary data, e.g. redundancy reduction
    • H03M7/46Conversion to or from run-length codes, i.e. by representing the number of consecutive digits, or groups of digits, of the same kind by a code word and a digit indicative of that kind

Definitions

  • the invention relates to the field of data compression, in particular to a data compression method and a decompression method and related devices, which are used for compressing continuously repeated data and saving storage space.
  • the FPGA is based on SRAM (Static Random Access Memory) programming, and the programming information is lost when the system is powered down.
  • SRAM Static Random Access Memory
  • the FLASH memory chip external to the device or The program data stored in the EEPROM (Electrically Erasable Programmable Read-Only Memory) is rewritten into the internal SRAM.
  • the compressed data segment includes n consecutively repeated predetermined data and a number d of consecutive repetitions of the predetermined data, where n is greater than Or a positive integer equal to 2;
  • the reading the predetermined data in the compressed data segment and the number of consecutive repetitions of the predetermined data d includes:
  • a third aspect of the embodiments of the present invention provides a data compression device, including an input device, an output device, a processor, and a memory, where
  • a sixth aspect of the embodiments of the present invention provides an FPGA, including an input device, an output device, a processor, and a memory, wherein the input device is configured to read a decompressed data file to be decompressed, and the processor is configured to execute the present invention.
  • the data decompression method according to any one of the second aspect of the first aspect and the first to second possible implementation manners of the first aspect decompresses the original FPGA load file to obtain a decompressed FPGA load file, where the memory Used to store the decompressed FPGA load file.
  • FIG. 5 is a schematic diagram of an embodiment of a compression device according to an embodiment of the present invention.
  • an embodiment of the data compression method in the embodiment of the present invention includes:
  • the decompressing device obtains the compressed data file to be decompressed, and the compressed data file may be stored in a readable storage medium, where the data file includes at least one compressed data segment, where the compressed data segment includes n consecutively repeated predetermined data and The number d of consecutive predetermined data repetitions, where n is a positive integer greater than or equal to two.
  • the decompression device may continuously repeat the predetermined data to form the fifth data segment, and the fifth The data segment is written to the compressed data file instead of the compressed data segment.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

A data compression method and data decompression method, and a related device, which are used for compressing continuously repeated data. The method may comprise: acquiring an original data file to be compressed (101); searching the original data file for a repeated data segment continuously repeating pre-determined data, and determining the number d of consecutive repetitions (102); and writing the pre-determined data and the number d of consecutive repetitions into the original data file to replace the repeated data segment (103) so as to compress the repeated data segment.

Description

一种数据压缩方法与解压方法以及相关设备Data compression method and decompression method and related equipment 技术领域Technical field
本发明涉及数据压缩领域特别涉及一种数据压缩方法与解压方法以及相关设备,用于压缩连续重复的数据,节约存储空间。The invention relates to the field of data compression, in particular to a data compression method and a decompression method and related devices, which are used for compressing continuously repeated data and saving storage space.
背景技术Background technique
FPGA(Field Programmable Gate Array,现场可编辑门阵列)是作为专用集成电路(ASIC)领域中的一种半定制电路而出现的,既解决了定制电路的不足,又克服了原有可编程器件门电路数有限的缺点,它是当今数字系统设计的主要硬件平台。FPGA (Field Programmable Gate Array) appears as a semi-custom circuit in the field of application specific integrated circuits (ASIC), which not only solves the shortcomings of custom circuits, but also overcomes the original programmable device gates. The shortcoming of the limited number of circuits is the main hardware platform for today's digital system design.
现有技术中,FPGA是基于SRAM(Static Random Access Memory,静态随机存取存储器)编程的,编程信息在系统掉电时会丢失,每次上电时,都需要从器件外部的FLASH存储芯片或EEPROM(Electrically Erasable Programmable Read-Only Memory,电可擦可编程只读存储器)中存储的编程数据重新写入内部的SRAM中。In the prior art, the FPGA is based on SRAM (Static Random Access Memory) programming, and the programming information is lost when the system is powered down. Each time the power is turned on, the FLASH memory chip external to the device or The program data stored in the EEPROM (Electrically Erasable Programmable Read-Only Memory) is rewritten into the internal SRAM.
在现有的技术方案中,当FPGA所需编程数据较大且该数据中有大量的连续重复数据时,该数据会占用FLASH芯片或EEPROM较大的存储空间。In the existing technical solution, when the programming data required by the FPGA is large and there is a large amount of continuous repetitive data in the data, the data occupies a large storage space of the FLASH chip or the EEPROM.
发明内容Summary of the invention
本发明实施例第一方面提供了一种数据压缩方法,可包括:A first aspect of the embodiments of the present invention provides a data compression method, which may include:
获取待压缩的原始数据文件;Obtain the original data file to be compressed;
查找所述原始数据文件中存在的对预定数据进行连续重复的重复数据段,并确定连续重复的次数d;Finding a repeated data segment that continuously repeats the predetermined data existing in the original data file, and determining the number of consecutive repetitions d;
将所述预定数据及所述连续重复的次数d写入所述原始数据文件中以代替所述重复数据段,从而压缩所述重复数据段。The predetermined data and the number of consecutive repetitions d are written in the original data file in place of the repeated data segments, thereby compressing the repeated data segments.
结合第一方面,在第一方面的第一种可能的实施方式中,,所述查找所述原始数据文件中存在的对预定数据进行连续重复的重复数据段,并确定连续重复的次数d包括:With reference to the first aspect, in a first possible implementation manner of the first aspect, the searching for the repeated data segments that are consecutively repeated for the predetermined data that exist in the original data file, and determining the number of consecutive repetitions d includes :
从所述原始数据文件中读取数据长度为预定数据n倍的第一数据段,n为大于等于2的正整数;Reading, from the original data file, a first data segment whose data length is n times the predetermined data, where n is a positive integer greater than or equal to 2;
判断所述第一数据段是否为n个连续重复的所述预定数据,若是,则记录 所述预定数据的重复次数d为n;Determining whether the first data segment is n consecutively repeated predetermined data, and if so, recording The number of repetitions d of the predetermined data is n;
读取数据长度与所述预定数据相同的第二数据段,并判断所述第二数据段是否为所述预定数据段,若是,则将所述d的数值增加1,并返回所述读取数据长度与所述预定数据相同的第二数据段的步骤。Reading a second data segment whose data length is the same as the predetermined data, and determining whether the second data segment is the predetermined data segment, and if so, increasing the value of the d by 1, and returning the reading The step of data length having the same second data segment as the predetermined data.
结合第一方面的第一种可能的实施方式,在第一方面的第二种可能的实施方式中,所述将所述预定数据及所述连续重复的次数d写入所述原始数据文件中以代替所述重复数据段包括:In conjunction with the first possible implementation of the first aspect, in a second possible implementation of the first aspect, the writing the predetermined data and the number of consecutive repetitions d into the original data file Instead of the repeated data segments,
将所述第一数据段及所述连续重复的次数d写入所述原始数据文件中以代替所述重复数据段。The first data segment and the number of consecutive repetitions d are written in the original data file in place of the repeated data segment.
结合第一方面的第一种可能的实施方式,在第一方面的第三种可能的实施方式中,在所述将所述d的数值增加1之后,还包括:In conjunction with the first possible implementation of the first aspect, in a third possible implementation manner of the first aspect, after the adding the value of the d is increased by one, the method further includes:
判断所述d的数值是否大于等于预定的最大值,如果是,执行所述将所述预定数据及所述连续重复的次数d写入所述原始数据文件中以代替所述重复数据段的步骤。Determining whether the value of the d is greater than or equal to a predetermined maximum value, and if so, performing the step of writing the predetermined data and the number of consecutive repetitions d into the original data file instead of the repeated data segment .
结合第一方面,在第一方面的第四种可能的实施方式中,在将所述预定数据及所述连续重复的次数d写入所述原始数据文件中以代替所述重复数据段之后,所述方法还包括:With reference to the first aspect, in a fourth possible implementation manner of the first aspect, after the predetermined data and the number of consecutive repetitions d are written in the original data file instead of the repeated data segment, The method further includes:
将所述d的数值清零;Clear the value of d to zero;
判断所述待压缩的原始数据文件是否压缩完毕,若否,返回所述查找所述原始数据文件中存在的对预定数据进行连续重复的重复数据段,并确定连续重复的次数d的步骤。Determining whether the original data file to be compressed is compressed, and if not, returning to the step of searching for the repeated data segments that are continuously repeated for the predetermined data existing in the original data file, and determining the number of consecutive repetitions d.
本发明实施例第二方面提供了一种数据解压方法,其特征在于,包括:A second aspect of the embodiments of the present invention provides a data decompression method, including:
获取待解压的压缩数据文件,所述数据文件中包括至少一段压缩数据段,所述压缩数据段包括预定数据及所述预定数据连续重复的次数d;Obtaining a compressed data file to be decompressed, the data file includes at least one compressed data segment, the compressed data segment including predetermined data and a number of times d of the predetermined data being continuously repeated;
读取所述压缩数据段中的预定数据及所述预定数据连续重复的次数d;Reading predetermined data in the compressed data segment and the number of consecutive repetitions of the predetermined data d;
将连续重复d次的预定数据写入所述压缩数据文件以代替所述压缩数据段,从而将待解压的压缩数据文件解压。The predetermined data that is continuously repeated d times is written into the compressed data file in place of the compressed data segment, thereby decompressing the compressed data file to be decompressed.
结合第二方面,在第二方面的第一种实施方式中,所述压缩数据段包括n个连续重复的所述预定数据及所述预定数据连续重复的次数d,其中n为大于 或等于2的正整数;With reference to the second aspect, in a first implementation manner of the second aspect, the compressed data segment includes n consecutively repeated predetermined data and a number d of consecutive repetitions of the predetermined data, where n is greater than Or a positive integer equal to 2;
所述读取所述压缩数据段中的预定数据及所述预定数据连续重复的次数d包括:The reading the predetermined data in the compressed data segment and the number of consecutive repetitions of the predetermined data d includes:
从所述压缩数据文件中读取数据长度为预定数据n倍的第二数据段;Reading a second data segment whose data length is n times the predetermined data from the compressed data file;
判断所述第二数据段是否为n个连续重复的所述预定数据,若是,则记录所述预定数据的重复次数d为n;Determining whether the second data segment is n consecutively repeated predetermined data, and if so, recording the predetermined number of repetitions d of the predetermined data is n;
读取所述第二数据段之后的一个预定长度的第三数据段,从所述第三数据段中读取所述预定数据连续重复的次数d。Reading a third data segment of a predetermined length after the second data segment, and reading the number d of consecutive repetitions of the predetermined data from the third data segment.
结合第二方面的第一种可能的实施方式,在第二方面的第二种可能的实施方式中,所述将连续重复d次的预定数据写入所述压缩数据文件以代替所述压缩数据段包括:In conjunction with the first possible implementation of the second aspect, in a second possible implementation of the second aspect, the predetermined data that is continuously repeated d times is written to the compressed data file instead of the compressed data The paragraph includes:
将所述预定数据连续重复d次形成第四数据段,将所述第四数据段写入所述压缩数据文件以代替所述压缩数据段。The predetermined data is repeatedly repeated d times to form a fourth data segment, and the fourth data segment is written to the compressed data file in place of the compressed data segment.
本发明实施例第三方面提供了一种数据压缩设备,其特征在于,包括输入装置、输出装置、处理器和存储器,其中,A third aspect of the embodiments of the present invention provides a data compression device, including an input device, an output device, a processor, and a memory, where
所述输入装置用于获取待压缩的数据文件;The input device is configured to acquire a data file to be compressed;
所述处理器用于执行如下方法:The processor is configured to perform the following methods:
查找所述数据文件中存在的对预定数据进行连续重复的重复数据段,并确定连续重复的次数d;Finding a repeated data segment that continuously repeats the predetermined data existing in the data file, and determining the number of consecutive repetitions d;
将所述预定数据及所述连续重复的次数d写入输出数据文件中以代替所述重复数据段,从而压缩所述重复数据段。The predetermined data and the number of consecutive repetitions d are written into the output data file to replace the repeated data segments, thereby compressing the repeated data segments.
本发明实施例第四方面提供了一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储有指令,当所述指令在计算机上运行时,使得所述计算机执行如本发明实施例中第一方面及第一方面的第一至第四种可能的实施方式以及第二方面及第二方面的第一或第二中可能的实施方式中任一项所述的方法。A fourth aspect of the embodiments of the present invention provides a computer readable storage medium, wherein the computer readable storage medium stores instructions, when the instructions are run on a computer, causing the computer to execute The first aspect of the invention and the first to fourth possible embodiments of the first aspect and the method of any of the first or second possible implementation of the second aspect and the second aspect.
本发明实施例第五方面提供了一种FPGA,包括输入装置、输出装置、处理器和存储器,其中所述输入装置用于读取原始的FPGA加载文件,所述处理器用于执行如本发明实施例中第一方面及第一方面的第一至第四种可能 的实施方式中任一项所述的数据压缩方法对所述原始的FPGA加载文件进行压缩得到压缩后的FPGA加载文件,所述存储器用于存储所述压缩后的FPGA加载文件。A fifth aspect of the embodiments of the present invention provides an FPGA, including an input device, an output device, a processor, and a memory, wherein the input device is configured to read an original FPGA load file, and the processor is configured to perform the implementation according to the present invention. The first aspect of the example and the first to fourth possibilities of the first aspect The data compression method of any one of the embodiments compresses the original FPGA load file to obtain a compressed FPGA load file, and the memory is used to store the compressed FPGA load file.
本发明实施例第六方面提供了一种FPGA,包括输入装置、输出装置、处理器和存储器,其中所述输入装置用于读取待解压的解压数据文件,所述处理器用于执行如本发明实施例中第二方面及第一方面的第一至第二种可能的实施方式中任一项所述的数据解压方法对原始的FPGA加载文件进行解压得到解压后的FPGA加载文件,所述存储器用于存储所述解压后的FPGA加载文件。A sixth aspect of the embodiments of the present invention provides an FPGA, including an input device, an output device, a processor, and a memory, wherein the input device is configured to read a decompressed data file to be decompressed, and the processor is configured to execute the present invention. The data decompression method according to any one of the second aspect of the first aspect and the first to second possible implementation manners of the first aspect decompresses the original FPGA load file to obtain a decompressed FPGA load file, where the memory Used to store the decompressed FPGA load file.
以上可以看出,本发明实施例中,当原始数据文件中的预定数据存在大量的连续的重复数据段时,压缩设备查找原始数据文件中存在的对预定数据进行连续重复的重复数据段,并确定连续重复的次数d,将所述预定数据及所述连续重复的次数d写入所述原始数据文件中以代替所述重复数据段,从而压缩所述重复数据段,而不必将大量的连续重复的该种预定数据展开记录,节省了存储空间。As can be seen from the above, in the embodiment of the present invention, when there is a large number of consecutive repeated data segments in the predetermined data in the original data file, the compression device searches for the repeated data segments that are continuously repeated in the original data file for the predetermined data, and Determining the number d of consecutive repetitions, writing the predetermined data and the number of consecutive repetitions d into the original data file to replace the repeated data segments, thereby compressing the repeated data segments without having to have a large number of consecutive Repeating such predetermined data expansion records saves storage space.
附图说明DRAWINGS
图1为本发明实施例中数据压缩方法一个实施例的示意图;1 is a schematic diagram of an embodiment of a data compression method according to an embodiment of the present invention;
图2为本发明实施例中数据压缩方法另一个实施例的示意图;2 is a schematic diagram of another embodiment of a data compression method according to an embodiment of the present invention;
图3为本发明实施例中数据解压方法一个实施例的示意图;3 is a schematic diagram of an embodiment of a data decompression method according to an embodiment of the present invention;
图4为本发明实施例中数据解压方法另一个实施例的示意图;4 is a schematic diagram of another embodiment of a data decompression method according to an embodiment of the present invention;
图5为本发明实施例中压缩设备一个实施例的示意图。FIG. 5 is a schematic diagram of an embodiment of a compression device according to an embodiment of the present invention.
具体实施方式detailed description
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solutions in the embodiments of the present invention are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present invention. It is obvious that the described embodiments are only a part of the embodiments of the present invention, but not all embodiments. All other embodiments obtained by a person skilled in the art based on the embodiments of the present invention without creative efforts are within the scope of the present invention.
为便于理解,下面对本发明实施例中的具体流程进行描述,请参阅图1,本发明实施例中数据压缩方法的一个实施例包括:For ease of understanding, the specific process in the embodiment of the present invention is described below. Referring to FIG. 1, an embodiment of the data compression method in the embodiment of the present invention includes:
101、获取待压缩的原始数据文件; 101. Obtain a raw data file to be compressed.
当原始数据文件中存在对预定数据进行连续重复的重复数据段时,压缩设备可以获取该原始数据文件对其进行压缩流程,可以将该原始数据文件存储在可读取的存储介质中。When there is a repeated data segment in the original data file that continuously repeats the predetermined data, the compression device may acquire the original data file to compress the original data file, and the original data file may be stored in a readable storage medium.
102、查找原始数据文件中存在的对预定数据进行连续重复的重复数据段,并确定连续重复的次数d;102. Search for a repeated data segment that continuously repeats the predetermined data existing in the original data file, and determine the number of consecutive repetitions d;
用户可以根据需求设置一种或多种预定数据,压缩设备可以查找原始数据文件中存在的对预定数据进行连续重复的重复数据段,并确定连续重复的次数d,具体的查找方式将在下述的实施例中详细描述。The user can set one or more predetermined data according to requirements, and the compression device can search for repeated data segments that are continuously repeated in the original data file for the predetermined data, and determine the number of consecutive repetitions d, and the specific search manner will be as follows. The details are described in the examples.
103、将预定数据及连续重复的次数d写入原始数据文件中以代替重复数据段;103. Write predetermined data and the number of consecutive repetitions d into the original data file to replace the repeated data segments;
在确定预定数据的连续重复次数之后,压缩设备可以将该预定数据及连续重复的次数d写入原始数据文件中以替代对应的重复数据段,而不必将大量的连续重复的该种预定数据展开记录,节省了存储空间。After determining the number of consecutive repetitions of the predetermined data, the compression device may write the predetermined data and the number of consecutive repetitions d into the original data file to replace the corresponding repeated data segments without having to expand a large number of consecutively repeated such predetermined data. Recording saves storage space.
以上可以看出,本发明实施例中,当原始数据文件中的预定数据存在大量的连续的重复数据段时,压缩设备查找原始数据文件中存在的对预定数据进行连续重复的重复数据段,并确定连续重复的次数d,将预定数据及连续重复的次数d写入原始数据文件中以代替重复数据段,从而压缩重复数据段,而不必将大量的连续重复的该种预定数据展开记录,节省了存储空间。As can be seen from the above, in the embodiment of the present invention, when there is a large number of consecutive repeated data segments in the predetermined data in the original data file, the compression device searches for the repeated data segments that are continuously repeated in the original data file for the predetermined data, and Determining the number d of consecutive repetitions, writing predetermined data and the number of consecutive repetitions d into the original data file instead of repeating the data segments, thereby compressing the repeated data segments without having to record a large number of consecutively repeated such predetermined data, saving The storage space.
上述实施例对本发明实施例中数据压缩方法的流程进行了描述,为了便于理解,下面将对本发明实施例中数据压缩方法进行详细描述,请参阅图2,本发明实施例中数据压缩方法的另一个实施例可包括:The foregoing embodiment describes the flow of the data compression method in the embodiment of the present invention. For ease of understanding, the data compression method in the embodiment of the present invention will be described in detail below. Referring to FIG. 2, another method of data compression in the embodiment of the present invention is provided. An embodiment can include:
201、获取待压缩的原始数据文件;201. Obtain a raw data file to be compressed.
当原始数据文件中存在对预定数据进行连续重复的重复数据段时,压缩设备可以获取该原始数据文件以启动压缩流程,可以将该原始数据文件存储在可读取的存储介质中。When there is a repeated data segment in the original data file that continuously repeats the predetermined data, the compression device may acquire the original data file to start a compression process, and the original data file may be stored in a readable storage medium.
202、从原始数据文件中读取数据长度为预定数据n倍的第一数据段;202. Read, from the original data file, a first data segment whose data length is n times the predetermined data;
为识别原始数据文件中的重复数据段,压缩设备可以从原始数据文件中读取数据长度为预定数据n倍的第一数据段进行进一步的判断,其中n为大于等于2的正整数。 In order to identify the repeated data segments in the original data file, the compression device may further read the first data segment whose data length is n times the predetermined data from the original data file, where n is a positive integer greater than or equal to 2.
203、判断第一数据段是否为n个连续重复的预定数据;203. Determine whether the first data segment is n consecutively repeated predetermined data.
在读取到第一数据段之后,压缩设备可以判断第一数据段是否为n个连续重复的预定数据,若是,则执行步骤204,若否,则执行步骤207。After reading the first data segment, the compression device may determine whether the first data segment is n consecutively repeated predetermined data, and if yes, execute step 204, and if no, perform step 207.
204、记录预定数据的重复次数d为n;204. The number of repetitions d of recording predetermined data is n;
当第一数据段是n个连续重复的预定数据时,可以确定预定数据在当前已读取的数据中连续重复的次数d的数值为n次。When the first data segment is n consecutively repeated predetermined data, it may be determined that the number of times d of the predetermined data continuously repeated in the currently read data is n times.
205、读取数据长度与预定数据相同的第二数据段,并判断第二数据段是否为预定数据段;205. Read a second data segment whose data length is the same as the predetermined data, and determine whether the second data segment is a predetermined data segment.
当第一数据段是n个连续重复的预定数据时,压缩设备可以继续判断后续的数据是否为预定数据的重复形式,具体的,压缩设备可以读取数据长度与预定数据相同的第二数据段,并判断第二数据段是否为预定数据段,若是,则执行步骤206;若否,则返回执行步骤202对后续的数据进行处理。When the first data segment is n consecutively repeated predetermined data, the compression device may continue to determine whether the subsequent data is a repeated form of the predetermined data. Specifically, the compression device may read the second data segment whose data length is the same as the predetermined data. And determining whether the second data segment is a predetermined data segment, and if yes, executing step 206; if not, returning to step 202 to process subsequent data.
206、将d的数值增加1;206, increasing the value of d by one;
若第二数据段也是预定数据的重复形式则将d的数值增加1,并返回执行步骤205对后续的数据进行处理。If the second data segment is also a repeated form of the predetermined data, the value of d is incremented by one, and the process returns to step 205 to process the subsequent data.
207、重新读取数据长度为预定数据n倍的数据段。207. Re-read the data segment whose data length is n times of the predetermined data.
当第一数据段不是任何一种预定数据的重复形式时,压缩设备可以重新读取数据长度为预定数据n倍的数据段作为第一数据段,重新进行判断流程。When the first data segment is not a repeated form of any of the predetermined data, the compression device may re-read the data segment whose data length is n times the predetermined data as the first data segment, and re-determine the flow.
具体的,压缩设备重新读取的新的第一数据段可以由上一个第一数据段中,除去与预定数据长度相同的前端数据段之后的部分与后续相连续的数据段组成。Specifically, the new first data segment re-read by the compression device may be composed of a portion of the previous first data segment that is removed from the front-end data segment having the same length as the predetermined data and a subsequent data segment.
208、将预定数据及连续重复的次数d写入原始数据文件中以代替重复数据段;208. Write the predetermined data and the number of consecutive repetitions d into the original data file to replace the repeated data segment;
在确定预定数据的连续重复次数之后,压缩设备可以将该预定数据及连续重复的次数d写入原始数据文件中以替代对应的重复数据段,而不必将大量的连续重复的该种预定数据展开记录,节省了存储空间。After determining the number of consecutive repetitions of the predetermined data, the compression device may write the predetermined data and the number of consecutive repetitions d into the original data file to replace the corresponding repeated data segments without having to expand a large number of consecutively repeated such predetermined data. Recording saves storage space.
具体的,压缩设备可以将第一数据段及连续重复的次数d写入原始数据文件中以代替重复数据段。Specifically, the compression device may write the first data segment and the number of consecutive repetitions d into the original data file instead of the repeated data segment.
以上可以看出,本实施例中压缩设备读取原始数据文件中的部分数据作为 第一目标压缩数据,在判定第一目标压缩数据为一种预置压缩数据的重复形式时,继续读取第二目标压缩数据,当判定第二目标压缩数据也为同一种预置压缩数据的重复时,记录该种预置压缩数据的重复次数,当该种预置压缩数据不再连续的重复时,压缩设备可以将第一目标压缩数据和该种预置压缩数据的重复次数写入压缩文件,而不必将连续重复的该种预置压缩数据逐一展开记录,节省了存储空间。As can be seen from the above, in the embodiment, the compression device reads part of the data in the original data file as The first target compressed data, when determining that the first target compressed data is a repeated form of preset compressed data, continues to read the second target compressed data, and when determining that the second target compressed data is also the same preset compressed data When the data is repeated, the number of repetitions of the preset compressed data is recorded. When the preset compressed data is not continuously repeated, the compression device may write and compress the first target compressed data and the repeated number of the preset compressed data. The file does not have to be continuously recorded by successively repeating the preset compressed data, saving storage space.
在上述实施例的基础上,优选的,在步骤206之后,还包括:Based on the foregoing embodiment, preferably, after step 206, the method further includes:
209、判断d的数值是否大于等于预定的最大值。209. Determine whether the value of d is greater than or equal to a predetermined maximum value.
实际运用中,记录同一预定数据连续重复次数d的数据所占用的数位是有限的,即d的数值具有最大值,具体的最大值可以由用户根据需求设定,在步骤206之后可以断d的数值是否大于等于预定的最大值,若大于或等于最大值,则执行步骤208,若小于最大值,则执行步骤205。In actual use, the number of digits occupied by the data of the same predetermined data continuous repetition number d is limited, that is, the value of d has a maximum value, and the specific maximum value can be set by the user according to requirements, and can be broken after step 206. If the value is greater than or equal to the maximum value, step 208 is performed. If the value is less than the maximum value, step 205 is performed.
在上述实施例的基础上,优选的,在将预定数据及连续重复的次数d写入原始数据文件中以代替重复数据段之后,还包括:On the basis of the foregoing embodiment, after the predetermined data and the number of consecutive repetitions d are written into the original data file instead of the repeated data segments, the method further includes:
210、将d的数值清零;210. Clear the value of d to zero;
211、判断待压缩的原始数据文件是否压缩完毕。211. Determine whether the original data file to be compressed is compressed.
若待压缩的原始数据文件压缩完毕,则结束流程,若待压缩的原始数据文件未压缩完毕,则返回步骤202,循环执行压缩流程。If the compressed original data file is compressed, the process ends. If the original data file to be compressed is not compressed, the process returns to step 202, and the compression process is executed cyclically.
可以理解的是,本实施例中的压缩设备可以是FPGA或计算机及其他可以实现上述方法的设备,此处不做限定。It is to be understood that the compression device in this embodiment may be an FPGA or a computer and other devices that can implement the foregoing method, which are not limited herein.
上述实施例对本发明实施例中的数据压缩方法进行了描述,下面将对本发明实施例中的数据解压方法进行描述,请参阅图3,本发明实施例中数据解压方法的一个实施例可包括:The foregoing embodiment describes the data compression method in the embodiment of the present invention. The following describes the data decompression method in the embodiment of the present invention. Referring to FIG. 3, an embodiment of the data decompression method in the embodiment of the present invention may include:
301、获取待解压的压缩数据文件;301. Obtain a compressed data file to be decompressed.
在需要对包括至少一压缩数据段的压缩数据文件解压时,解压设备可以先读取待解压的压缩数据文件,该文件中的压缩数据段包括预定数据及该预定数据连续重复的次数d。When decompressing the compressed data file including the at least one compressed data segment, the decompression device may first read the compressed data file to be decompressed, and the compressed data segment in the file includes the predetermined data and the number d of consecutive repetitions of the predetermined data.
302、读取压缩数据段中的预定数据及预定数据连续重复的次数d;302, reading the predetermined data in the compressed data segment and the number of consecutive repetitions of the predetermined data d;
在对压缩数据段进行解压时,需要读取确定被压缩的预定数据的种类及连 续重复的次数d,具体的确定方式将在下述的实施例中详细描述。When decompressing the compressed data segment, it is necessary to read and determine the type of the predetermined data to be compressed and The number of repetitions d will be repeated, and the specific manner of determination will be described in detail in the following embodiments.
303、将连续重复d次的预定数据写入压缩数据文件以代替压缩数据段。303. Write predetermined data that is continuously repeated d times to the compressed data file instead of compressing the data segment.
在确定预定数据的连续重复次数之后,解压设备可以将预定数据连续重复d次写入压缩数据文件以代替压缩数据段。After determining the number of consecutive repetitions of the predetermined data, the decompression device may write the predetermined data to the compressed data file continuously for d times instead of compressing the data segment.
具体的,本实施例中的待解压数据文件可以是采用图1及图2所示的数据压缩方法对原始数据文件压缩得到的。Specifically, the data file to be decompressed in this embodiment may be obtained by compressing the original data file by using the data compression method shown in FIG. 1 and FIG. 2.
上述实施例对本发明实施例中的数据解压方法的流程进行了描述,为了便于理解,下面将对本发明实施例中的数据解压方法进行详细描述,请参阅图4,本发明实施例中数据解压方法的另一个实施例可包括:The foregoing embodiment describes the flow of the data decompression method in the embodiment of the present invention. For ease of understanding, the data decompression method in the embodiment of the present invention will be described in detail below. Referring to FIG. 4, the data decompression method in the embodiment of the present invention is described. Another embodiment of the method can include:
401、获取待解压的压缩数据文件;401. Obtain a compressed data file to be decompressed.
解压设备获取待解压的压缩数据文件,可以将该压缩数据文件存储在可读取的存储介质中,该数据文件中包含至少一压缩数据段,该压缩数据段包括n个连续重复的预定数据及预定数据连续重复的次数d,其中n为大于或等于2的正整数。The decompressing device obtains the compressed data file to be decompressed, and the compressed data file may be stored in a readable storage medium, where the data file includes at least one compressed data segment, where the compressed data segment includes n consecutively repeated predetermined data and The number d of consecutive predetermined data repetitions, where n is a positive integer greater than or equal to two.
402、从压缩数据文件中读取数据长度为预定数据n倍的第三数据段;402. The third data segment whose data length is n times the predetermined data is read from the compressed data file.
解压设备要从压缩数据文件中逐步读取部分数据段进行解压,为确定压缩数据段,压缩设备可以从压缩数据文件中读取数据长度为预定数据n倍的第三数据段进行判断。The decompression device needs to gradually read part of the data segment from the compressed data file for decompression. To determine the compressed data segment, the compression device can read the third data segment whose data length is n times the predetermined data from the compressed data file.
403、判断第三数据段是否为n个连续重复的预定数据;403. Determine whether the third data segment is n consecutively repeated predetermined data.
压缩设备判断读取的第三数据段是否为压缩数据段,若是,则执行步骤404,若否,则执行步骤406。The compression device determines whether the read third data segment is a compressed data segment. If yes, step 404 is performed, and if no, step 406 is performed.
404、读取第三数据段之后的一个预定长度的第四数据段;404. Read a fourth data segment of a predetermined length after the third data segment.
压缩数据段在第三数据段之后的数据段中设置有预定长度的第四数据段用于记录预定数据连续重复,压缩设备可以读取该第四数据段,并从第四数据段中读取预定数据连续重复的次数d。The compressed data segment is provided with a predetermined length of the fourth data segment in the data segment subsequent to the third data segment for recording the predetermined data continuous repetition, and the compression device can read the fourth data segment and read from the fourth data segment. The number of times the predetermined data is continuously repeated.
405、将连续重复d次的预定数据写入压缩数据文件以代替压缩数据段。405. Write predetermined data that is continuously repeated d times to the compressed data file instead of compressing the data segment.
在确定预定数据的连续重复次数之后,解压设备可以将预定数据连续重复d次写入压缩数据文件以代替压缩数据段。After determining the number of consecutive repetitions of the predetermined data, the decompression device may write the predetermined data to the compressed data file continuously for d times instead of compressing the data segment.
具体的,解压设备可以将预定数据连续重复d次形成第五数据段,将第五 数据段写入压缩数据文件以代替压缩数据段。Specifically, the decompression device may continuously repeat the predetermined data to form the fifth data segment, and the fifth The data segment is written to the compressed data file instead of the compressed data segment.
406、重新读取数据长度为预定数据n倍的第三数据段。406. Re-read the third data segment whose data length is n times the predetermined data.
具体的,解压设备重新读取的新的第三数据段可以由上一个第三数据段中,除去与预定数据长度相同的前端数据段之后的部分与后续相连续的数据段组成。Specifically, the new third data segment re-read by the decompression device may be composed of a portion of the previous third data segment that is removed from the front end data segment having the same length as the predetermined data and a subsequent data segment.
优选的,在步骤405之后本实施例还可以包括:Preferably, after step 405, the embodiment may further include:
407、判断压缩数据文件是否读取完成。407. Determine whether the compressed data file is read.
解压设备判断压缩数据文件是否读取完成,若完成,则结束,若未完成,则返回步骤402,循环解压。The decompression device determines whether the compressed data file is read. If it is completed, it ends. If not, it returns to step 402 and decompresses.
下面将对本发明实施例中的数据压缩500设备进行描述,请参阅图5,本发明实施例中的数据压缩设备的一个实施例可包括:The following describes the data compression device in the embodiment of the present invention. Referring to FIG. 5, an embodiment of the data compression device in the embodiment of the present invention may include:
输入装置501、输出装置502、处理器503和存储器504,其中,An input device 501, an output device 502, a processor 503, and a memory 504, wherein
输入装置501用于获取待压缩的数据文件;The input device 501 is configured to acquire a data file to be compressed;
处理器503用于执行如下方法:The processor 503 is configured to perform the following methods:
查找数据文件中存在的对预定数据进行连续重复的重复数据段,并确定连续重复的次数d;Finding a repeated data segment existing in the data file for continuously repeating the predetermined data, and determining the number of consecutive repetitions d;
将预定数据及连续重复的次数d写入输出数据文件中以代替重复数据段,从而压缩重复数据段。The predetermined data and the number of consecutive repetitions d are written in the output data file instead of the repeated data segments, thereby compressing the repeated data segments.
优选的,处理器具体用于:Preferably, the processor is specifically configured to:
从输入数据文件中读取数据长度为预定数据n倍的第一数据段,n为大于等于2的正整数;Reading a first data segment whose data length is n times the predetermined data from the input data file, where n is a positive integer greater than or equal to 2;
判断第一数据段是否为n个连续重复的预定数据,若是,则记录预定数据的重复次数d为n;Determining whether the first data segment is n consecutively repeated predetermined data, and if so, the number of repetitions d of recording the predetermined data is n;
读取数据长度与预定数据相同的第二数据段,并判断第二数据段是否为预定数据段,若是,则将d的数值增加1,并返回读取数据长度与预定数据相同的第二数据段的步骤。Reading a second data segment whose data length is the same as the predetermined data, and determining whether the second data segment is a predetermined data segment, and if so, increasing the value of d by 1, and returning the second data whose read data length is the same as the predetermined data. The steps of the paragraph.
优选的,处理器503具体用于:Preferably, the processor 503 is specifically configured to:
将第一数据段及连续重复的次数d写入输出数据文件中以代替重复数据段。 The first data segment and the number of consecutive repetitions d are written into the output data file in place of the repeated data segments.
优选的,处理器503还用于:Preferably, the processor 503 is further configured to:
判断d的数值是否大于等于预定的最大值,如果是,执行将预定数据及连续重复的次数d写入输出数据文件中以代替重复数据段的步骤。It is judged whether or not the value of d is greater than or equal to a predetermined maximum value, and if so, a step of writing predetermined data and the number of consecutive repetitions d into the output data file instead of repeating the data segment is performed.
优选的,处理器503还用于:Preferably, the processor 503 is further configured to:
将d的数值清零;Clear the value of d to zero;
判断待压缩的输入数据文件是否压缩完毕,如果否,返回查找输入数据文件中存在的对预定数据进行连续重复的重复数据段,并确定连续重复的次数d的步骤。Determining whether the input data file to be compressed is compressed, and if not, returning to the step of searching for the repeated data segments existing in the input data file for continuously repeating the predetermined data, and determining the number of consecutive repetitions d.
本实施例中的数据压缩设备的具体功能与上述图1及图2中描述的类似,具体请参阅图1及图2所示的实施例,此处不再赘述。The specific functions of the data compression device in this embodiment are similar to those described in FIG. 1 and FIG. 2 . For details, refer to the embodiments shown in FIG. 1 and FIG. 2 , and details are not described herein again.
本发明实施例还提供了一种计算机可读存储介质,该计算机可读存储介质中存储有指令,当指令在计算机上运行时,使得计算机可以执行上述图1或图2或图3或图4中所示方法。Embodiments of the present invention also provide a computer readable storage medium having instructions stored therein that, when executed on a computer, cause the computer to perform the above-described FIG. 1 or FIG. 2 or FIG. 3 or FIG. The method shown.
本发明实施例还提供了一种FPGA,包括输入装置、输出装置、处理器和存储器,其中输入装置用于读取原始的FPGA加载文件,处理器用于执行上述图1或图2中所示的数据压缩方法对原始的FPGA加载文件进行压缩得到压缩后的FPGA加载文件,存储器用于存储压缩后的FPGA加载文件。An embodiment of the present invention further provides an FPGA, including an input device, an output device, a processor, and a memory, wherein the input device is configured to read an original FPGA load file, and the processor is configured to perform the foregoing shown in FIG. 1 or FIG. The data compression method compresses the original FPGA load file to obtain a compressed FPGA load file, and the memory is used to store the compressed FPGA load file.
本发明实施例还提供了一种FPGA,包括输入装置、输出装置、处理器和存储器,其中输入装置用于读取待解压的解压数据文件,处理器用于执行上述图3或图4中所示的数据解压方法对原始的FPGA加载文件进行解压得到解压后的FPGA加载文件,存储器用于存储解压后的FPGA加载文件。An embodiment of the present invention further provides an FPGA, including an input device, an output device, a processor, and a memory, wherein the input device is configured to read a decompressed data file to be decompressed, and the processor is configured to execute the foregoing FIG. 3 or FIG. The data decompression method decompresses the original FPGA load file to obtain the decompressed FPGA load file, and the memory is used to store the decompressed FPGA load file.
本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在一个计算机可读取存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。The technical solution of the present invention may be embodied in the form of a software product, which may be stored in a computer readable storage medium, in whole or in part, or all or part of the technical solution. A number of instructions are included to cause a computer device (which may be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like. .
以上所述,以上实施例仅用以说明本发明的技术方案,而非对其限制;尽 管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的精神和范围。 The above embodiments are only used to illustrate the technical solutions of the present invention, and are not limited thereto; The present invention has been described in detail with reference to the foregoing embodiments, and those skilled in the art will understand that the technical solutions described in the foregoing embodiments may be modified, or some of the technical features may be equivalently replaced. Modifications or substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the invention.

Claims (16)

  1. 一种数据压缩方法,其特征在于,包括:A data compression method, comprising:
    获取待压缩的原始数据文件;Obtain the original data file to be compressed;
    查找所述原始数据文件中存在的对预定数据进行连续重复的重复数据段,并确定连续重复的次数d;Finding a repeated data segment that continuously repeats the predetermined data existing in the original data file, and determining the number of consecutive repetitions d;
    将所述预定数据及所述连续重复的次数d写入所述原始数据文件中以代替所述重复数据段,从而压缩所述重复数据段。The predetermined data and the number of consecutive repetitions d are written in the original data file in place of the repeated data segments, thereby compressing the repeated data segments.
  2. 根据权利要求1所述的方法,其特征在于,所述查找所述原始数据文件中存在的对预定数据进行连续重复的重复数据段,并确定连续重复的次数d包括:The method according to claim 1, wherein the finding the repeated data segments that are continuously repeated for the predetermined data existing in the original data file, and determining the number of consecutive repetitions d includes:
    从所述原始数据文件中读取数据长度为预定数据n倍的第一数据段,n为大于等于2的正整数;Reading, from the original data file, a first data segment whose data length is n times the predetermined data, where n is a positive integer greater than or equal to 2;
    判断所述第一数据段是否为n个连续重复的所述预定数据,若是,则记录所述预定数据的重复次数d为n;Determining whether the first data segment is n consecutively repeated predetermined data, and if so, the number of repetitions d of recording the predetermined data is n;
    读取数据长度与所述预定数据相同的第二数据段,并判断所述第二数据段是否为所述预定数据段,若是,则将所述d的数值增加1,并返回所述读取数据长度与所述预定数据相同的第二数据段的步骤。Reading a second data segment whose data length is the same as the predetermined data, and determining whether the second data segment is the predetermined data segment, and if so, increasing the value of the d by 1, and returning the reading The step of data length having the same second data segment as the predetermined data.
  3. 根据权利要求2所述的方法,其特征在于,所述将所述预定数据及所述连续重复的次数d写入所述原始数据文件中以代替所述重复数据段包括:The method according to claim 2, wherein the writing the predetermined data and the number of consecutive repetitions d into the original data file instead of the repeated data segment comprises:
    将所述第一数据段及所述连续重复的次数d写入所述原始数据文件中以代替所述重复数据段。The first data segment and the number of consecutive repetitions d are written in the original data file in place of the repeated data segment.
  4. 根据权利要求2所述的方法,其特征在于,在所述将所述d的数值增加1之后,还包括:The method according to claim 2, further comprising: after adding the value of d to one, further comprising:
    判断所述d的数值是否大于等于预定的最大值,如果是,执行所述将所述预定数据及所述连续重复的次数d写入所述原始数据文件中以代替所述重复数据段的步骤。Determining whether the value of the d is greater than or equal to a predetermined maximum value, and if so, performing the step of writing the predetermined data and the number of consecutive repetitions d into the original data file instead of the repeated data segment .
  5. 根据权利要求1至4中任一项所述的方法,其特征在于,在将所述预定数据及所述连续重复的次数d写入所述原始数据文件中以代替所述重复数据段之后,所述方法还包括: The method according to any one of claims 1 to 4, wherein after the predetermined data and the number of consecutive repetitions d are written in the original data file in place of the repeated data segment, The method further includes:
    将所述d的数值清零;Clear the value of d to zero;
    判断所述待压缩的原始数据文件是否压缩完毕,若否,返回所述查找所述原始数据文件中存在的对预定数据进行连续重复的重复数据段,并确定连续重复的次数d的步骤。Determining whether the original data file to be compressed is compressed, and if not, returning to the step of searching for the repeated data segments that are continuously repeated for the predetermined data existing in the original data file, and determining the number of consecutive repetitions d.
  6. 一种数据解压方法,其特征在于,包括:A data decompression method, comprising:
    获取待解压的压缩数据文件,所述压缩数据文件中包括至少一段压缩数据段,所述压缩数据段包括预定数据及所述预定数据连续重复的次数d;Obtaining a compressed data file to be decompressed, where the compressed data file includes at least one compressed data segment, the compressed data segment including predetermined data and a number of times d of the predetermined data consecutively repeated;
    读取所述压缩数据段中的预定数据及所述预定数据连续重复的次数d;Reading predetermined data in the compressed data segment and the number of consecutive repetitions of the predetermined data d;
    将连续重复d次的预定数据写入所述压缩数据文件以代替所述压缩数据段,从而将待解压的压缩数据文件解压。The predetermined data that is continuously repeated d times is written into the compressed data file in place of the compressed data segment, thereby decompressing the compressed data file to be decompressed.
  7. 根据权利要求6所述的方法,其特征在于,所述压缩数据段包括n个连续重复的所述预定数据及所述预定数据连续重复的次数d,其中n为大于或等于2的正整数;The method according to claim 6, wherein said compressed data segment comprises n consecutively repeated said predetermined data and said predetermined number of consecutive repetitions of said predetermined data, wherein n is a positive integer greater than or equal to 2;
    所述读取所述压缩数据段中的预定数据及所述预定数据连续重复的次数d包括:The reading the predetermined data in the compressed data segment and the number of consecutive repetitions of the predetermined data d includes:
    从所述压缩数据文件中读取数据长度为预定数据n倍的第三数据段;Reading, from the compressed data file, a third data segment whose data length is n times the predetermined data;
    判断所述第三数据段是否为n个连续重复的所述预定数据,若是,则读取所述第三数据段之后的一个预定长度的第四数据段;Determining whether the third data segment is n consecutively repeated predetermined data, and if so, reading a fourth data segment of a predetermined length after the third data segment;
    从所述第四数据段中读取所述预定数据连续重复的次数d。The number d of consecutive repetitions of the predetermined data is read from the fourth data segment.
  8. 根据权利要求7所述的方法,其特征在于,所述将连续重复d次的预定数据写入所述压缩数据文件以代替所述压缩数据段包括:The method according to claim 7, wherein said writing predetermined data consecutively repeated d times to said compressed data file instead of said compressed data segment comprises:
    将所述预定数据连续重复d次形成第五数据段,将所述第五数据段写入所述压缩数据文件以代替所述压缩数据段。The predetermined data is repeatedly repeated d times to form a fifth data segment, and the fifth data segment is written to the compressed data file in place of the compressed data segment.
  9. 一种数据压缩设备,其特征在于,包括输入装置、输出装置、处理器和存储器,其中,A data compression device, comprising: an input device, an output device, a processor, and a memory, wherein
    所述输入装置用于获取待压缩的数据文件;The input device is configured to acquire a data file to be compressed;
    所述处理器用于执行如下方法:The processor is configured to perform the following methods:
    查找所述数据文件中存在的对预定数据进行连续重复的重复数据段,并确定连续重复的次数d; Finding a repeated data segment that continuously repeats the predetermined data existing in the data file, and determining the number of consecutive repetitions d;
    将所述预定数据及所述连续重复的次数d写入输出数据文件中以代替所述重复数据段,从而压缩所述重复数据段。The predetermined data and the number of consecutive repetitions d are written into the output data file to replace the repeated data segments, thereby compressing the repeated data segments.
  10. 根据权利要求9所述的数据压缩设备,其特征在于,所述处理器具体用于:The data compression device according to claim 9, wherein the processor is specifically configured to:
    从所述输入数据文件中读取数据长度为预定数据n倍的第一数据段,n为大于等于2的正整数;Reading, from the input data file, a first data segment whose data length is n times the predetermined data, where n is a positive integer greater than or equal to 2;
    判断所述第一数据段是否为n个连续重复的所述预定数据,若是,则记录所述预定数据的重复次数d为n;Determining whether the first data segment is n consecutively repeated predetermined data, and if so, the number of repetitions d of recording the predetermined data is n;
    读取数据长度与所述预定数据相同的第二数据段,并判断所述第二数据段是否为所述预定数据段,若是,则将所述d的数值增加1,并返回所述读取数据长度与所述预定数据相同的第二数据段的步骤。Reading a second data segment whose data length is the same as the predetermined data, and determining whether the second data segment is the predetermined data segment, and if so, increasing the value of the d by 1, and returning the reading The step of data length having the same second data segment as the predetermined data.
  11. 根据权利要求10所述的数据压缩设备,其特征在于,所述处理器具体用于:The data compression device according to claim 10, wherein the processor is specifically configured to:
    将所述第一数据段及所述连续重复的次数d写入输出数据文件中以代替所述重复数据段。The first data segment and the number of consecutive repetitions d are written in an output data file in place of the repeated data segment.
  12. 根据权利要求10所述的数据压缩设备,其特征在于,所述处理器还用于:The data compression device according to claim 10, wherein the processor is further configured to:
    判断所述d的数值是否大于等于预定的最大值,如果是,执行所述将所述预定数据及所述连续重复的次数d写入所述输出数据文件中以代替所述重复数据段的步骤。Determining whether the value of the d is greater than or equal to a predetermined maximum value, and if so, performing the step of writing the predetermined data and the number of consecutive repetitions d into the output data file instead of the repeated data segment .
  13. 根据权利要求9所述的数据压缩设备,其特征在于,所述处理器还用于:The data compression device according to claim 9, wherein the processor is further configured to:
    将所述d的数值清零;Clear the value of d to zero;
    判断所述待压缩的输入数据文件是否压缩完毕,如果否,返回所述查找所述输入数据文件中存在的对预定数据进行连续重复的重复数据段,并确定连续重复的次数d的步骤。Determining whether the input data file to be compressed is compressed, and if not, returning to the step of searching for the repeated data segments that are continuously repeated for the predetermined data existing in the input data file, and determining the number of consecutive repetitions d.
  14. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储有指令,当所述指令在计算机上运行时,使得所述计算机执行如权利要求1至8中任一项所述的方法。 A computer readable storage medium, wherein the computer readable storage medium stores instructions that, when executed on a computer, cause the computer to perform as claimed in any one of claims 1 to The method described.
  15. 一种FPGA,包括输入装置、输出装置、处理器和存储器,其中所述输入装置用于读取原始的FPGA加载文件,所述处理器用于执行如权利要求1至5中任一项所述的数据压缩方法对所述原始的FPGA加载文件进行压缩得到压缩后的FPGA加载文件,所述存储器用于存储所述压缩后的FPGA加载文件。An FPGA comprising an input device, an output device, a processor and a memory, wherein the input device is for reading an original FPGA load file, the processor for performing the method of any one of claims 1 to 5 The data compression method compresses the original FPGA load file to obtain a compressed FPGA load file, and the memory is used to store the compressed FPGA load file.
  16. 一种FPGA,包括输入装置、输出装置、处理器和存储器,其中所述输入装置用于读取待解压的解压数据文件,所述处理器用于执行如权利要求6至8中任一项所述的数据解压方法对原始的FPGA加载文件进行解压得到解压后的FPGA加载文件,所述存储器用于存储所述解压后的FPGA加载文件。 An FPGA comprising an input device, an output device, a processor, and a memory, wherein the input device is configured to read a decompressed data file to be decompressed, and the processor is configured to perform the method of any one of claims 6 to The data decompression method decompresses the original FPGA load file to obtain a decompressed FPGA load file, and the memory is used to store the decompressed FPGA load file.
PCT/CN2017/086062 2017-05-26 2017-05-26 Data compression method and data decompression method, and related device WO2018214140A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2017/086062 WO2018214140A1 (en) 2017-05-26 2017-05-26 Data compression method and data decompression method, and related device
CN201780091030.XA CN110799959B (en) 2017-05-26 2017-05-26 Data compression method, decompression method and related equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2017/086062 WO2018214140A1 (en) 2017-05-26 2017-05-26 Data compression method and data decompression method, and related device

Publications (1)

Publication Number Publication Date
WO2018214140A1 true WO2018214140A1 (en) 2018-11-29

Family

ID=64396072

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/086062 WO2018214140A1 (en) 2017-05-26 2017-05-26 Data compression method and data decompression method, and related device

Country Status (2)

Country Link
CN (1) CN110799959B (en)
WO (1) WO2018214140A1 (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111600961A (en) * 2020-05-22 2020-08-28 山东超越数控电子股份有限公司 Method, system, equipment and medium for transmitting bitmap file through CAN port
CN111708777A (en) * 2020-06-08 2020-09-25 云谷(固安)科技有限公司 Display data access method and device and display device
CN112612830A (en) * 2020-12-03 2021-04-06 海光信息技术股份有限公司 Method and system for exporting compressed data in batches and electronic equipment
CN112783056A (en) * 2021-01-04 2021-05-11 潍柴动力股份有限公司 Data programming method, device and equipment of ECU and storage medium
CN116828070A (en) * 2023-08-28 2023-09-29 无锡市锡容电力电器有限公司 Intelligent power grid data optimization transmission method
CN116980492A (en) * 2023-09-20 2023-10-31 新誉集团有限公司 CAN data transmission method and device
CN117331512A (en) * 2023-12-01 2024-01-02 芯动微电子科技(武汉)有限公司 Data compression and processing method for executing write operation on GPU (graphics processing unit) nuclear memory

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111313907B (en) * 2020-02-19 2023-04-21 广西电网有限责任公司 Method and device for compressing massive power data
CN112073736B (en) * 2020-08-04 2022-06-21 深圳市创必得科技有限公司 Encoding method, decoding method and device of 3D model file and 3D printer
CN112579128B (en) * 2020-12-23 2023-05-09 恒为科技(上海)股份有限公司 Data processing method, upper computer, singlechip and system
CN113347667B (en) * 2021-06-08 2022-07-05 武汉虹信科技发展有限责任公司 Bit compression method and system for reporting UCI (uplink control information)
CN113971702A (en) * 2021-10-29 2022-01-25 深圳市道通科技股份有限公司 Picture compression method, decompression method and electronic equipment
CN115543979B (en) * 2022-09-29 2023-08-08 广州鼎甲计算机科技有限公司 Method, apparatus, device, storage medium and program product for deleting duplicate data

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102122960A (en) * 2011-01-18 2011-07-13 西安理工大学 Multi-character combination lossless data compression method for binary data
US20150347442A1 (en) * 2014-06-02 2015-12-03 Sean Lawrence Data embedding in run length encoded streams
CN106407285A (en) * 2016-08-26 2017-02-15 西安空间无线电技术研究所 RLE and LZW-based optimized bit file compression and decompression method

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9405479B1 (en) * 2013-08-26 2016-08-02 Western Digital Technologies, Inc. Faster file compression using sliding compression window and backward compound pointers
CN106656195A (en) * 2015-11-04 2017-05-10 北京信威通信技术股份有限公司 Data compression decompression method and data compression decompression system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102122960A (en) * 2011-01-18 2011-07-13 西安理工大学 Multi-character combination lossless data compression method for binary data
US20150347442A1 (en) * 2014-06-02 2015-12-03 Sean Lawrence Data embedding in run length encoded streams
CN106407285A (en) * 2016-08-26 2017-02-15 西安空间无线电技术研究所 RLE and LZW-based optimized bit file compression and decompression method

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111600961A (en) * 2020-05-22 2020-08-28 山东超越数控电子股份有限公司 Method, system, equipment and medium for transmitting bitmap file through CAN port
CN111708777A (en) * 2020-06-08 2020-09-25 云谷(固安)科技有限公司 Display data access method and device and display device
CN111708777B (en) * 2020-06-08 2023-06-23 云谷(固安)科技有限公司 Display data access method and device and display device
CN112612830A (en) * 2020-12-03 2021-04-06 海光信息技术股份有限公司 Method and system for exporting compressed data in batches and electronic equipment
CN112612830B (en) * 2020-12-03 2023-01-31 海光信息技术股份有限公司 Method and system for exporting compressed data in batches and electronic equipment
CN112783056A (en) * 2021-01-04 2021-05-11 潍柴动力股份有限公司 Data programming method, device and equipment of ECU and storage medium
CN112783056B (en) * 2021-01-04 2022-09-23 潍柴动力股份有限公司 Data programming method, device and equipment of ECU and storage medium
CN116828070A (en) * 2023-08-28 2023-09-29 无锡市锡容电力电器有限公司 Intelligent power grid data optimization transmission method
CN116828070B (en) * 2023-08-28 2023-11-07 无锡市锡容电力电器有限公司 Intelligent power grid data optimization transmission method
CN116980492A (en) * 2023-09-20 2023-10-31 新誉集团有限公司 CAN data transmission method and device
CN117331512A (en) * 2023-12-01 2024-01-02 芯动微电子科技(武汉)有限公司 Data compression and processing method for executing write operation on GPU (graphics processing unit) nuclear memory
CN117331512B (en) * 2023-12-01 2024-04-12 芯动微电子科技(武汉)有限公司 Data compression and processing method for executing write operation on GPU (graphics processing unit) nuclear memory

Also Published As

Publication number Publication date
CN110799959A (en) 2020-02-14
CN110799959B (en) 2024-02-27

Similar Documents

Publication Publication Date Title
WO2018214140A1 (en) Data compression method and data decompression method, and related device
JP6742692B2 (en) Encoding program and decompression program
JP3305190B2 (en) Data compression device and data decompression device
KR101505263B1 (en) Method for de-duplicating data and apparatus therefor
JP6641857B2 (en) Encoding program, encoding method, encoding device, decoding program, decoding method, and decoding device
JP2010238107A (en) Program and method for storing data, and information processing apparatus
US11030172B2 (en) Database archiving method and device for creating index information and method and device of retrieving archived database including index information
US9479195B2 (en) Non-transitory computer-readable recording medium, compression method, decompression method, compression device, and decompression device
US9577666B2 (en) Method and system
JP2021162459A (en) Data management system, data management method, and data management program
CN107766067B (en) Method for improving compressed mirror image burning speed, storage medium and computer
KR101842420B1 (en) Information processing apparatus, and data management method
TWI377795B (en) Data development device and data development method
KR20150035876A (en) Method for de-duplicating data and apparatus therefor
JP6471012B2 (en) Semiconductor memory, storage device, host device, data processing system, data writing device, data writing program, control program, and data writing method
US20150193462A1 (en) Control method and control device
US10037148B2 (en) Facilitating reverse reading of sequentially stored, variable-length data
JP6276386B2 (en) Data structure, information processing apparatus, information processing method, and program recording medium
WO2020137611A1 (en) Data compression method
CN118606283A (en) File compression method, file decompression method, electronic device and storage medium
CN115469811A (en) Data storage method, apparatus, device, storage medium and program product
JP2018046518A (en) Data processing apparatus and data processing method
KR20070054055A (en) Data processing apparatus

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: 17910596

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17910596

Country of ref document: EP

Kind code of ref document: A1