Encoding method and device

文档序号:244765 发布日期:2021-11-12 浏览:16次 中文

阅读说明:本技术 编码方法及装置 (Encoding method and device ) 是由 张怡 于 2021-08-25 设计创作,主要内容包括:本申请提供编码方法及装置,其中所述编码方法包括:获取整数类型的目标数据对应的二进制数据;截取所述二进制数据的有效二进制位获得二进制位序列,并对所述二进制位序列进行二进制位划分处理获得二进制位分组;根据所述二进制位分组在二进制位序列中的排列顺序,确定所述二进制位分组对应的补充二进制位;基于所述补充二进制位以及所述补充二进制位对应的二进制位分组中的二进制位进行拼接,根据拼接结果生成所述目标数据对应的目标编码数据。(The application provides an encoding method and an encoding device, wherein the encoding method comprises the following steps: obtaining binary data corresponding to target data of an integer type; intercepting effective binary digits of the binary data to obtain a binary digit sequence, and carrying out binary digit division processing on the binary digit sequence to obtain a binary digit group; determining supplementary binary digits corresponding to the binary digit groups according to the arrangement sequence of the binary digit groups in a binary digit sequence; and splicing the supplementary binary digits and binary digits in the binary digit group corresponding to the supplementary binary digits, and generating target encoding data corresponding to the target data according to a splicing result.)

1. A method of encoding, comprising:

obtaining binary data corresponding to target data of an integer type;

intercepting effective binary digits of the binary data to obtain a binary digit sequence, and carrying out binary digit division processing on the binary digit sequence to obtain a binary digit group;

determining supplementary binary digits corresponding to the binary digit groups according to the arrangement sequence of the binary digit groups in a binary digit sequence;

and splicing the supplementary binary digits and binary digits in the binary digit group corresponding to the supplementary binary digits, and generating target encoding data corresponding to the target data according to a splicing result.

2. The encoding method according to claim 1, wherein said truncating the significant bits of the binary data to obtain a binary bit sequence and performing binary bit dividing processing on the binary bit sequence to obtain a binary bit group comprises:

intercepting the effective binary digits of the binary data to obtain a binary digit sequence consisting of the effective binary digits in the binary data;

and carrying out binary bit division processing on the binary bit sequence according to a preset division bit number to obtain at least one binary bit group.

3. The encoding method according to claim 1, wherein said determining complementary bits corresponding to said binary bit groups according to an arrangement order of said binary bit groups in a binary bit sequence comprises:

determining the arrangement sequence of the binary bit groups in the binary bit sequence;

determining a supplementary binary bit corresponding to the binary bit group as a first numerical value under the condition that the arrangement sequence is a last bit;

and determining the supplementary binary digit corresponding to the binary digit group as a second numerical value under the condition that the arrangement sequence is not the last digit.

4. The encoding method according to any one of claims 1-3, wherein said concatenating based on said supplementary binary digits and the binary digits in the binary digit group to which said supplementary binary digits correspond comprises:

calculating the sum of the supplementary binary digits and the number of binary digits in the binary digit group corresponding to the supplementary binary digits;

under the condition that the sum of the digits is not less than a preset digit, splicing the supplementary binary digits and binary digits in a binary digit group corresponding to the supplementary binary digits according to a first preset sequence to obtain a binary digit spliced group;

determining a second supplementary binary digit according to a digit difference value between the preset digit and the sum of the digits under the condition that the sum of the digits is less than a preset digit; and splicing the supplementary binary digits, the binary digits in the binary digit group corresponding to the supplementary binary digits and the second supplementary binary digits according to a second preset sequence to obtain a binary digit spliced group.

5. The encoding method according to claim 4, wherein the generating target encoded data corresponding to the target data according to the splicing result comprises:

and combining the binary bit splicing groups according to the arrangement sequence of the binary bit splicing groups to generate target coding data corresponding to the target data.

6. The encoding method according to claim 4, wherein the splicing the complementary binary digits and the binary digits in the binary digit group corresponding to the complementary binary digits according to a first preset order to obtain a binary digit spliced group comprises:

splicing the supplementary binary digits and the binary digits in the binary digit groups corresponding to the supplementary binary digits according to the sequence that the supplementary binary digits are located at the tail positions and the binary digits in the binary digit groups corresponding to the supplementary binary digits are located at the head positions to obtain binary digit spliced groups; or

And splicing the supplementary binary digits and the binary digits in the binary digit groups corresponding to the supplementary binary digits according to the sequence that the supplementary binary digits are at the first positions and the binary digits of the binary digit groups corresponding to the supplementary binary digits are at the last positions to obtain binary digit spliced groups.

7. The encoding method according to claim 5 or 6, wherein the generating target encoding data corresponding to the target data according to the splicing result based on the supplementary binary bits and the binary bits in the binary bit group corresponding to the supplementary binary bits comprises:

splicing the supplementary binary digits and binary digits in the binary digit group corresponding to the supplementary binary digits according to a first preset sequence to obtain a binary digit spliced group;

determining the number of bits in the first-bit concatenated packet of bits in the concatenated packet of bits;

determining a second supplementary binary digit according to a digit difference value between the preset digit and the digit under the condition that the digit is less than the preset digit;

inserting said second supplemental binary digit into the middle of a supplemental binary digit arranged in the first digit's spliced grouping of binary digits and a binary digit in the grouping of binary digits;

and combining the binary bit splicing groups according to the arrangement sequence of the binary bit splicing groups to generate target coding data corresponding to the target data.

8. The encoding method according to claim 1, wherein after said truncating the significant bits of the binary data to obtain a sequence of binary bits, further comprising:

determining the significance of binary digits contained in the binary digit sequence;

determining the number of bytes occupied by binary bits in the binary bit sequence according to the effective number;

determining a third supplementary binary bit corresponding to the binary sequence based on the number of bytes and the integer type of the target data;

and splicing the binary bit sequence and the third supplementary binary bit to obtain second target coding data corresponding to the target data.

9. The encoding method according to any one of claims 1 to 3 or 8, wherein the obtaining binary data corresponding to the integer type of target data comprises:

acquiring target data of an integer type;

binary coding is carried out on the target data to obtain binary data corresponding to the target data;

correspondingly, after the target encoding data corresponding to the target data is generated according to the splicing result, the method further includes:

and transmitting the target coded data to at least one receiving terminal.

10. An encoding apparatus, comprising:

the acquisition module is configured to acquire binary data corresponding to the target data of the integer type;

the dividing module is configured to intercept effective binary bits of the binary data to obtain a binary bit sequence, and perform binary bit dividing processing on the binary bit sequence to obtain a binary bit group;

the determining module is configured to determine complementary binary digits corresponding to the binary digit groups according to the arrangement sequence of the binary digit groups in the binary digit sequence;

and the splicing module is configured to splice binary digits in the binary digit groups corresponding to the supplementary binary digits based on the supplementary binary digits and generate target coded data corresponding to the target data according to a splicing result.

11. A computing device comprising a memory, a processor, and computer instructions stored on the memory and executable on the processor, wherein the processor implements the steps of the method of any one of claims 1-9 when executing the computer instructions.

12. A computer-readable storage medium storing computer instructions, which when executed by a processor, perform the steps of the method of any one of claims 1 to 9.

Technical Field

The present application relates to the field of computer technologies, and in particular, to an encoding method. The application also relates to an encoding apparatus, a computing device, and a computer-readable storage medium.

Background

With the development of the internet, binary codes are commonly used in both front-end communication and back-end communication and file storage, and particularly in the aspect of instant games, the binary codes are used more frequently. For a game developer, the server coding mode has a significant influence on the bandwidth of a game service period. Data that is communicated frequently in a game scene is typically small, integer numbers. At present, the binary data formed by performing conventional binary coding (dividing by 2 and performing coding in a reverse-order arrangement) on the integer data occupies more bytes.

Disclosure of Invention

In view of this, the present application provides an encoding method. The application also relates to an encoding device, a computing device and a computer readable storage medium, which are used for solving the problem that the conventional encoded binary data occupies a large number of bytes in the prior art.

According to a first aspect of embodiments of the present application, there is provided an encoding method, including:

obtaining binary data corresponding to target data of an integer type;

intercepting effective binary digits of the binary data to obtain a binary digit sequence, and carrying out binary digit division processing on the binary digit sequence to obtain a binary digit group;

determining supplementary binary digits corresponding to the binary digit groups according to the arrangement sequence of the binary digit groups in a binary digit sequence;

and splicing the supplementary binary digits and binary digits in the binary digit group corresponding to the supplementary binary digits, and generating target encoding data corresponding to the target data according to a splicing result.

According to a second aspect of embodiments of the present application, there is provided an encoding apparatus including:

the acquisition module is configured to acquire binary data corresponding to the target data of the integer type;

the dividing module is configured to intercept effective binary bits of the binary data to obtain a binary bit sequence, and perform binary bit dividing processing on the binary bit sequence to obtain a binary bit group;

the determining module is configured to determine complementary binary digits corresponding to the binary digit groups according to the arrangement sequence of the binary digit groups in the binary digit sequence;

and the splicing module is configured to splice binary digits in the binary digit groups corresponding to the supplementary binary digits based on the supplementary binary digits and generate target coded data corresponding to the target data according to a splicing result.

According to a third aspect of embodiments herein, there is provided a computing device comprising a memory, a processor and computer instructions stored on the memory and executable on the processor, the processor implementing the steps of the encoding method when executing the computer instructions.

According to a fourth aspect of embodiments herein, there is provided a computer readable storage medium storing computer instructions which, when executed by a processor, implement the steps of the encoding method.

The coding method includes acquiring binary data corresponding to integer type target data, intercepting effective binary digits of the binary data to obtain a binary digit sequence, carrying out binary digit division processing on the binary digit sequence to obtain binary digit groups, and determining supplementary binary digits corresponding to the binary digit groups according to arrangement sequences of the binary digit groups in the binary digit sequence on the basis of the binary digit groups; and finally, splicing is carried out on the basis of the supplementary binary digits and the binary digits in the binary digit group corresponding to the supplementary binary digits, and target encoding data corresponding to the target data is generated according to a splicing result. The optimization of a conventional binary coding mode is realized, the number of bytes occupied by the optimized target coding data is small, the storage space is further compressed, and the transmission bandwidth is reduced.

Drawings

Fig. 1 is a flowchart of an encoding method according to an embodiment of the present application;

FIG. 2 is a flowchart illustrating an encoding method applied to a game scene according to an embodiment of the present disclosure;

FIG. 3 is a schematic view of a game interface of a game client in an encoding method according to an embodiment of the present application;

fig. 4 is a schematic structural diagram of an encoding apparatus according to an embodiment of the present application;

fig. 5 is a block diagram of a computing device according to an embodiment of the present application.

Detailed Description

In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present application. This application is capable of implementation in many different ways than those herein set forth and of similar import by those skilled in the art without departing from the spirit of this application and is therefore not limited to the specific implementations disclosed below.

The terminology used in the one or more embodiments of the present application is for the purpose of describing particular embodiments only and is not intended to be limiting of the one or more embodiments of the present application. As used in one or more embodiments of the present application and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used in one or more embodiments of the present application is intended to encompass any and all possible combinations of one or more of the associated listed items.

It will be understood that, although the terms first, second, etc. may be used herein in one or more embodiments of the present application to describe various information, these information should not be limited by these terms. These terms are only used to distinguish one type of information from another. For example, a first aspect may be termed a second aspect, and, similarly, a second aspect may be termed a first aspect, without departing from the scope of one or more embodiments of the present application. The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination", depending on the context.

First, the noun terms to which one or more embodiments of the present application relate are explained.

Binary (binary) is a notation system with base 2 in mathematical and digital circuits, and represents a binary system of the system with base 2. In this system, two different symbols 0 (representing zero) and 1 (representing one) are usually used. In digital electronic circuits, the implementation of logic gates directly applies binary, so that binary is used in modern computers and devices relying on computers. Each digit is called a Bit (abbreviation for Binary digit)

A byte is a unit of binary data. One byte is typically 8 bits long. However, some older model computer architectures use different lengths. To avoid confusion, in most international literature, words are used instead of bytes. In most computer systems, a byte is an 8-bit long unit of data, and most computers use a byte to represent a character, number, or other character. A byte may also represent a series of binary bits. In some computer systems, 4 bytes represent a word, which is the unit of data that a computer can efficiently process when executing instructions. Some language descriptions require 2 bytes to represent a character, which is called a double-byte character set. Some processors are capable of processing double-byte or single-byte instructions. Bytes are often abbreviated as "B" and bits are often abbreviated as "B" in small parts, and the size of computer memory is often expressed in bytes

BIT (Binary), a computer term of art, is a unit of information quantity, which is transliterated from the english BIT. And is also a bit in the binary number, the unit of measure of the amount of information, which is the minimum unit of the amount of information. Information necessary to reduce the number of alternative stimuli by half in case different choices need to be made. I.e. the information content (number of bits) of the signal is equal to the logarithmic value of the signal stimulus with base 2. It was considered most appropriate to measure the information quantity in logarithmic units in 1928.

In the present application, an encoding method is provided, and the present application relates to an encoding apparatus, a computing device, and a computer-readable storage medium, which are described in detail in the following embodiments one by one.

Fig. 1 shows a flowchart of an encoding method according to an embodiment of the present application, which specifically includes the following steps:

step 102: and acquiring binary data corresponding to the target data of the integer type.

Specifically, the integer type may be a short integer, an integer, or a long integer. The target data may be an integer of an integer type, such as 68, 24, 150, etc. In specific implementation, in order to implement the encoding optimization of the target data, binary data corresponding to the target data sent by other devices may be obtained first, or binary data corresponding to the target data in the current device may also be obtained, and the encoding optimization is performed on the basis of the obtained binary data, which is not limited herein.

The binary data is data in a binary format generated by binary-coding target data. In a communication system, information or data is often encoded in a binary format, and after the information or data is encoded into binary data, the binary data is processed, such as storage or transmission. In specific implementation, the target data is binary-coded, which can be understood as coding the target data by conventional prior art.

Further, because different types of data have different characteristics, and different types of data are usually encoded by using different binary encoding methods, for example, integer type data is usually encoded by dividing by 2 and encoding in an inverted binary encoding method, and floating point type data is encoded by using another binary encoding method. Binary data generated by encoding with different encoding methods have different rules, for example, consecutive 0 s in the high-order bit (binary bit) of the integer type data formed by conventional binary encoding are meaningless. In order to reduce the occupation of meaningless 0 to space, the embodiment of the application provides an encoding optimization scheme for the existing binary encoding mode of integer types.

In practical application, considering that the usage rate of the small digits of the integer type is far greater than that of the large digits of the integer type in most scenes, the number of bytes occupied by the binary data obtained by binary coding the target data depends on the data type of the target data. If the target data is short integer, the binary data obtained by binary coding the short integer target data occupies fixed 2 bytes; if the target data is integer, the binary data after binary coding the integer target data fixedly occupies 4 bytes; if the target data is a long integer, the binary data obtained by binary coding the long integer target data occupies 8 bytes. However, for small numbers, most of the high-order bits in the bytes occupied by their corresponding binary data are meaningless (i.e., invalid), and if the small numbers are encoded by using the conventional binary encoding method, a part of the space is wasted for storing meaningless bits.

Further, in the process of data transmission with the terminal, the transmission of the binary data corresponding to the small numbers results in occupying more bandwidth. In order to reduce the bandwidth occupation with the terminal in the transmission process, in the embodiment of the application, the integer type target data is obtained, binary coding is performed on the target data, and the binary data corresponding to the target data is obtained, so that coding optimization is performed on the binary data corresponding to the integer type target data, the bandwidth occupation in the communication process with the terminal is reduced, the communication speed with the terminal is improved, and the network delay is reduced.

For example, the target data is 123456, and binary encoding is performed by a binary encoding method of dividing 2 and dividing, and performing reverse arrangement, and the obtained binary data is "00000000000000011110001001000000".

Step 104: and intercepting the effective binary digits of the binary data to obtain a binary digit sequence, and carrying out binary digit division processing on the binary digit sequence to obtain a binary digit group.

On the basis of the above-mentioned binary data corresponding to the target data, in order to compress the binary data, the number of meaningless binary bits (high-order continuous 0) in the binary data is reduced, and the effective binary bits in the binary data are intercepted, so as to obtain a binary bit sequence. However, the intercepted binary bit sequence may not be full of the original number of bytes, and if the computer still identifies the data according to the original number of bytes, an identification error may be caused, so that in order to make the computer determine the number of bytes occupied by the data, the binary bit sequence needs to be subjected to binary bit division again, so as to supplement the binary bits in the binary bit packet obtained by the subdivision, and make the computer identify the number of bytes occupied by the current data according to the supplemented binary bits.

The valid binary digits refer to binary digits with definite meanings in the binary data, and specifically, for the binary data corresponding to the integer type of data, the valid binary digits refer to other binary digits except for high-order continuous 0 in the binary data. And obtaining a binary bit sequence on the basis of the intercepted effective binary bits, wherein the binary bit sequence is formed by splicing the intercepted effective binary bits according to the arrangement sequence in the binary data.

On the basis of obtaining the binary bit sequence, because the conventional coding mode needs to determine the corresponding number of coding bytes according to the data type of the data, and the embodiment of the application changes the number of bytes with the original fixed length, the number of bytes occupied by the binary bit sequence also needs to be identified through the binary bit.

In specific implementation, due to the dividing mode of dividing the binary bit sequence, the coding efficiency, accuracy and compression ratio of the coding result of the obtained target data are directly influenced. In order to improve the coding efficiency and the coding accuracy of the target data, the binary bit sequence may be grouped according to a preset number of dividing bits, and in an optional implementation manner provided in this embodiment of the present application, a specific implementation manner is as follows:

intercepting the effective binary digits of the binary data to obtain a binary digit sequence consisting of the effective binary digits in the binary data;

and carrying out binary bit division processing on the binary bit sequence according to a preset division bit number to obtain at least one binary bit group.

The preset dividing digit refers to a preset granularity for dividing binary bits, for example, if the preset dividing digit is 7, the binary data is divided by taking 7 binary bits as a group; assuming that the predetermined number of division bits is 5, the binary data is divided into a group of 5 binary bits. In addition, the preset dividing bit number may also be 8, and the like, which is not limited herein.

In specific implementation, the binary bit sequence may be divided according to a preset division number in a direction from the lower bit to the upper bit. Under the condition that the number of binary digits in the binary digit sequence is less than a preset dividing digit, directly taking the binary digit sequence as a binary digit group; after the division is completed, if binary digits smaller than the preset division digit exist in the binary digit sequence, the binary digits are directly used as a binary digit group.

In practical application, on the basis of obtaining a binary bit sequence consisting of effective binary bits in the binary data by intercepting the effective binary bits, grouping the binary bits, wherein after the binary bit sequence is subjected to binary bit division processing according to a preset division number, the number of bits of the binary bits in at least one obtained binary bit group may be less than 8 bits. The missing bits may be used to supplement the bits that identify the number of bytes. Therefore, in practical application, a binary bit division mode for a binary bit sequence is selected according to the adopted identification strategy for occupying bytes of target data.

Along with the above example, the significant bits in the binary data "00000000000000011110001001000000" are truncated to obtain a binary bit sequence "11110001001000000", and under the condition that the preset division number is 7, the binary bit sequence is divided into 3 binary bit groups from right to left, where the 3 binary bit groups are respectively: "111", "1000100" and "1000000".

In conclusion, binary bit division processing is performed on the binary bit sequence formed by the effective binary bits according to the preset division number, so that the binary bit sequence is grouped through simple operation, the grouping efficiency is improved, and the coding efficiency of the target data is further improved.

In addition, in order to avoid occupying computing resources by grouping the binary bit sequence, the binary bit sequence may be identified as a whole by the number of bytes, and after the valid binary bits of the binary data are intercepted to obtain the binary bit sequence, the encoding optimization of the binary bit sequence may be realized by:

determining the significance of binary digits contained in the binary digit sequence;

determining the number of bytes occupied by binary bits in the binary bit sequence according to the effective number;

determining a third supplementary binary bit corresponding to the binary sequence based on the number of bytes and the integer type of the target data;

and splicing the binary bit sequence and the third supplementary binary bit to obtain second target coding data corresponding to the target data.

Specifically, based on the number of bits (i.e., the number of significant bits) of the binary bits included in the binary bit sequence, the number of bytes occupied by the binary bits in the current sequence is determined, and then the byte number flag bit (i.e., the third supplemental binary bit) corresponding to the binary sequence is determined.

In practical application, under the condition that the target data is short integer, the binary data obtained by binary coding the target data occupies fixed 2 bytes; under the condition that the target data is integer, the binary data obtained by binary coding the target data fixedly occupy 4 bytes; when the target data is a long integer, binary data obtained by binary encoding the target data occupies 8 bytes. It can be known that the binary bit sequence formed by the valid binary bits of the short integer target data after the conventional coding occupies at most 2 bytes; the binary bit sequence formed by the valid binary bits of the integer target data after the conventional coding occupies 4 bytes at most; the target data of long integer occupies 8 bytes at most in the binary bit sequence formed by the valid binary bits after conventional coding. In addition, a third supplementary binary bit which needs to be supplemented is added, so that the splicing of a binary bit sequence formed by the conventionally coded effective binary bits of the short integer target data and the third supplementary binary bit occupies 3 bytes at most; splicing a binary bit sequence consisting of the conventionally coded effective binary bits of the integer target data with a third supplementary binary bit to occupy at most 5 bytes; the splicing of the binary bit sequence consisting of the conventionally coded valid binary bits and the third complementary binary bit of the long integer target data takes up to 9 bytes.

Therefore, for short integer, the number of bytes that the third supplementary binary bit needs to identify is at most 3, and in this case, the third supplementary binary bit needs at least 2 bits; for integer, the number of bytes of the third supplementary binary bit to be identified is at most 5, and in this case, the third supplementary binary bit needs at least 3 binary bits; for long shapes, the third supplementary binary bit needs to be identified by a maximum number of bytes of 9, in which case the third supplementary binary bit needs to be at least 4 bits.

Based on the number of bytes occupied by the binary bits in the binary sequence and the integer type of the target data, the byte number flag bit (i.e. the third complementary binary bit) corresponding to the binary sequence can be determined. Splicing is carried out on the basis of the binary sequence and the third supplementary binary digit, and specifically, the binary sequence and the third supplementary binary digit can be spliced in a mode that the binary sequence is at the first position (arranged at the front) and the third supplementary binary digit is at the last position (arranged at the back); the binary sequence and the third complementary binary bit can be spliced in a mode that the binary sequence is at the last position and the third complementary binary bit is at the first position, and the final coding result, namely the second target coding data, can be obtained after splicing without limitation.

It should be noted that, since the computer recognizes the complete byte number, in the case that the binary bits after the binary sequence and the third complementary binary bit are spliced do not satisfy the complete byte number, a sufficient number of 0's are also needed to be supplemented between the binary sequence and the third complementary binary bit to ensure that the target encoded data occupies the complete byte number.

Along with the above example, on the basis of binary data "00000000000000011110001001000000", the binary bit sequence composed of significant bits in the binary data is intercepted as "11110001001000000", the number of bytes occupied by the binary bits in the binary bit sequence is 3, and in the case that the integer type of the target data is integer, it can be determined that the third supplemental binary bit is 3 bits, specifically, 010 of the 3 supplemental binary bit represents 3 bytes, and the concatenation is performed in such a way that the third supplemental binary bit is at the first bit and the binary bit sequence is at the last bit, to obtain a concatenation sequence "001011110001001000000", and the concatenation sequence is not a complete number of bytes, and differs by 3 binary bits, so that 3 bits of 0 are supplemented between the binary bit sequence and the third supplemental binary bit, and after the supplementation is completed, to obtain a second target encoded data "001000011110001001000000" corresponding to the target data 123456, and the second target encoded data occupies 3 bytes, and the binary coding method occupies 1 byte less than that of the original integer target data after binary coding.

In summary, based on the number of bytes and the integer type of the target data, a third supplementary binary bit corresponding to a binary sequence composed of valid binary bits is determined, and then the second target encoded data of the target data is generated by splicing the third supplementary binary bit with the binary sequence, so that the number of bytes occupied by most encoded data of the target data is reduced, and the storage space and the data transmission bandwidth are further saved.

Step 106: and determining supplementary binary digits corresponding to the binary digit groups according to the arrangement sequence of the binary digit groups in the binary digit sequence.

On the basis of the binary bit grouping obtained by performing the binary bit dividing process on the binary bit sequence, the byte identification is performed on the encoding result of the target data based on the binary bit grouping. Complementary binary digits corresponding to the binary digit groups can be determined according to the arrangement sequence of the binary digit groups in the binary digit sequence, and the bytes occupied by the current data are identified through the complementary binary digits.

The supplementary binary digits may be at least one binary digit group selected from the binary digit groups and added with supplementary binary digits. For example, only the binary bits sorted at the head are grouped to determine the corresponding supplementary binary bits; or only grouping the binary bits arranged at the last bit, determining the corresponding supplementary binary bits, etc., without limitation. In addition, supplemental bits may also be added to each binary bit grouping. In practical applications, the manner of supplementing the binary bits can be selected according to actual needs, and is not limited herein.

In practical applications, the number of bits of the divided binary bit groups and the complementary binary bits can be determined according to the adopted identification strategy for the occupied bytes of the target data. For example, the identification policy for occupying bytes of target data: the occupied (associated) byte is identified by 1 binary bit in each byte. Then, on the basis of the binary bit division of the binary data in 7-bit 1 groups, the complementary binary bit corresponding to each group is determined to be 1 bit.

Further, it is considered that if the number of supplemental binary bits is too many, the number of bytes occupied by the encoding result is increased, and if the termination position (last bit) of the encoding result can be determined in an actual scene, the number of bytes occupied by the encoding result can be determined. Therefore, the number of bytes of the encoding result may be identified by determining one supplementary binary bit for the packet with the last bit arranged in the sorting order in the binary bit sequence, and determining another supplementary binary bit for the packet with the non-last bit, which is described as follows in an optional implementation manner provided by the embodiment of the present application:

determining the arrangement sequence of the binary bit groups in the binary bit sequence;

determining a supplementary binary bit corresponding to the binary bit group as a first numerical value under the condition that the arrangement sequence is a last bit;

and determining the supplementary binary digit corresponding to the binary digit group as a second numerical value under the condition that the arrangement sequence is not the last digit.

In practical applications, when binary bit sequences are divided, the binary bits are usually grouped according to the arrangement order of the binary bits in the binary bit sequences so as not to affect the association relationship between the binary bits. And therefore the binary bit groupings obtained after grouping still have an ordering in the binary bit sequence.

Further, in the case where the arrangement order of the binary bit group is the last bit, indicating that the following byte is not integrated with the current data (target data), it is determined that the supplementary binary bit corresponding to the binary bit group is the first value. In the case where the sequence of the binary bit group is non-last indicating that the following byte is integral with the current data, the complementary binary bit corresponding to the binary bit group may be determined to be the second value. In specific implementation, the first value may be 0, and the second value may be 1; the first value may be 1, and the second value may be 0, which is not limited herein.

Following the above example, the 3 binary bits obtained are grouped as: "111", "1000100", and "1000000", in which if the arrangement order of "1000000" in the binary bit sequence "11110001001000000" in the 3 packets is the last bit, the complementary binary bit corresponding to the binary bit packet "1000000" is determined to be "0", and if the arrangement order of the binary bit packet "111", "1000100" in the binary bit sequence "11110001001000000" is not the last bit, the complementary binary bit corresponding to the binary bit packet "111" and the binary bit packet "1000100" is determined to be "1".

In summary, according to the arrangement order of the binary bit groups in the binary sequence, the complementary binary bit corresponding to each group can be determined, and whether the bytes behind the binary bit group are integrated with the current data can be determined according to the complementary binary bit, so that the bytes occupied by the target data can be identified.

Step 108: and splicing the supplementary binary digits and binary digits in the binary digit group corresponding to the supplementary binary digits, and generating target encoding data corresponding to the target data according to a splicing result.

Specifically, on the basis of determining the supplementary binary digits, the supplementary binary digits and the binary digits in the binary digit group corresponding to the supplementary binary digits are spliced to form bytes, and further target encoding data corresponding to the binary data is generated according to the formed bytes. The target coded data is a coding result finally generated by coding the target data.

In a specific implementation, considering that the target encoded data must be composed of complete bytes, and in an actual scenario, only the complementary binary bits and the binary bits in the binary bit packet corresponding to the complementary binary bits are spliced, the obtained splicing result may not satisfy the binary bits required by the bytes. In order to ensure the format requirement of the target encoded data, it is necessary to supplement binary bits that do not satisfy the requirement of the bytes with binary bits, and in an optional implementation manner provided in the embodiment of the present application, the specific implementation manner is as in steps S1082 to S1086:

step S1082, calculating the sum of the supplementary binary digits and the number of bits in the binary digit group corresponding to the supplementary binary digits.

Specifically, the sum of the number of bits of the complementary bits and the number of bits in the bit group corresponding to the complementary bits is to determine whether the sum of the number of bits satisfies the number of bits required in one byte.

Step S1084, under the condition that the sum of the digits is not less than a preset digit, splicing the supplementary binary digits and the binary digits in the binary digit group corresponding to the supplementary binary digits according to a first preset sequence to obtain a binary digit spliced group;

specifically, the predetermined number of bits refers to the number of binary bits required in a complete byte. In the case where the sum of the number of bits is not less than the predetermined number of bits, it is indicated that the combination of the supplementary binary bit and the binary bit in the binary bit group to which the supplementary binary bit corresponds has satisfied the number of binary bits required for the byte, and therefore, there is no need to supplement the binary bit. And directly splicing the supplementary binary digits and the binary digits in the binary digit group corresponding to the supplementary binary digits according to a first preset sequence to obtain a binary digit spliced group.

Further, considering that a binary bit splicing group formed by splicing in multiple ways does not affect encoding of target data, in order to increase flexibility and diversity of encoding and implement splicing of complementary binary bits and binary bits in the binary bit group corresponding to the complementary binary bits, in an optional implementation manner provided in an embodiment of the present application, the specific implementation manner is as follows:

splicing the supplementary binary digits and the binary digits in the binary digit groups corresponding to the supplementary binary digits according to the sequence that the supplementary binary digits are located at the tail positions and the binary digits in the binary digit groups corresponding to the supplementary binary digits are located at the head positions to obtain binary digit spliced groups; or according to the sequence that the supplementary binary digits are located at the first positions and the binary digits of the binary digit group corresponding to the supplementary binary digits are located at the last positions, the supplementary binary digits and the binary digits in the binary digit group corresponding to the supplementary binary digits are spliced to obtain a binary digit spliced group.

The first bit is a position arranged before the first bit, and the last bit is a position arranged after the first bit.

Step S1086, determining a second supplementary binary digit according to a digit difference value between the preset digit and the sum of the digits under the condition that the sum of the digits is less than a preset digit; and splicing the supplementary binary digits, the binary digits in the binary digit group corresponding to the supplementary binary digits and the second supplementary binary digits according to a second preset sequence to obtain a binary digit spliced group. And in the case that the sum of the bit numbers is less than the preset bit number, indicating that the combination of the supplementary binary digits and the binary digits in the binary digit group corresponding to the supplementary binary digits still does not meet the requirement of the number of binary digits of the byte, further calculating the combination of the supplementary binary digits and the binary digits in the binary digit group corresponding to the supplementary binary digits, and further calculating the number of the supplementary binary digits, namely calculating the bit number difference between the sum of the preset bit number and the bit number, wherein the bit number difference indicates the number of the binary digits needing to be supplemented, and determining the binary digits needing to be supplemented (namely, a second supplementary binary digit) based on the bit number difference, namely, the number of the second supplementary binary digits is the bit number difference.

It should be noted that, since the second complementary binary digit has no practical meaning, only in order to satisfy the number of binary digits required by the byte, the second complementary binary digit per bit can be determined to be 0. Based on this, the complementary binary digits, the binary digits in the binary digit group corresponding to the complementary binary digits, and the second complementary binary digits are spliced according to a second preset sequence to obtain a binary digit spliced group, in a specific implementation, the second preset sequence may be that the complementary binary digits are at first positions (may be understood as arranged at the front positions), the second complementary binary digits are at middle positions (may be understood as arranged at the middle positions), and the binary digits in the binary digit group corresponding to the complementary binary digits are at last positions (may be understood as arranged at the back positions); the second preset sequence can also be that the binary bit in the binary bit group corresponding to the complementary binary bit is set at the first position, the complementary binary bit is set at the middle position, and the second complementary binary bit is set at the end position; and further, splicing is carried out based on a second preset sequence to obtain a binary bit splicing group.

Following the above example, for the binary bit grouping "111", the sum of the number of bits in the binary bit grouping "111" and the corresponding complementary binary bit "1" is calculated to be 4. Under the condition that the preset digit is 8, if the sum of digits is smaller than the preset digit, determining that the digit difference value of the preset digit and the sum of digits is 4, determining that the second supplementary binary digit is 0000, and splicing the supplementary binary digit "1", the second supplementary binary digit is 0000 "and the binary digits in the binary digit group" 111 "according to the sequence that the supplementary binary digit is at the head position, the second supplementary binary digit is at the middle position, and the binary digits in the binary digit group corresponding to the supplementary binary digit are at the tail position, so as to obtain a binary digit spliced group" 10000111 ".

For the binary digit group '1000100', the sum of the number of binary digits in the binary digit group '1000100' and the corresponding complementary binary digit '1' is calculated to be 8, and if the sum of the number of digits is equal to the preset number of digits under the condition that the preset number of digits is 8, the complementary binary digits '1' and the binary digits in the binary digit group '1000100' are directly spliced to obtain a binary digit spliced group '11000100'. Similarly, for the binary bit group "1000000", the sum of the number of bits of the binary bit in the binary bit group "1000000" and the corresponding complementary binary bit "0" is calculated to be 8, and in the case that the preset number of bits is 8, the sum of the number of bits is equal to the preset number of bits, the complementary binary bit "0" and the binary bits in the binary bit group "1000000" are directly spliced to obtain the binary bit spliced group "01000000".

To sum up, before splicing, whether the sum of the supplementary binary digits and the digits of the binary digits in the binary digit group corresponding to the supplementary binary digits is smaller than the preset digit or not is calculated, and under the condition that the sum of the supplementary binary digits and the digits of the binary digits in the binary digit group corresponding to the supplementary binary digits is smaller than the preset digit, the second supplementary binary digits meeting the requirement of the preset digit for supplement are determined, and on the basis, splicing is carried out according to the preset splicing sequence to obtain the binary digit spliced group, so that each binary digit spliced group meets the binary digits needed by bytes.

Further, on the basis of obtaining the binary digit spliced packets, because the obtained binary digit spliced packets may be multiple and the multiple binary digit spliced packets are independent from each other, the multiple binary digit spliced packets need to be combined to generate target encoded data corresponding to the binary data, in an optional implementation manner provided in an embodiment of the present application, the specific implementation manner is as follows:

and combining the binary bit splicing groups according to the arrangement sequence of the binary bit splicing groups to generate target coding data corresponding to the target data.

Specifically, the binary digit spliced group is formed by splicing other binary digits on the basis of the binary digits in the binary digit group, so that the arrangement order of the binary digit spliced group is the same as that of the binary digit group. Based on the above, the binary bit splicing groups are combined to form a complete coded data, namely the target coded data.

Following the above example, on the basis of obtaining the binary splice packets "10000111", "11000100" and "01000000", the binary splice packets are combined in the order of "10000111" preceding, "11000100" in the middle, and "01000000" following, so as to obtain the target encoded data corresponding to the target data 123456: "100001111100010001000000".

In conclusion, the binary bit splicing groups are combined according to the arrangement order of the binary bit splicing groups to generate the target coding data corresponding to the target data, and the accuracy of the target coding data is guaranteed.

In addition, in addition to the above target encoding data corresponding to the target data generated according to the splicing result, because the preset division number is 7 bits, and the supplementary binary bits are 1 bit, after the supplementary binary bits and the binary bits in the binary bit group corresponding to the supplementary binary bits are spliced according to the preset sequence, only the binary bit spliced group arranged at the first bit may be smaller than the preset number of bits, therefore, in order to avoid determining whether the sum of the binary bits in the binary bit group and the number of the supplementary binary bits satisfies the preset number of bits, thereby improving the encoding efficiency, in an optional implementation manner provided by the embodiment of the present application, the specific implementation manner is as follows:

splicing the supplementary binary digits and binary digits in the binary digit group corresponding to the supplementary binary digits according to a first preset sequence to obtain a binary digit spliced group;

determining the number of bits in the first-bit concatenated packet of bits in the concatenated packet of bits;

determining a second supplementary binary digit according to a digit difference value between the preset digit and the digit under the condition that the digit is less than the preset digit;

inserting said second supplemental binary digit into the middle of a supplemental binary digit arranged in the first digit's spliced grouping of binary digits and a binary digit in the grouping of binary digits;

and combining the binary bit splicing groups according to the arrangement sequence of the binary bit splicing groups to generate target coding data corresponding to the target data.

In practical application, under the condition that the preset division bit number is 7 bits and the supplementary binary bits are 1 bit, the binary bits contained in the binary bit group divided with the first bit may not be 7 bits, and after the 7-bit binary bits contained in other binary bit groups are spliced with the supplementary binary bits, the obtained bit number of the binary bit spliced group is not less than the preset bit number, so that the second supplementary binary bit does not need to be determined. Wherein the second complementary bit is understood to be a bit having no practical meaning for satisfying the bits required for a complete byte in the concatenated group of bits.

Therefore, it is only necessary to determine whether the number of bits in the first-order bit concatenated packet in the bit concatenated packet satisfies the preset number of bits, and if not (i.e., if less than the preset number of bits), determine a second supplemental bit according to the bit number difference between the preset number of bits and the number of bits, and insert the second supplemental bit into the first-order bit concatenated packet, specifically, insert the second supplemental bit between the supplemental bit concatenated packet ordered in the first-order bit concatenated packet and the bit in the bit concatenated packet, so as to avoid the random insertion from affecting the data representation of the bits in the bit concatenated packet.

For example, on the basis of the above determination of the complementary binary bit corresponding to each binary bit group, the binary bits are grouped: splicing the '111' with the complementary binary bit '1' corresponding to the '111' to obtain a binary bit splicing group '1111'; splicing the binary bit grouping '1000100' with the complementary binary bit '1' corresponding to the binary bit grouping '1000100', and obtaining a binary bit splicing grouping '11000100'; splicing the binary bit grouping of '1000000' with the corresponding complementary binary bit of '0', and obtaining a binary bit splicing grouping of '01000000'; the binary digit spliced group "1111" is a binary digit spliced group arranged at the first digit, the digit difference between the preset digit 8 and the digit is calculated to be 4 if the digit of the binary digit in the binary digit spliced group is 4, and the second complementary binary digit is determined to be 0 of 4 digits, namely "0000" according to the digit difference. The 4-bit supplementary binary bits are inserted between the supplementary binary bits in the binary bit spliced packet "1111" and the binary bits in the binary bit spliced packet to obtain an updated binary bit spliced packet "10000111", and the binary bit spliced packet "10000111" is combined with the two binary bit spliced packets "11000100" and the binary bit spliced packet "01000000" in the arrangement order to obtain target encoded data, which is "100001111100010001000000".

In conclusion, whether the binary digits in the binary digit splicing group arranged at the first digit meet the preset digit or not is only judged, and the second supplementary binary digit is inserted under the condition that the binary digits do not meet the preset digit, so that the coding efficiency is improved.

It should be noted that, the number of bytes occupied by the target encoded data generated according to the above encoding method is variable, while the number of bytes occupied by the binary data generated according to the conventional binary encoding method is fixed, in an actual scene, the binary data generated by encoding data of various integer types by the conventional binary encoding method and the target encoded data generated by encoding according to the scheme of the present application, the number of bytes occupied is specifically shown in table 1 below:

TABLE 1

Data type Number of bytes occupied by binary data Target coded data occupation byte number
Short (Short integer) 2 bytes 1 to 3 bytes
Int (integer type) 4 bytes 1-5 bytes
Long (Long and integer type) 8 bytes 1-10 bytes

Further, taking target data as 1, 127, 128, 255, and 123456 as an example, binary data generated by encoding the target data in a conventional binary encoding manner and target encoded data generated by encoding according to the scheme of the present application occupy the number of bytes specifically as shown in table 2 below:

TABLE 2

Object data Number of bytes occupied by binary data Target coded data occupation byte number
1 4 bytes 1 byte
127 4 bytes 1 byte
128 4 bytes 2 bytes
255 4 bytes 2 bytes
123456 4 bytes 3 bytes

On the basis of obtaining the binary data corresponding to the target data of the integer type sent by the sending terminal, considering that the number of receiving terminals facing the service end is usually large and the number of small digits in the transmitted integer is usually large, after the target encoded data corresponding to the target data is generated according to the splicing result, the target encoded data is sent to at least one receiving terminal. The data volume transmitted with the receiving terminal can be reduced, so that the bandwidth occupation in the communication process with the receiving terminal is reduced, the communication speed with the receiving terminal is improved, and the network delay is reduced.

In addition, there is also a scenario where the server sends the target data to the receiving terminal, and the target data may be coded by the coding method and then sent to the receiving terminal. The receiving terminal may be any device terminal, such as a mobile phone, a tablet computer, a desktop computer, and the like, which is not limited herein.

Taking a game scene as an example, a receiving terminal can be understood as a client, and when a user logs in through the sum of the clients, a server needs to send role information of the user to the client, where the information generally consists of a series of data of integer types, such as: exp (empirical value): "150", level: and 4, the integer in the character information is coded by using the coding mode, and the byte occupation is smaller than that of the common coding mode.

For another example, the coordinates of a series of displacements of a character are 30, 50, 10, 170 (these data are integer data), and the conventional encoding method in the prior art will encode the series of displacements as: "00000000000000000000000000011110", "00000000000000000000000000110010", "00000000000000000000000000001010", "00000000000000000000000010101010", the encoded binary data occupies 128 bits; by adopting the encoding method of the embodiment of the application, the displacement coordinates are encoded into: "00011110", "00110010", "00001010", "1000000100101010", which occupy 40 bits in total. Because the bit number of the output binary bit can be dynamically adjusted according to the encoding number, the scheme is different from the traditional encoding mode which aims at the integer fixed output of 32-bit encoding data, and most bytes are saved.

To sum up, the encoding method provided by the present application obtains binary data corresponding to integer type target data, then intercepts valid binary bits of the binary data to obtain a binary bit sequence, and performs binary bit division processing on the binary bit sequence to obtain a binary bit group, and determines a complementary binary bit corresponding to the binary bit group according to an arrangement sequence of the binary bit group in the binary bit sequence on the basis of the binary bit group; and finally, splicing is carried out on the basis of the supplementary binary digits and the binary digits in the binary digit group corresponding to the supplementary binary digits, and target encoding data corresponding to the target data is generated according to a splicing result. The optimization of a conventional binary coding mode is realized, the number of bytes occupied by the optimized target coding data is small, the storage space is further compressed, and the transmission bandwidth is reduced.

The encoding method provided by the present application is further described below with reference to fig. 2, taking the application of the encoding method in a game scene as an example. Fig. 2 shows a processing flow chart of an encoding method applied to a game scene according to an embodiment of the present application, which specifically includes the following steps:

step 202: and acquiring binary data corresponding to the target data of the positive integer type.

In practical application, the game server needs to send the report data to the game client for playing, the report data includes a series of displacement and blood volume change data, the displacement and blood volume change data are usually small numbers of positive integer type, in the embodiment of the present application, the small numbers of positive integer type are used as target data, and the target data are divided by 2 to obtain the remainder, and are encoded in a binary encoding mode of reverse order arrangement to obtain binary data corresponding to the target data.

Specifically, in the case where the target data of the positive integer data is 200 and 601, the server takes these two data as target data and encodes them with 4 bytes per digit, and obtains binary data corresponding to the target data 200 as "00000000000000000000000011001000" and binary data corresponding to the target data 601 as "00000000000000000000001001011001".

Step 204: and intercepting the effective binary digits of the binary data to obtain a binary digit sequence consisting of the effective binary digits in the binary data.

Specifically, the valid binary bit in the binary data "00000000000000000000000011001000" corresponding to the target data 200 is truncated to obtain a binary bit sequence "11001000" in the binary data, and the valid binary bit in the binary data "00000000000000000000001001011001" corresponding to the target data 601 is truncated to obtain a binary bit sequence "1001011001" in the binary data.

Step 206: and carrying out binary bit division processing on the binary bit sequence according to a preset division bit number to obtain at least one binary bit group.

Specifically, under the condition that the preset dividing bit number is 7, binary bit division processing is performed on the obtained binary bit sequence "11001000" to obtain two binary bit groups, wherein the two binary bit groups are respectively "1" and "1001000"; and obtaining the binary bit sequence '1001011001' obtained above, two binary bit groups are respectively: "100" and "1011001".

Step 208: the arrangement order of each binary bit group in the associated binary bit sequence is determined.

Specifically, it is determined that binary digit group "1" is arranged at the first bit in the binary digit sequence to which it belongs, and it is determined that binary digit group "1001000" is arranged at the last bit in the binary digit sequence to which it belongs; and determining that the binary digit group "100" is ranked first in the binary digit sequence to which it belongs, and determining that the binary digit group "1011001" is ranked last in the binary digit sequence to which it belongs.

Step 210: for each binary bit group, determining the complementary binary bit corresponding to the binary bit group as a first numerical value under the condition that the arrangement sequence is the last bit.

Specifically, if the binary bit group "1001000" is ranked at the last bit in the binary bit sequence to which the binary bit group belongs, it is determined that the complementary binary bit corresponding to the binary bit group "1001000" is 0; similarly, the binary bit group "1011001" is ranked at the last bit in the binary bit sequence to which it belongs, and the complementary binary bit corresponding to the binary bit group "1011001" is determined to be 0.

Step 212: for each binary bit group, determining the complementary binary bit corresponding to the binary bit group as a second value in case that the permutation order is non-last bit.

Specifically, if the arrangement sequence of the binary bit group '1' in the binary bit sequence to which the binary bit group belongs is a non-last bit, the complementary binary bit corresponding to the binary bit group '1' is determined to be 1; similarly, if the arrangement order of the binary bit group "100" in the binary bit sequence to which it belongs is a non-last bit, it is determined that the complementary binary bit corresponding to the binary bit group "100" is 1.

Step 214: and splicing the supplementary binary digits and the binary digits in the binary digit group corresponding to the supplementary binary digits according to a first preset sequence to obtain a binary digit spliced group.

Specifically, under the condition that the first preset sequence is that the supplementary binary digit is the first digit and the binary digits in the binary digit group are the last digits, the supplementary binary digits determined in the above step 210 and the above step 212 are spliced with the binary digits in the binary digit group corresponding to the supplementary binary digits according to the first preset sequence, and the binary digit spliced group corresponding to the obtained target data 200 respectively includes: "11" and "01001000", and the binary bit concatenation groups corresponding to the obtained target data 601 are respectively: "1100" and "01011001".

Step 216: determining a number of bits in the first-ordered spliced group of bits in the spliced group of bits.

Specifically, the binary bits in the binary concatenated group ranked at the first bit in the binary concatenated group corresponding to the target data 200 are determined: the number of bits of "11" is 2; and determining the binary bits in the binary concatenation group ranked at the first bit in the binary concatenation group corresponding to the target data 601: the number of bits of "1100" is 4.

Step 218: and under the condition that the digit is smaller than a preset digit, determining a second supplementary binary digit according to a digit difference value between the preset digit and the digit.

Specifically, in the case that the preset number of bits is 8, based on the binary bits in the determined binary concatenated group: the digit of 11 is 2, and the difference value between the preset digit and the digit is 6, so that the second complementary binary digit is determined to be 000000; and based on the determined binary bits in the binary concatenated group: the number of bits of "1100" is 4, and the difference between the preset number of bits and the number of bits is calculated to be 4, the second supplementary binary bit is determined to be "0000".

Step 220: inserting said second supplemental bit intermediate the supplemental bits arranged in the first bit's spliced grouping and the bits in the binary bit grouping.

Specifically, on the basis of determining the second supplemental binary digit, the determined second supplemental binary digit "000000" is inserted into the middle of the supplemental binary digit arranged in the binary digit splicing group "11" of the first digit and the binary digits in the binary digit grouping, so as to obtain an updated binary digit splicing group "10000001"; and inserting the second supplemental binary digit "0000" determined above into the middle of the supplemental binary digit in the first binary digit concatenated group "1100" and the binary digits in the binary digit concatenated group to obtain an updated binary digit concatenated group "10000100".

Step 222: and combining the binary bit splicing groups according to the arrangement sequence of the binary bit splicing groups to generate target coding data corresponding to the target data.

Specifically, according to the arrangement order of the binary bit concatenation groups corresponding to the target data 200, the binary bit concatenation groups "10000001" and "01001000" are combined to generate target encoded data "1000000101001000" corresponding to the target data 200; and combining the binary bit splicing packets "10000100" and "01011001" according to the arrangement order of the binary bit splicing packets corresponding to the target data 601 to generate target encoded data "1000010001011001" corresponding to the target data 200.

Step 224: and transmitting the target coded data to at least one receiving terminal.

Specifically, the target encoding data "1000000101001000" and "1000010001011001" generated as described above are transmitted to at least one game client (i.e., a receiving terminal).

In practical applications, the receiving terminal decodes the received target encoding data and displays the decoded data in a game interface of the receiving terminal, specifically, fig. 3 shows a game interface schematic diagram of the game client, where the blood volume of the character in the game interface changes into the decoded data.

To sum up, the encoding method provided by the present application obtains binary data corresponding to integer type target data, then intercepts valid binary bits of the binary data to obtain a binary bit sequence, and performs binary bit division processing on the binary bit sequence to obtain a binary bit group, and determines a complementary binary bit corresponding to the binary bit group according to an arrangement sequence of the binary bit group in the binary bit sequence on the basis of the binary bit group; and finally, splicing is carried out on the basis of the supplementary binary digits and the binary digits in the binary digit group corresponding to the supplementary binary digits, and target encoding data corresponding to the target data is generated according to a splicing result. The optimization of a conventional binary coding mode is realized, the number of bytes occupied by the optimized target coding data is small, the storage space is further compressed, and the transmission bandwidth is reduced.

Corresponding to the above method embodiment, the present application further provides an encoding apparatus embodiment, and fig. 4 shows a schematic structural diagram of an encoding apparatus provided in an embodiment of the present application. As shown in fig. 4, the apparatus includes:

an obtaining module 402 configured to obtain binary data corresponding to the target data of the integer type;

a dividing module 404 configured to intercept valid binary bits of the binary data to obtain a binary bit sequence, and perform binary bit dividing processing on the binary bit sequence to obtain a binary bit packet;

a determining module 406 configured to determine complementary binary digits corresponding to the binary digit groups according to an arrangement order of the binary digit groups in a binary digit sequence;

and the splicing module 408 is configured to splice the complementary binary digits and binary digits in the binary digit group corresponding to the complementary binary digits, and generate target encoding data corresponding to the target data according to a splicing result.

Optionally, the dividing module 404 is further configured to:

intercepting the effective binary digits of the binary data to obtain a binary digit sequence consisting of the effective binary digits in the binary data;

and carrying out binary bit division processing on the binary bit sequence according to a preset division bit number to obtain at least one binary bit group.

Optionally, the determining module 406 is further configured to:

determining the arrangement sequence of the binary bit groups in the binary bit sequence;

determining a supplementary binary bit corresponding to the binary bit group as a first numerical value under the condition that the arrangement sequence is a last bit;

and determining the supplementary binary digit corresponding to the binary digit group as a second numerical value under the condition that the arrangement sequence is not the last digit.

Optionally, the splicing module 408 includes:

a computation submodule configured to compute a sum of the supplementary binary digits and the number of bits of the binary digits in the binary digit group to which the supplementary binary digits correspond;

the first splicing sub-module is configured to splice the supplementary binary digits and binary digits in the binary digit group corresponding to the supplementary binary digits according to a first preset sequence under the condition that the sum of the digits is not less than a preset digit, so as to obtain a binary digit spliced group;

a second splicing submodule configured to determine a second supplementary binary bit according to a bit number difference between the preset bit number and the sum of the bit numbers when the sum of the bit numbers is less than a preset bit number; and splicing the supplementary binary digits, the binary digits in the binary digit group corresponding to the supplementary binary digits and the second supplementary binary digits according to a second preset sequence to obtain a binary digit spliced group.

Optionally, the splicing module 408 is further configured to:

and combining the binary bit splicing groups according to the arrangement sequence of the binary bit splicing groups to generate target coding data corresponding to the target data.

Optionally, the first splicing sub-module is further configured to:

splicing the supplementary binary digits and the binary digits in the binary digit groups corresponding to the supplementary binary digits according to the sequence that the supplementary binary digits are located at the tail positions and the binary digits in the binary digit groups corresponding to the supplementary binary digits are located at the head positions to obtain binary digit spliced groups; or

And splicing the supplementary binary digits and the binary digits in the binary digit groups corresponding to the supplementary binary digits according to the sequence that the supplementary binary digits are at the first positions and the binary digits of the binary digit groups corresponding to the supplementary binary digits are at the last positions to obtain binary digit spliced groups.

Optionally, the splicing module 408 is further configured to:

splicing the supplementary binary digits and binary digits in the binary digit group corresponding to the supplementary binary digits according to a first preset sequence to obtain a binary digit spliced group;

determining the number of bits in the first-bit concatenated packet of bits in the concatenated packet of bits;

determining a second supplementary binary digit according to a digit difference value between the preset digit and the digit under the condition that the digit is less than the preset digit;

inserting said second supplemental binary digit into the middle of a supplemental binary digit arranged in the first digit's spliced grouping of binary digits and a binary digit in the grouping of binary digits;

and combining the binary bit splicing groups according to the arrangement sequence of the binary bit splicing groups to generate target coding data corresponding to the target data.

Optionally, the encoding apparatus further includes:

a number of bits determining module configured to determine a significand of a binary bit contained in the sequence of binary bits;

a byte number determining module configured to determine the number of bytes occupied by the binary bits in the binary bit sequence according to the significant digit;

a third complementary binary bit determining module configured to determine a third complementary binary bit corresponding to the binary sequence based on the number of bytes and the integer type of the target data;

and the binary bit splicing module is configured to splice the binary bit sequence and the third supplementary binary bit to obtain second target coding data corresponding to the target data.

Optionally, the obtaining module 402 is further configured to:

acquiring target data of an integer type;

binary coding is carried out on the target data to obtain binary data corresponding to the target data;

accordingly, the encoding apparatus further includes:

a transmitting module configured to transmit the target encoded data to at least one receiving terminal.

To sum up, the encoding device provided by the present application obtains binary data corresponding to integer-type target data, then intercepts valid binary bits of the binary data to obtain a binary bit sequence, and performs binary bit division processing on the binary bit sequence to obtain a binary bit group, and determines a complementary binary bit corresponding to the binary bit group according to an arrangement order of the binary bit group in the binary bit sequence on the basis of the binary bit group; and finally, splicing is carried out on the basis of the supplementary binary digits and the binary digits in the binary digit group corresponding to the supplementary binary digits, and target encoding data corresponding to the target data is generated according to a splicing result. The optimization of a conventional binary coding mode is realized, the number of bytes occupied by the optimized target coding data is small, the storage space is further compressed, and the transmission bandwidth is reduced.

The above is a schematic scheme of an encoding apparatus of the present embodiment. It should be noted that the technical solution of the encoding apparatus and the technical solution of the encoding method belong to the same concept, and details that are not described in detail in the technical solution of the encoding apparatus can be referred to the description of the technical solution of the encoding method.

FIG. 5 illustrates a block diagram of a computing device 500 provided in accordance with one embodiment of the present description. The components of the computing device 500 include, but are not limited to, a memory 510 and a processor 520. Processor 520 is coupled to memory 510 via bus 530, and database 550 is used to store data.

Computing device 500 also includes access device 540, access device 540 enabling computing device 500 to communicate via one or more networks 560. Examples of such networks include the Public Switched Telephone Network (PSTN), a Local Area Network (LAN), a Wide Area Network (WAN), a Personal Area Network (PAN), or a combination of communication networks such as the internet. The access device 540 may include one or more of any type of network interface, e.g., a Network Interface Card (NIC), wired or wireless, such as an IEEE802.11 Wireless Local Area Network (WLAN) wireless interface, a worldwide interoperability for microwave access (Wi-MAX) interface, an ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a bluetooth interface, a Near Field Communication (NFC) interface, and so forth.

In one embodiment of the present description, the above-described components of computing device 500, as well as other components not shown in FIG. 5, may also be connected to each other, such as by a bus. It should be understood that the block diagram of the computing device architecture shown in FIG. 5 is for purposes of example only and is not limiting as to the scope of the present description. Those skilled in the art may add or replace other components as desired.

Computing device 500 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., tablet, personal digital assistant, laptop, notebook, netbook, etc.), mobile phone (e.g., smartphone), wearable computing device (e.g., smartwatch, smartglasses, etc.), or other type of mobile device, or a stationary computing device such as a desktop computer or PC. Computing device 500 may also be a mobile or stationary server.

Wherein, the processor 520 is used for implementing the steps of the encoding method when executing the computer instructions.

The above is an illustrative scheme of a computing device of the present embodiment. It should be noted that the technical solution of the computing device and the technical solution of the encoding method belong to the same concept, and details that are not described in detail in the technical solution of the computing device can be referred to the description of the technical solution of the encoding method.

An embodiment of the present application further provides a computer readable storage medium, which stores computer instructions, and the computer instructions, when executed by a processor, implement the steps of the encoding method as described above.

The above is an illustrative scheme of a computer-readable storage medium of the present embodiment. It should be noted that the technical solution of the storage medium belongs to the same concept as the technical solution of the above-mentioned encoding method, and details that are not described in detail in the technical solution of the storage medium can be referred to the description of the technical solution of the above-mentioned encoding method.

The foregoing description of specific embodiments of the present application has been presented. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.

The computer instructions comprise computer program code which may be in the form of source code, object code, an executable file or some intermediate form, or the like. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media does not include electrical carrier signals and telecommunications signals as is required by legislation and patent practice.

It should be noted that, for the sake of simplicity, the above-mentioned method embodiments are described as a series of acts or combinations, but those skilled in the art should understand that the present application is not limited by the described order of acts, as some steps may be performed in other orders or simultaneously according to the present application. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required in this application.

In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.

The preferred embodiments of the present application disclosed above are intended only to aid in the explanation of the application. Alternative embodiments are not exhaustive and do not limit the invention to the precise embodiments described. Obviously, many modifications and variations are possible in light of the above teaching. The embodiments were chosen and described in order to best explain the principles of the application and its practical applications, to thereby enable others skilled in the art to best understand and utilize the application. The application is limited only by the claims and their full scope and equivalents.

25页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种通信信号发生器

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!