CN106909398A - The compression method and device of a kind of executable file - Google Patents

The compression method and device of a kind of executable file Download PDF

Info

Publication number
CN106909398A
CN106909398A CN201710142482.8A CN201710142482A CN106909398A CN 106909398 A CN106909398 A CN 106909398A CN 201710142482 A CN201710142482 A CN 201710142482A CN 106909398 A CN106909398 A CN 106909398A
Authority
CN
China
Prior art keywords
target data
compression
storage format
strategy
executable file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201710142482.8A
Other languages
Chinese (zh)
Other versions
CN106909398B (en
Inventor
刘兆祥
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Skyworth RGB Electronics Co Ltd
Original Assignee
Shenzhen Skyworth RGB Electronics Co Ltd
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 Shenzhen Skyworth RGB Electronics Co Ltd filed Critical Shenzhen Skyworth RGB Electronics Co Ltd
Priority to CN201710142482.8A priority Critical patent/CN106909398B/en
Publication of CN106909398A publication Critical patent/CN106909398A/en
Priority to PCT/CN2018/076624 priority patent/WO2018161791A1/en
Application granted granted Critical
Publication of CN106909398B publication Critical patent/CN106909398B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/73Program documentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0608Saving storage space on storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/0643Management of files
    • 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/02Conversion to or from weighted codes, i.e. the weight given to a digit depending on the position of the digit within the block or code word
    • H03M7/04Conversion to or from weighted codes, i.e. the weight given to a digit depending on the position of the digit within the block or code word the radix thereof being two

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Human Computer Interaction (AREA)
  • Library & Information Science (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本发明实施例公开了一种可执行文件的压缩方法及装置。所述方法包括:分析所述可执行文件各部分数据的功能属性和存储格式属性;根据所述功能属性,识别出所述各部分数据中可压缩的目标数据;根据所述目标数据的存储格式属性,得到所述目标数据的压缩策略;根据所述压缩策略,对所述目标数据进行压缩,并更新所述目标数据的存储格式属性,得到压缩后的可执行文件。通过采用上述技术方案,可以使得压缩后的可执行文件占用较少的存储空间,达到节约硬件成本的效果,提升了市场竞争力。

The embodiment of the invention discloses a compression method and device for an executable file. The method includes: analyzing the functional attributes and storage format attributes of each part of the executable file data; identifying the compressible target data in each part of the data according to the functional attributes; according to the storage format of the target data attribute, to obtain a compression strategy for the target data; according to the compression strategy, compress the target data, and update the storage format attribute of the target data, to obtain a compressed executable file. By adopting the above technical solution, the compressed executable file can occupy less storage space, achieve the effect of saving hardware cost, and enhance the market competitiveness.

Description

一种可执行文件的压缩方法及装置Compression method and device for an executable file

技术领域technical field

本发明实施例涉嵌入式技术领域,尤其涉及一种可执行文件的压缩方法及装置。The embodiment of the present invention relates to the field of embedded technologies, and in particular to a method and device for compressing executable files.

背景技术Background technique

随着科学技术的不断发展,电视等行业的竞争越来越激烈。其中,成本竞争是很重要的一个方面,如何降低成本也是绝大多数公司都需要考虑的问题。With the continuous development of science and technology, the competition in industries such as television is becoming more and more fierce. Among them, cost competition is a very important aspect, and how to reduce costs is also a problem that most companies need to consider.

以电视机制造行业为例,成本竞争主要集中在硬件方面。在软件方面一般是通过减少可执行文件的大小,从而减小存储芯片空间的大小来降低电视机存储硬件的材料成本。Taking the TV manufacturing industry as an example, cost competition mainly focuses on hardware. In terms of software, the material cost of the TV storage hardware is generally reduced by reducing the size of the executable file, thereby reducing the size of the storage chip space.

在现有技术中,一般是根据可执行文件的不同,确定不同的压缩算法以对可执行文件进行压缩。然而,当可执行文件较多时,且对各个可执行文件分别压缩后,也可能存在存储空间无法存储所有压缩后的可执行文件的这种情况。这是因为,在各个可执行文件的压缩和/或解压缩过程中,需要为压缩和/或解压缩算法的执行开辟额外的存储空间,而当可执行文件较多时,执行压缩和/或解压缩算法本身所需要的额外存储空间也比较多,在存储空间不能满足执行压缩和/或解压算法的要求时,压缩和/或解压缩算法的效果就会受到影响,进而造成文件所占存储设备空间增大,使得存储可执行文件存储芯片的成本增加。In the prior art, generally, different compression algorithms are determined according to different executable files to compress the executable files. However, when there are many executable files and each executable file is compressed separately, there may be a situation where the storage space cannot store all the compressed executable files. This is because, during the compression and/or decompression process of each executable file, it is necessary to open up additional storage space for the execution of the compression and/or decompression algorithm, and when there are many executable files, it is necessary to perform compression and/or decompression The compression algorithm itself requires a lot of additional storage space. When the storage space cannot meet the requirements of the compression and/or decompression algorithm, the effect of the compression and/or decompression algorithm will be affected, which will cause the storage device occupied by the file The increased space increases the cost of the memory chip for storing executable files.

因此,现有技术中的可执行文件的压缩方式和压缩效率有待提高。Therefore, the compression method and compression efficiency of executable files in the prior art need to be improved.

发明内容Contents of the invention

为解决上述相关技术问题,本发明提供一种可执行文件的压缩方法及装置,以提高可执行文件的压缩率,节省存储可执行文件存储芯片的存储空间,间接达到节约硬件成本的技术效果。In order to solve the above related technical problems, the present invention provides a method and device for compressing executable files to improve the compression rate of executable files, save the storage space of storage chips for storing executable files, and indirectly achieve the technical effect of saving hardware costs.

为实现上述目的,本发明实施例采用如下技术方案:In order to achieve the above purpose, the embodiment of the present invention adopts the following technical solutions:

第一方面,本发明实施例提供了一种可执行文件的压缩方法,所述方法包括:In a first aspect, an embodiment of the present invention provides a method for compressing an executable file, the method comprising:

分析所述可执行文件各部分数据的功能属性和存储格式属性;Analyzing the functional attributes and storage format attributes of the data in each part of the executable file;

根据所述功能属性,识别出所述各部分数据中可压缩的目标数据;Identifying compressible target data in each part of data according to the functional attributes;

根据所述目标数据的存储格式属性,得到所述目标数据的压缩策略;Obtaining the compression policy of the target data according to the storage format attribute of the target data;

根据所述压缩策略,对所述目标数据进行压缩,并更新所述目标数据的存储格式属性,得到压缩后的可执行文件。According to the compression strategy, the target data is compressed, and the storage format attribute of the target data is updated to obtain a compressed executable file.

第二方面,本发明实施例提供了一种可执行文件的装置,所述装置包括:In a second aspect, an embodiment of the present invention provides an executable file device, the device comprising:

属性分析模块,用于分析所述可执行文件各部分数据的功能属性和存储格式属性;An attribute analysis module, configured to analyze the functional attributes and storage format attributes of the data of each part of the executable file;

目标数据识别模块,用于根据所述功能属性,识别出所述各部分数据中可压缩的目标数据;A target data identification module, configured to identify compressible target data in each part of the data according to the functional attributes;

压缩策略确定模块,用于根据所述目标数据的存储格式属性,得到所述目标数据的压缩策略;A compression strategy determination module, configured to obtain a compression strategy for the target data according to the storage format attribute of the target data;

压缩模块,用于根据所述压缩策略,对所述目标数据进行压缩,并更新所述目标数据的存储格式属性,得到压缩后的可执行文件。The compression module is configured to compress the target data according to the compression strategy, and update the storage format attribute of the target data to obtain a compressed executable file.

本发明实施例提供的一种可执行文件的压缩方法及装置,首先分析可执行文件各部分数据的功能属性和存储格式属性,根据各部分数据的功能属性,可识别出各部分数据中可压缩的目标数据;根据目标数据的存储格式属性,可得到目标数据的压缩策略;根据压缩策略,对可压缩的目标数据进行压缩,并更新目标数据的存储格式属性,得到压缩后的可执行文件。通过采用上述技术方案,相对于现有技术,可以使得压缩后的可执行文件占用较少的存储空间,达到节省存储可执行文件的硬件成本的技术效果,间接提升了产品的市场竞争力。The embodiment of the present invention provides a method and device for compressing an executable file. Firstly, the functional attributes and storage format attributes of each part of the executable file are analyzed, and according to the functional attributes of each part of the data, it is possible to identify the The target data; according to the storage format attribute of the target data, the compression strategy of the target data can be obtained; according to the compression strategy, the compressible target data is compressed, and the storage format attribute of the target data is updated to obtain the compressed executable file. By adopting the above technical solution, compared with the prior art, the compressed executable file can occupy less storage space, achieve the technical effect of saving hardware cost for storing the executable file, and indirectly improve the market competitiveness of the product.

附图说明Description of drawings

为了更清楚地说明本发明实施例中的技术方案,下面将对本发明实施例描述中所需要使用的附图作简单的介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据本发明实施例的内容和这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the accompanying drawings that need to be used in the description of the embodiments of the present invention. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention , for those skilled in the art, other drawings can also be obtained according to the content of the embodiment of the present invention and these drawings without any creative effort.

图1为本发明实施例一提供的一种可执行文件的压缩方法的流程图;FIG. 1 is a flow chart of a method for compressing an executable file provided in Embodiment 1 of the present invention;

图2a为写FLASH操作后生成的一种可执行的二进制文件数据;Figure 2a is a kind of executable binary file data generated after writing the FLASH operation;

图2b为写FLASH操作后生成的又一种可执行的二进制文件数据;Figure 2b is another executable binary file data generated after the FLASH operation;

图3a为本发明实施例一提供的优化前电视FLASH内存的数据存储结构分布图;Figure 3a is a distribution diagram of the data storage structure of the TV FLASH memory before optimization provided by Embodiment 1 of the present invention;

图3b为本发明实施例一提供的优化后电视FLASH内存的数据存储结构分布图;Figure 3b is a distribution diagram of the data storage structure of the optimized TV FLASH memory provided by Embodiment 1 of the present invention;

图4为本发明实施例二提供的一种可执行文件的压缩方法的流程图;FIG. 4 is a flow chart of an executable file compression method provided in Embodiment 2 of the present invention;

图5为本发明实施例二提供的一种可执行文件在压缩前后所占存储空间的对比示意图;FIG. 5 is a schematic diagram of a comparison of storage space occupied by an executable file before and after compression provided in Embodiment 2 of the present invention;

图6为本发明实施例三提供的一种可执行文件的压缩装置的结构框图。FIG. 6 is a structural block diagram of an executable file compression device provided by Embodiment 3 of the present invention.

具体实施方式detailed description

为使本发明解决的技术问题、采用的技术方案和达到的技术效果更加清楚,下面将结合附图对本发明实施例的技术方案作进一步的详细描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the technical problems solved by the present invention, the technical solutions adopted and the technical effects achieved clearer, the technical solutions of the embodiments of the present invention will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only the technical solutions of the present invention. Some, but not all, embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative efforts fall within the protection scope of the present invention.

实施例一Embodiment one

图1为本发明实施例一提供的一种可执行文件的压缩方法的流程图。本实施例的方法可以由如电视和/或电视机顶盒等可执行文件的压缩装置来执行,其中,该方法可由部署在如电视和/或电视机顶盒中的软件和/或硬件来实施,该软件和/或硬件一般可集成在某个嵌入式系统中。如图1所示,该方法可以包括如下步骤:FIG. 1 is a flow chart of a method for compressing an executable file provided by Embodiment 1 of the present invention. The method of this embodiment may be executed by a device for compressing executable files such as a TV and/or a TV set-top box, wherein the method may be implemented by software and/or hardware deployed in a TV and/or a TV set-top box, the software And/or hardware can generally be integrated in an embedded system. As shown in Figure 1, the method may include the following steps:

S110:分析可执行文件各部分数据的功能属性和存储格式属性。S110: Analyze the functional attributes and storage format attributes of the data in each part of the executable file.

其中,可执行文件是指由操作系统进行加载执行的文件,本实施例中提到的可执行文件优选为可执行的二进制(bin)文件。上述可执行的二进制文件可以为已经经过压缩处理的二进制文件,也可为未经过压缩处理的二进制文件。其中,本领域技术人员可根据可执行的二进制文件中携带的压缩标识,来判断该二进制文件是否已被压缩。Wherein, an executable file refers to a file loaded and executed by an operating system, and the executable file mentioned in this embodiment is preferably an executable binary (bin) file. The above-mentioned executable binary file may be a compressed binary file or a non-compressed binary file. Wherein, those skilled in the art can judge whether the binary file has been compressed according to the compression identifier carried in the executable binary file.

示例性的,可执行文件各部分数据的存储格式属性可以从各部分数据对应存储路径中附加的标识该部分数据对应存储格式的标识符中得到,通常包括如下三种情况:Exemplarily, the storage format attribute of each part of the data in the executable file can be obtained from the identifier that identifies the corresponding storage format of the part of the data attached to the corresponding storage path of each part of the data, usually including the following three situations:

1、对应存储路径中未添加有任何压缩标识;1. There is no compression mark added to the corresponding storage path;

对于在各部分数据对应存储路径中未添加任何压缩标识的可执行文件,编译器在编译该文件时只需完成正常的编译处理即可,无需做任何压缩和解压缩处理。For an executable file without any compression mark added to the corresponding storage path of each part of data, the compiler only needs to complete normal compilation processing when compiling the file, without any compression and decompression processing.

2、对应存储路径中添加有压缩率较低的压缩标识;2. A compression flag with a lower compression ratio is added to the corresponding storage path;

优选的,本发明实施例中的预设存储格式属性是指,在存储路径中按照第一预设存储格式(如标识符“-g”)或第二预设存储格式(如标识符“-7”)保存的可执行文件具有的特征属性。上述两种存储格式对应的压缩率不同,第一预设存储格式对应的压缩率较低,第二预设存储格式对应的压缩率较高。具体的,当第一预设存储格式的标记符为“-g”时。若在可执行的二进制文件的某部分数据的对应存储路径中检测到存在“-g”标识符时,则说明编译器在编译该可执行的二进制文件的该部分数据过程中,对该部分数据按较小压缩率的方式进行过压缩处理,以节省该二进制文件所占用的存储空间,进而节省存储该二进制文件硬件(如存储芯片)的材料成本。Preferably, the preset storage format attribute in the embodiment of the present invention refers to, in the storage path, according to the first preset storage format (such as the identifier "-g") or the second preset storage format (such as the identifier "-g") 7") The characteristic attribute that the saved executable file has. The compression ratios corresponding to the above two storage formats are different, the compression ratio corresponding to the first preset storage format is relatively low, and the compression ratio corresponding to the second preset storage format is relatively high. Specifically, when the flag of the first preset storage format is "-g". If the presence of the "-g" identifier is detected in the corresponding storage path of a certain part of the data in the executable binary file, it means that the compiler will The compression process is performed with a smaller compression rate to save the storage space occupied by the binary file, thereby saving the material cost of hardware (such as a memory chip) for storing the binary file.

3、对应存储路径中添加有压缩率较高的压缩标识。3. A compression mark with a higher compression rate is added to the corresponding storage path.

优选的,当第二预设存储格式的标识符为“-7”。若可执行的二进制文件的某部分数据的对应存储路径中若检测到存在“-7”标识符时,则说明编译器在编译该二进制文件的该部分数据过程中,对该部分数据按较大压缩率的方式进行过压缩处理,相较于标识符为“-g”的第一预设存储格式,上述压缩方式可进一步节省该可执行的二进制文件所占用的存储空间,以节省存储该二进制文件硬件的材料成本。Preferably, when the identifier of the second preset storage format is "-7". If the "-7" identifier is detected in the corresponding storage path of a certain part of the data in the executable binary file, it means that the compiler presses the larger Compared with the first preset storage format whose identifier is "-g", the above compression method can further save the storage space occupied by the executable binary file, so as to save the storage space of the binary file. The material cost of the file hardware.

需要说明的是,由于压缩算法和技术众多,可执行的二进制文件各部分数据的存储格式并不限于以上所列举的三种形式。It should be noted that due to numerous compression algorithms and technologies, the storage format of the data of each part of the executable binary file is not limited to the three forms listed above.

S120:根据功能属性,识别出各部分数据中可压缩的目标数据。S120: Identify compressible target data in each part of data according to the functional attributes.

进一步的,在可执行的二进制文件各部分被压缩之前,需要根据各部分数据的功能属性这一基本特性,判断该可执行的二进制文件中的各部分数据是否可以进行压缩。示例性的,可执行的二进制文件中的各部分数据的功能属性可包括但不限于如存储属性、压缩或解压缩属性等。在具体操作过程中,对于具有解压缩属性或者具有标记属性的可执行的二进制文件的数据,则不可以违背其数据属性对其做压缩处理;而对于具有存储属性的二进制文件中的数据,则可以对其进行压缩以节省存储空间。Further, before each part of the executable binary file is compressed, it is necessary to judge whether each part of the data in the executable binary file can be compressed according to the basic characteristic of the functional attribute of each part of data. Exemplarily, the functional attributes of each part of data in the executable binary file may include, but not limited to, storage attributes, compression or decompression attributes, and the like. In the specific operation process, for the data of an executable binary file with decompression attribute or tag attribute, it cannot be compressed against its data attribute; and for the data in a binary file with storage attribute, then It can be compressed to save storage space.

示例性的,下面以系统的实际结构为例进行说明,该系统优选NOS(No OperatingSystem,没有操作系统)系统:Exemplarily, the actual structure of the system is used as an example below to illustrate, and the system is preferably a NOS (No Operating System, no operating system) system:

00113:#define IMG_INFO_OFFSET 0x2100000113: #define IMG_INFO_OFFSET 0x21000

00112:#difine MAGIC_BOOTLOADER 0x55AA123400112: #difine MAGIC_BOOTLOADER 0x55AA1234

00113:#define MAGIC_APP 0x55AA567800113: #define MAGIC_APP 0x55AA5678

00114:#define MAGIC_IMAGE_END 0x55AAABCD00114: #define MAGIC_IMAGE_END 0x55AAABCD

图2a为写闪存(Flash Memory,一般简称FLASH)操作后生成的一种可执行的二进制文件数据。如图2a所示,通过对该结构体进行写FLASH操作,在实际的生成文件中,0x21000是实际写入的数据。由于该地址对应的是标记码部分,则生成的文件数据不可以被压缩,必须以实际占用的字节大小进行存储。FIG. 2a is an executable binary file data generated after a flash memory (Flash Memory, generally abbreviated as FLASH) operation. As shown in Figure 2a, by writing the FLASH operation to the structure, in the actual generated file, 0x21000 is the actually written data. Since this address corresponds to the markup code part, the generated file data cannot be compressed and must be stored in the actual occupied byte size.

示例性的,对于下述可执行的二进制文件数据:Exemplarily, for the following executable binary file data:

00303:#difine BIN_PACKAGE_HEADER_ID0 0x54454C0900303: #difine BIN_PACKAGE_HEADER_ID0 0x54454C09

00304:#difine BIN_PACKAGE_HEADER_ID1 0x5833690000304: #difine BIN_PACKAGE_HEADER_ID1 0x58336900

00289:PlaceU32_(BIN_PACKAGE_HEADER_ID0),00289: PlaceU32_(BIN_PACKAGE_HEADER_ID0),

PlaceU32_(BIN_PACKAGE_HEADER_ID1)PlaceU32_(BIN_PACKAGE_HEADER_ID1)

具体的,图2b为写FLASH操作后生成的又一种可执行的二进制文件数据。如图2b所示,本领域技术人员可以理解的是,在该二进制文件中,地址0002100h对应的数据与写入的数据(54454C09和58336900)一致,则表明该二进制文件中的该部分数据是可以被压缩的。Specifically, FIG. 2b shows another executable binary file data generated after the FLASH write operation. As shown in Figure 2b, those skilled in the art can understand that in the binary file, the data corresponding to the address 0002100h is consistent with the written data (54454C09 and 58336900), indicating that this part of the data in the binary file can be is compressed.

通过对可执行的二进制文件各部分数据的功能属性进行分析,可以快速识别出该二进制文件中可被压缩的目标数据,从而快速锁定可压缩,即待处理对象,缩小处理范围。By analyzing the functional attributes of the data of each part of the executable binary file, the target data that can be compressed in the binary file can be quickly identified, so as to quickly lock the compressible, that is, the object to be processed, and narrow the scope of processing.

S130:根据目标数据的存储格式属性,得到目标数据的压缩策略。S130: Obtain a compression strategy for the target data according to the storage format attribute of the target data.

示例性的,不同的存储格式属性对应的压缩策略不同。例如:Exemplarily, different storage format attributes correspond to different compression strategies. E.g:

若目标数据对应存储路径中未添加有任何压缩标识的存储属性,则说明该目标数据完全没有别压缩。据此,从而可以得出该目标数据的下一步压缩策略,即可以按照某种压缩方式对该部分数据进行压缩,从而减少该目标数据的存储空间;If no storage attribute with any compression flag is added to the storage path corresponding to the target data, it means that the target data is not compressed at all. Accordingly, the next compression strategy for the target data can be obtained, that is, the part of the data can be compressed according to a certain compression method, thereby reducing the storage space of the target data;

若目标数据按照第一预设存储格式(如标识符为“-g”)的形式存储在对应路径中,则说明目标数据当前是按压缩率较低的压缩方式压缩的。据此,可以得出该目标数据下一步的压缩策略,即可按比当前压缩率更高的某种压缩方式压缩该部分目标数据;If the target data is stored in the corresponding path in the form of the first preset storage format (for example, the identifier is “-g”), it means that the target data is currently compressed by a compression method with a relatively low compression rate. Accordingly, the next compression strategy for the target data can be obtained, that is, the part of the target data can be compressed in a compression method with a higher compression rate than the current one;

若目标数据按照第二预设存储格式(如标识符为“-7”)的形式存储在对应路径中,则说明目标数据当前可按某种压缩率较高的压缩方式压缩的。据此,有可能可以得出该目标数据下一步的压缩策略,即有可能无法再通过更换压缩方式,进一步提升该部分目标数据的压缩率了。If the target data is stored in the corresponding path in the form of the second preset storage format (for example, the identifier is "-7"), it means that the target data can currently be compressed by a compression method with a relatively high compression rate. Based on this, it is possible to obtain the next compression strategy for the target data, that is, it may not be possible to further improve the compression rate of this part of the target data by changing the compression method.

S140:根据压缩策略,对目标数据进行压缩,并更新目标数据的存储格式属性,得到压缩后的可执行文件。S140: Compress the target data according to the compression strategy, and update the storage format attribute of the target data to obtain a compressed executable file.

对于可压缩的目标数据,根据上述步骤中已确定的压缩策略,可对其进行压缩处理,同时可更新目标数据对应的存储路径中的存储格式属性,使得压缩后的目标数据的存储格式属性与当前的压缩策略相对应。从而便于该目标数据被执行时选择与当前压缩策略对应的解压缩策略。因此,通过识别目标数据的存储格式属性,可确定出该目标数据是否被压缩,或者是按照怎样的方式经过压缩处理的。For the compressible target data, according to the compression strategy determined in the above steps, it can be compressed, and at the same time, the storage format attribute in the storage path corresponding to the target data can be updated, so that the storage format attribute of the compressed target data is the same as Corresponds to the current compaction strategy. Therefore, it is convenient to select the decompression strategy corresponding to the current compression strategy when the target data is executed. Therefore, by identifying the storage format attribute of the target data, it can be determined whether the target data is compressed, or in what way it is compressed.

进一步的,将压缩后的可执行文件保存在FLASH中后,对于FLASH剩余的存储空间,可通过充分利用其剩余空间保存数据,使得该FLASH内存空间的利用率达到最大。具体的,其优化方法如下:Further, after saving the compressed executable file in the FLASH, for the remaining storage space of the FLASH, the remaining space of the FLASH can be fully utilized to store data, so that the utilization rate of the FLASH memory space can be maximized. Specifically, the optimization method is as follows:

图3a为本发明实施例一提供的优化前电视FLASH内存的数据存储结构分布图。如图3a所示,在0-57BANK(存储单位)的存储空间,主要存储软件的可执行文件,所以可执行文件的大小最大为58×64K=3712K。如果可执行文件的大小大于这个空间,就会存在覆盖数据区的风险。而对于可执行文件以外的数据则根据实际结构体的大小以及实际的频道个数进行存储空间的分配。将全部数据存储完成之后,只剩余了2K的可用空间,即存储空间余量不足。因此,为了对存储空间进行优化以达到精简的要求,需在图3a中的7个BANK中再节省出一个BANK来存储数据。具体优化过程如下:FIG. 3 a is a distribution diagram of the data storage structure of the TV FLASH memory before optimization provided by Embodiment 1 of the present invention. As shown in Fig. 3a, in the storage space of 0-57BANK (storage unit), executable files of software are mainly stored, so the maximum size of executable files is 58*64K=3712K. If the size of the executable file is larger than this space, there is a risk of overwriting the data area. For data other than executable files, the storage space is allocated according to the size of the actual structure and the actual number of channels. After all the data is stored, there is only 2K available space left, that is, the storage space margin is insufficient. Therefore, in order to optimize the storage space to meet the requirement of simplification, it is necessary to save another BANK among the 7 BANKs in Fig. 3a to store data. The specific optimization process is as follows:

经过分析,在第63个BANK中,真实的数据只有304个BYTE,但是FLASH的存储空间是以BANK为单元来进行划分的,所以,第63个BANK中304个BYTE的数据占据了整个第63个BANK,造成了FLASH存储空间资源的浪费。图3b为本发明实施例一提供的优化后电视FLASH内存的数据存储结构分布图。如图3b所示,通过升级HDCP,可将高带宽数字内容保护(High-bandwidth Digital Content Protection,HDCP)部分的数据直接写入到规定的内存(如第58个BANK)中。这样,就可以多节省出一个BANK来存放其它程序代码。除此之外,还可将数据的存储方式修改为不保存的方式,在系统初始化时将初始化整个表格,然后在切换不同的时序时,可直接从表格中加载数据,这样又可节省一个BANK出来。因此,通过采用上述优化内存分配的方式,可达到进一步节省存储空间的技术效果。After analysis, in the 63rd BANK, the real data is only 304 BYTEs, but the storage space of FLASH is divided by BANK as a unit, so the data of 304 BYTEs in the 63rd BANK occupies the entire 63rd BANK. BANK, resulting in a waste of FLASH storage space resources. FIG. 3 b is a distribution diagram of the data storage structure of the optimized TV FLASH memory provided by Embodiment 1 of the present invention. As shown in FIG. 3b, by upgrading the HDCP, the data of the high-bandwidth digital content protection (High-bandwidth Digital Content Protection, HDCP) part can be directly written into the specified memory (such as the 58th BANK). In this way, one more BANK can be saved to store other program codes. In addition, the data storage method can also be modified to not save. The entire table will be initialized when the system is initialized, and then when switching between different timings, the data can be directly loaded from the table, which can save another BANK come out. Therefore, by adopting the above method of optimizing memory allocation, the technical effect of further saving storage space can be achieved.

可选的,对于节省存储空间的方法,本领域技术人员可以理解的是,对于在后续程序执行中不需要用到的图片,可通过对其在程序数据中进行删除,或者在对图片进行编译时修改图片的压缩率来降低生成图片的可执行文件的大小,进而进一步节省程序所需要的存储空间。Optionally, for the method of saving storage space, those skilled in the art can understand that, for the pictures that are not needed in the subsequent program execution, they can be deleted in the program data, or the pictures can be compiled Modify the compression rate of the picture from time to time to reduce the size of the executable file that generates the picture, and further save the storage space required by the program.

可选的,还可通过将程序中不需要执行的代码进行屏蔽的模式,修改为直接删除这部分被屏蔽使其不被执行代码的模式,达到进一步节省可执行文件存储空间的技术效果。因为采取的屏蔽代码的技术手段只是不执行这部分代码而已,但在原可执行的二进制文件中,这部分被屏蔽的不被执行的代码仍然物理上存在于原可执行的二进制文件中,所以这部分被屏蔽的代码仍然会占据一定的物理存储空间。如果对于被屏蔽以刻意不被执行的代码,采取直接删除代码的形式,则由于代码被物理性的删除了,相较于屏蔽不被执行的技术手段,删除代码则会进一步节省可执行的二进制文件的存储空间。Optionally, the mode of masking the codes that do not need to be executed in the program can be changed to the mode of directly deleting the codes that are masked so that they cannot be executed, so as to achieve the technical effect of further saving the storage space of the executable file. Because the technical means of shielding the code is only to not execute this part of the code, but in the original executable binary file, this part of the shielded non-executable code still physically exists in the original executable binary file, so this Partially shielded code still occupies a certain amount of physical storage space. If the code that is shielded from being executed deliberately is directly deleted, since the code is physically deleted, compared with the technical means of shielding from execution, deleting the code will further save executable binary Storage space for files.

本实施例提供了一种可执行文件的压缩方法,在分析可执行文件各部分数据的功能属性和存储格式属性后,根据可执行文件各部分数据的存储、压缩或解压缩等功能属性,可识别出该可执行文件各部分数据中可被压缩的目标数据。根据目标数据的存储格式属性,可得到目标数据的压缩策略。其中,压缩策略可包括不进行压缩、进行压缩,按照比原压缩率较大的新的压缩方式进行压缩,以及按照比原压缩率较小的新的压缩方式进行压缩等情况。根据压缩策略,对目标数据进行压缩,并更新目标数据的存储格式属性,得到压缩后的可执行文件。通过采用上述技术方案,可以使得压缩后的可执行文件占用较少的存储空间,达到节省可执行文件所需要的存储硬件材料成本的技术效果,从而间接地提升相应产品的市场竞争力。This embodiment provides a method for compressing an executable file. After analyzing the functional attributes and storage format attributes of each part of the executable file, according to the functional attributes such as storage, compression or decompression of the data of each part of the executable file, the Object data that can be compressed among portions of the executable file is identified. According to the storage format attribute of the target data, the compression strategy of the target data can be obtained. Wherein, the compression strategy may include no compression, compression, compression by a new compression method with a higher compression ratio than the original one, and compression by a new compression method with a smaller compression ratio than the original one. According to the compression strategy, the target data is compressed, and the storage format attribute of the target data is updated to obtain a compressed executable file. By adopting the above technical solution, the compressed executable file can occupy less storage space, achieving the technical effect of saving the cost of storage hardware materials required by the executable file, thereby indirectly improving the market competitiveness of corresponding products.

实施例二Embodiment two

图4为本发明实施例二提供的一种可执行文件的压缩方法的流程图。本实施例二在实施例一的基础上,对实施例一的步骤S130“根据目标数据的存储格式属性,得到目标数据的压缩策略”进行了进一步地优化,参照图4,本发明实施例二具体包括如下步骤:FIG. 4 is a flowchart of a method for compressing an executable file provided by Embodiment 2 of the present invention. On the basis of Embodiment 1, this Embodiment 2 further optimizes the step S130 of Embodiment 1 "obtaining the compression strategy of the target data according to the storage format attribute of the target data". Referring to FIG. 4, Embodiment 2 of the present invention Specifically include the following steps:

S210:分析可执行文件各部分数据的功能属性和存储格式属性。S210: Analyzing the functional attributes and storage format attributes of the data in each part of the executable file.

S220:根据功能属性,识别出各部分数据中可压缩的目标数据。S220: Identify compressible target data in each part of data according to the functional attribute.

S230:判断当前存储格式是否与预设存储格式相匹配,若是,则执行步骤S240;否则,则执行步骤S260。S230: Determine whether the current storage format matches the preset storage format, if yes, execute step S240; otherwise, execute step S260.

示例性的,由于经过步骤S220识别出的可压缩的目标数据有可能是已经过压缩处理后的数据,也可能是未经过任何压缩的数据。因此,通过将目标数据的当前存储格式与预设存储格式相比较,若二者不相符,则有可能表明目标数据是未经过压缩处理的数据。若当前存储格式与任一预设存储格式相匹配,则可说明当前目标数据是按照预设存储格式对应的压缩率经过压缩处理之后的数据。因此步骤230可以作为确定当前目标数据的压缩策略的基础,在压缩策略确定后,可选择合适的压缩方式对当前的目标数据进行进一步地压缩,进而节省目标数据所占用的存储空间。Exemplarily, the compressible target data identified in step S220 may be data that has undergone compression processing, or may be data that has not undergone any compression. Therefore, by comparing the current storage format of the target data with the preset storage format, if the two do not match, it may be possible to indicate that the target data is uncompressed data. If the current storage format matches any of the preset storage formats, it may indicate that the current target data is compressed according to the compression rate corresponding to the preset storage format. Therefore, step 230 can be used as a basis for determining the compression strategy of the current target data. After the compression strategy is determined, an appropriate compression method can be selected to further compress the current target data, thereby saving the storage space occupied by the target data.

S240:判断当前存储格式是否与第一压缩策略对应的第一预设存储格式相匹配,若是,则执行步骤S250;否则,则执行步骤S260。S240: Determine whether the current storage format matches the first preset storage format corresponding to the first compression strategy, if yes, execute step S250; otherwise, execute step S260.

示例性的,在目标数据的当前存储格式与预设存储格式匹配的前提下,若进一步判断出当前存储格式与第一压缩策略对应的第一预设存储格式(如标识符为“-g”)相匹配,则可说明目标数据已按照第一压缩策略经过了压缩处理。此时,可根据实际需求,更改目标数据的压缩策略,并同时相应地对目标数据的原第一预设存储格式(如标识符为“-g”)进行修改,以提升目标数据的压缩率,达到节省可执行文件存储空间,节约存储材料成本的技术效果。Exemplarily, on the premise that the current storage format of the target data matches the preset storage format, if it is further determined that the current storage format corresponds to the first preset storage format of the first compression strategy (for example, the identifier is "-g" ), it indicates that the target data has been compressed according to the first compression strategy. At this time, the compression strategy of the target data can be changed according to actual needs, and at the same time, the original first preset storage format of the target data (such as the identifier is "-g") can be modified correspondingly to improve the compression rate of the target data , to achieve the technical effect of saving executable file storage space and saving storage material costs.

示例性的,还可以进一步判断当前存储格式是否与第二压缩策略对应的第二预设存储格式(如标识符为“-7”)相匹配,若是,则可说明目标数据已按照第二压缩策略经过了压缩处理。此时,也可根据实际需求,更改目标数据的压缩策略,并同时相应地对目标数据的原第二预设存储格式(如标识符为“-7”)进行修改。Exemplarily, it can be further judged whether the current storage format matches the second preset storage format corresponding to the second compression strategy (for example, the identifier is "-7"), and if so, it can indicate that the target data has been compressed according to the second Policies are compressed. At this time, the compression policy of the target data can also be changed according to actual needs, and at the same time, the original second preset storage format (eg, the identifier is "-7") of the target data can be correspondingly modified.

S250:按照与第二预设存储格式对应的第二压缩策略压缩目标数据,其中,第二压缩策略对应的压缩率大于第一压缩策略对应的压缩率,继续执行步骤S270。S250: Compress the target data according to the second compression strategy corresponding to the second preset storage format, wherein the compression ratio corresponding to the second compression strategy is greater than the compression ratio corresponding to the first compression strategy, and continue to execute step S270.

示例性的,若将目标数据中的第一预设预储格式(如标识符为“-g”)修改为第二预设存储格式(如标识符为“-7),则可提升目标数据的压缩率,节省存储空间。具体的,图5为本发明实施例二提供的一种可执行文件在压缩前后所占存储空间的对比示意图。如图5所示,未压缩的文件(vdplayer.bin)在存储空间中需要占用文件本身大小以节省存储空间(1270KB);而对于压缩后的文件(vdplayer.bin),则占用了较少一部分存储空间(380KB)。Exemplarily, if the first preset pre-storage format (for example, the identifier is "-g") in the target data is modified to the second preset storage format (for example, the identifier is "-7), the target data can be upgraded The compression ratio saves storage space. Specifically, Fig. 5 is a schematic diagram of the comparison of the storage space occupied by an executable file before and after compression for a kind of executable file provided by the embodiment of the present invention. As shown in Fig. 5, the uncompressed file (vdplayer. bin) needs to occupy the size of the file itself in the storage space to save storage space (1270KB); and for the compressed file (vdplayer.bin), it takes up a small part of the storage space (380KB).

示例性的,在一些特定情况下,对于某些目标数据,根据实际需要,若无需或不宜采用较大压缩率的方式进行压缩,则可将第二预设存储格式(如标识符为“-7”)修改为第一预设存储格式(如标识符为“-g”),以根据目标数据本身的特性节省其所占用的存储空间。Exemplarily, in some specific cases, for some target data, according to actual needs, if it is not necessary or appropriate to use a large compression ratio for compression, the second preset storage format (such as the identifier is "- 7") is modified to the first preset storage format (for example, the identifier is "-g"), so as to save the storage space occupied by the target data according to the characteristics of the target data itself.

S260:根据预设存储格式,确定目标数据的压缩策略,继续执行步骤S270。S260: Determine the compression policy of the target data according to the preset storage format, and continue to execute step S270.

示例性的,若目标数据的当前存储格式与预设存储格式不相符时,则可表明目标数据未经过压缩处理。此时,可将预设存储格式(例如,可以为第一预设存储格式也可以为第二预设存储格式)添加到目标数据对应存储的路径中,在压缩目标数据时,编辑器则可根据不同存储格式对应的压缩方式压缩目标数据,并得到不同压缩率的目标数据,以节省可执行文件中目标数据的存储空间,减小存储可执行文件所需要的硬件成本。Exemplarily, if the current storage format of the target data does not match the preset storage format, it may indicate that the target data has not been compressed. At this time, the preset storage format (for example, it can be the first preset storage format or the second preset storage format) can be added to the storage path corresponding to the target data. When compressing the target data, the editor can The target data is compressed according to the compression methods corresponding to different storage formats, and the target data with different compression ratios are obtained, so as to save the storage space of the target data in the executable file and reduce the hardware cost required for storing the executable file.

S270:根据压缩策略,对目标数据进行压缩,并更新目标数据的存储格式属性,得到压缩后的可执行文件。S270: Compress the target data according to the compression strategy, and update the storage format attribute of the target data to obtain a compressed executable file.

本实施例二在上述实施例的基础上,通过对目标数据的当前存储格式与预设的存储格式进行匹配,根据匹配结果,采取不同的压缩策略,并且根据所选择的压缩策略,相应进行添加或更改当前目标数据的原存储格式属性至新的存储格式属性,从而可以根据实际需要,相应地添加或更改目标数据的压缩方式,进而可以提升可执行文件目标数据的压缩率,节省目标数据所占存储空间,间接达到节约存储材料成本的技术效果。In the second embodiment, on the basis of the above-mentioned embodiments, by matching the current storage format of the target data with the preset storage format, different compression strategies are adopted according to the matching results, and correspondingly added according to the selected compression strategy. Or change the original storage format attribute of the current target data to the new storage format attribute, so that the compression method of the target data can be added or changed accordingly according to actual needs, and then the compression rate of the target data of the executable file can be improved, saving the cost of the target data. It takes up storage space and indirectly achieves the technical effect of saving storage material costs.

以下是本发明实施例提供的可执行文件的压缩装置的实施例,可执行文件的压缩装置与上述各实施例提供可执行文件的压缩方法属于同一个发明构思。The following is an embodiment of an executable file compression device provided by an embodiment of the present invention. The executable file compression device and the executable file compression method provided by the above embodiments belong to the same inventive concept.

实施例三Embodiment three

图6为本发明实施例三提供的一种可执行文件的压缩装置的结构框图。该装置可由部署在如电视和/或电视机顶盒中的软件和/或硬件来实现,其中,该装置一般可集成在如电视和/或电视机顶盒等硬件实体的嵌入式系统中。FIG. 6 is a structural block diagram of an executable file compression device provided by Embodiment 3 of the present invention. The device may be realized by software and/or hardware deployed in a TV and/or a TV set-top box, wherein the device may generally be integrated in an embedded system of a hardware entity such as a TV and/or a TV set-top box.

如图6所示,该装置包括:属性分析模块310、目标数据识别模块320、压缩策略确定模块330和压缩模块340。其中,As shown in FIG. 6 , the device includes: an attribute analysis module 310 , a target data identification module 320 , a compression policy determination module 330 and a compression module 340 . in,

属性分析模块310,用于分析所述可执行文件各部分数据的功能属性和存储格式属性;An attribute analysis module 310, configured to analyze the functional attributes and storage format attributes of the data of each part of the executable file;

目标数据识别模块320,用于根据所述功能属性,识别出所述各部分数据中可压缩的目标数据;A target data identification module 320, configured to identify compressible target data in each part of the data according to the functional attributes;

压缩策略确定模块330,用于根据所述目标数据的存储格式属性,得到所述目标数据的压缩策略;A compression strategy determination module 330, configured to obtain a compression strategy for the target data according to the storage format attribute of the target data;

压缩模块340,用于根据所述压缩策略,对所述目标数据进行压缩,并更新所述目标数据的存储格式属性,得到压缩后的可执行文件。The compression module 340 is configured to compress the target data according to the compression strategy, and update the storage format attribute of the target data to obtain a compressed executable file.

本实施例提供了一种可执行文件的压缩装置,首先分析可执行文件各部分数据的功能属性和存储格式属性,根据可执行文件各部分数据的存储、压缩或解压缩等功能属性,可识别出该可执行文件各部分数据中可压缩的目标数据。根据目标数据的存储格式属性,可得到目标数据的压缩策略。其中,压缩策略可包括不进行压缩、进行压缩,按照比原压缩率较大的新的压缩方式进行压缩,以及按照比原压缩率较小的新的压缩方式进行压缩等情况。根据压缩策略,对目标数据进行压缩,并更新目标数据的存储格式属性,得到压缩后的可执行文件。通过采用上述技术方案,可以使得压缩后的可执行文件占用较少的存储空间,达到节省可执行文件所需要的存储硬件材料成本的技术效果,从而间接地提升了相应产品的市场竞争力。This embodiment provides a compression device for executable files. First, it analyzes the functional attributes and storage format attributes of each part of the executable file data, and can identify Extract the compressible object data in each part of the executable file. According to the storage format attribute of the target data, the compression strategy of the target data can be obtained. Wherein, the compression strategy may include no compression, compression, compression by a new compression method with a higher compression ratio than the original one, and compression by a new compression method with a smaller compression ratio than the original one. According to the compression strategy, the target data is compressed, and the storage format attribute of the target data is updated to obtain a compressed executable file. By adopting the above technical solution, the compressed executable file can occupy less storage space, achieving the technical effect of saving the cost of storage hardware materials required by the executable file, thereby indirectly improving the market competitiveness of the corresponding product.

在上述实施例的基础上,所述压缩策略确定模块330可以进一步包括:On the basis of the foregoing embodiments, the compression policy determination module 330 may further include:

压缩策略确定单元,用于若所述目标数据的当前存储格式与预设存储格式相匹配,则根据所述当前存储格式,确定所述目标数据的压缩策略。A compression strategy determining unit, configured to determine a compression strategy for the target data according to the current storage format if the current storage format of the target data matches a preset storage format.

在上述实施例的基础上,所述压缩策略确定单元具体用于:On the basis of the above embodiments, the compression policy determination unit is specifically configured to:

若所述当前存储格式与第一压缩策略对应的第一预设存储格式相匹配,则所述目标数据的压缩策略为:If the current storage format matches the first preset storage format corresponding to the first compression strategy, the compression strategy of the target data is:

按照与第二预设存储格式对应的第二压缩策略压缩所述目标数据,其中,所述第二压缩策略对应的压缩率大于所述第一压缩策略对应的压缩率。Compressing the target data according to a second compression strategy corresponding to a second preset storage format, wherein a compression ratio corresponding to the second compression strategy is greater than a compression ratio corresponding to the first compression strategy.

在上述实施例的基础上,所述压缩策略确定模块330还可以具体用于:On the basis of the foregoing embodiments, the compression policy determination module 330 may also be specifically configured to:

若所述目标数据的当前存储格式与预设存储格式不匹配,则根据预设存储格式,确定所述目标数据的压缩策略。If the current storage format of the target data does not match the preset storage format, then determine the compression policy of the target data according to the preset storage format.

在上述实施例的基础上,所述第一预设存储格式为“-g”,所述第二预设存储格式为“-7”。Based on the above embodiment, the first preset storage format is "-g", and the second preset storage format is "-7".

本发明实施例提供的可执行文件的压缩装置可执行本发明任意实施例所提供的可执行文件的压缩方法,具备执行方法相应的功能模块和相应的有益效果。未在上述实施例中详尽描述的技术细节,可参见本发明任意实施例所提供的可执行文件的压缩方法。The executable file compression device provided by the embodiments of the present invention can execute the executable file compression method provided by any embodiment of the present invention, and has corresponding functional modules and corresponding beneficial effects for executing the method. For technical details not exhaustively described in the foregoing embodiments, reference may be made to the executable file compression method provided in any embodiment of the present invention.

注意,上述仅为本发明的较佳实施例及所运用技术原理。本领域技术人员会理解,本发明不限于这里所述的特定实施例,对本领域技术人员来说能够进行各种明显的变化、重新调整和替代而不会脱离本发明的保护范围。因此,虽然通过以上实施例对本发明进行了较为详细的说明,但是本发明不仅仅限于以上实施例,在不脱离本发明构思的情况下,还可以包括更多其他等效实施例,而本发明的范围由所附的权利要求范围决定。Note that the above are only preferred embodiments of the present invention and applied technical principles. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the protection scope of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments, and can also include more other equivalent embodiments without departing from the concept of the present invention, and the present invention The scope is determined by the scope of the appended claims.

Claims (10)

1.一种可执行文件的压缩方法,其特征在于,所述方法包括:1. a compression method of executable file, is characterized in that, described method comprises: 分析所述可执行文件各部分数据的功能属性和存储格式属性;Analyzing the functional attributes and storage format attributes of the data in each part of the executable file; 根据所述功能属性,识别出所述各部分数据中可压缩的目标数据;Identifying compressible target data in each part of data according to the functional attributes; 根据所述目标数据的存储格式属性,得到所述目标数据的压缩策略;Obtaining the compression policy of the target data according to the storage format attribute of the target data; 根据所述压缩策略,对所述目标数据进行压缩,并更新所述目标数据的存储格式属性,得到压缩后的可执行文件。According to the compression strategy, the target data is compressed, and the storage format attribute of the target data is updated to obtain a compressed executable file. 2.根据权利要求1所述的方法,其特征在于,所述根据所述目标数据的存储格式属性,得到所述目标数据的压缩策略的步骤包括:2. The method according to claim 1, wherein the step of obtaining the compression policy of the target data according to the storage format attribute of the target data comprises: 若所述目标数据的当前存储格式与预设存储格式相匹配,则根据所述当前存储格式,确定所述目标数据的压缩策略。If the current storage format of the target data matches the preset storage format, then determine a compression strategy for the target data according to the current storage format. 3.根据权利要求2所述的方法,其特征在于,所述根据所述当前存储格式,确定所述目标数据的压缩策略的步骤,包括:3. The method according to claim 2, wherein the step of determining the compression policy of the target data according to the current storage format comprises: 若所述当前存储格式与第一压缩策略对应的第一预设存储格式相匹配,则所述目标数据的压缩策略为:If the current storage format matches the first preset storage format corresponding to the first compression strategy, the compression strategy of the target data is: 按照与第二预设存储格式对应的第二压缩策略压缩所述目标数据,其中,所述第二压缩策略对应的压缩率大于所述第一压缩策略对应的压缩率。Compressing the target data according to a second compression strategy corresponding to a second preset storage format, wherein a compression ratio corresponding to the second compression strategy is greater than a compression ratio corresponding to the first compression strategy. 4.根据权利要求1所述的方法,其特征在于,所述根据所述目标数据的存储格式属性,得到所述目标数据的压缩策略的步骤还包括:4. The method according to claim 1, wherein the step of obtaining the compression policy of the target data according to the storage format attribute of the target data further comprises: 若所述目标数据的当前存储格式与预设存储格式不匹配,则根据预设存储格式,确定所述目标数据的压缩策略。If the current storage format of the target data does not match the preset storage format, then determine the compression policy of the target data according to the preset storage format. 5.根据权利要求3所述的方法,其特征在于,5. The method of claim 3, wherein, 所述第一预设存储格式为-g,所述第二预设存储格式为-7。The first preset storage format is -g, and the second preset storage format is -7. 6.一种可执行文件的压缩装置,其特征在于,所述装置包括:6. A compression device for an executable file, characterized in that the device comprises: 属性分析模块,用于分析所述可执行文件各部分数据的功能属性和存储格式属性;An attribute analysis module, configured to analyze the functional attributes and storage format attributes of the data of each part of the executable file; 目标数据识别模块,用于根据所述功能属性,识别出所述各部分数据中可压缩的目标数据;A target data identification module, configured to identify compressible target data in each part of the data according to the functional attributes; 压缩策略确定模块,用于根据所述目标数据的存储格式属性,得到所述目标数据的压缩策略;A compression strategy determination module, configured to obtain a compression strategy for the target data according to the storage format attribute of the target data; 压缩模块,用于根据所述压缩策略,对所述目标数据进行压缩,并更新所述目标数据的存储格式属性,得到压缩后的可执行文件。The compression module is configured to compress the target data according to the compression strategy, and update the storage format attribute of the target data to obtain a compressed executable file. 7.根据权利要求6所述的装置,其特征在于,所述压缩策略确定模块包括:7. The device according to claim 6, wherein the compression policy determination module comprises: 压缩策略确定单元,用于若所述目标数据的当前存储格式与预设存储格式相匹配,则根据所述当前存储格式,确定所述目标数据的压缩策略。A compression strategy determining unit, configured to determine a compression strategy for the target data according to the current storage format if the current storage format of the target data matches a preset storage format. 8.根据权利要求7所述的装置,其特征在于,所述压缩策略确定单元具体用于:8. The device according to claim 7, wherein the compression strategy determination unit is specifically configured to: 若所述当前存储格式与第一压缩策略对应的第一预设存储格式相匹配,则所述目标数据的压缩策略为:If the current storage format matches the first preset storage format corresponding to the first compression strategy, the compression strategy of the target data is: 按照与第二预设存储格式对应的第二压缩策略压缩所述目标数据,其中,所述第二压缩策略对应的压缩率大于所述第一压缩策略对应的压缩率。The target data is compressed according to a second compression strategy corresponding to a second preset storage format, wherein a compression ratio corresponding to the second compression strategy is greater than a compression ratio corresponding to the first compression strategy. 9.根据权利要求6所述的装置,其特征在于,所述压缩策略确定模块具体用于:9. The device according to claim 6, wherein the compression policy determination module is specifically used for: 若所述目标数据的当前存储格式与预设存储格式不匹配,则根据预设存储格式,确定所述目标数据的压缩策略。If the current storage format of the target data does not match the preset storage format, then determine the compression policy of the target data according to the preset storage format. 10.根据权利要求8所述的装置,其特征在于,10. The apparatus of claim 8, wherein: 所述第一预设存储格式为-g,所述第二预设存储格式为-7。The first preset storage format is -g, and the second preset storage format is -7.
CN201710142482.8A 2017-03-10 2017-03-10 Compression method and device for executable file Expired - Fee Related CN106909398B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201710142482.8A CN106909398B (en) 2017-03-10 2017-03-10 Compression method and device for executable file
PCT/CN2018/076624 WO2018161791A1 (en) 2017-03-10 2018-02-13 Method and device for compressing executable file

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710142482.8A CN106909398B (en) 2017-03-10 2017-03-10 Compression method and device for executable file

Publications (2)

Publication Number Publication Date
CN106909398A true CN106909398A (en) 2017-06-30
CN106909398B CN106909398B (en) 2020-10-16

Family

ID=59187689

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710142482.8A Expired - Fee Related CN106909398B (en) 2017-03-10 2017-03-10 Compression method and device for executable file

Country Status (2)

Country Link
CN (1) CN106909398B (en)
WO (1) WO2018161791A1 (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018161791A1 (en) * 2017-03-10 2018-09-13 深圳创维-Rgb电子有限公司 Method and device for compressing executable file
CN111078647A (en) * 2019-11-22 2020-04-28 北京安兔兔科技有限公司 Method and device for creating uncompressed file, method and device for testing magnetic disk and electronic equipment
CN113850055A (en) * 2021-09-29 2021-12-28 北京有竹居网络技术有限公司 Data processing method, equipment, storage medium and product
CN116055728A (en) * 2023-01-10 2023-05-02 杭州联吉技术有限公司 Image compression method and compression device
CN116909937A (en) * 2023-05-11 2023-10-20 深圳三地一芯电子股份有限公司 Flash memory capacity optimization method, device, equipment and storage medium

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1556472A (en) * 2003-12-31 2004-12-22 中兴通讯股份有限公司 Compression and loading method of executable file in embedded system
CN101977061A (en) * 2010-10-19 2011-02-16 广西师范大学 Lossless compression and decompression method for general information
CN202134001U (en) * 2011-03-07 2012-02-01 浪潮(北京)电子信息产业有限公司 An executable file backup device
CN102609360A (en) * 2012-01-12 2012-07-25 华为技术有限公司 Data processing method, data processing device and data processing system
CN103186597A (en) * 2011-12-29 2013-07-03 盛大计算机(上海)有限公司 Method and system for expanding hard disk capacity
CN103218224A (en) * 2013-03-29 2013-07-24 东莞宇龙通信科技有限公司 Method and terminal for improving utilization ratio of memory space
CN103563255A (en) * 2011-04-11 2014-02-05 马维尔国际贸易有限公司 Method for compression and real-time decompression of executable code
CN105677348A (en) * 2016-01-04 2016-06-15 青岛海信信芯科技有限公司 BOOT program storing method and device and BOOT program starting method and device
CN106202213A (en) * 2016-06-28 2016-12-07 深圳市恒扬数据股份有限公司 A kind of FPGA binary file compression, decompressing method and compression, decompression device

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102957633A (en) * 2011-08-19 2013-03-06 北京大学 Data packing and transmitting method and data packing and transmitting system for message-oriented middleware
CN104954497B (en) * 2015-07-03 2018-09-14 浪潮(北京)电子信息产业有限公司 Data transmission method and system in a kind of cloud storage system
CN106909398B (en) * 2017-03-10 2020-10-16 深圳创维-Rgb电子有限公司 Compression method and device for executable file

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1556472A (en) * 2003-12-31 2004-12-22 中兴通讯股份有限公司 Compression and loading method of executable file in embedded system
CN101977061A (en) * 2010-10-19 2011-02-16 广西师范大学 Lossless compression and decompression method for general information
CN202134001U (en) * 2011-03-07 2012-02-01 浪潮(北京)电子信息产业有限公司 An executable file backup device
CN103563255A (en) * 2011-04-11 2014-02-05 马维尔国际贸易有限公司 Method for compression and real-time decompression of executable code
CN103186597A (en) * 2011-12-29 2013-07-03 盛大计算机(上海)有限公司 Method and system for expanding hard disk capacity
CN102609360A (en) * 2012-01-12 2012-07-25 华为技术有限公司 Data processing method, data processing device and data processing system
CN103218224A (en) * 2013-03-29 2013-07-24 东莞宇龙通信科技有限公司 Method and terminal for improving utilization ratio of memory space
CN105677348A (en) * 2016-01-04 2016-06-15 青岛海信信芯科技有限公司 BOOT program storing method and device and BOOT program starting method and device
CN106202213A (en) * 2016-06-28 2016-12-07 深圳市恒扬数据股份有限公司 A kind of FPGA binary file compression, decompressing method and compression, decompression device

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018161791A1 (en) * 2017-03-10 2018-09-13 深圳创维-Rgb电子有限公司 Method and device for compressing executable file
CN111078647A (en) * 2019-11-22 2020-04-28 北京安兔兔科技有限公司 Method and device for creating uncompressed file, method and device for testing magnetic disk and electronic equipment
CN111078647B (en) * 2019-11-22 2023-09-22 北京安兔兔科技有限公司 Method and device for creating uncompressed file and testing magnetic disk and electronic equipment
CN113850055A (en) * 2021-09-29 2021-12-28 北京有竹居网络技术有限公司 Data processing method, equipment, storage medium and product
CN113850055B (en) * 2021-09-29 2024-11-15 北京有竹居网络技术有限公司 Data processing method, device, storage medium and product
CN116055728A (en) * 2023-01-10 2023-05-02 杭州联吉技术有限公司 Image compression method and compression device
CN116909937A (en) * 2023-05-11 2023-10-20 深圳三地一芯电子股份有限公司 Flash memory capacity optimization method, device, equipment and storage medium
CN116909937B (en) * 2023-05-11 2024-02-23 深圳三地一芯电子股份有限公司 Flash memory capacity optimization method, device, equipment and storage medium

Also Published As

Publication number Publication date
WO2018161791A1 (en) 2018-09-13
CN106909398B (en) 2020-10-16

Similar Documents

Publication Publication Date Title
CN106909398B (en) Compression method and device for executable file
CN105404521B (en) A kind of method for updating increment and relevant apparatus
CN111078318B (en) Configuration file processing method, device, system and storage medium
KR101281326B1 (en) Extended utilization area for a memory device
CN110377226B (en) Compression method and device based on storage engine bluestore and storage medium
CN103517141B (en) Based on IP Set Top Box segmented data upgrade methods
CN105487907A (en) Difference package manufacturing method and device
WO2021115177A1 (en) Application installation method and apparatus, terminal device, server and storage medium
CN112099798B (en) Method and device for counting time consumption of public function execution, storage medium and terminal
CN104281528A (en) Data storage method and device
CN107305495A (en) Realize the method and terminal of software installation packet function modification
CN112181471A (en) Differential upgrading method and device, storage medium and computer equipment
CN107688456B (en) File generation method, device and computer readable storage medium
US20140258247A1 (en) Electronic apparatus for data access and data access method therefor
CN104133796A (en) Method and device for coding and decoding image in smart mobile terminal LK
CN112559088B (en) Configuration file optimization method, device, server and storage medium
CN101135978B (en) Compressed version application program generation, execution method and device, application method and system
CN107562452A (en) Terminal preset application update method, intelligent terminal and the device with store function
US8131918B2 (en) Method and terminal for demand paging at least one of code and data requiring real-time response
CN108093258B (en) Code stream data decoding method, computer device and computer readable storage medium
CN115495020A (en) File processing method and device, electronic equipment and readable storage medium
CN107577474B (en) Processing method and device for upgrading file and electronic equipment
CN114706825A (en) File scanning method and device, terminal equipment and storage medium
CN111414339A (en) File processing method, system, device, equipment and medium
CN114780120B (en) Upgrade method, device and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20201016