Data coding method and device, data operation method and device, equipment and medium

By converting fixed-point numbers into integer data and encode symbols and absolute values ​​respectively, the spatial redundancy problem caused by fixed-point numbers is solved, and the spatial compression rate is improved.

CN118921067AActive Publication Date: 2024-11-08SHENZHEN INST OF COMPUTING SCI
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202410922385.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-10
Publication Date
2024-11-08
Estimated Expiration
2044-07-10

AI Technical Summary

Technical Problem

In the column storage database, the encoding method of fixed-point number type leads to spatial redundancy, resulting in low spatial compression rate.

Method used

By converting the fixed-point data to be encoded into integer data, determining its symbols and absolute values, and encoding the symbols and absolute values ​​based on the preset encoding method to form encoding results, avoiding symbol encoding placeholding, thereby improving the spatial compression rate .

Benefits of technology

Reduce spatial redundancy, improve spatial compression rate, and optimize the data encoding process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118921067A_ABST
    Figure CN118921067A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of data coding, in particular to a data coding method, an operation method, a device, equipment and a medium. The method comprises the following steps: acquiring fixed point number data to be coded, converting the fixed point number data to be coded into integer data, determining a symbol and an absolute value of the integer data, coding the symbol based on a preset coding mode to obtain a symbol vector of the symbol, coding the absolute value to obtain an absolute value vector of the absolute value, and mapping the symbol vector and the absolute value vector to form a coding result of the to-be-coded fixed point number data. According to the method and the device, the to-be-coded fixed-point number data is converted into the integer data, the integer data is split into the symbols and the absolute values, so that the symbols and the absolute values are separately processed, and when the integer with the fixed length is stored, bit occupation of symbol coding in coding of the to-be-coded fixed-point number data is avoided, and compression of absolute value coding is facilitated; therefore, the space redundancy is reduced, and the space compression ratio is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data coding technology, and in particular to a data coding method, calculation method, device, equipment and medium. Background Art

[0002] Fixed-point numbers are the standard data type of structured query language databases. In the field of column-stored databases, the industry has proposed a variety of encoding schemes to optimize the encoding of fixed-point numbers. The mainstream encoding scheme is to use fixed-length integer storage according to the precision defined by the fixed-point number. However, this leads to a problem. When the user-defined precision far exceeds the precision of the actual stored data, the traditional method will have more space redundancy, resulting in a low space compression rate. Therefore, in the process of data encoding, how to improve the space compression rate is an urgent problem to be solved. Summary of the invention

[0003] In view of this, embodiments of the present invention provide a data encoding method, a computing method, an apparatus, a device and a medium to solve the problem of low spatial compression rate during data encoding.

[0004] In a first aspect, an embodiment of the present invention provides a data encoding method, the data encoding method comprising:

[0005] Get the fixed-point data to be encoded;

[0006] Converting the fixed-point data to be encoded into integer data, and determining the sign and absolute value of the integer data;

[0007] Based on a preset encoding method, encode the symbol to obtain a symbol vector of the symbol, and encode the absolute value to obtain an absolute value vector of the absolute value;

[0008] The symbol vector and the absolute value vector are mapped to form an encoding result of the fixed-point number data to be encoded.

[0009] In a second aspect, an embodiment of the present invention provides a method for calculating coded data, the method comprising:

[0010] Acquire data to be calculated, and use the data to be calculated as fixed-point number data to be encoded;

[0011] Using the data encoding method described in the first aspect to encode the data to be operated, to obtain an encoding result of the data to be operated;

[0012] According to the sign vector and the absolute value vector in the encoding result of the data to be operated, a bit operator matching the preset encoding method is used to operate the sign vector and the absolute value vector of the data to be operated to obtain an operation result.

[0013] In a third aspect, an embodiment of the present invention provides a data encoding device, the data encoding device comprising:

[0014] A first acquisition module, used for acquiring fixed-point number data to be encoded;

[0015] A conversion module, used for converting the fixed-point data to be encoded into integer data, and determining the sign and absolute value of the integer data;

[0016] A first encoding module, configured to encode the symbol based on a preset encoding method to obtain a symbol vector of the symbol, and encode the absolute value to obtain an absolute value vector of the absolute value;

[0017] A mapping module is used to map the symbol vector and the absolute value vector to form an encoding result of the fixed-point number data to be encoded.

[0018] In a fourth aspect, an embodiment of the present invention provides a computing device for encoding data, wherein the computing device method includes:

[0019] A second acquisition module is used to acquire data to be calculated, and use the data to be calculated as fixed-point data to be encoded;

[0020] A second encoding module, used to use the data encoding method described in the first aspect to encode the data to be operated, to obtain an encoding result of the data to be operated;

[0021] The operation module is used to operate the symbol vector and the absolute value vector of the data to be operated according to the symbol vector and the absolute value vector in the encoding result of the data to be operated, using a bit operator matching the preset encoding method to obtain an operation result.

[0022] In a fifth aspect, an embodiment of the present invention provides a computer device, characterized in that the computer device includes a processor, a memory, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the data encoding method described in the first aspect and the operation method described in the second aspect are implemented.

[0023] In a sixth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the data encoding method described in the first aspect and the operation method described in the second aspect are implemented.

[0024] Compared with the prior art, the present invention has the following beneficial effects:

[0025] Obtain fixed-point data to be encoded, convert the fixed-point data to be encoded into integer data, determine the sign and absolute value of the integer data, encode the sign based on a preset encoding method to obtain a sign vector of the sign, encode the absolute value to obtain an absolute value vector of the absolute value, and map the sign vector and the absolute value vector to form an encoding result of the fixed-point data to be encoded. In the present application, the fixed-point data to be encoded is converted into integer data, and the integer data is split into a sign and an absolute value, so that the sign and the absolute value can be processed separately. When storing fixed-length integers, the placeholder of the sign code in the code of the fixed-point data to be encoded is avoided, and the compression of the absolute value code is facilitated, thereby reducing space redundancy and improving the space compression rate. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.

[0027] Figure 1 It is a flowchart of a data encoding method provided by an embodiment of the present invention;

[0028] Figure 2 It is a flowchart of a method for calculating coded data provided by one embodiment of the present invention;

[0029] Figure 3 is a structural schematic diagram of a data encoding device provided by an embodiment of the present invention;

[0030] Figure 4 It is a schematic diagram of the structure of a data encoding operation device provided by an embodiment of the present invention;

[0031] Figure 5 It is a structural schematic diagram of a computer device provided by an embodiment of the present invention. DETAILED DESCRIPTION

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

[0033] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present invention. However, it should be clear to those skilled in the art that the present invention may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present invention.

[0034] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.

[0035] It should also be understood that the term "and / or" used in the present description and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.

[0036] As used in the present specification and the appended claims, the term "if" may be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" may be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]", depending on the context.

[0037] In addition, in the description of the present specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.

[0038] References to "one embodiment" or "some embodiments" etc. described in the present specification mean that one or more embodiments of the present invention include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0039] It should be understood that the order of execution of the steps in the following embodiments does not imply a precedence of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0040] In order to illustrate the technical solution of the present invention, specific embodiments are provided below for illustration.

[0041] An embodiment of the present invention provides a data encoding method, see Figure 1 , is a flow chart of a data encoding method provided by an embodiment of the present invention, such as Figure 1 As shown, the data encoding method may include the following steps.

[0042] S101: Obtain fixed-point data to be encoded.

[0043] In step S101, fixed-point data to be encoded is obtained, wherein the fixed-point data to be encoded is data with known bit number and precision.

[0044] In this embodiment, fixed-point data to be encoded is obtained. For example, the fixed-point data to be encoded may be data represented by a fixed-point representation method, and the number of decimal places and the data precision of the fixed-point number are fixed. For example, the fixed-point data to be encoded is Decimal(5, 2), (5, 2) indicates that the data precision of the fixed-point data to be encoded is 5 digits, and the number of digits after the decimal point is 2 digits. Therefore, Decimal(5, 2) can represent any data between 000.01 and 999.99.

[0045] S102: Convert the fixed-point data to be encoded into integer data, and determine the sign and absolute value of the integer data.

[0046] In step S102, the fixed-point data to be encoded is converted into integer data, wherein the integer data is the data after the decimal point is removed, and the sign and absolute value of the integer data are determined, wherein the sign of the integer data includes a positive sign and a negative sign, and the absolute value of the integer data is related to the number of data bits after the decimal point.

[0047] In this embodiment, the fixed-point data to be encoded is converted into integer data, and the sign and absolute value of the integer data are determined. For example, if the fixed-point data to be encoded is number(3,2), that is, the total number of data digits is 3 digits, and the data after the decimal point is 2 digits, if the input is 3.1, it is represented as 3.10 after the fixed-point data; if the fixed-point data to be encoded is number(5,2), that is, the total number of data digits is 5 digits, and the data after the decimal point is 2 digits, and the input is 3.1, it is represented as 003.10 after the fixed-point data. The fixed-point data to be encoded is converted into integer data, that is, the data after the decimal point is removed. For example, if the fixed-point data is represented as 003.10, it is converted into integer data as 00310.

[0048] Determine the sign and absolute value of the integer data. For example, if the integer data is 310, the corresponding integer data sign is positive and the absolute value is 310. If the integer data is -310, the corresponding integer data sign is negative and the absolute value is 310.

[0049] It should be noted that after the fixed-point data to be encoded is converted into integer data, if the first non-0 bit of the integer data from left to right is not the first bit of the data from left to right, the 0 before the corresponding first non-0 bit can be removed. For example, if the integer data is 00310, the 0 before 3 can be removed, and the integer data can be written as 310.

[0050] S103: Based on a preset encoding method, encode the symbol to obtain a symbol vector of the symbol, and encode the absolute value to obtain an absolute value vector of the absolute value.

[0051] In step S103, based on a preset encoding method, the symbol is encoded to obtain a symbol vector of the symbol, and the absolute value is encoded to obtain an absolute value vector of the absolute value, wherein the preset encoding method is to encode integer data into a preset data type, for example, a binary type or a hexadecimal type, and to encode the symbol and the absolute value, that is, to encode the symbol and the absolute value into corresponding types.

[0052] In this embodiment, based on the preset coding method, the symbol is encoded to obtain the symbol vector of the symbol, and the absolute value is encoded to obtain the absolute value vector of the absolute value. Wherein, when encoding the symbol, the corresponding symbol is represented as a numerical value of the corresponding type of the preset coding method. For example, if the preset coding method is binary coding, when encoding the symbol, the corresponding symbol is encoded as a corresponding 0 or 1 numerical value. If the preset coding method is hexadecimal coding, the corresponding symbol is encoded as any numerical value included in the corresponding hexadecimal, and the corresponding numerical value is used as the symbol vector. Encoding the absolute value means converting the corresponding absolute value into a value of the corresponding type in the preset coding method as an absolute value vector.

[0053] In this embodiment, the sign and the absolute value are encoded separately, so that the encoding result of the sign, a sign vector, and the encoding result of the absolute value, an absolute value vector, can be stored separately, which is convenient for subsequent compression of the vector.

[0054] For example, if the preset encoding method is a binary encoding method, based on the preset encoding method, the sign is encoded, that is, the corresponding positive and negative signs are encoded as different vectors, that is, the corresponding positive and negative signs are encoded as 0 or 1. For example, if the positive sign is encoded as 1, that is, the sign vector is 1, then the corresponding negative sign is encoded as 0, and the sign vector is 0. If the positive sign is encoded as 0, that is, the sign vector is 0, then the corresponding negative sign is encoded as 1, and the sign vector is 1. The absolute value is encoded to obtain an absolute value vector of the absolute value, wherein the absolute value is encoded, that is, the corresponding absolute value is converted into binary. For example, when the absolute value is 310, the corresponding binary is 100110110, that is, the corresponding absolute value vector is 100110110. If the sign vector of the positive sign is 1, the encoding result after the encoding of the integer data 310 is that the sign vector is 1 and the absolute value vector is 100110110.

[0055] It should be noted that if the fixed-point data to be encoded is a group of multiple fixed-point data with equal precision, the symbol vectors in the data in the group can be stored in the same vector, and the absolute value vectors can be stored in the same vector at the same time. For example, after the multiple fixed-point data to be encoded are converted into integer data, they are 310, -123, 234, and -132. If the symbol vector of the positive sign is encoded as 1 and the symbol vector of the negative sign is encoded as 0, the encoding results of 310, -123, 234, and -132 are (1, 0, 1, 0) and (100110110, 1111011, 11101010, 10000100). When the fixed-point data to be encoded is a group of multiple fixed-point data with equal precision, the corresponding sign vector and absolute value vector can be stored separately, that is, (1,0,1,0) and (100110110, 1111011, 11101010, 10000100) can be stored respectively.

[0056] In this embodiment, the sign and absolute value in the integer data are encoded separately to prevent the sign vector from occupying the high-order encoding position when the sign and the absolute value are encoded in one vector, so that the encoding vector corresponding to the absolute value cannot be compressed, thereby occupying a large memory. For example, if an integer storage with a bit number of 64 is used, the encoding vector of the integer data needs to be converted into 64 bits, and the first bit from left to right is the sign vector of the sign encoding. However, in this embodiment, the sign and the absolute value are encoded separately, and the sign vector does not occupy the bit number of the absolute value vector. The absolute value vector can be The 0s to the left of the first non-0 bit in the digits are removed to save storage space. For example, if an integer with 64 bits is used for storage, the absolute value vector of the integer data 310 after absolute value encoding is 00...0000100110110, which is 64 bits in total. After the sign vector does not occupy the corresponding number of bits, the absolute value vector 00...0000100110110 can be converted to 100110110, and one bit in the sign vector is counted, which is a total of 10 bits, that is, a 64-bit bit is converted into a 10-bit bit, thereby improving the space compression rate.

[0057] Optionally, the symbol is encoded to obtain a symbol vector of the symbol, including:

[0058] Determine the type of symbol;

[0059] If the type of the sign is positive, the sign is encoded as the first value;

[0060] If the sign type is negative, the sign is encoded as the second value.

[0061] In this embodiment, the corresponding preset encoding method is a binary encoding method, that is, the corresponding symbol vector is 0 or 1. When encoding the symbol of integer data, the type of the symbol is first determined. If the type of the symbol is a positive sign, the symbol is encoded as a first value, wherein the first value is 1 or 0. If the type of the symbol is a negative sign, the symbol is encoded as a second value, wherein the second value is 1 or 0. It should be noted that the first value is not equal to the second value. If the first value is 1, the second value is 0, and if the first value is 0, the second value is 1.

[0062] It should be noted that, in this embodiment, if the type of the symbol is a positive sign, the symbol is encoded as 0, and if the type of the symbol is a negative sign, the symbol is encoded as 1.

[0063] Optionally, the absolute value is encoded to obtain an absolute value vector of the absolute value, including:

[0064] Convert the absolute value into binary data and determine the number of bits of the binary data;

[0065] If the number of bits of the binary data is greater than a preset value, the binary data is split into a first vector and a second vector according to the preset value, and an absolute value vector of the absolute value is determined according to the first vector and the second vector;

[0066] If the number of bits of the binary data is not greater than a preset value, the binary data is determined as an absolute value vector of absolute values.

[0067] In this embodiment, the absolute value is encoded to obtain an absolute value vector of the absolute value, that is, the corresponding absolute value is converted into binary data, wherein the binary data is binary data in which all bits are valid bits, that is, the highest bit data in the binary data is non-0 data. After conversion to binary data, the number of bits of the binary data is determined. If the number of bits of the binary data is greater than a preset value, the binary data is split into a first vector and a second vector according to the preset value, wherein the preset value can be a storage bit number of a database such as 32, 64, 128 and 256. The first vector and the second vector are vectors composed of data after the binary data is split. For example, if the preset value is 64, then when the number of bits of the binary data is greater than 64, the binary data is divided into a first vector and a second vector, and the absolute value vector of the absolute value is determined according to the first vector and the second vector. Among them, the first vector can be a vector composed of values ​​in bits with a high bit greater than 64 in the binary data, that is, a vector composed of values ​​starting from the 65th bit from right to left, or a vector composed of corresponding values ​​in bits with a low bit not greater than 64, that is, a vector composed of values ​​from the 1st bit to the 64th bit from right to left. If the first vector is a vector composed of the values ​​in the bits with high bits greater than 64 in the binary data, then the second vector is a vector composed of the corresponding values ​​in the bits with low bits not greater than 64. If the first vector is a vector composed of the corresponding values ​​in the bits with low bits not greater than 64, then the second vector is a vector composed of the values ​​in the bits with high bits greater than 64.

[0068] If the number of bits of the binary data is not greater than a preset value, the binary data is determined as an absolute value vector of absolute values. For example, if the binary data is 100101, the corresponding absolute value vector is 100101.

[0069] Optionally, according to a preset value, splitting the binary data into a first vector and a second vector includes:

[0070] Count the number of bits of the binary data from right to left, and divide the binary data into a first part of data whose number of bits is greater than a preset value and a second part of data whose number of bits is not greater than the preset value;

[0071] The first part of the data is used as the first vector, and the second part of the data is used as the second vector.

[0072] In this embodiment, the number of bits of binary data is counted from right to left, and the binary data is divided into a first part of data whose number of bits is greater than a preset value and a second part of data whose number of bits is not greater than the preset value. The first part of data is used as a first vector, and the second part of data is used as a second vector, that is, a vector composed of values ​​in the number of bits whose high bits are greater than the preset value is used as the first vector, and a vector composed of corresponding values ​​in the number of bits whose low bits are not greater than the preset value is used as the second vector. For example, if the preset value is 8, the number of bits of binary data is counted from right to left, and the first part of data whose number of bits of binary data is greater than 8 is used as the first vector, and the first part of data whose number of bits is not greater than 8 is used as the second vector. For example, if the binary data is 10010010001, 100 is used as the first vector, and 10010001 is used as the second vector.

[0073] It should be noted that if the value of the first digit of the highest bit in the second vector is 0, the corresponding 0 cannot be omitted.

[0074] S104: Map the sign vector and the absolute value vector to form an encoding result of the fixed-point number data to be encoded.

[0075] In step S104, the encoding result of the fixed-point number data to be encoded is determined according to the sign vector and the absolute value vector.

[0076] In this embodiment, the encoding result of the fixed-point data to be encoded includes two parts, namely a sign vector and an absolute value vector. For example, if the sign vector is 0 and the absolute value vector is 100110110, the corresponding encoding result is [(0), (100110110)].

[0077] Obtain fixed-point data to be encoded, convert the fixed-point data to be encoded into integer data, determine the sign and absolute value of the integer data, encode the sign based on a preset encoding method to obtain a sign vector of the sign, encode the absolute value to obtain an absolute value vector of the absolute value, and map the sign vector and the absolute value vector to form an encoding result of the fixed-point data to be encoded. In the present application, the fixed-point data to be encoded is converted into integer data, and the integer data is split into a sign and an absolute value, so that the sign and the absolute value can be processed separately. When storing fixed-length integers, the placeholder of the sign code in the code of the fixed-point data to be encoded is avoided, and the compression of the absolute value code is facilitated, thereby reducing space redundancy and improving the space compression rate.

[0078] See also Figure 2 , is a flow chart of a method for calculating coded data provided by an embodiment of the present invention, such as Figure 2 As shown, the method for calculating the encoded data may include the following steps.

[0079] S201: Acquire data to be calculated, and use the data to be calculated as fixed-point data to be encoded;

[0080] S202: using the above data encoding method to encode the data to be operated, to obtain an encoding result of the data to be operated;

[0081] S203: According to the symbol vector and the absolute value vector in the encoding result of the data to be operated, use the bit operator matching the preset encoding method to operate on the symbol vector and the absolute value vector of the data to be operated to obtain the operation result.

[0082] In this embodiment, the data to be operated is obtained, and the data to be operated is used as the fixed-point data to be encoded. The above-mentioned data encoding method is used to encode the data to be operated, and the encoding result of the data to be operated is obtained. According to the symbol vector and absolute value vector in the encoding result of the data to be operated, a bit operator matching the preset encoding method is used to operate the symbol vector and absolute value vector of the data to be operated to obtain the operation result. For example, the data to be operated is a fixed-point data defined as (10, 2), which is (916280.93, 250929.78, -787201.33, 29680.79, -577549.14, 754211.56, -8515271.80, 98640593.79, 250929.78), and (916280.93, 250929.78, -787201.33) is calculated. 1.33, 29680.79, -577549.14, 754211.56, -8515271.80, 98640593.79) are smaller than 250929.78. For (916280.93, 250929.78, -787201.33, 29680.79, -577549.14, 754211.56, -8515271.80, 98 640593.79) is sign-encoded to obtain the corresponding sign vector P1=(0, 0, 1, 0, 1, 0, 1, 0), 250929.78 is sign-encoded to obtain the corresponding sign vector P2=(0), wherein the sign corresponding to the positive sign is encoded as 0, and the sign corresponding to the negative sign is encoded as 1, and the sign vector is XOR-ed to obtain the sign operation result P=(0, 0, 1, 0, 1, 0, 1, 0), and then the data to be operated is converted into integer data, the absolute values ​​in the integer data are compared, and the absolute values ​​are compared to obtain the absolute value operation result Q=(0, 0, 0, 1, 0, 0, 0), wherein the comparison result of the number with an absolute value less than 250929.78 is marked as 1, and the comparison result of the number with an absolute value greater than or equal to 250929.78 is marked as 0, that is, if the comparison result is true, it is marked as 1, and if the comparison result is false, it is marked as 0. Finally, the sign operation result and the absolute value operation result are bitwise operated, where the bitwise operation formula is P|(~P&Q), and the operation result is (0, 0, 1, 1, 1, 0, 1, 0), where 0 is the operation result of (916280.93, 250929.78, -787201.33, 29680.79, -577549.14, 754211.56, -8515271.80, 98640593.79) not less than 250929.78, and 1 is the operation result less than 250929.78, that is, -787201.33, 29680.79, -577549.14, -8515271.80 are less than 250929.78.

[0083] In another embodiment, the data to be calculated is a fixed-point data defined as (10, 2), which is (916280.93, 250929.78, -787201.33, 29680.79, -577549.14, 754211.56, -8515271.80, 98640593.79, 250929.78), and (916280.93, 250929.78, -787201.33, 29680.79, -577549.14, 754211.56, -8515271.80, 98640593.79, 250929.78) is calculated. 7201.33, 29680.79, -577549.14, 754211.56, -8515271.80, 98640593.79) are smaller than 250929.78. For (916280.93, 250929.78, -787201.33, 29680.79, -577549.14, 754211.56, -8515271.80, 98640593.79) is sign-encoded to obtain the corresponding sign vector P1=(1, 1, 0, 1, 0, 1, 0, 1), 250929.78 is sign-encoded to obtain the corresponding sign vector P2=(1), wherein the sign corresponding to the positive sign is encoded as 1, and the sign corresponding to the negative sign is encoded as 0, and the sign vector is ANDed to obtain the sign operation result P=(0, 0, 1, 0, 1, 0, 1, 0), and then the data to be operated is converted into integer data, the absolute values ​​in the integer data are compared, and the absolute values ​​are compared to obtain the absolute value operation result Q=(0, 0, 0, 1, 0, 0, 0), wherein the comparison result of the number with an absolute value less than 250929.78 is marked as 1, and the comparison result of the number with an absolute value greater than or equal to 250929.78 is marked as 0, that is, if the comparison result is true, it is marked as 1, and if the comparison result is false, it is marked as 0. Finally, the sign operation result and the absolute value operation result are bitwise operated. The bitwise operation formula is P|(~P&Q), and the operation result is (0, 0, 1, 1, 1, 0, 1, 0). Among them, 0 is (916280.93, 250929.78, -787201.33, 29680.79,

[0084] -577549.14, 754211.56, -8515271.80, 98640593.79) are not less than 250929.78, and 1 is less than 250929.78, that is, -787201.33, 29680.79, -577549.14, -8515271.80 are less than 250929.78.

[0085] See also Figure 3 , Figure 31 is a structural block diagram of a data encoding device provided by an embodiment of the present invention. For the convenience of description, only the part related to the embodiment of the present invention is shown. Figure 3 The data encoding device 30 includes: a first acquisition module 31, a conversion module 32, a first encoding module 33, and a mapping module 34.

[0086] The first acquisition module 31 is used to acquire fixed-point number data to be encoded.

[0087] The conversion module 32 is used to convert the fixed-point data to be encoded into integer data, and determine the sign and absolute value of the integer data.

[0088] The first encoding module 33 is used to encode the symbol based on a preset encoding method to obtain a symbol vector of the symbol, and to encode the absolute value to obtain an absolute value vector of the absolute value.

[0089] The mapping module 34 is used to map the sign vector and the absolute value vector to form an encoding result of the fixed-point number data to be encoded.

[0090] Optionally, the first encoding module 33 includes:

[0091] The judging unit is used to judge the type of the symbol.

[0092] The first encoding unit is used to encode the sign into a first value if the type of the sign is a positive sign.

[0093] The second encoding unit is used to encode the sign into a second value if the type of the sign is a negative sign.

[0094] Optionally, the first encoding module 33 includes:

[0095] The conversion unit is used to convert the absolute value into binary data and determine the number of bits of the binary data.

[0096] The first judgment unit is used for splitting the binary data into a first vector and a second vector according to the preset value if the number of bits of the binary data is greater than a preset value, and determining an absolute value vector of the absolute value according to the first vector and the second vector.

[0097] The second judgment unit is used to determine the binary data as an absolute value vector of the absolute value if the number of bits of the binary data is not greater than a preset value.

[0098] Optionally, the first judging unit includes:

[0099] The dividing subunit is used to count the number of bits of the binary data from right to left, and divide the binary data into a first part of data with a number of bits greater than a preset value and a second part of data with a number of bits not greater than the preset value.

[0100] A subunit is determined, which is used to use the first part of the data as a first vector and the second part of the data as a second vector.

[0101] See also Figure 4 , Figure 4 1 is a block diagram of a data encoding operation device provided by an embodiment of the present invention. For the sake of convenience, only the part related to the embodiment of the present invention is shown. Figure 4 , the data encoding computing device 40 comprises:

[0102] The second acquisition module 41 is used to acquire the data to be calculated and use the data to be calculated as the fixed-point number data to be encoded.

[0103] The second encoding module 42 is used to encode the data to be operated using the above data encoding method to obtain an encoding result of the data to be operated.

[0104] The operation module 43 is used to operate the sign vector and the absolute value vector of the data to be operated according to the sign vector and the absolute value vector in the encoding result of the data to be operated, using a bit operator matching the preset encoding method, to obtain an operation result.

[0105] It should be noted that the information interaction, execution process and other contents between the above modules are based on the same concept as the embodiment of the method of the present invention. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.

[0106] Figure 5 A schematic diagram of the structure of a computer device provided by an embodiment of the present invention. Figure 5 As shown, the computer device of this embodiment includes: at least one processor ( Figure 5 Only one is shown), a memory, and a computer program stored in the memory and executable on at least one processor, wherein when the processor executes the computer program, any of the above-mentioned data encoding methods and the steps in the operation method embodiment are implemented.

[0107] The computer device may include, but is not limited to, a processor and a memory. Those skilled in the art will appreciate that Figure 5 This is merely an example of a computer device and does not constitute a limitation on the computer device. The computer device may include more or fewer components than those shown in the figure, or a combination of certain components, or different components, for example, it may also include a network interface, etc.

[0108] The processor may be a CPU, or other general-purpose processors, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0109] The memory includes a readable storage medium, an internal memory, etc., wherein the internal memory may be the memory of a computer device, and the internal memory provides an environment for the operation of an operating system and computer-readable instructions in the readable storage medium. The readable storage medium may be a hard disk of a computer device, and in other embodiments may also be an external storage device of a computer device, for example, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on a computer device. Further, the memory may also include both an internal storage unit of a computer device and an external storage device. The memory is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as program codes of computer programs, etc. The memory may also be used to temporarily store data that has been output or is to be output.

[0110] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention. The specific working process of the units and modules in the above-mentioned device can refer to the corresponding process in the above-mentioned method embodiment, which will not be repeated here. If the integrated unit 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 understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of the above-mentioned method embodiment can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device capable of carrying computer program code, recording medium, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.

[0111] The present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by a computer program product. When the computer program product runs on a computer device, the computer device can implement the steps in the above-mentioned method embodiment when executing.

[0112] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0113] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can 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 the present invention.

[0114] In the embodiments provided by the present invention, it should be understood that the disclosed devices / computer equipment and methods can be implemented in other ways. For example, the device / computer equipment embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0115] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0116] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention.

Claims

1. A data encoding method, characterized in that: The data encoding method comprises: Get the fixed-point data to be encoded; Converting the fixed-point data to be encoded into integer data, and determining the sign and absolute value of the integer data; Based on a preset encoding method, encode the symbol to obtain a symbol vector of the symbol, and encode the absolute value to obtain an absolute value vector of the absolute value; The symbol vector and the absolute value vector are mapped to form an encoding result of the fixed-point number data to be encoded.

2. The data encoding method according to claim 1, characterized in that: The encoding of the symbol to obtain a symbol vector of the symbol includes: Determining the type of the symbol; If the type of the sign is a positive sign, encoding the sign as a first numerical value; If the type of the sign is a negative sign, the sign is encoded as a second value.

3. The data encoding method according to claim 1, characterized in that: The encoding of the absolute value to obtain an absolute value vector of the absolute value includes: Convert the absolute value into binary data, and determine the number of bits of the binary data; If the number of bits of the binary data is greater than a preset value, splitting the binary data into a first vector and a second vector according to the preset value, and determining an absolute value vector of the absolute value according to the first vector and the second vector; If the number of bits of the binary data is not greater than the preset value, the binary data is determined as an absolute value vector of the absolute value.

4. The data encoding method according to claim 3, characterized in that: The step of splitting the binary data into a first vector and a second vector according to the preset value includes: Counting the number of bits of the binary data from right to left, dividing the binary data into a first part of data having a number of bits greater than the preset value and a second part of data having a number of bits not greater than the preset value; The first part of data is used as a first vector, and the second part of data is used as a second vector.

5. A method for calculating coded data, characterized in that: The operation method comprises: Acquire data to be calculated, and use the data to be calculated as fixed-point number data to be encoded; Using the data encoding method according to any one of claims 1 to 4 to encode the data to be operated, to obtain an encoding result of the data to be operated; According to the sign vector and the absolute value vector in the encoding result of the data to be operated, a bit operator matching the preset encoding method is used to operate the sign vector and the absolute value vector of the data to be operated to obtain an operation result.

6. A data encoding device, characterized in that: The data encoding device comprises: A first acquisition module, used for acquiring fixed-point number data to be encoded; A conversion module, used for converting the fixed-point data to be encoded into integer data, and determining the sign and absolute value of the integer data; A first encoding module, configured to encode the symbol based on a preset encoding method to obtain a symbol vector of the symbol, and encode the absolute value to obtain an absolute value vector of the absolute value; A mapping module is used to map the symbol vector and the absolute value vector to form an encoding result of the fixed-point number data to be encoded.

7. The data encoding device according to claim 6, characterized in that: The first encoding module includes: A conversion unit, used for converting the absolute value into binary data, and determining the number of bits of the binary data; A first judgment unit is configured to, if the number of bits of the binary data is greater than a preset value, split the binary data into a first vector and a second vector according to the preset value, and determine an absolute value vector of the absolute value according to the first vector and the second vector; The second judgment unit is used to determine the binary data as the absolute value vector of the absolute value if the number of bits of the binary data is not greater than the preset value.

8. A computing device for encoding data, characterized in that: The computing device comprises: A second acquisition module is used to acquire data to be calculated, and use the data to be calculated as fixed-point data to be encoded; A second encoding module, configured to use the data encoding method according to any one of claims 1 to 5 to perform data encoding on the data to be operated, to obtain an encoding result of the data to be operated; The operation module is used to operate the symbol vector and the absolute value vector of the data to be operated according to the symbol vector and the absolute value vector in the encoding result of the data to be operated, using a bit operator matching the preset encoding method to obtain an operation result.

9. A computer device, characterized in that: The computer device includes a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the data encoding method according to claims 1 to 4 and the operation method according to claim 5 are implemented.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the data encoding method according to claims 1 to 4 and the calculation method according to claim 5 are implemented.

Citation Information

Patent Citations

  • Method and apparatus for encoding / decoding vector as well as flow medium player

    CN101304254A

  • Binarization of dqp using separate absolute value and sign (savs) in cabac

    CN102868882A

  • Wavelet transformation encoding / decoding method and device

    CN104471945A

  • In-memory sparse matrix multiplication operation method, equation solving method and solver

    CN113870918A

  • Compression method and device for time sequence data of Internet of Vehicles and electronic equipment

    CN114759929A