A data compression method, device, equipment and medium

By determining the valid data bits according to the data format, removing redundancy and splicing the data fields, the inefficiency problem caused by redundant data bits in dual-machine communication is solved and the data transmission efficiency is significantly improved.

CN113868182BActive Publication Date: 2024-10-01GEER TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111158426.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-28
Publication Date
2024-10-01
Estimated Expiration
2041-09-28

AI Technical Summary

Technical Problem

In the existing technology, due to the existence of redundant data bits in fields during data transmission, the data transmission efficiency is low, and the data transmission efficiency of dual-machine communication cannot be effectively improved.

Method used

According to the data format of the protocol to which the data to be processed belongs, the effective data bits of each field are determined, and through redundant processing and splicing technology, the amount of data is reduced and compressed data is formed to avoid the occupation of redundant data bits.

Benefits of technology

By removing redundant data bits, the length of data is shortened, data transmission efficiency is significantly improved, data transmission volume is reduced, and communication efficiency is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113868182B_ABST
    Figure CN113868182B_ABST
Patent Text Reader

Abstract

The embodiment of the present application discloses a data compression method, device, equipment and medium. According to the data format corresponding to the protocol to which the data to be processed belongs, the valid data bits corresponding to each field are determined; the data bits corresponding to a field except for the valid data bits are all redundant data bits and have no practical significance. According to the valid data bits corresponding to each field, the data to be processed is de-redundanted to obtain the data of each field after de-redundancy. According to the arrangement order of each field and the valid data bits corresponding to each field, the data of each field is spliced ​​to obtain compressed data. The amount of data of each field can be effectively reduced by de-redundant processing. In order to avoid the data of each field after de-redundancy occupying at least one byte separately, the data of each field can be spliced ​​so that the field data that can be merged can be compressed into one byte, effectively shortening the length of the data to be processed, thereby improving the efficiency of data transmission.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a data compression method, device, equipment and computer-readable storage medium. Background Art

[0002] Now more and more electronic devices are beginning to use dual system configurations, which can reduce power consumption while meeting the performance requirements of electronic devices. As the functions of electronic devices continue to improve, their data throughput is also increasing, and transmission efficiency is becoming more and more important.

[0003] When executing data transmission, the data will be encapsulated according to the data format corresponding to the communication protocol and transmitted. Usually, the data format of two-machine communication is as follows: Figure 1 As shown, it includes two parts: a protocol frame header (Header) and a protocol frame body (Payload), wherein the protocol frame header includes a start frame (Start Of Frame, SOF) and a control bit (ControlBit); the protocol frame body includes a module service ID (ServiceId), a module command ID (CommandId), a command type (Type), a command length (Length) and command data (Value).

[0004] The data format of two-machine communication contains eight fields. When compressing data, the conventional practice is to directly use one or two bytes to represent one field. One byte contains 8 bits. However, in actual applications, some fields can be represented by 1 to 4 bits and do not need to occupy a byte. According to the conventional technology, directly using one or two bytes to represent one field will result in many redundant data bits. Redundant data bits will affect the transmission efficiency of data.

[0005] It can be seen that how to improve data transmission efficiency is a problem that technical personnel in this field need to solve. Summary of the invention

[0006] The purpose of the embodiments of the present application is to provide a data compression method, apparatus, device and computer-readable storage medium, which can improve data transmission efficiency.

[0007] In order to solve the above technical problems, the present application provides a data compression method, including:

[0008] Determine the valid data bits corresponding to each field according to the data format corresponding to the protocol to which the data to be processed belongs;

[0009] De-redundancy processing is performed on the data to be processed according to the valid data bits corresponding to each field to obtain de-redundancy data of each field;

[0010] According to the arrangement order of each field and the valid data bits corresponding to each field, the data of each field are spliced ​​to obtain compressed data.

[0011] Optionally, performing redundancy removal processing on the data to be processed according to valid data bits corresponding to each field to obtain redundancy-free data of each field includes:

[0012] Convert each field data in the data to be processed into binary data;

[0013] The binary data of each field is intercepted according to its corresponding valid data bits to obtain the data of each field after redundancy removal.

[0014] Optionally, the step of intercepting the binary data of each field according to its corresponding valid data bits to obtain the de-redundant data of each field includes:

[0015] Taking the last bit of the binary data of the target field as the starting bit, and intercepting binary data with the same length of valid data bits corresponding to the target field from the starting bit forward; wherein the target field is any one of all the fields;

[0016] The intercepted binary data is used as the field data after redundancy removal.

[0017] Optionally, the step of concatenating the field data according to the arrangement order of the fields and the valid data bits corresponding to the fields to obtain compressed data includes:

[0018] According to the arrangement order of each field and the valid data bits corresponding to each field, the field data whose sum of valid data bits is less than or equal to one byte length is compressed into one byte data in turn;

[0019] The compressed byte data is concatenated according to the arrangement order of each field to obtain compressed data.

[0020] Optionally, the data format includes instruction type, instruction length and instruction data;

[0021] After performing redundancy removal processing on the data to be processed according to the valid data bits corresponding to each field to obtain redundancy-free data of each field, the method further includes:

[0022] Determine whether the instruction type of the data to be processed is a set instruction type; wherein the set instruction type includes a switch instruction;

[0023] If the instruction type of the data to be processed is a set instruction type, de-redundancy processing is performed on the instruction type, the instruction length, and the field data corresponding to the instruction data according to the data bit format corresponding to the instruction type.

[0024] Optionally, after determining the valid data bits corresponding to each field according to the data format corresponding to the protocol to which the data to be processed belongs, the method further includes:

[0025] Receive data bit adjustment instructions;

[0026] Based on the field data bits carried in the data bit adjustment instruction, the valid data bits corresponding to each field are adjusted.

[0027] Optionally, after determining the valid data bits corresponding to each field according to the data format corresponding to the protocol to which the data to be processed belongs, the method further includes:

[0028] According to the rate of change of the data volume within a preset time period, the valid data bits corresponding to each field are adjusted.

[0029] The embodiment of the present application also provides a data compression device, including a determination unit, a redundancy removal unit and a splicing unit;

[0030] The determining unit is used to determine the valid data bits corresponding to each field according to the data format corresponding to the protocol to which the data to be processed belongs;

[0031] The de-redundancy unit is used to perform de-redundancy processing on the data to be processed according to the valid data bits corresponding to each field, so as to obtain de-redundant data of each field;

[0032] The splicing unit is used to splice the field data according to the arrangement order of each field and the valid data bits corresponding to each field to obtain compressed data.

[0033] Optionally, the de-redundancy unit includes a conversion subunit and an interception subunit;

[0034] The conversion subunit is used to convert each field data in the data to be processed into binary data;

[0035] The interception subunit is used to intercept the binary data of each field according to its corresponding valid data bits to obtain the data of each field after redundancy removal.

[0036] Optionally, the truncation subunit is used to take the last bit of the binary data of the target field as the starting bit, and truncate binary data with the same length as the valid data bits corresponding to the target field from the starting bit forward; wherein the target field is any one of all the fields; and the truncation binary data is used as the field data after de-redundancy.

[0037] Optionally, the splicing unit is used to compress field data whose sum of valid data bits is less than or equal to one byte length into one byte data in sequence according to the arrangement order of each field and the valid data bits corresponding to each field; and splice the compressed byte data according to the arrangement order of each field to obtain compressed data.

[0038] Optionally, the data format includes instruction type, instruction length and instruction data; the device also includes a judgment unit;

[0039] The judging unit is used to judge whether the instruction type of the data to be processed is a set instruction type; wherein the set instruction type includes a switch instruction;

[0040] The de-redundancy unit is also used to perform de-redundancy processing on the instruction type, the instruction length and the field data corresponding to the instruction data according to the data bit format corresponding to the instruction type if the instruction type of the data to be processed is a set instruction type.

[0041] Optionally, it also includes a receiving unit and an adjusting unit;

[0042] The receiving unit is used to receive a data bit adjustment instruction;

[0043] The adjustment unit is used to adjust the valid data bits corresponding to each field based on the field data bits carried in the data bit adjustment instruction.

[0044] Optionally, an adjustment unit is also included;

[0045] The adjustment unit is used to adjust the valid data bits corresponding to each field according to the change rate of the data volume within a preset time period.

[0046] The present application also provides a data compression device, including:

[0047] Memory for storing computer programs;

[0048] A processor is used to execute the computer program to implement the steps of any one of the data compression methods described above.

[0049] An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned data compression methods are implemented.

[0050] It can be seen from the above technical solution that the valid data bits corresponding to each field are determined according to the data format corresponding to the protocol to which the data to be processed belongs; the valid data bits refer to the data bits with practical significance. A field is often recorded in the form of bytes, and a byte contains eight data bits. The data bits corresponding to a field except the valid data bits are all redundant data bits and have no practical significance. Therefore, in order to reduce the amount of data transmission, the data to be processed can be de-redundanted according to the valid data bits corresponding to each field to obtain the data of each field after de-redundancy. After de-redundanting the data corresponding to each field, in order to obtain complete data, the data of each field can be spliced ​​according to the arrangement order of each field and the valid data bits corresponding to each field to obtain compressed data. In this technical solution, by deleting the redundant data bits of each field data, the amount of data of each field data can be effectively reduced. In order to avoid the data of each field after de-redundancy occupying at least one byte alone, the data of each field can be spliced ​​so that the field data that can be merged can be compressed into one byte, effectively shortening the length of the data to be processed, thereby improving the efficiency of data transmission. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0052] Figure 1 A data format for two-machine communication provided by the prior art;

[0053] Figure 2 A flowchart of a data compression method provided in an embodiment of the present application;

[0054] Figure 3 A schematic diagram of performing redundancy removal on data to be processed provided in an embodiment of the present application;

[0055] Figure 4 A method based on the embodiment of the present application is provided Figure 3 Schematic diagram of de-redundancy of compressed data obtained in ;

[0056] Figure 5 A schematic diagram of the structure of a data compression device provided in an embodiment of the present application;

[0057] Figure 6 A structural diagram of a data compression device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0058] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0059] The terms "including" and "having" and any variations thereof in the specification and claims of this application and the above drawings are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device comprising a series of steps or units is not limited to the listed steps or units, but may include steps or units that are not listed.

[0060] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0061] Next, a data compression method provided in an embodiment of the present application is described in detail. Figure 2 A flowchart of a data compression method provided in an embodiment of the present application, the method comprising:

[0062] S201: Determine the valid data bits corresponding to each field according to the data format corresponding to the protocol to which the data to be processed belongs.

[0063] Data transmission has its own protocols, common protocols include I 2 C (Inter-Integrated Circuit, serial bus) protocol, SPI (Serial Peripheral Interface, serial peripheral interface) protocol, UART (Universal Asynchronous Receiver / Transmitter, universal asynchronous receiver / transmitter) protocol, etc.

[0064] S202: De-redundancy processing is performed on the data to be processed according to the valid data bits corresponding to each field to obtain de-redundancy data of each field.

[0065] Different protocols have different corresponding data formats. For the sake of convenience, the SPI protocol used in the dual-machine communication system is used as an example in the present application embodiment. The corresponding data format can be found in Figure 1 .

[0066] The data to be processed is often presented in hexadecimal form. In order to achieve redundancy removal of the data to be processed, the hexadecimal data to be processed may be converted into binary form.

[0067] The data packet to be processed contains different fields, each field is used to represent different types of information. In the initial state, redundant data bits are set for each field to ensure that the data recording requirements can be met based on the current data format.

[0068] In the embodiment of the present application, in order to improve the transmission efficiency of data, the redundant data bits of each field can be discarded, thereby achieving the purpose of compressing data. In practical applications, after the data of each field in the data to be processed is converted into binary data, the binary data of each field can be intercepted according to its corresponding valid data bits to obtain the data of each field after de-redundancy.

[0069] Valid data bits refer to data bits with actual meaning. A field is often recorded in the form of bytes, and a byte contains eight data bits. Except for the valid data bits, the remaining data bits corresponding to a field are redundant data bits and have no actual meaning. Therefore, in order to reduce the amount of data transmission, the binary data of each field can be intercepted according to its corresponding valid data bits to obtain the data of each field after redundancy removal.

[0070] Binary data is generally recorded from back to front. Therefore, when intercepting binary data, the last bit of the binary data of the target field can be used as the starting bit, and binary data with the same length of valid data bits corresponding to the target field can be intercepted from the starting bit forward; the intercepted binary data is used as the field data after redundancy removal. Among them, the target field is any field among all fields.

[0071] S203: According to the arrangement order of each field and the valid data bits corresponding to each field, the data of each field are concatenated to obtain compressed data.

[0072] After de-redundancy processing is performed on the data corresponding to each field, in order to avoid each field data after de-redundancy occupying at least one byte separately, the field data can be spliced ​​so that the merged field data can be compressed into one byte, effectively shortening the length of the data to be processed.

[0073] In a specific implementation, field data whose sum of valid data bits is less than or equal to one byte length can be compressed into one byte data in sequence according to the arrangement order of each field and the valid data bits corresponding to each field; the compressed byte data are spliced ​​according to the arrangement order of each field to obtain compressed data.

[0074] by Figure 1 As an example of the data format of the two-machine communication shown in FIG. 1 , the schematic diagram of de-redundancy processing of the data to be processed can be seen in FIG. Figure 3 , Figure 3Contains 4 lines of data, the top line of data represents the hexadecimal data to be processed, and the second line of data represents the binary data obtained by conversion.

[0075] Figure 3 The start of frame (SOF) of the header is 0x5A, and SOF is represented by eight data bits. However, in actual applications, four data bits are sufficient to identify SOF, and eight data bits are obviously redundant. Therefore, the effective data bits of SOF can be set to 4 bits. In actual applications, only the last four bits of binary data are intercepted. After redundancy removal, the field data corresponding to SOF is 1010.

[0076] Figure 3 The control bit is 0x03. The control bit is represented by eight data bits, and generally half of the data bits of the control bit are reserved bits. Therefore, the effective data bits of the control bit can be set to four bits. After redundancy removal, the field data corresponding to the control bit is 0011.

[0077] In actual applications, in the Payload part, the first four bits of the module service ID (ServiceId), module command ID (CommandId) and command type (Type) fields are all 0, which does not represent valid data, so they can be discarded, that is, the valid data bits of ServiceId, CommandId and Type are all set to 4 bits, and the field data corresponding to ServiceId after de-redundancy is 0101, the field data corresponding to CommandId after de-redundancy is 0010, and the field data corresponding to Type after de-redundancy is 0001. Four data bits are sufficient to represent the data length in the command length (Length) field, so the first four bits can also be discarded, that is, the valid data bits of Length are set to 4 bits, and the field data corresponding to Length after de-redundancy is 0001. The command data (Value) can be kept in its original form without compression, so the field data corresponding to Value after de-redundancy is still 00000001. Figure 3 The third row of data represents the data of each field after redundancy is removed.

[0078] from Figure 3As can be seen from the third line of data, after de-redundancy, SOF, Control Bit, ServiceId, CommandId, Type, and Length are all four data bits, and a byte can contain eight data bits. Therefore, when splicing the data of each field, SOF and Control Bit can be merged into one byte; ServiceId and CommandId can be merged into one byte; Type and Length can be merged into one byte, so as to obtain Figure 3 The data format shown in the fourth row.

[0079] based on Figure 3 The schematic diagram of de-redundancy processing of the data to be processed is shown. It can be seen that the data to be processed can be compressed from the original seven bytes to four bytes after de-redundancy processing, shortening the length by nearly half. By shortening the length of the data to be processed, the data transmission efficiency is improved.

[0080] It can be seen from the above technical solution that the valid data bits corresponding to each field are determined according to the data format corresponding to the protocol to which the data to be processed belongs; the valid data bits refer to the data bits with practical significance. A field is often recorded in the form of bytes, and a byte contains eight data bits. The data bits corresponding to a field except the valid data bits are all redundant data bits and have no practical significance. Therefore, in order to reduce the amount of data transmission, the data to be processed can be de-redundanted according to the valid data bits corresponding to each field to obtain the data of each field after de-redundancy. After de-redundanting the data corresponding to each field, in order to obtain complete data, the data of each field can be spliced ​​according to the arrangement order of each field and the valid data bits corresponding to each field to obtain compressed data. In this technical solution, by deleting the redundant data bits of each field data, the amount of data of each field data can be effectively reduced. In order to avoid the data of each field after de-redundancy occupying at least one byte alone, the data of each field can be spliced ​​so that the field data that can be merged can be compressed into one byte, effectively shortening the length of the data to be processed, thereby improving the efficiency of data transmission.

[0081] The data format generally includes instruction type, instruction length and instruction data. In the above introduction, in order to ensure that the data of each field after redundancy removal can meet the representation requirements of data diversity, the value of the valid data bit of each field is generally set larger.

[0082] Considering that in actual applications, there are only two forms of instruction types of the data to be processed, these two forms can generally be distinguished by 0 and 1. In this case, the instruction type, instruction length and instruction data of the data to be processed do not need to occupy too many data bits. Therefore, based on the above S202, the data can be further de-redundant.

[0083] In the embodiment of the present application, after performing redundancy removal processing on the data to be processed according to the valid data bits corresponding to each field to obtain the data of each field after redundancy removal, it can be determined whether the instruction type of the data to be processed is a set instruction type; wherein the set instruction type may include a switch instruction. The switch instruction has only two forms: on and off.

[0084] If the instruction type of the data to be processed is a set instruction type, redundancy removal processing may be performed on the instruction type, instruction length, and field data corresponding to the instruction data according to the data bit format corresponding to the instruction type.

[0085] Taking the instruction type of the data to be processed as a switch instruction as an example, the instruction type, instruction length and instruction data of the data to be processed can all be represented by one data bit. Considering that a byte contains eight data bits, the first six bits can record the instruction type, the seventh bit can record the instruction length, and the eighth bit can record the instruction data in order from front to back.

[0086] Combination Figure 3 The third byte corresponds to the instruction type and instruction length, and the fourth byte corresponds to the instruction length. Figure 4 Based on Figure 3 Schematic diagram of de-redundancy of compressed data obtained in Figure 4 In the further redundancy of instruction type, instruction length and instruction length, Figure 3 The third byte field data "00010001" used to represent the instruction type and instruction length and the fourth byte field data "00000001" used to represent the instruction length are compressed into one byte. According to the method of recording the instruction type in the first six bits, the instruction length in the seventh bit, and the instruction data in the eighth bit, the de-redundant field data can be obtained as "00000111".

[0087] It should be noted that the above introduction uses only two types of instruction types as an example for explanation. In the embodiment of the present application, there is no specific limitation on the form of the instruction type. As long as the instruction type, instruction length, and instruction data can be represented by fewer bytes, such as one byte, the original valid data bits corresponding to each field can be de-redundanted for the data to be processed, and the instruction type, instruction length, and instruction data can be further de-redundanted on the basis of obtaining the de-redundant field data, thereby compressing the instruction type, instruction length, and instruction data to fewer bytes.

[0088] In the embodiment of the present application, in order to meet the compression requirements of all types of data under the same protocol, the value of the valid data bit of each field is often set larger. However, in actual applications, even different types of data under the same protocol may have different valid data bits corresponding to each field. Therefore, in the embodiment of the present application, in order to achieve differentiated processing when compressing different types of data, the valid data bits corresponding to each field in the data to be processed can be adjusted depending on the user's operation.

[0089] In a specific implementation, after determining the valid data bits corresponding to each field according to the data format corresponding to the protocol to which the data to be processed belongs, if a data bit adjustment instruction is received, the valid data bits corresponding to each field are adjusted based on the field data bits carried in the data bit adjustment instruction.

[0090] In addition to adjusting the valid data bits corresponding to each field according to the instruction, the system can also adjust the valid data bits corresponding to each field according to the rate of change of the amount of data within a preset time period.

[0091] The value of the preset time period can be set according to actual needs and is not limited here. For example, the preset time period can be one day or one week.

[0092] For example, assuming that in the initial state, the effective data bits corresponding to the instruction type are four. Within the preset time period, the amount of data to be processed increases sharply. At this time, the four-bit instruction type may not be able to distinguish all the data to be processed. In order to meet the data representation requirements, the effective data bits corresponding to the instruction type can be increased, for example, the original four bits are adjusted to six bits.

[0093] By adjusting the valid data bits corresponding to each field based on the received data bit adjustment instructions or the changes in the amount of data within a preset time period, the valid data bits of each field can be made to better fit the actual needs of the current characterization data. The adjusted valid data bits can not only meet the characterization needs of the data to be processed, but also effectively avoid data redundancy caused by excessively high valid data bit values.

[0094] Figure 5A schematic diagram of the structure of a data compression device provided in an embodiment of the present application, comprising a determination unit 51, a redundancy removal unit 52 and a splicing unit 53;

[0095] A determination unit 51, configured to determine the valid data bits corresponding to each field according to the data format corresponding to the protocol to which the data to be processed belongs;

[0096] A de-redundancy unit 52 is used to perform de-redundancy processing on the data to be processed according to the valid data bits corresponding to each field, so as to obtain de-redundant data of each field;

[0097] The splicing unit 53 is used to splice the data of each field according to the arrangement order of each field and the valid data bits corresponding to each field to obtain compressed data.

[0098] Optionally, the redundancy removal unit includes a conversion subunit and an interception subunit;

[0099] The conversion subunit is used to convert the data of each field in the data to be processed into binary data;

[0100] The interception subunit is used to intercept the binary data of each field according to its corresponding valid data bits to obtain the data of each field after redundancy removal.

[0101] Optionally, the truncation subunit is used to take the last bit of the binary data of the target field as the starting bit, and truncate binary data with the same length as the valid data bits corresponding to the target field from the starting bit forward; wherein the target field is any field among all the fields; and the truncation binary data is used as the field data after de-redundancy.

[0102] Optionally, the splicing unit is used to compress field data whose sum of valid data bits is less than or equal to one byte length into one byte data in sequence according to the arrangement order of each field and the valid data bits corresponding to each field; and splice the compressed byte data according to the arrangement order of each field to obtain compressed data.

[0103] Optionally, the data format includes instruction type, instruction length and instruction data; the device also includes a judgment unit;

[0104] A judging unit, used to judge whether the instruction type of the data to be processed is a set instruction type; wherein the set instruction type includes a switch instruction;

[0105] The de-redundancy unit is also used to perform de-redundancy processing on the instruction type, instruction length and field data corresponding to the instruction data according to the data bit format corresponding to the instruction type if the instruction type of the data to be processed is a set instruction type.

[0106] Optionally, it also includes a receiving unit and an adjusting unit;

[0107] A receiving unit, used for receiving a data bit adjustment instruction;

[0108] The adjustment unit is used to adjust the valid data bits corresponding to each field based on the field data bits carried in the data bit adjustment instruction.

[0109] Optionally, an adjustment unit is also included;

[0110] The adjustment unit is used to adjust the valid data bits corresponding to each field according to the rate of change of the data volume within a preset time period.

[0111] Figure 5 The description of the features in the corresponding embodiments can be found in Figure 2 The relevant descriptions of the corresponding embodiments will not be repeated here one by one.

[0112] It can be seen from the above technical solution that the valid data bits corresponding to each field are determined according to the data format corresponding to the protocol to which the data to be processed belongs; the valid data bits refer to the data bits with practical significance. A field is often recorded in the form of bytes, and a byte contains eight data bits. The data bits corresponding to a field except the valid data bits are all redundant data bits and have no practical significance. Therefore, in order to reduce the amount of data transmission, the data to be processed can be de-redundanted according to the valid data bits corresponding to each field to obtain the data of each field after de-redundancy. After de-redundanting the data corresponding to each field, in order to obtain complete data, the data of each field can be spliced ​​according to the arrangement order of each field and the valid data bits corresponding to each field to obtain compressed data. In this technical solution, by deleting the redundant data bits of each field data, the amount of data of each field data can be effectively reduced. In order to avoid the data of each field after de-redundancy occupying at least one byte alone, the data of each field can be spliced ​​so that the field data that can be merged can be compressed into one byte, effectively shortening the length of the data to be processed, thereby improving the efficiency of data transmission.

[0113] Figure 6 A structural diagram of a data compression device provided in an embodiment of the present application, such as Figure 6 As shown, the data compression device comprises: a memory 20 for storing a computer program;

[0114] The processor 21 is used to implement the steps of the data compression method in the above embodiment when executing a computer program.

[0115] The data compression device provided in this embodiment may include but is not limited to a smart phone, a tablet computer, a laptop computer, or a desktop computer.

[0116] Among them, the processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 21 can be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 21 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 21 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 21 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.

[0117] The memory 20 may include one or more computer-readable storage media, which may be non-transitory. The memory 20 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In this embodiment, the memory 20 is at least used to store the following computer program 201, wherein, after the computer program is loaded and executed by the processor 21, it can implement the relevant steps of the data compression method disclosed in any of the aforementioned embodiments. In addition, the resources stored in the memory 20 may also include an operating system 202 and data 203, etc., and the storage method may be temporary storage or permanent storage. Among them, the operating system 202 may include Windows, Unix, Linux, etc. The data 203 may include but is not limited to the data format corresponding to the protocol, etc.

[0118] In some embodiments, the data compression device may further include a display screen 22 , an input / output interface 23 , a communication interface 24 , a power supply 25 , and a communication bus 26 .

[0119] Those skilled in the art will understand that Figure 6 The structure shown in the figure does not constitute a limitation on the data compression device, and may include more or less components than those shown in the figure.

[0120] It is understandable that if the data compression method in the above embodiment is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium to execute all or part of the steps of each embodiment method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), electrically erasable programmable ROM, register, hard disk, removable disk, CD-ROM, magnetic disk or optical disk and other media that can store program codes.

[0121] Based on this, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned data compression method are implemented.

[0122] The functions of the functional modules of the computer-readable storage medium described in the embodiment of the present invention can be specifically implemented according to the method in the above method embodiment. The specific implementation process can refer to the relevant description of the above method embodiment, which will not be repeated here.

[0123] The above is a detailed introduction to a data compression method, device, equipment and computer-readable storage medium provided in the embodiments of the present application. The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the various embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.

[0124] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0125] The above is a detailed introduction to a data compression method, device, equipment and computer-readable storage medium provided by the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present invention, and the description of the above embodiments is only used to help understand the method of the present invention and its core idea. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present invention, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of the present application.

Claims

1. A data compression method, characterized in that: include: Determine the valid data bits corresponding to each field according to the data format corresponding to the protocol to which the data to be processed belongs; De-redundancy processing is performed on the data to be processed according to the valid data bits corresponding to each field to obtain de-redundancy data of each field; According to the arrangement order of each field and the valid data bits corresponding to each field, the data of each field are concatenated to obtain compressed data; The de-redundancy processing is performed on the data to be processed according to the valid data bits corresponding to each field to obtain the de-redundant data of each field, including: Convert each field data in the data to be processed into binary data; Taking the last bit of the binary data of the target field as the starting bit, and intercepting binary data with the same length of valid data bits corresponding to the target field from the starting bit forward; wherein the target field is any one of all the fields; The intercepted binary data is used as the field data after redundancy removal.

2. The data compression method according to claim 1, characterized in that: The step of concatenating the field data according to the arrangement order of the fields and the valid data bits corresponding to the fields to obtain compressed data includes: According to the arrangement order of each field and the valid data bits corresponding to each field, the field data whose sum of valid data bits is less than or equal to one byte length is compressed into one byte data in sequence; The compressed byte data is concatenated according to the arrangement order of each field to obtain compressed data.

3. The data compression method according to claim 1, characterized in that: The data format includes instruction type, instruction length and instruction data; After performing redundancy removal processing on the data to be processed according to the valid data bits corresponding to each field to obtain redundancy-free data of each field, the method further includes: Determine whether the instruction type of the data to be processed is a set instruction type; wherein the set instruction type includes a switch instruction; If the instruction type of the data to be processed is a set instruction type, de-redundancy processing is performed on the instruction type, the instruction length, and the field data corresponding to the instruction data according to the data bit format corresponding to the instruction type.

4. The data compression method according to any one of claims 1 to 3, characterized in that: After determining the valid data bits corresponding to each field according to the data format corresponding to the protocol to which the data to be processed belongs, the method further includes: Receive data bit adjustment instructions; Based on the field data bits carried in the data bit adjustment instruction, the valid data bits corresponding to each field are adjusted.

5. The data compression method according to any one of claims 1 to 3, characterized in that: After determining the valid data bits corresponding to each field according to the data format corresponding to the protocol to which the data to be processed belongs, the method further includes: According to the rate of change of the data volume within a preset time period, the valid data bits corresponding to each field are adjusted.

6. A data compression device, characterized in that: It includes a determination unit, a redundancy removal unit and a splicing unit; The determining unit is used to determine the valid data bits corresponding to each field according to the data format corresponding to the protocol to which the data to be processed belongs; The de-redundancy unit is used to perform de-redundancy processing on the data to be processed according to the valid data bits corresponding to each field, so as to obtain de-redundant data of each field; The splicing unit is used to splice the data of each field according to the arrangement order of each field and the valid data bits corresponding to each field to obtain compressed data; The de-redundancy unit includes a conversion subunit and an interception subunit; The conversion subunit is used to convert each field data in the data to be processed into binary data; The interception subunit is used to take the last bit of the binary data of the target field as the starting bit, and intercept binary data with the same length as the valid data bit corresponding to the target field from the starting bit forward; wherein the target field is any one field among all the fields; and the intercepted binary data is used as the field data after de-redundancy.

7. A data compression device, characterized in that: include: Memory for storing computer programs; A processor, configured to execute the computer program to implement the steps of the data compression method according to any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the data compression method according to any one of claims 1 to 5 are implemented.