Embedded coding method, device, computer equipment and storage medium
By performing trapezoidal structure detection and bit group generation on the mantissa matrix, the problem of low coding rate in traditional embedded coding methods is solved, and more efficient data coding processing is achieved.
Patent Information
- Application Number
- CN202211702359.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-29
- Publication Date
- 2025-09-30
- Estimated Expiration
- 2042-12-29
AI Technical Summary
The coding rate in traditional embedded coding methods is too low, resulting in low data processing efficiency.
By performing trapezoidal structure detection on the mantissa matrix, the number of leading zeros corresponding to each row of data is determined, and based on this, a bit group is generated and encoded in the form of the bit group to reduce shift operations.
The coding rate is increased, the complexity of data processing is reduced, and the coding efficiency is improved.
Smart Images

Figure CN115987292B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to an embedded coding method, apparatus, computer equipment, storage medium, and computer program product. Background Art
[0002] Embedded coding is the most advanced coding technique for wavelet coefficient encoding. The encoder sorts the bits to be encoded by importance and terminates encoding at any time based on the target bit rate or distortion level. Initially applied to graphics compression, this technique has evolved and is now widely used in floating-point compression coding in high-performance computing.
[0003] However, conventional embedded coding currently uses a bit-plane-based coding method, which generally suffers from a low coding rate. Summary of the Invention
[0004] Based on this, it is necessary to provide an embedded coding method, apparatus, computer equipment, computer-readable storage medium and computer program product that can effectively improve the coding rate of embedded coding in order to address the above technical problems.
[0005] In a first aspect, the present application provides an embedded coding method. The method comprises:
[0006] Obtaining data to be encoded, and generating a mantissa matrix according to the data to be encoded;
[0007] Performing a trapezoidal structure detection on the mantissa matrix to obtain the number of leading zeros corresponding to each row of data in the mantissa matrix;
[0008] Obtaining each bit group in the mantissa matrix based on the number of leading zeros corresponding to each row of data;
[0009] The data to be encoded is encoded according to each bit group in the mantissa matrix to obtain target encoded data.
[0010] In one embodiment, performing a trapezoidal structure detection on the mantissa matrix to obtain the number of leading zeros corresponding to each row of data in the mantissa matrix includes:
[0011] Performing turning point detection on each row of data in the mantissa matrix from bottom to top to obtain turning points of the trapezoidal structure;
[0012] The number of leading zeros corresponding to each row of data in the mantissa matrix is determined according to the detected turning points.
[0013] In one embodiment, performing turning point detection on each row of data of the mantissa matrix from bottom to top to obtain turning points of the trapezoidal structure includes:
[0014] Detecting the most significant bit of each row of data in the mantissa matrix to obtain position data of the most significant bit of each row;
[0015] According to the position data of the most significant bit of each row, the position data of the most significant bit of the current row is compared with the bit group value of the previous row corresponding to the current row from bottom to top;
[0016] If the position data of the most significant bit of the current row is greater than the bit group value of the previous row corresponding to the current row, the most significant bit of the current row is determined as the turning point of the trapezoidal structure, and the bit group value of the current row is recorded.
[0017] In one embodiment, obtaining each bit group in the mantissa matrix based on the number of leading zeros corresponding to each row of data includes:
[0018] Based on the number of leading zeros corresponding to each row of data, the leading zeros on the left side of each row of data are discarded;
[0019] Determine the remaining data in each row of data as a bit group for each row;
[0020] Based on the bit groups in each row, each bit group in the mantissa matrix is obtained.
[0021] In one embodiment, encoding the data to be encoded according to each bit group in the mantissa matrix to obtain target encoded data includes:
[0022] Encoding the data to be encoded according to each bit group in the mantissa matrix to obtain encoded data to be output;
[0023] According to the number of leading zeros corresponding to each row of data, additional marking data is added to the encoded data to be output to obtain target encoded data, where the additional marking data is used to mark the number of leading zeros discarded in each row of data.
[0024] In one embodiment, the adding of additional marker data to the to-be-output encoded data according to the number of leading zeros corresponding to each row of data to obtain target encoded data includes:
[0025] Determining incremental data of leading zeros discarded by each bit group according to the number of leading zeros corresponding to each row of data;
[0026] Based on the incremental data of the leading zeros discarded by each of the bit groups, the incremental data is added to the corresponding position of the to-be-output coded data to obtain the target coded data.
[0027] In a second aspect, the present application further provides an embedded coding device. The device comprises:
[0028] A matrix generation module, configured to obtain data to be encoded and generate a mantissa matrix according to the data to be encoded;
[0029] a structure detection module, configured to perform a trapezoidal structure detection on the mantissa matrix to obtain the number of leading zeros corresponding to each row of data in the mantissa matrix;
[0030] a bit group determination module, configured to obtain each bit group in the mantissa matrix based on the number of leading zeros corresponding to each row of data;
[0031] The encoding module is used to encode the data to be encoded according to each bit group in the mantissa matrix to obtain target encoded data.
[0032] In a third aspect, the present application further provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above-mentioned embedded coding method when executing the computer program.
[0033] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, which implements the steps of the above-mentioned embedded coding method when executed by a processor.
[0034] In a fifth aspect, the present application further provides a computer program product, which includes a computer program that implements the steps of the above-mentioned embedded coding method when executed by a processor.
[0035] The above-mentioned embedded coding method, device, computer equipment, storage medium and computer program product perform trapezoidal structure detection on the mantissa matrix, obtain the number of leading zeros corresponding to each row of data in the mantissa matrix, and obtain each bit group of the mantissa matrix based on the number of leading zeros. Therefore, the data in each bit group is the bit data that should be stored for each row of data during embedded coding. The data is encoded and stored in the form of bit groups. There is no need to store data in the traditional bit-plane-based manner. Each time a bit plane is formed, all data needs to be shifted once. The entire process only requires one shift operation for each row of data, which greatly reduces the complexity of data processing and effectively improves the coding rate of embedded coding. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1A diagram illustrating an application environment of an embedded coding method according to an embodiment;
[0037] Figure 2 1 is a flow chart of an embedded coding method in one embodiment;
[0038] Figure 3 FIG1 is a flow chart of steps for detecting turning points of each row of mantissa matrix from bottom to top to obtain turning points of a trapezoidal structure in one embodiment;
[0039] Figure 4 FIG4 is a flow chart of the steps of obtaining each bit group in the mantissa matrix based on the number of leading zeros corresponding to each row of data in one embodiment;
[0040] Figure 5 FIG. 1 is a schematic diagram of a mantissa matrix of a traditional embedded coding method in one embodiment;
[0041] Figure 6 1 is a flow chart of an embedded coding method according to another embodiment;
[0042] Figure 7 Schematic diagram of a mantissa matrix of an embedded coding method in one embodiment;
[0043] Figure 8 is a structural block diagram of an embedded coding device in one embodiment;
[0044] Figure 9 FIG. 1 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0045] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0046] The embedded coding method provided in the embodiment of the present application can be applied to Figure 1In the application environment shown. The encoding tool 102 is integrated into an application, and the user communicates with the encoding tool 102 using the application through the terminal 104. The data storage system can store the data that the encoding tool 102 needs to process. The data storage system can be integrated into the encoding tool 102, or it can be placed on the cloud or other network servers. The encoding tool 102 obtains the data to be encoded from the terminal 104, generates a mantissa matrix based on the data to be encoded, performs a trapezoidal structure test on the mantissa matrix, obtains the number of leading zeros corresponding to each row of data in the mantissa matrix, obtains each bit group in the mantissa matrix based on the number of leading zeros corresponding to each row of data, and encodes the data to be encoded based on each bit group in the mantissa matrix to obtain target encoded data. The terminal 104 can be, but is not limited to, various personal computers, laptops, smart phones, tablets, Internet of Things devices, and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The encoding tool 102 may be a compressor integrated with an embedded encoding algorithm, such as a ZFP compressor.
[0047] In one embodiment, Figure 2 As shown, an embedded coding method is provided, which is applied to Figure 1 The following steps are used as an example to illustrate the encoding tool in the example:
[0048] Step 202: Obtain the data to be encoded, and generate a mantissa matrix according to the data to be encoded.
[0049] The data to be encoded is data that requires encoding. For example, common graphic data often contains a large amount of redundant information, which provides a possibility for data compression. The data that requires encoding is used as the data to be encoded. It is understood that the data to be encoded can be data that needs to be encoded directly input by the user, or it can be data that requires encoding obtained by transforming the user-input data.
[0050] In one embodiment, the data to be encoded is wavelet coefficients obtained by performing wavelet transformation on the collected data, and the expression form of the wavelet coefficients is binary data.
[0051] The mantissa matrix is matrix data obtained by visualizing the bits of elements in the data to be encoded.
[0052] Specifically, the encoding tool obtains the data to be encoded, and performs visualization processing on the bits of the elements in the data to be encoded to obtain a mantissa matrix corresponding to the data to be encoded.
[0053] Step 204 : Perform a trapezoidal structure test on the mantissa matrix to obtain the number of leading zeros corresponding to each row of data in the mantissa matrix.
[0054] From a graphical perspective, the mantissa matrix can be considered as a matrix consisting of decreasingly significant bits and discarded leading zeros. Significant bits are the bits to the right of the most significant bit of the element in the image data. For example, for the element 00111011, the significant bits are 111011, while the 00 to the left is the leading zero.
[0055] The meaningful bits in each row of data in the mantissa matrix are regarded as a bit group, and the mantissa matrix is regarded as a whole. The meaningful bits in each row of data in the mantissa matrix decrease from top to bottom. Therefore, the graphic structure composed of all the bit groups in the mantissa matrix can be approximately regarded as a trapezoidal structure.
[0056] The leading zeros can be considered as the complement of the minimum row echelon of the mantissa matrix, used as padding values and not as meaningful bits. Therefore, when encoding the data to be encoded, the leading zeros do not need to be written to the memory for encoding. As can be understood, in the mantissa matrix, the leading zeros are located on the left side of each row of data.
[0057] Specifically, the encoding platform performs a trapezoidal structure detection on the generated mantissa matrix to obtain the number of leading zeros corresponding to each row of data in the mantissa evidence.
[0058] Step 206: Obtain each bit group in the mantissa matrix based on the number of leading zeros corresponding to each row of data.
[0059] Specifically, the number of bits in each row of data is certain. Therefore, once the number of leading zeros corresponding to each row of data is determined, the encoding tool can obtain each bit group in the mantissa matrix based on the number of leading zeros corresponding to each row of data.
[0060] Step 208: Encode the data to be encoded according to each bit group in the mantissa matrix to obtain target encoded data.
[0061] Specifically, since the bit group is composed of meaningful bits, the data in each bit group is the bit data that should be stored in each row of data during embedded coding. When encoding the data to be encoded, it is directly encoded according to the bit groups in the mantissa matrix, and the bit group is used instead of the bit plane in the traditional technology to encode the entire data set. The entire process only requires one shift operation on each row of data to obtain the target encoded data.
[0062] In the above-mentioned embedded coding method, the trapezoidal structure detection is performed on the mantissa matrix to obtain the number of leading zeros corresponding to each row of data in the mantissa matrix, and each bit group of the mantissa matrix is obtained based on the number of leading zeros. Therefore, the data in each bit group is the bit data that should be stored for each row of data during embedded coding. The data is encoded and stored in the form of a bit group. There is no need to store data in the traditional bit-plane-based manner. Each time a bit plane is formed, all data needs to be shifted once. The entire process only requires one shift operation for each row of data, which greatly reduces the complexity of data processing and effectively improves the coding rate of embedded coding.
[0063] In one embodiment, performing a trapezoidal structure detection on the mantissa matrix to obtain the number of leading zeros corresponding to each row of data in the mantissa matrix includes:
[0064] A turning point detection is performed on each row of data in the mantissa matrix from bottom to top to obtain the turning points of the trapezoidal structure; and the number of leading zeros corresponding to each row of data in the mantissa matrix is determined based on the detected turning points.
[0065] From the perspective of visual graphics, the turning point can be considered as the vertex of the trapezoidal structure of the mantissa matrix, that is, the dividing point between the leading zero and the bit group corresponding to each row of data.
[0066] Specifically, the encoding tool performs turning point detection on each row of data in the mantissa evidence, in reverse order from bottom to top, to determine the turning points of the trapezoidal structure in the mantissa matrix, that is, to determine the vertices of the trapezoidal structure of the mantissa matrix. Based on each detected turning point, the amount of data to the left of each turning point is determined, and the amount of data to the left of each turning point is determined as the number of leading zeros in the row of data corresponding to that turning point.
[0067] In this embodiment, turning point detection is performed on each row of data in the mantissa matrix in reverse order from bottom to top to obtain the turning points of the trapezoidal structure, and then the number of leading zeros corresponding to each row of data in the mantissa matrix is determined based on the detected turning points. The number of leading zeros corresponding to each row of data can be quickly determined from the mantissa matrix, and the coding rate of the embedded coding can be effectively improved by improving the speed of determining the leading zeros.
[0068] Furthermore, in one embodiment, Figure 3 As shown, turning point detection is performed on each row of the mantissa matrix from bottom to top to obtain the turning points of the trapezoidal structure, including the following steps:
[0069] Step 302: Detect the most significant bit of each row of the mantissa matrix to obtain the position data of the most significant bit of each row.
[0070] The most significant bit (MSB) is the most significant bit in a binary digit, corresponding to the least significant bit (LSB). Generally, the least significant bit on the right side of a binary digit is called the least significant bit, and the most significant bit on the left is called the most significant bit. For example, in the number 00111011, the first "1" counted from left to right is the most significant bit.
[0071] Specifically, the encoding tool performs a most significant bit (MSB) detection on each row of the generated mantissa matrix to obtain the position data of each MSB and the bit group value of each row of data. The MSB position data is the position data of the MSB in the row of data from right to left. The position data can be directly represented by a numerical value. For example, the MSB position data of element 00111011 can be directly represented as 6, indicating that the MSB is at the 6th position from right to left in the row of data, and the bit group value of element 00111011 is 6.
[0072] Step 304 : Based on the position data of the most significant bit of each row, the position data of the most significant bit of the current row is compared with the bit group values of the previous row corresponding to the current row from bottom to top.
[0073] The bit group value of each row refers to the number of elements contained in a bit group. It can be understood that in a mantissa matrix, the bit group value of each row of data increases gradually from bottom to top.
[0074] Specifically, after obtaining the position data of each most significant bit, the encoding tool compares the position data of the most significant bit of the current row with the bit group value of the previous row corresponding to the current row in reverse order from bottom to top. For example, if the current row is the second row from the bottom to the top, the previous row corresponding to the current row is the first row from the bottom to the top, and the position data of the most significant bit of the second row is compared with the bit group value of the first row from the bottom to the top. After the comparison is completed, the third row from the bottom to the top is used as the current row, and the comparison operation is continued until the position data of the most significant bit of each row of data in the mantissa matrix is compared.
[0075] Step 306: If the position data of the most significant bit of the current row is greater than the bit group value of the previous row corresponding to the current row, the most significant bit of the current row is determined as the turning point of the trapezoidal structure, and the bit group value of the current row is recorded.
[0076] Specifically, if the position data of the most significant bit of the current row is compared with the bit group value of the previous row corresponding to the current row, and it is found that the position data of the most significant bit of the current row is greater than the bit group value of the previous row corresponding to the current row, then the most significant bit of the current row is determined as the turning point of the trapezoidal structure, and the bit group value of the current row is recorded.
[0077] For example, if the element of the current row is 0000101001, and the element of the previous row of the current row is 0000011001, then the position data of the most significant bit of the current row is 6, and the bit group value of the previous row of the current row is 5. It can be considered that the most significant bit of the current row is the turning point of the trapezoidal structure, and the bit group value of the current row is recorded as 6.
[0078] If the element of the current row is 0000010100, and the element of the row above the current row is 0000110010, then the most significant bit position of the current row is 6, and the bit group value of the row above the current row is 6. At this time, the position data of the most significant bit of the current row is equal to the bit group value of the row above the current row. The most significant bit of the current row is not the turning point of the ladder structure. The bit group value of the current row is consistent with the bit group value of the row above the current row, that is, the bit group value of the current row is still recorded as 6. After the comparison of the current row is completed, the row below the current row is updated to the current row, and the comparison continues.
[0079] If the element of the row below the current row is 0001110010, the position of the most significant bit of the row below the current row is 7. The position of the most significant bit of the row below the current row is greater than the bit group value of the current row. Therefore, the most significant bit of the row below the current row is the turning point of the ladder structure, and the bit group value of the row below the current row is recorded as 7.
[0080] In this embodiment, the encoding tool first determines the position data of the most significant bit of each row of data, and then compares the position data of the most significant bit of the current row with the bit group value of the previous row corresponding to the current row, thereby determining the turning point of the trapezoidal structure, improving the accuracy and speed of turning point determination, and further improving the encoding rate of embedded coding.
[0081] In one embodiment, Figure 4 As shown, based on the number of leading zeros corresponding to each row of data, each bit group in the mantissa matrix is obtained, including:
[0082] Step 402 : based on the number of leading zeros corresponding to each row of data, discard the leading zeros on the left side of each row of data.
[0083] Specifically, the encoding tool discards the leading zeros on the left side of each row of data based on the determined number of leading zeros corresponding to each row of data.
[0084] Step 404: Determine the remaining data in each row of data as a bit group for each row.
[0085] Specifically, after the encoding tool discards the meaningless leading zeros on the left side of each row of data, the remaining data are all meaningful bits, and the remaining data in each row of data is determined as the bit group of each row.
[0086] Step 406: Based on the bit groups in each row, obtain each bit group in the mantissa matrix.
[0087] Specifically, the encoding tool obtains each bit group in the mantissa matrix based on the set of bit groups in each row.
[0088] In this embodiment, the leading zeros on the left side of each row of data are discarded, leaving meaningful bits as the bit groups of each row of data, thereby obtaining the bit groups in the mantissa matrix, which provides a data basis for subsequent direct encoding according to each bit group to obtain the target encoded data.
[0089] After obtaining each bit group in the mantissa matrix, the target coded data can be obtained according to each bit group. In one embodiment, encoding the data to be coded according to each bit group in the mantissa matrix to obtain the target coded data includes:
[0090] The data to be encoded is encoded according to each bit group in the mantissa matrix to obtain the encoded data to be output; and additional mark data is added to the encoded data to be output according to the number of leading zeros corresponding to each row of data to obtain the target encoded data.
[0091] The additional marker data is used to mark the number of leading zeros discarded for each row of data.
[0092] Specifically, the encoding tool writes each bit group in the mantissa matrix into memory for encoding, generating the output encoded data. Simultaneously, the encoding tool adds additional marker data to the corresponding positions in the output encoded data, based on the number of leading zeros corresponding to each row of data. This data is used to indicate the number of leading zeros discarded in each row of data, thereby generating the final target encoded data.
[0093] In this embodiment, by adding additional marking data to the encoded data to be output, the number of discarded leading zeros can be compactly marked, which facilitates subsequent decoding work.
[0094] During the original decoding process, the number of bits read into each column is determined based on the redundant information written into the memory by the group test. To achieve the same effect as the original group test, in one embodiment, additional marker data is added to the encoded data to be output based on the number of leading zeros corresponding to each row of data to obtain the target encoded data, including:
[0095] According to the number of leading zeros corresponding to each row of data, the incremental data of the leading zeros discarded by each bit group is determined; based on the incremental data of the leading zeros discarded by each bit group, the incremental data is added to the corresponding position of the coded data to be output to obtain the target coded data.
[0096] Among them, the incremental data is the data used to determine how many bits should be read into each row of data during decoding. The expression form of the incremental data is not limited in this application. For example, 0...1 can be used to represent the increment. When the leading zeros of the current row of data are 4, the corresponding incremental data is set to 00001, and the incremental data ends with "1" to indicate the end of the incremental expression. If the leading zeros of the next row of data of the current row of data are still 4, it is considered that the next row of data of the current row of data has no incremental data. If the leading zeros of the next row of data of the current row of data are 6, the incremental data corresponding to the next row of data of the current row of data is set to 001, indicating that the next row of data has two leading zeros added on the basis of the previous row.
[0097] Specifically, the encoding tool determines the incremental data of the leading zeros discarded by each bit group based on the number of leading zeros corresponding to each row of data, and adds the incremental data to the corresponding position of the encoded data to be output based on the incremental data of the leading zeros discarded by each bit group to obtain the target encoded data.
[0098] When decoding is required, the number of leading zeros in the current row of data can be determined based on the added incremental data, thereby determining how many bits of the current row of data should be written. For example, if the incremental data is 00001 and the current row of data is 10 bits, then the number of bits of the current row of data that should be written is 6.
[0099] In this embodiment, the corresponding incremental data is determined for each row of data, and the incremental data is added to the corresponding position to obtain the target encoded data. During subsequent decoding, the number of bits that should be written in each row of data in the mantissa matrix can be determined simply and quickly, thereby improving the efficiency of data decoding.
[0100] In traditional embedded coding methods, such as Figure 5 As shown, embedded coding relies on the construction of bit planes to detect the discardable leading zeros of each data point. Group testing is performed to encode each bit plane in the mantissa matrix. The main implementation is to encode the bit plane by repeatedly testing whether the remaining portion of the bit plane is zero. Only when a non-zero bit exists is it encoded. A bit plane is composed of all bits in the same column of the data set. All bits in the same bit plane have the same impact on the error of the entire data set. Bit planes composed of higher-order bits have a greater impact on the error, so encoding starts with the higher-order bit planes.
[0101] In the lossy stream compressor (ZFP), the encoding process has three stages. The first stage is when the bit plane is equal to 0, in which case only a single bit of 0 is encoded into memory. The second stage is the variable-length encoding stage. In this part of the ZFP embedded encoding, a greedy algorithm is used to assume that the most significant bit of the bit plane is non-decreasing. The position of the most significant bit is recorded using L. For bits below L, they are directly written to memory. For bits above L, group tests are used to encode, and the value of L is iteratively updated based on each group test. The third stage is to assume that the most significant bit has equaled the total number of bits in the bit plane (the number of data in the data set).
[0102] Since the traditional embedded coding method needs to perform a shift operation on all data each time a bit plane is formed, the coding efficiency of the embedded coding will be greatly reduced.
[0103] Based on this, in one embodiment, Figure 6 As shown, an embedded coding method is provided, which specifically includes the following steps:
[0104] First, the encoding tool obtains the user's data to be encoded based on the application, and generates a mantissa matrix based on the image data to be encoded. The mantissa matrix is as follows: Figure 7 Perform the most significant bit detection on each row of data in the mantissa matrix to obtain the position data of each most significant bit in the mantissa matrix.
[0105] From bottom to top, the position data of the most significant bit of the current row is compared with the bit group value of the previous row corresponding to the current row in reverse order. If the position data of the most significant bit of the current row is higher than the bit group value of the previous row corresponding to the current row, the most significant bit of the current row is determined as the turning point of the trapezoidal structure, the bit group value of the current row is recorded, and the previous row of the current row is updated as the current row. Return to execute the step of comparing the position data of the most significant bit of the current row with the bit group value of the previous row corresponding to the current row, until the most significant bit of each row of data in the mantissa matrix is completely compared, and the turning points of the trapezoidal structure of the mantissa matrix are obtained. The turning points are in Figure 7 Circle the middle.
[0106] According to the determined turning points, determine the leading zero corresponding to each row of data in the mantissa matrix ( Figure 7 The number of light gray parts in the figure.
[0107] The encoding tool discards the leading zeros on the left side of each row of data and determines the remaining data of each row of data as the bit group of each row of data ( Figure 7 Based on the set of bit groups of each row of data, each bit group in the mantissa matrix is obtained.
[0108] According to each bit group in the mantissa matrix, the bits of each bit group are written into the memory one by one for encoding to obtain the encoded data to be output. At the same time, the encoding tool determines the incremental data of the leading zeros discarded by each bit group according to the number of leading zeros corresponding to each row of data. Based on the incremental data of the leading zeros discarded by each bit group, the incremental data is added to the corresponding position of the encoded data to be output to obtain the target encoded data.
[0109] The method in this embodiment reduces a large number of shift and addition operations in forming and writing bit planes by packaging all meaningful bits of an element into a bit group for encoding (a bit group only requires one shift to be formed and only requires one write to the memory, which is different from the group test of the bit plane, which requires writing each bit one by one). By using the bit group to write these bits of each element to the memory, there is no need to use the bit plane to originally encode the set into the memory, which reduces a lot of computing time. At the same time, through the row ladder mechanism, the redundant bits written are equal to the redundant bits written using the bit plane.
[0110] It should be understood that, although the various steps in the flowcharts involved in the various embodiments described above are displayed in sequence according to the instructions of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowcharts involved in the various embodiments described above can include multiple steps or multiple stages, and these steps or stages are not necessarily executed and completed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of steps or stages in other steps.
[0111] Based on the same inventive concept, the present application also provides an embedded coding device for implementing the above-mentioned embedded coding method. The implementation solution provided by the device is similar to the implementation solution described in the above-mentioned method. Therefore, the specific limitations of one or more embedded coding device embodiments provided below can be found in the above-mentioned limitations of the embedded coding method and will not be repeated here.
[0112] In one embodiment, Figure 8 As shown, an embedded coding device 800 is provided, comprising: a matrix generation module 801, a structure detection module 802, a bit group determination module 803 and a coding module 804, wherein:
[0113] The matrix generation module 801 is used to obtain data to be encoded and generate a mantissa matrix according to the data to be encoded.
[0114] The structure detection module 802 is configured to perform a trapezoidal structure detection on the mantissa matrix to obtain the number of leading zeros corresponding to each row of data in the mantissa matrix.
[0115] The bit group determination module 803 is configured to obtain each bit group in the mantissa matrix based on the number of leading zeros corresponding to each row of data.
[0116] The encoding module 804 is configured to encode the data to be encoded according to each bit group in the mantissa matrix to obtain target encoded data.
[0117] The above-mentioned embedded coding device performs a trapezoidal structure detection on the mantissa matrix, obtains the number of leading zeros corresponding to each row of data in the mantissa matrix, and obtains each bit group of the mantissa matrix based on the number of leading zeros. Therefore, the data in each bit group is the bit data that should be stored for each row of data during embedded coding. The data is encoded and stored in the form of a bit group. There is no need to store data in the traditional bit-plane-based manner. Each time a bit plane is formed, all data needs to be shifted once. The entire process only requires one shift operation for each row of data, which greatly reduces the complexity of data processing and effectively improves the coding rate of embedded coding.
[0118] In one embodiment, the structure detection module is further used to: perform turning point detection on each row of data in the mantissa matrix from bottom to top to obtain the turning points of the trapezoidal structure; and determine the number of leading zeros corresponding to each row of data in the mantissa matrix based on the detected turning points.
[0119] In one embodiment, the structure detection module is also used to: detect the most significant bit of each row of data in the mantissa matrix, obtain the position data of the most significant bit of each row and the bit group value of each row; compare the position data of the most significant bit of the current row with the bit group value of the previous row corresponding to the current row from bottom to top; if the position data of the most significant bit of the current row is greater than the bit group value of the previous row corresponding to the current row, then determine the most significant bit of the current row as the turning point of the trapezoidal structure, and record the bit group value of the current row.
[0120] In one embodiment, the bit group determination module is further used to: discard the leading zeros on the left side of each row of data based on the number of leading zeros corresponding to each row of data; determine the remaining data in each row of data as the bit groups of each row; and obtain each bit group in the mantissa matrix based on the bit groups of each row.
[0121] In one embodiment, the encoding module is further used to: encode the data to be encoded according to each bit group in the mantissa matrix to obtain the encoded data to be output; add additional mark data to the encoded data to be output according to the number of leading zeros corresponding to each row of data to obtain target encoded data, and the additional mark data is used to mark the number of leading zeros discarded in each row of data.
[0122] In one embodiment, the encoding module is also used to: determine the incremental data of the leading zeros discarded by each bit group based on the number of leading zeros corresponding to each row of data; and add incremental data at the corresponding position of the encoded data to be output based on the incremental data of the leading zeros discarded by each bit group to obtain the target encoded data.
[0123] Each module in the above-mentioned embedded coding device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the corresponding operations of each module.
[0124] In one embodiment, a computer device is provided. The computer device may be a server integrated with a coding tool, and its internal structure diagram may be as follows: Figure 9 As shown. The computer device includes a processor, a memory, and a network interface connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The database of the computer device is used to store data such as data to be encoded, a mantissa matrix, and the number of leading zeros. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, an embedded coding method is implemented.
[0125] Those skilled in the art will understand that Figure 9 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0126] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0127] Obtaining data to be encoded, and generating a mantissa matrix according to the data to be encoded;
[0128] Performing a trapezoidal structure detection on the mantissa matrix to obtain the number of leading zeros corresponding to each row of data in the mantissa matrix;
[0129] Obtaining each bit group in the mantissa matrix based on the number of leading zeros corresponding to each row of data;
[0130] The data to be encoded is encoded according to each bit group in the mantissa matrix to obtain target encoded data.
[0131] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0132] Performing turning point detection on each row of data in the mantissa matrix from bottom to top to obtain turning points of the trapezoidal structure;
[0133] The number of leading zeros corresponding to each row of data in the mantissa matrix is determined according to the detected turning points.
[0134] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0135] Detect the most significant bit of each row of data in the mantissa matrix to obtain the position data of the most significant bit of each row and the bit group value of each row;
[0136] Compare the position data of the most significant bit of the current row with the bit group value of the previous row corresponding to the current row from bottom to top;
[0137] If the position data of the most significant bit of the current row is greater than the bit group value of the previous row corresponding to the current row, the most significant bit of the current row is determined as the turning point of the trapezoidal structure, and the bit group value of the current row is recorded.
[0138] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0139] Based on the number of leading zeros corresponding to each row of data, the leading zeros on the left side of each row of data are discarded;
[0140] Determine the remaining data in each row of data as a bit group for each row;
[0141] Based on the bit groups in each row, each bit group in the mantissa matrix is obtained.
[0142] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0143] Encoding the data to be encoded according to each bit group in the mantissa matrix to obtain encoded data to be output;
[0144] According to the number of leading zeros corresponding to each row of data, additional marking data is added to the encoded data to be output to obtain target encoded data, where the additional marking data is used to mark the number of leading zeros discarded in each row of data.
[0145] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0146] Determining incremental data of leading zeros discarded by each bit group according to the number of leading zeros corresponding to each row of data;
[0147] Based on the incremental data of the leading zeros discarded by each of the bit groups, the incremental data is added to the corresponding position of the to-be-output coded data to obtain the target coded data.
[0148] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented:
[0149] Obtaining data to be encoded, and generating a mantissa matrix according to the data to be encoded;
[0150] Performing a trapezoidal structure detection on the mantissa matrix to obtain the number of leading zeros corresponding to each row of data in the mantissa matrix;
[0151] Obtaining each bit group in the mantissa matrix based on the number of leading zeros corresponding to each row of data;
[0152] The data to be encoded is encoded according to each bit group in the mantissa matrix to obtain target encoded data.
[0153] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0154] Performing turning point detection on each row of data in the mantissa matrix from bottom to top to obtain turning points of the trapezoidal structure;
[0155] The number of leading zeros corresponding to each row of data in the mantissa matrix is determined according to the detected turning points.
[0156] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0157] Detect the most significant bit of each row of data in the mantissa matrix to obtain the position data of the most significant bit of each row and the bit group value of each row;
[0158] Compare the position data of the most significant bit of the current row with the bit group value of the previous row corresponding to the current row from bottom to top;
[0159] If the position data of the most significant bit of the current row is greater than the bit group value of the previous row corresponding to the current row, the most significant bit of the current row is determined as the turning point of the trapezoidal structure, and the bit group value of the current row is recorded.
[0160] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0161] Based on the number of leading zeros corresponding to each row of data, the leading zeros on the left side of each row of data are discarded;
[0162] Determine the remaining data in each row of data as a bit group for each row;
[0163] Based on the bit groups in each row, each bit group in the mantissa matrix is obtained.
[0164] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0165] Encoding the data to be encoded according to each bit group in the mantissa matrix to obtain encoded data to be output;
[0166] According to the number of leading zeros corresponding to each row of data, additional marking data is added to the encoded data to be output to obtain target encoded data, where the additional marking data is used to mark the number of leading zeros discarded in each row of data.
[0167] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0168] Determining incremental data of leading zeros discarded by each bit group according to the number of leading zeros corresponding to each row of data;
[0169] Based on the incremental data of the leading zeros discarded by each of the bit groups, the incremental data is added to the corresponding position of the to-be-output coded data to obtain the target coded data.
[0170] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:
[0171] Obtaining data to be encoded, and generating a mantissa matrix according to the data to be encoded;
[0172] Performing a trapezoidal structure detection on the mantissa matrix to obtain the number of leading zeros corresponding to each row of data in the mantissa matrix;
[0173] Obtaining each bit group in the mantissa matrix based on the number of leading zeros corresponding to each row of data;
[0174] The data to be encoded is encoded according to each bit group in the mantissa matrix to obtain target encoded data.
[0175] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0176] Performing turning point detection on each row of data in the mantissa matrix from bottom to top to obtain turning points of the trapezoidal structure;
[0177] The number of leading zeros corresponding to each row of data in the mantissa matrix is determined according to the detected turning points.
[0178] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0179] Detect the most significant bit of each row of data in the mantissa matrix to obtain the position data of the most significant bit of each row and the bit group value of each row;
[0180] Compare the position data of the most significant bit of the current row with the bit group value of the previous row corresponding to the current row from bottom to top;
[0181] If the position data of the most significant bit of the current row is greater than the bit group value of the previous row corresponding to the current row, the most significant bit of the current row is determined as the turning point of the trapezoidal structure, and the bit group value of the current row is recorded.
[0182] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0183] Based on the number of leading zeros corresponding to each row of data, the leading zeros on the left side of each row of data are discarded;
[0184] Determine the remaining data in each row of data as a bit group for each row;
[0185] Based on the bit groups in each row, each bit group in the mantissa matrix is obtained.
[0186] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0187] Encoding the data to be encoded according to each bit group in the mantissa matrix to obtain encoded data to be output;
[0188] According to the number of leading zeros corresponding to each row of data, additional marking data is added to the encoded data to be output to obtain target encoded data, where the additional marking data is used to mark the number of leading zeros discarded in each row of data.
[0189] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0190] Determining incremental data of leading zeros discarded by each bit group according to the number of leading zeros corresponding to each row of data;
[0191] Based on the incremental data of the leading zeros discarded by each of the bit groups, the incremental data is added to the corresponding position of the to-be-output coded data to obtain the target coded data.
[0192] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0193] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, database or other media used in the embodiments provided in this application may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory may include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, distributed databases based on blockchains. The processor involved in the various embodiments provided herein may be, but are not limited to, a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, and the like.
[0194] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0195] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present application. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the spirit of the present application, and these modifications and improvements fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.
Claims
1. An embedded coding method, characterized in that: The method comprises: Obtaining data to be encoded, and generating a mantissa matrix according to the data to be encoded; Detecting the most significant bit of each row of data in the mantissa matrix to obtain position data of the most significant bit of each row and a bit group value of each row; the most significant bit refers to the significant bit with the highest weight in a binary digit, and the position data of the most significant bit is the position data of the most significant bit in the row of data from right to left; the bit group value refers to the number of elements contained in a bit group; Compare the position data of the most significant bit of the current row with the bit group value of the previous row corresponding to the current row from bottom to top; If the position data of the most significant bit of the current row is greater than the bit group value of the previous row corresponding to the current row, the most significant bit of the current row is determined as the turning point of the trapezoidal structure, and the bit group value of the current row is recorded; Determining the number of leading zeros corresponding to each row of data in the mantissa matrix according to each detected turning point; Obtaining each bit group in the mantissa matrix based on the number of leading zeros corresponding to each row of data; The data to be encoded is encoded according to each bit group in the mantissa matrix to obtain target encoded data.
2. The method according to claim 1, characterized in that The obtaining of each bit group in the mantissa matrix based on the number of leading zeros corresponding to each row of data includes: Based on the number of leading zeros corresponding to each row of data, the leading zeros on the left side of each row of data are discarded; Determine the remaining data in each row of data as a bit group for each row; Based on the bit groups in each row, each bit group in the mantissa matrix is obtained.
3. The method according to claim 1 or 2, characterized in that The step of encoding the data to be encoded according to each bit group in the mantissa matrix to obtain target encoded data includes: Encoding the data to be encoded according to each bit group in the mantissa matrix to obtain encoded data to be output; According to the number of leading zeros corresponding to each row of data, additional marking data is added to the encoded data to be output to obtain target encoded data, where the additional marking data is used to mark the number of leading zeros discarded in each row of data.
4. The method according to claim 3, characterized in that The step of adding additional marker data to the to-be-output coded data according to the number of leading zeros corresponding to each row of data to obtain target coded data includes: Determining incremental data of leading zeros discarded by each bit group according to the number of leading zeros corresponding to each row of data; Based on the incremental data of the leading zeros discarded by each of the bit groups, the incremental data is added to the corresponding position of the to-be-output coded data to obtain the target coded data.
5. An embedded coding device, characterized in that: The device comprises: A matrix generation module, configured to obtain data to be encoded and generate a mantissa matrix according to the data to be encoded; a structure detection module, for detecting the most significant bit of each row of data in the mantissa matrix, obtaining the position data of the most significant bit of each row and the bit group value of each row; the most significant bit refers to the valid bit with the highest weight in the binary digit, and the position data of the most significant bit is the position data of the most significant bit in the row data from right to left; the bit group value refers to the number of elements contained in a bit group; comparing the position data of the most significant bit of the current row with the bit group value of the previous row corresponding to the current row from bottom to top; if the position data of the most significant bit of the current row is greater than the bit group value of the previous row corresponding to the current row, determining the most significant bit of the current row as the turning point of the trapezoidal structure, and recording the bit group value of the current row; determining the number of leading zeros corresponding to each row of data in the mantissa matrix according to each detected turning point; a bit group determination module, configured to obtain each bit group in the mantissa matrix based on the number of leading zeros corresponding to each row of data; The encoding module is used to encode the data to be encoded according to each bit group in the mantissa matrix to obtain target encoded data.
6. The device according to claim 5, characterized in that The bit group determination module is further configured to: Based on the number of leading zeros corresponding to each row of data, discard the leading zeros on the left side of each row of data; and determine the remaining data in each row of data as a bit group for each row; Based on the bit groups in each row, each bit group in the mantissa matrix is obtained.
7. The device according to claim 5 or 6, characterized in that The encoding module is also used for: The data to be encoded is encoded according to each bit group in the mantissa matrix to obtain encoded data to be output; and additional marking data is added to the encoded data to be output according to the number of leading zeros corresponding to each row of data to obtain target encoded data, wherein the additional marking data is used to mark the number of leading zeros discarded in each row of data.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 4 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.
10. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Incremental upgrade method and device for embedded system
CN108170460A
Communication data processing method and device, equipment and storage medium
CN114499743A