A coding method, apparatus, device and storage medium

CN116015313BActive Publication Date: 2026-10-09SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310111341.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-10
Publication Date
2026-10-09
Estimated Expiration
2043-02-10

AI Technical Summary

Technical Problem

然而,经ANS算法编码,最终的生成的数字非常大,受制于计算机数据处理的位宽,软硬件难以处理如此大的数字

Benefits of technology

[0032] In this application, during the encoding stage, the encoded number and target threshold obtained after encoding the previous subsequence according to the asymmetric number system group coding method are first acquired; wherein, the target threshold is the upper limit of the number after encoding according to the asymmetric number system group coding method; then, based on the encoded number of the previous subsequence and the target threshold, the current subsequence is encoded according to the asymmetric number system group coding method to obtain the current encoded number, and the current encoded number is encapsulated according to the encoded number of the previous subsequence and the target threshold to obtain the current encoded number of the current subsequence; finally, the spatial redundancy of the encoded number of the previous subsequence is determined according to the target threshold of the previous subsequence, and the target threshold of the previous subsequence is expanded according to the spatial redundancy to obtain the updated target threshold, so as to determine the target threshold of the current subsequence. Each subsequence in this application is obtained based on the principle of group coding. When encoding the current subsequence, it is based on the encoded number and target threshold of the previous subsequence, and after encoding, the encoded number of the current subsequence is further encapsulated, while the target threshold of the current subsequence is updated according to the target threshold of the previous subsequence after expansion. It can eliminate spatial redundancy between subsequence encodings, making the encoding results easier for computers to process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116015313B_ABST
    Figure CN116015313B_ABST
Patent Text Reader

Abstract

The application relates to the computer technical field, and particularly discloses a coding and decoding method, a device, equipment and a storage medium, which comprises the following steps: obtaining an encoded number obtained by encoding a previous subsequence according to an asymmetric digital system grouping coding mode and a target threshold; encoding a current subsequence according to the asymmetric digital system grouping coding mode based on the encoded number of the previous subsequence and the target threshold to obtain a current encoded number, and encapsulating the current encoded number according to the encoded number of the previous subsequence and the target threshold to obtain the encoded number of the current subsequence; determining the spatial redundancy of the encoded number of the previous subsequence according to the target threshold of the previous subsequence, and performing expansion processing on the target threshold of the previous subsequence according to the spatial redundancy to obtain an updated target threshold, so that the updated target threshold is determined as the target threshold of the current subsequence. The spatial redundancy between the subsequence encoding can be eliminated, and the coding result is convenient for computer processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and in particular to an encoding / decoding method, apparatus, device, and storage medium. Background Technology

[0002] Entropy coding (or entropy encoding) is a lossless data compression scheme. The core idea of ​​entropy coding is to use fewer bits to represent frequently occurring symbols and more bits to represent rarely occurring elements. Huffman coding and arithmetic coding are two of the most common entropy coding methods. The Huffman coding algorithm is simple in principle, allocating code length based on the probability ordering of the symbol set. Huffman coding always uses integer bits to represent a symbol, and it encodes each symbol individually. Therefore, Huffman coding cannot guarantee optimal compression performance. Huffman coding produces the best results when the probabilities of all symbols are negative powers of 2. In Huffman coding, each occurrence of a symbol is always encoded into the same codeword. The advantage of Huffman coding is its fast encoding speed. From information theory, we know that the ideal codeword length of a single symbol is determined solely by the probability of the symbol's occurrence: code-length(x) = -log p(x) If the probability of a symbol occurring is 0.4, then the ideal codeword length is 1.32(-log). 0.4 Unfortunately, Huffman coding can only assign codewords of integer length, which is a major drawback of the Huffman coding algorithm. Arithmetic coding can solve this problem; it is another entropy coding technique. It encodes input data into a real number range between 0 and 1. As the input is encoded and the number of bits required to specify it increases, this range becomes smaller. Unlike Huffman coding, arithmetic coding uses almost exact probabilities, thus achieving compression rates close to the theoretical limit. However, the algorithm of arithmetic coding is also more complex. Furthermore, its coding efficiency is very low (roughly 1 / 10 of Huffman coding), and it is rarely used in data compression applications with high real-time requirements.

[0003] Therefore, a new algorithm, Asymmetric Numeral Systems (ANS), emerged, achieving a compression ratio close to that of arithmetic coding and a coding efficiency close to that of Huffman coding. Asymmetric Numeral Systems achieve a compression ratio comparable to arithmetic coding while possessing a processing speed similar to Huffman coding. However, the final generated numbers after encoding with the ANS algorithm are extremely large. Limited by the bit width of computer data processing, both hardware and software struggle to handle such large numbers. It can be said that achieving such "whole-packaging" ANS encoding and decoding is virtually impossible.

[0004] Therefore, the aforementioned technical problems urgently need to be solved by those skilled in the art. Summary of the Invention

[0005] In view of this, the purpose of this invention is to provide an encoding / decoding method, apparatus, device, and storage medium that can eliminate spatial redundancy between sub-sequence encodings, making the encoding results easier for computer processing. The specific solution is as follows:

[0006] The first aspect of this application provides an encoding / decoding method, comprising:

[0007] During the encoding phase, the encoded numbers and target thresholds are obtained after encoding the previous subsequence according to the asymmetric number system block coding method; wherein, the target threshold is the upper limit of the number after encoding according to the asymmetric number system block coding method.

[0008] The current subsequence is encoded using the coded number of the previous subsequence and the target threshold according to the asymmetric digital system block coding method to obtain the current coded number, and the current coded number is encapsulated according to the coded number of the previous subsequence and the target threshold to obtain the current coded number of the current subsequence.

[0009] The spatial redundancy of the encoded digits of the previous subsequence is determined based on the target threshold of the previous subsequence, and the target threshold of the previous subsequence is expanded based on the spatial redundancy to obtain the updated target threshold, so as to determine the target threshold of the current subsequence.

[0010] Optionally, the encoding / decoding method further includes:

[0011] Before encoding, the encoding bit width is set and the initial value of the target threshold is determined according to the first relation; the first relation is:

[0012] Thresh = 2 m ;

[0013] Where Thresh is the initial value of the target threshold, and m is the encoding bit width.

[0014] Optionally, the step of encapsulating the current encoded number based on the encoded number of the previous subsequence and the target threshold to obtain the encoded number of the current subsequence includes:

[0015] Calculate the difference between the current encoded number and the target threshold of the previous subsequence, and sum the difference with the encoded number of the previous subsequence.

[0016] The summation result is used as the encoded number for the current subsequence.

[0017] Optionally, determining the spatial redundancy of the encoded digits of the previous subsequence based on the target threshold of the previous subsequence includes:

[0018] The target threshold of the previous subsequence is calculated to determine the difference in the encoded digits of the previous subsequence, and the result of the difference calculation is determined as the spatial redundancy of the encoded digits of the previous subsequence.

[0019] Optionally, the step of expanding the target threshold of the previous subsequence based on the spatial redundancy to obtain the updated target threshold includes:

[0020] The target threshold of the previous subsequence is summed with the spatial redundancy, and the summation result is determined as the updated target threshold; wherein, the updated target threshold is the difference between the sum of the target thresholds of the two previous subsequences and the encoded number of the previous subsequence.

[0021] Optionally, the encoding / decoding method further includes:

[0022] During the decoding phase, the spatial redundancy of the encoded digits of the previous subsequence is obtained;

[0023] Based on the spatial redundancy and the encoded digits of the current subsequence, the initial decoding value corresponding to the current subsequence is determined, and the current subsequence is decoded according to the asymmetric digital system group decoding method based on the initial decoding value corresponding to the current subsequence.

[0024] Optionally, determining the initial decoding value corresponding to the current subsequence based on the spatial redundancy and the encoded digits of the current subsequence includes:

[0025] The spatial redundancy and the encoded digits of the current subsequence are summed, and the summation result is determined as the initial decoding value corresponding to the current subsequence.

[0026] A second aspect of this application provides an encoding / decoding apparatus, comprising:

[0027] The acquisition module is used during the encoding stage to acquire the encoded number and the target threshold obtained after encoding the previous subsequence according to the asymmetric number system block coding method; wherein, the target threshold is the upper limit of the number after encoding according to the asymmetric number system block coding method;

[0028] The encoding and encapsulation module is used to encode the current subsequence according to the coded number of the previous subsequence and the target threshold in the asymmetric digital system grouping encoding method to obtain the current coded number, and to encapsulate the current coded number according to the coded number of the previous subsequence and the target threshold to obtain the coded number of the current subsequence.

[0029] The redundancy elimination module is used to determine the spatial redundancy of the encoded digits of the previous subsequence based on the target threshold of the previous subsequence, and to expand the target threshold of the previous subsequence based on the spatial redundancy to obtain an updated target threshold, so as to determine the updated target threshold as the target threshold of the current subsequence.

[0030] A third aspect of this application provides an electronic device including a processor and a memory; wherein the memory is used to store a computer program, which is loaded and executed by the processor to implement the aforementioned encoding / decoding method.

[0031] A fourth aspect of this application provides a computer-readable storage medium storing computer-executable instructions, which, when loaded and executed by a processor, implement the aforementioned encoding / decoding method.

[0032] In this application, during the encoding stage, the encoded number and target threshold obtained after encoding the previous subsequence according to the asymmetric number system group coding method are first acquired; wherein, the target threshold is the upper limit of the number after encoding according to the asymmetric number system group coding method; then, based on the encoded number of the previous subsequence and the target threshold, the current subsequence is encoded according to the asymmetric number system group coding method to obtain the current encoded number, and the current encoded number is encapsulated according to the encoded number of the previous subsequence and the target threshold to obtain the current encoded number of the current subsequence; finally, the spatial redundancy of the encoded number of the previous subsequence is determined according to the target threshold of the previous subsequence, and the target threshold of the previous subsequence is expanded according to the spatial redundancy to obtain the updated target threshold, so as to determine the target threshold of the current subsequence. Each subsequence in this application is obtained based on the principle of group coding. When encoding the current subsequence, it is based on the encoded number and target threshold of the previous subsequence, and after encoding, the encoded number of the current subsequence is further encapsulated, while the target threshold of the current subsequence is updated according to the target threshold of the previous subsequence after expansion. It can eliminate spatial redundancy between subsequence encodings, making the encoding results easier for computers to process. Attached Figure Description

[0033] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0034] Figure 1 A flowchart of an encoding / decoding method provided in this application;

[0035] Figure 2 A schematic diagram of a specific encoding / decoding method provided in this application;

[0036] Figure 3 A flowchart of a specific encoding / decoding method provided in this application;

[0037] Figure 4 A schematic diagram of an encoding / decoding device structure is provided in this application;

[0038] Figure 5 This application provides a structural diagram of an electronic codec device. Detailed Implementation

[0039] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0040] Existing Asymmetric Number System (ANS) algorithms achieve compression rates comparable to arithmetic coding while maintaining processing speeds similar to Huffman coding. However, the final generated numbers after ANS encoding are extremely large, and due to the limited bit width of computer data processing, both hardware and software struggle to handle such large numbers. It is practically impossible to achieve such "whole-pack" ANS encoding and decoding. To address these technical shortcomings, this application provides an encoding and decoding scheme that eliminates spatial redundancy between encoded sub-sequences, making the encoded results easier for computers to process.

[0041] Figure 1 A flowchart illustrating an encoding / decoding method provided in an embodiment of this application. See also... Figure 1 As shown, the encoding / decoding method includes:

[0042] S11: In the encoding stage, obtain the encoded number and target threshold obtained after encoding the previous subsequence according to the asymmetric number system group coding method; wherein, the target threshold is the upper limit of the number after encoding according to the asymmetric number system group coding method.

[0043] In this embodiment, during the encoding phase, for each current subsequence, the encoded digits obtained by encoding the previous subsequence using the asymmetric digit system block coding method and the target threshold are first acquired. The target threshold is the upper limit of the digits encoded using the asymmetric digit system block coding method. The encoding method for each subsequence is consistent, while the target threshold is continuously updated.

[0044] To facilitate understanding, this embodiment will explain the principle of ANS:

[0045] Suppose we need to convert a set S of two symbols... i Encoding the symbol sequence ∈A={0,1} into a number num, first considering the standard binary number system, this symbol sequence can be encoded as num=∑S i ·2 i In this case, each symbol ("0" or "1") in the sequence occupies 1 bit. The bit width of the number num is n. Obviously, the binary number system ignores the frequency of occurrence of the two symbols (0, 1), that is, the binary number system is applicable to the case that conforms to a uniform distribution of (0, 1).

[0046] According to Shannon's information theory, assuming the probability distribution of each symbol in a sequence of symbols is {P1, P2, P3, ..., Pn}, then the average amount of information per symbol in the symbol set is:

[0047]

[0048] The amount of information contained in symbol S and the probability P of that symbol S Related log(1 / P) s The information content of the two symbols S1 and S2 combined is:

[0049]

[0050] Assuming natural numbers Therefore, the information content of x combined with S2 is:

[0051]

[0052] If the number x and the symbol s are combined and encoded into a natural number x′, then the formula for calculating x′ is as follows:

[0053]

[0054] Based on this, to facilitate the description of the ANS encoding and decoding process, two expressions are introduced as follows:

[0055] x′=C(x,s)

[0056] (x,s)=D(x′)

[0057] s is the current symbol, x is the current number, x' is the encoded number, C(~) represents the encoding algorithm, D(~) represents the decoding algorithm, and (x,s) is the decoded result.

[0058] formula The description of the encoding principle of natural numbers and (probability) symbols belongs to the local level. The encoding principle of natural numbers and symbol sequences is as follows: Suppose that the natural number x is combined with the symbol sequence [S1, S2, S3, ... Sn] to form an encoding, and the probability of each symbol is [P1, P2, P3, ... Pn].

[0059] x and S1 are combined to generate the natural number x1.

[0060] x1 and S2 are combined to generate the natural number x2.

[0061] x2 and S3 are combined to generate the natural number x3.

[0062] ...

[0063] Xn-1 and SN are combined to generate the natural number x. n ,

[0064] From a macroscopic perspective, the symbol sequence encoded using the ANS algorithm ultimately generates the number y:

[0065]

[0066] Clearly, the natural number y calculated from the above formula is an extremely large number. Due to the limitations of computer data processing bit width, both hardware and software struggle to handle such a large number. It's practically impossible to achieve this kind of "whole-pack" ANS encoding and decoding. In other words, a symbol sequence encoded using ANS would result in an extremely large natural number, which current mainstream computers cannot process, thus limiting the application scenarios of ANS.

[0067] Based on this, this embodiment divides the entire symbol sequence into several subsequences according to certain rules. These subsequences are then encoded using the ANS algorithm to generate several numbers. To ensure encoding consistency, the bit width of these numbers will be set to a fixed value (i.e., the value of the encoded number has an upper limit). The subsequence splitting rule is to ensure that the number generated by each subsequence after ANS encoding is as close as possible to the upper limit (not greater than the upper limit).

[0068] Specifically, before encoding, the initial value of x in each encoding group is fixed; in this embodiment, the initial value of x is set to 1. Then, the encoding bit width is set, which can be set to n = (16, 32, 64, 128), with each encoded number having the same bit width (upper limit). Next, the initial value of the target threshold is determined according to the first relational formula, that is, a threshold Thresh is set. This threshold is the upper limit of the encoded number, and obviously, this upper limit has the following relationship with the encoding bit width m:

[0069] Thresh=2 m ;

[0070] Wherein, Thresh is the initial value of the target threshold, and m is the encoding bit width.

[0071] S12: Based on the encoded number of the previous subsequence and the target threshold, encode the current subsequence according to the asymmetric numeral system grouped encoding method to obtain the current encoded number, and encapsulate the current encoded number according to the encoded number of the previous subsequence and the target threshold to obtain the encoded number of the current subsequence.

[0072] In this embodiment, after obtaining the encoded number obtained by encoding the previous subsequence and the target threshold, based on the encoded number of the previous subsequence and the target threshold, encode the current subsequence according to the asymmetric numeral system grouped encoding method to obtain the current encoded number, and encapsulate the current encoded number according to the encoded number of the previous subsequence and the target threshold to obtain the encoded number of the current subsequence.

[0073] In this embodiment, the specific process of encoding the current subsequence to obtain the current encoded number based on the encoded number of the previous subsequence and the target threshold according to the asymmetric numeral system grouped encoding method is as follows: calculating a difference between the current encoded number and the target threshold of the previous subsequence, and performing a summation calculation on the difference calculation result and the encoded number of the previous subsequence; determining the summation calculation result as the encoded number of the current subsequence.

[0074] Specifically, each symbol is extracted in natural order, and encoding is performed according to the encoding formula for encoding, assuming the current symbol is s, x′=C(x,s);

[0075] if x′<thresh, update the value of x, x=x′;

[0076] if x′≥thresh, the current x needs to be encoded and output with a bit width of m, and a set of ANS compressed data is obtained at this time.

[0077] At the same time, update the value of x to x=C(0,s) and start encoding the next subsequence.

[0078] On this basis, the current encoded number is encapsulated according to the encoded number of the previous subsequence and the target threshold to obtain the encoded number of the current subsequence. Specifically, the encapsulated value is Y+X n-1 -Thresh, where the current encoded number is Y, the target threshold of the previous subsequence is Thresh, and the encoded number of the previous subsequence is X n-1 .

[0079] S13: Determine the spatial redundancy of the encoded digits of the previous subsequence based on the target threshold of the previous subsequence, and expand the target threshold of the previous subsequence based on the spatial redundancy to obtain the updated target threshold, so as to determine the updated target threshold as the target threshold of the current subsequence.

[0080] In this embodiment, the spatial redundancy of the encoded digits of the previous subsequence is determined based on the target threshold of the previous subsequence. The target threshold of the previous subsequence is then expanded based on this spatial redundancy to obtain an updated target threshold, which is then used as the target threshold for the current subsequence. In the above grouped ANS encoding / decoding scheme, the ANS encoding results {X1, X2, ..., Xn} of each grouped subsequence are independent and have no dependency relationship. Since all elements in the set {X1, X2, ..., Xn} are less than the upper limit Thresh, the theoretical value space for each group is Thresh = 2. m However, each value is less than Thresh. From an information theory perspective, this grouped ANS encoding has redundancy in the value space, and this redundancy needs to be eliminated as much as possible.

[0081] Specifically, the target threshold of the previous subsequence is calculated, and the difference between the encoded digits of the previous subsequence is determined. The result of the difference calculation is determined as the spatial redundancy of the encoded digits of the previous subsequence. To solve the above spatial redundancy, the redundant space is quantized as Thresh-X. In this embodiment, the spatial redundancy of the previous set is applied to the encoding process of the next set of subsequences. The target threshold of the previous subsequence is summed with the spatial redundancy, and the summation result is determined as the updated target threshold. The updated target threshold is the difference between the sum of the target thresholds of the two previous subsequences and the encoded digits of the previous subsequence, as shown in the following formula:

[0082] Thresh n =Thresh + Thresh - X n-1 =2×Thresh-X n-1

[0083] The current subsequence number is encoded using ANS to generate a value no greater than Thresh. n Since the value of Y may be greater than Thresh, Y cannot be directly used for encapsulation encoding. The final calculated encapsulation value is Y+X. n-1 -Thresh, obviously X at this time n The value of will be less than Thresh. In summary, the scheme in this embodiment is similar to the CBC mode in block cipher mode; therefore, the above process is also based on ANS block coding in CBC mode.

[0084] Figure 2The diagram above illustrates the encoding process, and the corresponding grouping pseudocode is shown below:

[0085]

[0086] As can be seen, in the encoding stage of this application embodiment, the encoded number and target threshold obtained after encoding the previous subsequence according to the asymmetric number system group coding method are first obtained; wherein, the target threshold is the upper limit of the number after encoding according to the asymmetric number system group coding method; then, based on the encoded number of the previous subsequence and the target threshold, the current subsequence is encoded according to the asymmetric number system group coding method to obtain the current encoded number, and the current encoded number is encapsulated according to the encoded number of the previous subsequence and the target threshold to obtain the current encoded number of the current subsequence; finally, the spatial redundancy of the encoded number of the previous subsequence is determined according to the target threshold of the previous subsequence, and the target threshold of the previous subsequence is expanded according to the spatial redundancy to obtain the updated target threshold, so as to determine the updated target threshold as the target threshold of the current subsequence. In this application embodiment, each subsequence is obtained based on the principle of group coding. When encoding the current subsequence, it is based on the encoded number and target threshold of the previous subsequence, and after encoding, the encoded number of the current subsequence is further encapsulated, while the target threshold of the current subsequence is updated according to the target threshold of the previous subsequence after expansion. It can eliminate spatial redundancy between subsequence encodings, making the encoding results easier for computers to process.

[0087] Figure 3 A flowchart illustrating a specific encoding / decoding method provided in this application embodiment. See also... Figure 3 As shown, the encoding / decoding method includes:

[0088] S21: During the decoding stage, obtain the spatial redundancy of the encoded digits of the previous subsequence.

[0089] In this embodiment, the specific process of the encoding stage can be referred to the corresponding content disclosed in the previous embodiments, and will not be repeated here. During the decoding stage, when decoding the current subsequence, the spatial redundancy of the encoded numbers of the previous subsequence is first obtained.

[0090] S22: Determine the initial decoding value corresponding to the current subsequence based on the spatial redundancy and the encoded digit of the current subsequence, and decode the current subsequence according to the asymmetric digital system group decoding method based on the initial decoding value corresponding to the current subsequence.

[0091] In this embodiment, an initial decoding value corresponding to the current subsequence is determined based on the spatial redundancy and the encoded numbers of the current subsequence. Then, the current subsequence is decoded using an asymmetric digital system grouping decoding method based on this initial decoding value. Specifically, the spatial redundancy and the encoded numbers of the current subsequence are summed, and the summation result is determined as the initial decoding value corresponding to the current subsequence.

[0092] Specifically, assuming the entire symbol sequence, after being processed by the above block coding scheme, yields an encoding result of {X1, X2, ..., Xn}, a buffer is added during the decoding process to store data related to the previous subsequence. Assume the encoded number of the current subsequence is Xn, and the encoded number of the previous subsequence is X... n-1 Then the number stored in the cache is NUM. cache =Thresh-X n-1 When decoding the current subsequence, the initial number used is NUM. initial =NUM cache +X n =Thresh-X n-1 +X n .

[0093] The grouping pseudocode corresponding to the above process is shown below:

[0094]

[0095] The block coding scheme in this embodiment divides the entire symbol sequence into several subsequences, allowing small natural numbers to encode these subsequences. Since the encoded subsequences have a consistent bit width, they are easier for computers to process. Furthermore, although there are dependencies between the subsequences, these dependencies are only related to the output value (decoding input value) of the previous subsequence, allowing for parallel decoding.

[0096] See Figure 4 As shown in the figure, this application also discloses an encoding / decoding device, including:

[0097] The acquisition module 11 is used to acquire, during the encoding stage, the encoded number and the target threshold obtained after encoding the previous subsequence according to the asymmetric number system block coding method; wherein, the target threshold is the upper limit of the number after encoding according to the asymmetric number system block coding method;

[0098] The encoding and encapsulation module 12 is used to encode the current subsequence according to the coded number of the previous subsequence and the target threshold in the asymmetric digital system group coding method to obtain the current coded number, and to encapsulate the current coded number according to the coded number of the previous subsequence and the target threshold to obtain the coded number of the current subsequence.

[0099] The redundancy elimination module 13 is used to determine the spatial redundancy of the encoded digits of the previous subsequence based on the target threshold of the previous subsequence, and to expand the target threshold of the previous subsequence based on the spatial redundancy to obtain an updated target threshold, so as to determine the updated target threshold as the target threshold of the current subsequence.

[0100] As can be seen, in the encoding stage of this application embodiment, the encoded number and target threshold obtained after encoding the previous subsequence according to the asymmetric number system group coding method are first obtained; wherein, the target threshold is the upper limit of the number after encoding according to the asymmetric number system group coding method; then, based on the encoded number of the previous subsequence and the target threshold, the current subsequence is encoded according to the asymmetric number system group coding method to obtain the current encoded number, and the current encoded number is encapsulated according to the encoded number of the previous subsequence and the target threshold to obtain the current encoded number of the current subsequence; finally, the spatial redundancy of the encoded number of the previous subsequence is determined according to the target threshold of the previous subsequence, and the target threshold of the previous subsequence is expanded according to the spatial redundancy to obtain the updated target threshold, so as to determine the updated target threshold as the target threshold of the current subsequence. In this application embodiment, each subsequence is obtained based on the principle of group coding. When encoding the current subsequence, it is based on the encoded number and target threshold of the previous subsequence, and after encoding, the encoded number of the current subsequence is further encapsulated, while the target threshold of the current subsequence is updated according to the target threshold of the previous subsequence after expansion. It can eliminate spatial redundancy between subsequence encodings, making the encoding results easier for computers to process.

[0101] In some specific embodiments, the encoding and encapsulation module 12 specifically includes:

[0102] The first calculation unit is used to calculate the difference between the current coded number and the target threshold of the previous subsequence, and to sum the difference calculation result with the coded number of the previous subsequence.

[0103] The first determining unit is used to determine the summation result as the encoded number of the current subsequence.

[0104] In some specific embodiments, the encoding / decoding apparatus further includes:

[0105] The setting module is used to set the encoding bit width and determine the initial value of the target threshold according to a first relational expression before encoding; the first relational expression is:

[0106] Thresh = 2 m ;

[0107] Where Thresh is the initial value of the target threshold, and m is the encoding bit width.

[0108] In some specific embodiments, the redundancy elimination module 13 specifically includes:

[0109] The first calculation unit is used to calculate the difference between the target threshold of the previous subsequence and the encoded digit of the previous subsequence.

[0110] The second determining unit is used to determine the difference calculation result as the spatial redundancy of the encoded digits of the previous subsequence;

[0111] The third calculation unit is used to sum the target threshold of the previous subsequence with the spatial redundancy.

[0112] The third determining unit is used to determine the summation result as the updated target threshold; wherein, the updated target threshold is the difference between the sum of the target thresholds of the two preceding subsequences and the encoded digit of the preceding subsequence.

[0113] In some specific embodiments, the codec device is further used for:

[0114] During the decoding phase, the spatial redundancy of the encoded digits of the previous subsequence is obtained;

[0115] Based on the spatial redundancy and the encoded digits of the current subsequence, the initial decoding value corresponding to the current subsequence is determined, and the current subsequence is decoded according to the asymmetric digital system group decoding method based on the initial decoding value corresponding to the current subsequence.

[0116] Furthermore, embodiments of this application also provide an electronic device. Figure 5 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content of the diagram should not be construed as limiting the scope of this application.

[0117] Figure 5 This is a schematic diagram of the structure of an electronic device 20 provided in an embodiment of this application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 stores a computer program, which is loaded and executed by the processor 21 to at least implement the following steps:

[0118] During the encoding phase, the encoded numbers and target thresholds are obtained after encoding the previous subsequence according to the asymmetric number system block coding method; wherein, the target threshold is the upper limit of the number after encoding according to the asymmetric number system block coding method.

[0119] The current subsequence is encoded using the coded number of the previous subsequence and the target threshold according to the asymmetric digital system block coding method to obtain the current coded number, and the current coded number is encapsulated according to the coded number of the previous subsequence and the target threshold to obtain the current coded number of the current subsequence.

[0120] The spatial redundancy of the encoded digits of the previous subsequence is determined based on the target threshold of the previous subsequence, and the target threshold of the previous subsequence is expanded based on the spatial redundancy to obtain the updated target threshold, so as to determine the target threshold of the current subsequence.

[0121] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and is not specifically limited here; the input / output interface 25 is used to acquire external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.

[0122] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or optical disk, etc. The resources stored thereon can include operating system 221, computer program 222 and data 223, etc., and the storage method can be temporary storage or permanent storage.

[0123] The operating system 221 manages and controls the various hardware devices on the electronic device 20 and the computer program 222 to enable the processor 21 to perform calculations and processing on the massive data 223 in the memory 22. It can be Windows Server, Netware, Unix, Linux, etc. The computer program 222, in addition to including a computer program capable of performing the encoding / decoding methods disclosed in any of the foregoing embodiments, may further include computer programs capable of performing other specific tasks. The data 223 may include encoded numbers and target thresholds collected by the electronic device 20.

[0124] Furthermore, embodiments of this application also disclose a storage medium storing a computer program, which, when loaded and executed by a processor, performs at least the following steps:

[0125] During the encoding phase, the encoded numbers and target thresholds are obtained after encoding the previous subsequence according to the asymmetric number system block coding method; wherein, the target threshold is the upper limit of the number after encoding according to the asymmetric number system block coding method.

[0126] The current subsequence is encoded using the coded number of the previous subsequence and the target threshold according to the asymmetric digital system block coding method to obtain the current coded number, and the current coded number is encapsulated according to the coded number of the previous subsequence and the target threshold to obtain the current coded number of the current subsequence.

[0127] The spatial redundancy of the encoded digits of the previous subsequence is determined based on the target threshold of the previous subsequence, and the target threshold of the previous subsequence is expanded based on the spatial redundancy to obtain the updated target threshold, so as to determine the target threshold of the current subsequence.

[0128] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.

[0129] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0130] The encoding / decoding method, apparatus, device, and storage medium provided by the present invention have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. An encoding / decoding method, characterized in that, include: During the encoding phase, the encoded numbers and target thresholds are obtained after encoding the previous subsequence according to the asymmetric number system block coding method; wherein, the target threshold is the upper limit of the number after encoding according to the asymmetric number system block coding method; The current subsequence is encoded using the coded number of the previous subsequence and the target threshold according to the asymmetric digital system block coding method to obtain the current coded number, and the current coded number is encapsulated according to the coded number of the previous subsequence and the target threshold to obtain the current coded number of the current subsequence. The spatial redundancy of the encoded digits of the previous subsequence is determined based on the target threshold of the previous subsequence, and the target threshold of the previous subsequence is expanded based on the spatial redundancy to obtain the updated target threshold, so as to determine the updated target threshold as the target threshold of the current subsequence. The step of encapsulating the current encoded number based on the encoded number of the previous subsequence and the target threshold to obtain the encoded number of the current subsequence includes: Calculate the difference between the current encoded number and the target threshold of the previous subsequence, and sum the difference with the encoded number of the previous subsequence. The summation result is used as the encoded number for the current subsequence; The step of determining the spatial redundancy of the encoded digits of the previous subsequence based on the target threshold of the previous subsequence includes: Calculate the target threshold of the previous subsequence and determine the difference in the encoded digits of the previous subsequence; The difference calculation result is determined as the spatial redundancy of the encoded digits of the previous subsequence; The step of expanding the target threshold of the previous subsequence based on the spatial redundancy to obtain the updated target threshold includes: The target threshold of the previous subsequence is summed with the spatial redundancy, and the summation result is determined as the updated target threshold; wherein, the updated target threshold is the difference between the sum of the target thresholds of the two previous subsequences and the encoded number of the previous subsequence.

2. The encoding / decoding method according to claim 1, characterized in that, Also includes: Before encoding, the encoding bit width is set and the initial value of the target threshold is determined according to the first relation; the first relation is: Thresh=2 m ; Where Thresh is the initial value of the target threshold, and m is the encoding bit width.

3. The encoding / decoding method according to claim 1 or 2, characterized in that, Also includes: During the decoding phase, the spatial redundancy of the encoded digits of the previous subsequence is obtained; Based on the spatial redundancy and the encoded digits of the current subsequence, the initial decoding value corresponding to the current subsequence is determined, and the current subsequence is decoded according to the asymmetric digital system group decoding method based on the initial decoding value corresponding to the current subsequence.

4. The encoding / decoding method according to claim 3, characterized in that, The step of determining the initial decoding value corresponding to the current subsequence based on the spatial redundancy and the encoded digits of the current subsequence includes: The spatial redundancy and the encoded digits of the current subsequence are summed, and the summation result is determined as the initial decoding value corresponding to the current subsequence.

5. A codec device, characterized in that, include: The acquisition module is used during the encoding stage to acquire the encoded number and the target threshold obtained after encoding the previous subsequence according to the asymmetric number system block coding method; wherein, the target threshold is the upper limit of the number after encoding according to the asymmetric number system block coding method; The encoding and encapsulation module is used to encode the current subsequence according to the coded number of the previous subsequence and the target threshold in the asymmetric digital system grouping encoding method to obtain the current coded number, and to encapsulate the current coded number according to the coded number of the previous subsequence and the target threshold to obtain the coded number of the current subsequence. The redundancy elimination module is used to determine the spatial redundancy of the encoded digits of the previous subsequence based on the target threshold of the previous subsequence, and to expand the target threshold of the previous subsequence based on the spatial redundancy to obtain an updated target threshold, so as to determine the updated target threshold as the target threshold of the current subsequence. Specifically, the encoding and encapsulation module is used to calculate the difference between the current encoded number and the target threshold of the previous subsequence, and to sum the difference calculation result with the encoded number of the previous subsequence; the sum calculation result is determined as the encoded number of the current subsequence. Specifically, the redundancy elimination module is used to calculate the target threshold of the previous subsequence and determine the difference between the encoded numbers of the previous subsequence; and to determine the spatial redundancy of the encoded numbers of the previous subsequence based on the difference calculation result; wherein, the step of expanding the target threshold of the previous subsequence based on the spatial redundancy to obtain the updated target threshold includes: summing the target threshold of the previous subsequence with the spatial redundancy, and determining the summation result as the updated target threshold; wherein, the updated target threshold is the difference between the sum of the target thresholds of the two previous subsequences and the encoded numbers of the previous subsequence.

6. An electronic device, characterized in that, The electronic device includes a processor and a memory; wherein the memory is used to store a computer program, which is loaded and executed by the processor to implement the encoding / decoding method as described in any one of claims 1 to 4.

7. A computer-readable storage medium, characterized in that, Used to store computer-executable instructions, which, when loaded and executed by a processor, implement the encoding / decoding method as described in any one of claims 1 to 4.

Citation Information

Patent Citations

  • Communication method and system based on IEC61850 model and electronic equipment

    CN114268675A

  • Multi-context entropy coding for graph compression

    CN115104305A