Data compression method and device and data decompression method and device

By dividing the file into unit sizes and counting character combination formats, generating compressed data and selectively decompressing it, the problem of resource waste in the existing technology is solved and efficient data processing is achieved.

CN120723737APending Publication Date: 2025-09-30BEIJING CO WHEELS TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410384928.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-03-29
Publication Date
2025-09-30

AI Technical Summary

Technical Problem

In the prior art, when compressing and decompressing data on a file, the entire file needs to be processed, resulting in a waste of resources.

Method used

The file is divided into unit data sets according to the unit size value, and the characters in the unit data set are divided according to the unit byte length, the adjacent identical character combination formats are identified, the number values ​​of the identical character combination formats are counted, and compressed data is generated; when decompressing, the target compressed data is selected and the decompressed data is generated according to the number value of the character group.

Benefits of technology

By dividing and counting files, the resource waste in the data compression process is reduced, the processing efficiency is improved, and repeated processing of the entire file is avoided.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120723737A_ABST
    Figure CN120723737A_ABST
Patent Text Reader

Abstract

The invention provides a data compression method and device and a data decompression method and device, and relates to the technical field of data compression. According to the technical scheme, the whole file can be divided, so that the file can be formed in a combined unit data set mode, before the compression process needs to be executed, the corresponding unit data set can be selected to independently execute the data compression process, the data compression process does not need to be executed for the whole file, and the data compression efficiency is improved. And resource waste in a data compression process is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data compression technology, and in particular to a data compression method and device, and a data decompression device. Background Art

[0002] To save storage space occupied by characters, the characters representing a file can be compressed to generate a compressed file. When the file needs to be processed, the compressed file is decompressed to obtain the characters. The prior art process for character compression primarily utilizes the RLE (run-length encoding) algorithm, which identifies and counts consecutive characters in a character segment and stores the count results to compress the entire file.

[0003] The RLE algorithm primarily compresses data for the characters corresponding to the entire file, generating a compressed file. To extract characters, the compressed file is decompressed and the target characters are searched for within the decompressed characters. However, this compression and decompression method processes the entire file each time it is executed, resulting in a waste of file processing resources. Summary of the Invention

[0004] In view of this, the present application provides a data compression method and device, and a data decompression device, the main purpose of which is to solve the problem in the prior art that before data processing, compression and decompression processing must be performed on the entire file or compressed file, resulting in a waste of processing resources.

[0005] To achieve the above objectives, the present application discloses, in a first aspect, a data compression method, comprising:

[0006] Dividing the file by unit size values ​​to obtain a unit data set, wherein the unit data set is generated by character combination;

[0007] Dividing the characters in the unit data set by unit byte length to generate unit character groups;

[0008] Counting the adjacent unit character groups of the same character combination format in the unit data set to obtain a number value of the character groups of the same character combination format;

[0009] The character group quantity value and the unit character group corresponding to the character group quantity value are combined to generate compressed data.

[0010] In a second aspect of the present application, a data compression method is disclosed, the method comprising:

[0011] According to the decompression instruction, select the target compressed data;

[0012] Reading a unit character group in the target compressed data and a character group quantity value corresponding to the unit character group, wherein the target compressed data includes at least one unit character group, and the character group quantity value corresponds to the unit character group in a one-to-one manner;

[0013] generating a unit character group of a character group quantity value according to the unit character group and the character group quantity value corresponding to the unit character group;

[0014] The unit character groups are combined to obtain decompressed data.

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

[0016] A division module is used to divide the file into unit size values ​​to obtain unit data sets, wherein the unit data sets are generated by character combinations; and to divide the characters in the unit data sets into unit byte lengths to generate unit character groups;

[0017] a counting module, configured to count adjacent unit character groups of the same character combination format in the unit data set to obtain a number value of character groups of the same character combination format;

[0018] The combining module is used to combine the character group quantity value and the unit character group corresponding to the character group quantity value to generate compressed data.

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

[0020] A selection module, used for selecting target compressed data according to a decompression instruction;

[0021] a reading module, configured to read a unit character group in the target compressed data and a character group quantity value corresponding to the unit character group, wherein the target compressed data includes at least one unit character group, and the character group quantity value corresponds to the unit character group in a one-to-one manner;

[0022] A generating module, configured to generate a unit character group of a character group quantity value according to the unit character group and the character group quantity value corresponding to the unit character group;

[0023] The combining module is used for combining the unit character groups to obtain decompressed data.

[0024] In a fifth aspect of the present application, an electronic device is provided, including:

[0025] At least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute any one of the methods disclosed in the first aspect.

[0026] In a sixth aspect of the present application, an embodiment provides a computer-readable storage medium having a computer program stored thereon, which implements the method described in the first aspect when the computer program is executed by a processor.

[0027] In a seventh aspect embodiment of the present application, a vehicle is provided, in which the device as described in the third aspect or the fourth aspect or the electronic device as described in the fifth aspect is mounted.

[0028] In summary, according to the technical solution disclosed in the present application, before data processing is performed in the prior art, the whole file or compressed file must be compressed and decompressed, resulting in a waste of processing resources. In the technical solution of the present application, during the data compression process, the file is divided according to the unit size value, and the file is divided into multiple unit data sets. The characters in each unit data set have a strong correlation. In addition, the characters in the unit data set are divided according to the unit byte length. By identifying the character combination format in the divided unit character group, the adjacent unit character groups of the same format are uniformly counted. In the case where the frequency of occurrence of the unit character group of the same format is high, the data redundancy caused by the repeated unit character groups can be reduced in the form of a combination of the character combination format and the unit character quantity value, thereby realizing the occupation of the storage space value. In the technical solution of the present application, the file can be divided as a whole so that the file can be constructed in the form of a combined unit data set. Before the compression process needs to be performed, the corresponding unit data set can be selected to perform the data compression process separately. There is no need to perform the data compression process for the entire file, thereby avoiding the waste of resources in the data compression process.

[0029] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0031] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0032] Figure 1 A flow chart of a data compression method provided in an embodiment of the present application is shown;

[0033] Figure 2 A flow chart of a data decompression method provided in an embodiment of the present application is shown;

[0034] Figure 3 A structural diagram of a data compression device provided in an embodiment of the present application is shown;

[0035] Figure 4 A structural diagram of a data decompression device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0036] In order to more clearly understand the above-mentioned objectives, features and advantages of the present application, the scheme of the present application will be further described below. It should be noted that, in the absence of conflict, the embodiments of the present application and the features therein can be combined with each other.

[0037] In order to solve the problem in the prior art that the entire file or compressed file must be compressed and decompressed before data processing, resulting in a waste of processing resources, the present application provides the following embodiments to solve the above problem:

[0038] This embodiment provides a data compression method, such as Figure 1 FIG. 1 is a flow chart of the method of this embodiment, which may include the following steps:

[0039] Step 101 : Divide the file into unit size values ​​to obtain unit data sets, where the unit data sets are generated by character combinations.

[0040] After the file is determined, the file is divided. Here, the file is represented as a file to be compressed. The file here may have a large occupied space. If the file compression process is performed, all characters of the file need to be obtained and read, and the data compression process is further performed based on all the characters.

[0041] In the present embodiment, after obtaining a file, the process of dividing the file is first performed. The file here can be represented not only as a document, but also as an information form such as an image. After determining to perform a data compression process on the file, the file division process is further performed. When performing the file division process, it is necessary to ensure that there is a strong correlation between the characters in each unit data set generated by the division, that is, the number of repeated characters is large. When there are many repeated characters in the unit data set, data compression can be conveniently performed more simply and quickly based on the repeated characters.

[0042] In a possible embodiment, dividing the file into unit size values ​​to obtain unit data sets includes:

[0043] Identify the distribution matrix interval of the file; obtain the unit height value and the unit width value, and use the unit height value and the unit width value as the unit size value; divide the distribution matrix interval according to the unit height value and the unit width value to generate a unit data set.

[0044] In the process of executing file division, this embodiment exemplifies a feasible embodiment. In this embodiment, the file division process is further performed based on the file distribution matrix. The information stored in the file is represented in the form of characters. Further, it can be considered that the file is represented in a format composed of characters. For example, when the file is an image, the file is represented by a combination of pixel information corresponding to each pixel. The pixel information corresponding to each pixel can be represented in the form of characters. Then, it can be considered that the entire image is represented by a matrix interval of multiple characters, and the rows and columns of each matrix correspond to the height and width of the image.

[0045] Based on the above content, the file division process in the content of this embodiment can be divided according to the distribution range of the entire file, and the unit height value and unit width value corresponding to the unit size value. That is, the distribution range corresponding to the entire file is divided by the unit height value for the column vector and the unit width value for the row vector. The unit data set after division only represents part of the characters of the file.

[0046] In the content of this embodiment, the file is divided into parts according to the unit size value, so that the file can be completely divided, and the divided files can perform the data compression process separately. By compressing the divided files, when it is not necessary to compress the entire file, the amount of compressed data can be effectively reduced, the workload of data compression can be reduced, and the waste of compression workload can be avoided.

[0047] Step 102: Divide the characters in the unit data set by unit byte length to generate unit character groups.

[0048] After the file is divided into unit data sets to generate the unit data sets, this embodiment further includes a character division process. To maximize character processing efficiency, the characters in the unit data sets are further divided so that the divided unit character groups are compatible with the processed characters. The unit byte length in this case can be compatible with the computer's machine byte length, for example, 4 bytes or 6 bytes. The divided unit byte length is compatible with the computer's machine byte length, allowing the computer to transmit characters with the highest efficiency.

[0049] In a possible embodiment, dividing the characters in the unit data set by unit byte length to generate unit character groups includes:

[0050] The characters in the unit data set are divided according to the row sequence to generate character rows; according to the arrangement order of the character rows, the character rows are divided in turn by the unit byte length to generate unit character groups.

[0051] This embodiment further divides the characters of a unit data set. A unit data set is a component of a file and can be represented as a character matrix. The unit data set is divided based on the unit byte length in the unit data set. To achieve orderly character division, the unit character group division is further performed based on the character row of the unit data set.

[0052] That is, the characters of each row in the unit data set are identified separately, and each row of characters is regarded as a character row. At the same time, according to the column distribution order of the character row, the division process is performed on the characters of each row according to the unit byte length, and the characters of each row are divided into a combination of unit character groups of multiple unit byte lengths. In addition, when the number of characters in the character row is not enough to just make up the byte positions of the unit byte length, the characters that are less than the byte positions of the character row are alone in a byte position and are not in a byte position with the characters of the subsequent rows. For example, when there are 19 characters in the character row, when it is divided with 4 characters as the unit byte length, the 5th unit character group contains only 3 characters. Exemplarily, the unit data set can be expressed as:

[0053] wwwwwwwwwwwwbbbbbbbbbbbbbbwbwbwbwb

[0054] wwwwwwwbbbbbbbbbbbbwbwbwbwbwwwwwwww

[0055] The enumerated unit data set has two character rows. When the unit byte length is 4 bytes, each character row in the unit data set is divided, and the division result is:

[0056] wwww wwww wwww bbbb bbbb bbbb bbbb wbwb wbwb

[0057] wwww wwww bbbb bbbb bbbb wbwb wbwb wwww wwww

[0058] Therefore, the divided unit data set is represented in the form of a combination of multiple unit character groups. By performing character division on the unit data set in the form of character rows, orderly processing of characters can be achieved, avoiding the problem of disordered character processing caused by the different number of characters in each row and column in the unit data set.

[0059] Step 103: Count adjacent unit character groups of the same character combination format in the unit data set to obtain a value for the number of character groups of the same character combination format.

[0060] After the characters in the unit data set are divided, the unit character groups generated by the division are further subjected to character combination format recognition. The character combination format in this embodiment is used to represent the arrangement form of the characters in each unit character group. For example, when the characters in the unit character group are represented as "bbbb", it is used as one character combination format, and when the characters in the unit character group are represented as "bbbw", it is used as another character combination format.

[0061] After the unit data set is divided into character rows and unit character groups are divided in each character row, the character combination formats of the characters in each character group are respectively identified. When the character combination formats in adjacent unit character groups are the same, the character combination formats are counted, and finally the number of unit character groups corresponding to the character combination pattern is obtained. Exemplarily, when the divided unit character groups are represented as: wwww wwww wwww bbbb bbbb bbbb bbbb, at this time, the character combination formats of the first three groups of unit character groups are all "wwww", and the character combination formats of the last four groups of unit characters are all "bbbb". At the same time, the first three groups and the last four groups of unit character groups with the same character combination format are adjacent character groups, then the character group quantity values ​​corresponding to the first three groups of unit character groups can be counted as 3, and the character group quantity values ​​corresponding to the last four groups of unit character groups can be counted as 4. The count of 3 or the count of 4 respectively represent the character group quantity values ​​corresponding to the unit character groups of the character combination format.

[0062] Step 104: Combine the character group quantity value and the unit character group corresponding to the character group quantity value to generate compressed data.

[0063] After determining the number of character groups, this embodiment further proposes a scheme for combining the number of character groups and the unit character groups. When it is determined that some adjacent unit character groups have the same character combination format, the number of character groups can be combined with the unit character groups to represent them. For example, when the adjacent unit character groups with the same character combination format are: "wwww wwww wwww", there are 3 groups of adjacent unit character groups with the same character combination format. At this time, the character group format is represented as "wwwww", and the number of unit characters is 3, which can be represented as "wwww3". Through this combined representation, the space occupied by the characters generated by the combination can be made much smaller than the space occupied by the original characters, thereby achieving the purpose of decompressing the characters.

[0064] In a possible embodiment, combining the character group quantity value and the unit character group corresponding to the character group quantity value to generate compressed data includes:

[0065] Determine a target character group in a unit data set, where the target character group is a group in the unit character group; read a target character combination format in the target character group; identify other character groups adjacent to the target character group and having the same target character combination format; record the target character group and the target character group quantity and value, and the target character combination format of the other character groups; combine the target character group quantity and value and the target character combination format in the unit data set to generate compressed data.

[0066] This embodiment specifically describes the identification and combination method of a set of unit character groups and their corresponding character group quantity values ​​in a character row. In the process of identifying the unit character groups in a character row, the character combination format is recognized based on the arrangement order of the unit character groups. For example, when identifying the first unit character group, the first unit character group is used as the target character group, the target character combination format corresponding to the target character group is identified, and the character group quantity and value are recorded as 1, and the second unit character group is further read according to the arrangement order between the character groups. If the character combination format of the second unit character group is the same as the target character group, the character group quantity and value are increased by one, and the character combination format is further trained and recognized according to the arrangement order of the character groups until the character combination format of the identified character group is different from the target character group, the current target character group quantity and value are recorded, and the unit character group as the target character group is cancelled, and the character group that is first identified and has a different character combination format from the previous one is used as the new target character group. For example, when the character row is represented as: wwwwwwww wwww bbbb bbbb bbbb bbb, when the first group of "wwww" is recognized, the target character group is recorded, and its target character combination format is recorded. At the same time, the character combination formats of the first three groups of character groups are the same, and the character combination format of the fourth group changes. The first three groups of target character groups are represented as "wwww 3", and the character combination formats of the 4th to 7th groups are the same, and they are represented as "bbbb 4". Then the character row can be combined to generate "wwww 3bbbb 4" as compressed data.

[0067] The data compression method of this embodiment can achieve data compression using another character group expression format based on the fact that the character combination format in the unit character group is the same when there is a high degree of data overlap in the unit data set. In the technical solution of this application, the entire file can be divided so that the file can be constructed in the form of combined unit data sets. Before the compression process is required, the corresponding unit data set can be selected to perform the data compression process separately, eliminating the need to perform the data compression process on the entire file, thereby avoiding resource waste in the data compression process.

[0068] In a possible embodiment, the target number and value of character groups and the target character combination format in a unit data set are combined to generate compressed data, including: calculating the unit byte length and value of the target number and value of character groups and the target character combination format; identifying the byte length and value corresponding to the unit character group in the unit data set based on the unit byte length and value, the byte length and value being the sum of all unit byte lengths and values; determining the original byte length value of the character in the unit data set; storing the byte length and value and the original byte length value as attribute data in an identification data bit; and combining the identification data bit, the target number and value of character groups and the target character combination format to generate compressed data.

[0069] This embodiment further illustrates the data involved in the process of combining compressed data. In addition to the target character combination format and the target number and value of character groups, attribute data is also included. The stored attributes facilitate rapid modification of corresponding decompression configuration data based on the attribute data before decompression is performed based on the number and value of character groups and the character combination format.

[0070] In this embodiment, two types of attribute data are listed, namely, byte length and value and original byte length value. According to the byte length and value, the number of character combination formats that need to be decompressed can be quickly determined during the data decompression process, so as to configure the number of decompression times of the character combination formats according to the number of character combination formats. In the process of obtaining the byte length, it is necessary to identify the target character combination format and the number of target character groups corresponding to each group of target character groups in the unit data set. For example, after data compression of "bbbb bbbb bbbb bbb", "bbbb 4" is generated. At this time, multiple groups of "bbbb" before compression are used as target character groups. In the compressed data generated by them, "bbbb" is used as the target character combination format, and "4" is used as the target character group number and value. At this time, in the compressed data generated, "bbbb" occupies a certain byte length, and "4" occupies a certain byte length. The byte length value occupied by the target character combination format, target character group number and value corresponding to a group of target character groups is used as the unit byte length and value. The row characters of the unit data set include at least one target character group, and the sum of the unit byte lengths and values ​​corresponding to all target character groups is used as the byte length and value of the entire row characters.

[0071] The original byte length value records the byte length of the character group in the original character line, which corresponds to the byte length of the data generated after decompression of the compressed data. This facilitates the allocation of appropriate storage space before decompression and helps quickly allocate decompression space when dynamically adjusting storage space.

[0072] The attribute data is stored in an identification character, which can be set at the first position of the file compression package to quickly identify the attribute data when performing the decompression step and quickly adjust the decompression configuration based on the attribute data.

[0073] This embodiment provides a data decompression method, such as Figure 2 FIG. 1 is a flow chart of the method of this embodiment, which may include the following steps:

[0074] Step 201: Select target compressed data according to a decompression instruction.

[0075] During the compression process, the file is divided into unit data sets, and the data compression process is performed on each unit data set to generate corresponding compressed data. In other words, in this embodiment, the data compression process does not compress the entire file, but rather selectively compresses portions of the file. The compressed data generated by compression only corresponds to a portion of the file content. During the decompression process of the compressed data, the corresponding compressed data corresponding to the portion of the file data is selected for decompression based on the decompression instructions, and the selected compressed data serves as the target compressed data.

[0076] Step 202: Read the unit character group in the target compressed data and the character group quantity value corresponding to the unit character group. The target compressed data includes at least one unit character group, and the character group quantity value corresponds to the unit character group in a one-to-one manner.

[0077] After selecting the target compressed data, the unit character group and the corresponding character group quantity value in the compressed data are further read. In the target compressed data, the unit character group is processed and stored, and the quantity value corresponding to the unit character group is also included.

[0078] For example, if the target compressed data contains "wwww 3" and the selected unit character group is "wwww", the character group quantity value indicates the number of unit character groups at this position, "3", which means that three groups of "wwww" are generated after decompression.

[0079] Step 203 : Generate a unit character group of the character group quantity value according to the unit character group and the character group quantity value corresponding to the unit character group.

[0080] For example, when the unit character group and its corresponding character group quantity value are respectively expressed as: "wwww 3", it is considered that the unit character group is "wwww", and the unit character group is 3 groups after decompression, which is expressed as "wwww wwww wwww" after decompression.

[0081] Step 204: combine the unit character groups to obtain decompressed data.

[0082] Identify all unit character groups in the compressed data and their corresponding quantities, and generate corresponding unit character groups according to the quantity corresponding to each unit character group. For example, the compressed data is represented as: "wwww 3bbbb 4wbwb 2", and the decompressed data is: "wwww wwww wwww bbbb bbbb bbbb bbbb wbwb wbwb".

[0083] This embodiment further explains the decompression steps. The decompression supports separate decompression of part of the compressed data of the file. The decompression data is generated by identifying the unit character groups in the compressed data and the number of character groups corresponding to the unit character groups. The decompression of the required compressed data is completed without wasting file processing resources.

[0084] In a possible embodiment, before reading the unit character group and the character group quantity value corresponding to the unit character group in the target compressed data, the method further includes:

[0085] Determining an identification data bit in the target compressed data, the identification data bit being used to store attribute data of the target compressed data; and determining a storage space for the decompressed data using the attribute data;

[0086] Read the unit character group in the target compressed data and the character group quantity value corresponding to the unit character group, including:

[0087] In the storage space, a unit character group in the target compressed data and a character group quantity value corresponding to the unit character group are read.

[0088] This embodiment further illustrates the application of the original byte length value in the attribute data. Before executing the decompression step, by reading the original byte length value, the storage space can be quickly configured to increase the storage space in advance, which is more friendly to dynamically adjustable storage space.

[0089] In a possible embodiment, reading a unit character group in the target compressed data and a character group quantity value corresponding to the unit character group includes:

[0090] Determine the byte length and value in the identification data of the target compressed data, the byte length and value being used to represent the data length value of the data to be decompressed; read the first byte length value occupied by each group of unit character groups; read the second byte length value corresponding to the character group quantity value corresponding to each group of unit character groups; accumulate the unit character groups and the character group quantity values ​​until the sum of the first byte length value of the first quantity and the second byte length value of the second quantity is equal to the byte length sum; determine the first number of unit character groups and the second number of character group quantity values.

[0091] This embodiment describes the number of times a unit character group is recognized in compressed data. The number of decompressions required for the compressed data is calculated based on the byte length and value and the unit byte length, serving as the number of data to be decompressed. This number is configured in advance and provides a data basis for generating subsequent unit character groups.

[0092] In the target compressed data, the data stored in the identification data includes a byte length and a value, and the byte length and the value are used to represent the byte length occupied by the data (to-be-decompressed data) that needs to be decompressed in the target compressed data. For example, when the target decompressed data is represented as "15wwww 3bbbb 4wbwb 2", the current target decompressed data contains three unit character groups, namely "wwwww", "bbbb" and "wbwb". The three unit character groups each need to occupy a certain character length, and the character length occupied by each unit character group is represented as a first byte length value. In this example, the first byte length values ​​of "wwww", "bbbb" and "wbwb" are 4 respectively. Among them, the character group quantity value corresponding to "wwwww" is 3, the character group quantity value corresponding to "bbbb" is 4, and the character group quantity value corresponding to "wbwb" is 2. The display of "2", "3" and "4" also needs to occupy a certain character length. The character length occupied by each character group quantity value is represented as a second byte length value. In this example, the second byte length values ​​of "2", "3" and "4" are 1 respectively. Based on the original byte length sum value of 15, the first byte length value of the unit character group and the second byte length value of the corresponding character group quantity value are sequentially identified so that the sum of the first byte length value plus the sum of the second byte length value ultimately equals the byte length sum value, thereby completing the identification of all unit characters and the corresponding character group quantity values, and ultimately determining the first number of unit character groups and the second number of character group quantity values. The number of unit character groups and their corresponding character group quantity values ​​that need to be executed is directly determined based on the byte length sum value as the number of data to be decompressed.

[0093] Based on the determination of the amount of data to be decompressed, a cyclic calculation process based on the amount of data to be decompressed can be established to ensure the stability and reliability of the calculation. Furthermore, the storage space occupied by the unit character group after decompression is directly calculated based on the product of the unit character group and the corresponding number of character groups. By calculating and summing the storage space occupied by each unit character group in the target decompressed data, the storage space required for the entire target compressed data after decompression can be obtained, thereby facilitating the rapid identification of the amount of data to be decompressed before decompression is performed and calculating the decompression parameters required for decompression.

[0094] This embodiment provides a data compression device, such as Figure 3 FIG. 1 is a structural diagram of the device of this embodiment, comprising:

[0095] The division module 31 is used to divide the file into unit size values ​​to obtain unit data sets, wherein the unit data sets are generated by character combinations; and to divide the characters in the unit data sets into unit byte lengths to generate unit character groups;

[0096] a counting module 32 for counting adjacent unit character groups of the same character combination format in the unit data set to obtain a number of character groups of the same character combination format;

[0097] The combining module 33 is configured to combine the character group quantity value and the unit character group corresponding to the character group quantity value to generate compressed data.

[0098] In a possible embodiment, the division module 31 is configured to:

[0099] Identify the distribution matrix interval of the file;

[0100] Obtain a unit height value and a unit width value, and use the unit height value and the unit width value as a unit size value;

[0101] The distribution matrix interval is divided according to the unit height value and the unit width value to generate a unit data set.

[0102] In a possible embodiment, the counting module 32 is configured to:

[0103] Dividing the characters in the unit data set according to a row sequence to generate character rows;

[0104] According to the arrangement order of the character rows, the character rows are divided in sequence by unit byte length to generate unit character groups.

[0105] In a possible embodiment, the combination module 33 is configured to:

[0106] determining a target character group in the unit data set, the target character group being a group in the unit character group;

[0107] Reading a target character combination format in the target character group;

[0108] Identifying other character groups that are adjacent to the target character group and have the same target character combination format;

[0109] Recording the target character group quantity and value of the target character group and the other character groups, and the target character combination format;

[0110] The target character group quantity and value in the unit data set and the target character combination format are combined to generate compressed data.

[0111] In a possible embodiment, the combination module 33 is configured to:

[0112] Calculating the number and value of the target character group and the byte length and value of the target character combination format;

[0113] Determine the original byte length value of the character in the unit data set;

[0114] The byte length and value and the original byte length value are stored as attribute data in the identification data bit;

[0115] The identification data bit, the target character group quantity and value, and the target character combination format are combined to generate compressed data.

[0116] This embodiment provides a data decompression device, such as Figure 4 FIG. 1 is a structural diagram of the device of this embodiment, comprising:

[0117] A selection module 41 is used to select target compressed data according to the decompression instruction;

[0118] a reading module 42 configured to read a unit character group in the target compressed data and a character group quantity value corresponding to the unit character group, wherein the target compressed data includes at least one unit character group, and the character group quantity value corresponds to the unit character group in a one-to-one manner;

[0119] A generating module 43 is configured to generate a unit character group of a character group quantity value according to the unit character group and the character group quantity value corresponding to the unit character group;

[0120] The combining module 44 is used to combine the unit character groups to obtain decompressed data.

[0121] In a possible embodiment, the reading module 42 is configured to:

[0122] determining an identification data bit in the target compressed data, wherein the identification data bit is used to store attribute data of the target compressed data;

[0123] Determining storage space for decompressed data using the attribute data;

[0124] The reading module 42 is configured to read, in the storage space, a unit character group in the target compressed data and a character group quantity value corresponding to the unit character group.

[0125] In a possible embodiment, the reading module 42 is configured to:

[0126] Determining a byte length and a value in the identification data of the target compressed data, wherein the byte length and the value are used to represent a data length value of the to-be-decompressed data;

[0127] Read the first byte length value occupied by each group of the unit character groups;

[0128] Read the second byte length value corresponding to the character group quantity value corresponding to each group of the unit character groups;

[0129] Accumulating the unit character groups and the character group quantity values ​​until the sum of the first byte length value of the first quantity and the second byte length value of the second quantity is equal to the byte length sum value;

[0130] The first number of unit character groups and the second number of character group quantity values ​​are determined.

[0131] Based on this understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, USB flash drive, mobile hard disk, etc.), and includes a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods of various implementation scenarios of the present application.

[0132] Based on the above Figure 1 or Figure 2 The method shown, and Figure 3 or Figure 4 In order to achieve the above-mentioned purpose, the embodiment of the virtual device shown in the embodiment of the present application further provides an electronic device that can be configured on the vehicle (such as a new energy vehicle) side, the device includes at least one processor, and a memory connected to the at least one processor in communication; the memory is used to store instructions that can be executed by at least one processor, the instructions are executed by at least one processor, and the processor is used to execute a computer program to achieve the above-mentioned Figure 1 The method shown.

[0133] Optionally, the physical device may further include a user interface, a network interface, a camera, a radio frequency (RF) circuit, a sensor, an audio circuit, a Wi-Fi module, and the like. The user interface may include a display, an input unit such as a keyboard, and the like. The optional user interface may also include a USB interface, a card reader interface, and the like. The network interface may optionally include a standard wired interface, a wireless interface (such as a Wi-Fi interface), and the like.

[0134] Those skilled in the art will understand that the above-mentioned physical device structure provided in this embodiment does not constitute a limitation on the physical device, and may include more or fewer components, or a combination of certain components, or different component arrangements.

[0135] Based on the above Figure 1 or Figure 2The method shown, the embodiment of the present application also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the method corresponding to any embodiment is implemented. The storage medium may also include an operating system and a network communication module. The operating system is a program that manages the hardware and software resources of the above-mentioned physical device and supports the operation of information processing programs and other software and / or programs. The network communication module is used to realize communication between the components inside the storage medium, and communication with other hardware and software in the information processing physical device.

[0136] Based on the above electronic device, the embodiment of the present application further provides a vehicle, which may specifically include: Figure 3 or Figure 4 The device shown or the electronic device as described above. The vehicle can be a new energy vehicle or a traditional vehicle.

[0137] Through the description of the above implementation methods, those skilled in the art can clearly understand that the present application can be implemented by means of software plus the necessary general hardware platform, or by hardware. By applying the solution of this embodiment, compared with the current existing technology, during the data compression process, the file is divided by unit size value, and the file is divided into multiple unit data sets, and the characters in each unit data set have a strong correlation. In addition, the characters in the unit data set are divided by unit byte length, and by identifying the character combination format in the divided unit character group, the adjacent unit character groups of the same format are uniformly counted. In the case where the frequency of occurrence of the unit character group of the same format is high, the data redundancy caused by the repeated unit character group can be reduced in the form of a combination of the character combination format and the unit character quantity value, so as to realize the occupation of the storage space value. In the technical solution of the present application, the file can be divided as a whole so that the file can be constructed in the form of a combined unit data set. Before the compression process needs to be executed, the corresponding unit data set can be selected to execute the data compression process separately, without executing the data compression process for the entire file, thereby avoiding the waste of resources in the data compression process.

[0138] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprises" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device that includes a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a..." do not exclude the presence of other identical elements in the process, method, article or device that includes the elements.

[0139] The foregoing is merely a list of specific embodiments of the present application, intended to enable those skilled in the art to understand and implement the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application is not limited to the embodiments described herein, but is intended to conform to the broadest scope consistent with the principles and novel features of the present application.

Claims

1. A data compression method, characterized in that: include: Dividing the file by unit size values ​​to obtain a unit data set, wherein the unit data set is generated by character combination; Dividing the characters in the unit data set by unit byte length to generate unit character groups; Counting the adjacent unit character groups of the same character combination format in the unit data set to obtain a number value of the character groups of the same character combination format; The character group quantity value and the unit character group corresponding to the character group quantity value are combined to generate compressed data.

2. The method according to claim 1, characterized in that The step of dividing the file into unit size values ​​to obtain a unit data set includes: Identify the distribution matrix interval of the file; Obtain a unit height value and a unit width value, and use the unit height value and the unit width value as a unit size value; The distribution matrix interval is divided according to the unit height value and the unit width value to generate a unit data set.

3. The method according to claim 1, characterized in that The step of dividing the characters in the unit data set by unit byte length to generate unit character groups includes: Dividing the characters in the unit data set according to a row sequence to generate character rows; According to the arrangement order of the character rows, the character rows are divided in sequence by unit byte length to generate unit character groups.

4. The method according to claim 1, wherein The combining the character group quantity value and the unit character group corresponding to the character group quantity value to generate compressed data includes: determining a target character group in the unit data set, the target character group being a group in the unit character group; Reading a target character combination format in the target character group; Identifying other character groups that are adjacent to the target character group and have the same target character combination format; Recording the target character group quantity and value of the target character group and the other character groups, and the target character combination format; The target character group quantity and value in the unit data set and the target character combination format are combined to generate compressed data.

5. The method according to claim 4, characterized in that The step of combining the target character group quantity and value in the unit data set and the target character combination format to generate compressed data includes: Calculating the number and value of the target character group and the unit byte length and value of the target character combination format; Identify, according to the unit byte length and value, the byte length and value corresponding to the unit character group in the unit data set, wherein the byte length and value is the sum of all the unit byte lengths and values; Determine the original byte length value of the character in the unit data set; The byte length and value and the original byte length value are stored as attribute data in the identification data bit; The identification data bit, the target character group quantity and value, and the target character combination format are combined to generate compressed data.

6. A data decompression method, characterized in that: include: According to the decompression instruction, select the target compressed data; Reading a unit character group in the target compressed data and a character group quantity value corresponding to the unit character group, wherein the target compressed data includes at least one unit character group, and the character group quantity value corresponds to the unit character group in a one-to-one manner; generating a unit character group of a character group quantity value according to the unit character group and the character group quantity value corresponding to the unit character group; The unit character groups are combined to obtain decompressed data.

7. The method according to claim 6, characterized in that Before reading the unit character group in the target compressed data and the number of character groups corresponding to the unit character group, the method further includes: determining an identification data bit in the target compressed data, wherein the identification data bit is used to store attribute data of the target compressed data; Determining storage space for decompressed data using the attribute data; The step of reading a unit character group in the target compressed data and a character group quantity value corresponding to the unit character group includes: In the storage space, a unit character group in the target compressed data and a character group quantity value corresponding to the unit character group are read.

8. The method according to claim 7, characterized in that The step of reading a unit character group in the target compressed data and a character group quantity value corresponding to the unit character group includes: Determining a byte length and a value in the identification data of the target compressed data, wherein the byte length and the value are used to represent a data length value of the to-be-decompressed data; Read the first byte length value occupied by each group of the unit character groups; Read the second byte length value corresponding to the character group quantity value corresponding to each group of the unit character groups; Accumulating the unit character groups and the character group quantity values ​​until the sum of the first byte length value of the first quantity and the second byte length value of the second quantity is equal to the byte length sum value; The first number of unit character groups and the second number of character group quantity values ​​are determined.

9. A data compression device, characterized in that: include: A division module, configured to divide the file into unit size values ​​to obtain unit data sets, wherein the unit data sets are generated by character combinations; Dividing the characters in the unit data set by unit byte length to generate unit character groups; a counting module, configured to count adjacent unit character groups of the same character combination format in the unit data set to obtain a number value of character groups of the same character combination format; The combining module is used to combine the character group quantity value and the unit character group corresponding to the character group quantity value to generate compressed data.

10. A data decompression device, characterized in that: include: A selection module, used for selecting target compressed data according to a decompression instruction; a reading module, configured to read a unit character group in the target compressed data, and a character group quantity value corresponding to the unit character group, wherein the target compressed data includes at least one unit character group, and the character group quantity value corresponds to the unit character group in a one-to-one manner; A generating module, configured to generate a unit character group of a character group quantity value according to the unit character group and the character group quantity value corresponding to the unit character group; The combining module is used for combining the unit character groups to obtain decompressed data.

11. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 8.

12. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.

13. A vehicle, characterized in that: The vehicle is equipped with the device according to claim 9 or claim 10, or the electronic device according to claim 11.