CN115801021A - ANS (answer System) grouping coding and decoding method, computer equipment and storage medium - Google Patents
ANS (answer System) grouping coding and decoding method, computer equipment and storage medium Download PDFInfo
- Publication number
- CN115801021A CN115801021A CN202211180870.2A CN202211180870A CN115801021A CN 115801021 A CN115801021 A CN 115801021A CN 202211180870 A CN202211180870 A CN 202211180870A CN 115801021 A CN115801021 A CN 115801021A
- Authority
- CN
- China
- Prior art keywords
- coding
- ans
- symbol
- decoding
- sequence
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Landscapes
- Compression, Expansion, Code Conversion, And Decoders (AREA)
Abstract
The invention provides an ANS grouping coding and decoding method, computer equipment and a storage medium, wherein the method comprises an ANS coding method and an ANS decoding method; during encoding, setting a coding bit width n, setting a threshold Thresh, wherein the bit width of each coding digit is equal; extracting each symbol according to a natural sequence, and coding according to a coding formula; according to the grouping rule and the coding symbol sequence, obtaining a plurality of numbers with the bit width of n after the coding is finished; during decoding, each number is sequentially extracted, and each symbol is sequentially analyzed according to a decoding formula; splicing all the subsequences according to a natural sequence to obtain a whole symbol sequence; the subsequence can be encoded by small natural numbers, and the digital bit width obtained by encoding the subsequence is consistent, so that the processing of a computer is facilitated. In addition, since each self-sequence is independently encoded, no dependency exists, and decoding can be performed in parallel during decoding.
Description
Technical Field
The invention relates to the technical field of computers, in particular to an ANS (automatic System bus) grouping coding and decoding method, computer equipment and a storage medium.
Background
Entropy coding (or entropy coding) is a lossless data compression scheme. The core idea of entropy coding is to represent the frequently occurring symbols with fewer bits (bits) and the less frequently occurring elements with more bits (bits).
Huffman coding and arithmetic coding are the two most common entropy coding methods. Huffman coding is an entropy coding technique developed by David a. The algorithm principle of Huffman coding is simple, and the code length is distributed based on the probability sequencing of a symbol set. Huffman coding always uses integer bits to represent a symbol and it codes each symbol separately. The huffman code does not guarantee the best compression effect. Huffman coding produces the best results when the probability of all symbols is a negative integer power of 2. In a huffman code, each occurrence of a symbol is always encoded into the same codeword. The advantage of huffman coding is that the coding rate is fast.
As can be seen from the information theory, the ideal codeword length of a single symbol is determined only by the occurrence probability of the symbol: code-length (x) = -log p(x) If the probability of occurrence of one symbol is 0.4, the ideal codeword length is 1.32 (-log) 0.4 ) Unfortunately, however, huffman coding assigns code words that are only integer in length. This is also the pain point of the Huffman coding algorithm.
Arithmetic coding, which is another entropy coding technique, can solve this pain point of Huffman coding. It encodes the input data as a real number interval between 0 and 1. As the input is encoded and the number of bits required to specify it increases, the interval becomes smaller, and the arithmetic encoding uses almost exact probabilities unlike the huffman encoding, so it achieves a compression rate close to the theoretical limit. However, the algorithmic principles of arithmetic coding are also more complex. And the coding efficiency is very low (approximately 1/10 of Huffman coding), and the method is rarely applied to the field of data compression with higher real-time requirement.
As such, in recent years, many researchers have sought a new algorithm that "compression rate approaches arithmetic coding and coding efficiency approaches Huffman coding". 2009, jarekdda proposed an Asymmetric digital Systems (ANS) that, according to jarekdda's parlance, achieves compression rate comparable to arithmetic coding while having a similar processing rate to Huffman coding. However, due to the bit width of computer data processing, software and hardware are difficult to process such large numbers, which limits the application scenarios of ANS.
Disclosure of Invention
In view of this, the present invention provides an ANS block coding and decoding method, a computer device, and a storage medium, which solve the technical problem in the background art by changing the implementation form of ANS coding, splitting the entire symbol sequence into a plurality of subsequences according to a certain rule, and encoding the subsequences by an ANS algorithm to generate a plurality of numbers.
In view of the above objects, in one aspect, the present invention provides an ANS block coding and decoding method, including an ANS coding method and an ANS decoding method, wherein the ANS coding method includes the following steps:
setting a coding bit width n, wherein the bit width of each coding digit is equal, setting a threshold value Thresh, and the relationship between the threshold value Thresh and the coding bit width n is as follows: thresh =2 n ;
Extracting each symbol according to a natural sequence, and coding according to a coding formula;
according to the grouping rule and the coding symbol sequence, obtaining a plurality of numbers with the bit width of n after the coding is finished;
wherein the ANS decoding method comprises the steps of:
extracting each digit in turn, and resolving each symbol in turn according to a decoding formula;
and splicing all the subsequences according to a natural sequence to obtain the whole symbol sequence.
As a further aspect of the present invention, in each set of codes, the initial value of the current number x is a fixed value.
As a further scheme of the present invention, extracting each symbol according to a natural order, and when coding according to a coding formula, the method further comprises:
setting the current symbol to s, x' = C (x, s);
if x '< thresh, update the value of x, x = x';
if x' > = thresh, outputting the current x code, wherein the bit width is x, and obtaining a group of ANS compressed data;
update the value of x to x = C (0,s); the next sub-sequence encoding is turned on.
As a further scheme of the present invention, each symbol (x, s) = D (x') is sequentially analyzed according to a decoding formula, s is a solved character, and x is an updated value;
if x is greater than 0, resolving the symbol and updating the value of x;
if x =0, stopping the analysis to obtain a subsequence, and arranging the subsequences in a reverse order.
As a further aspect of the present invention, the ANS packet coding and decoding method is further configured to split the entire symbol column into a plurality of subsequences according to rules, and generate a plurality of digits after the subsequences are encoded by an ANS algorithm, where a bit width of the digits is set as a fixed value.
As a further aspect of the present invention, the ANS block coding and decoding method performs coding and decoding satisfying the following conditions:
generating a number after the symbol sequence is subjected to ANS coding, and reversely analyzing the number by a decoding end to obtain the whole sequence;
the intermediate number x can only correspond to one symbol in the encoding and decoding process;
C(x,s 1 )≠C(x,s 2 ) Even if the probabilities of s1, s2 are equal (p) 1 =p 2 ) The same holds true, where C () represents the algorithm of the encoding;
C(x 1 ,s)≠C(x 2 ,s),C(x 1 ,s m )≠C(x 2 ,s n );
for any x and s, x ≠ C (x, s).
As a further aspect of the present invention, an ANS decoded data formula is constructed based on the mathematical principle of an ANS, wherein the mathematical principle of the ANS is: the calculation formula of combining the number x and the symbol s into a natural number x ', x' is as follows
In yet another aspect of the present invention, there is also provided a computer apparatus comprising a memory and a processor, the memory having stored therein a computer program which, when executed by the processor, performs any one of the ANS packet coding and decoding methods according to the present invention described above.
In still another aspect of the present invention, there is also provided a computer-readable storage medium storing computer program instructions which, when executed, implement any of the above ANS packet coding and decoding methods according to the present invention.
Compared with the traditional implementation mode, the invention has the following main advantages:
the ANS grouping coding and decoding method, the computer equipment and the storage medium divide the whole symbol sequence into a plurality of subsequences according to rules, generate a plurality of numbers after the subsequences are coded by an ANS algorithm, and set the bit width of the numbers as a fixed value. After the whole symbol sequence is divided into a plurality of subsequences, the subsequences can be coded by small natural numbers, and the digital bit widths obtained by coding the subsequences are consistent, so that the processing of a computer is facilitated. In addition, since each self-sequence is independently encoded, no dependency exists, and decoding can be performed in parallel during decoding.
These and other aspects of the present application will be more readily apparent from the following description of the embodiments. It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other embodiments can be obtained by using the drawings without creative efforts.
In the figure:
fig. 1 is a flowchart of ANS decoding in the ANS block coding and decoding method of the present invention;
fig. 2 is a flowchart of an ANS codec operation in the ANS packet codec method of the present invention;
FIG. 3 is a flow chart of ANS decoding in the ANS block coding and decoding method of the present invention;
fig. 4 is a schematic diagram of an embodiment of a computer readable storage medium for implementing an ANS block coding and decoding method according to the present invention;
fig. 5 is a schematic hardware structure diagram of an embodiment of a computer device for implementing an ANS block coding and decoding method according to the present invention;
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the following embodiments of the present invention are described in further detail with reference to the accompanying drawings.
It should be noted that all expressions using "first" and "second" in the embodiments of the present invention are used for distinguishing two non-identical entities with the same name or different parameters, and it is understood that "first" and "second" are only used for convenience of expression and should not be construed as limiting the embodiments of the present invention. Moreover, the terms "comprises" and "comprising," as well as any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements does not include other steps or elements inherent in the present invention.
In order to make the objects, technical solutions and advantages of the present invention more apparent, the following embodiments of the present invention are described in further detail with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
Since entropy coding (or entropy coding) is a lossless data compression scheme. The core idea of entropy coding is to achieve compression by representing frequently occurring symbols with fewer bits (bits) and rarely occurring elements with more bits (bits).
In the above formula, P (x) refers to the statistical frequency of the symbol x, and L (x) is the code length allocated by the symbol x of the entropy coding algorithm.
Huffman coding and arithmetic coding are the two most common entropy coding methods, which will be briefly described below. Huffman coding is an entropy coding technique developed by David a. The algorithm principle of the Huffman coding is simple, and the code length is distributed based on the probability sequencing of the symbol set. Huffman coding always uses integer bits to represent a symbol and it codes each symbol separately. The huffman code does not guarantee the best compression result. Huffman coding produces the best results when the probability of all symbols is a negative integer power of 2. In a huffman code, each occurrence of a symbol is always encoded into the same codeword. The advantage of huffman coding is that the coding rate is fast.
As can be seen from the information theory, the ideal codeword length of a single symbol is determined only by the occurrence probability of the symbol: code-length (x) = -log p(x) If the probability of occurrence of one symbol is 0.4, the ideal codeword length is 1.32 (-log) 0.4 ) Unfortunately, huffman coding assigns code word lengths that can only be integers. This is also the pain point of the Huffman coding algorithm.
Arithmetic coding, which is another entropy coding technique, can solve this pain point of Huffman coding. It encodes the input data as a real number interval between 0 and 1. As the input is encoded and the number of bits required to specify it increases, the interval becomes smaller, and the arithmetic encoding uses almost exact probabilities unlike huffman encoding, so it achieves a compression rate close to the theoretical limit. However, the algorithmic principles of arithmetic coding are also more complex. And the coding efficiency is very low (approximately 1/10 of Huffman coding), and the method is rarely applied to the field of data compression with higher real-time requirement.
As such, in recent years, many researchers have sought a new algorithm that "compression rate approaches arithmetic coding and coding efficiency approaches Huffman coding". 2009, jarekdda proposed an Asymmetric digital Systems (ANS) that, according to jarekdda's parlance, achieves compression rate comparable to arithmetic coding while having a similar processing rate to Huffman coding. However, such large numbers are difficult to handle by software and hardware due to the bit width of computer data processing.
The ANS mathematical principle is as follows:
suppose that a symbol set S consisting of two symbols is required i A symbol sequence formed by e a = {0,1} is encoded as one number num, and considering a standard binary digit system first, the symbol sequence can be encoded as num = ∑ S i ·2 i At this time, each symbol ("0" or "1") in the sequence occupies 1 bit. Bit width n of the number num. Obviously, the binary digital system ignores the occurrence frequency of two symbols (0,1), i.e. the binary digital system is suitable for the case of even distribution (0,1).
As known from Shannon information theory, the probability distribution of each symbol in a symbol sequence is assumed to be { P } 1 ,P 2 ,P 3 ,……,P n Then the average information amount per symbol (amount of information) of the symbol set is:
the amount of information contained in the symbol S and the probability P of the symbol S Log of correlation (1/P) s ). Two symbols S 1 S 2 The amount of information combined is
JarekDuda further contemplates the mathematical relationship of the above equation: combining the number x and the symbol s together to code into a natural number x ', the calculation formula of x' is as follows:
the above is the basic mathematical principle of the ANS. The ANS encodes a string of symbol sequences as natural numbers, similar to the principle of AC (arithmetic coding) algorithms.
In fact, the calculation formula shown in (3) cannot be directly used for ANS coding, and for convenience of describing the coding and decoding process of ANS, the invention introduces two expressions as follows:
s is the current symbol, x is the current number, x' is the number after encoding, C (-) represents the encoding algorithm, and D (-) represents the decoding algorithm. (x, s) the decoded result.
Formula (3) describes the principle of natural number and (probability) symbol coding, and belongs to the local level. The natural number and the symbol sequence are coded according to the following principle that the natural number x and the symbol sequence S are assumed to be coded 1 ,S 2 ,S 3 ,……S n ,]Composite coding with a probability of each symbol being respectively [ P 1 ,P 2 ,P 3 ,……Pn]。
……
From a macroscopic perspective, the symbol sequence is encoded by the ANS algorithm, and the resulting generated number y:
it is obvious that the natural number calculated by the expression (5) is a very large number. Such large numbers are difficult to handle by software and hardware, subject to the bit width of computer data processing. It can be said that it is almost impossible to implement such "integrally packed" ANS codecs.
After the symbol sequence is encoded by the ANS, a very natural number can be obtained, and the current mainstream computer cannot process the large number, so that the application scene of the ANS is limited. In order to solve this problem,
therefore, the invention provides an ANS grouping coding and decoding method, computer equipment and a storage medium, wherein two expressions are introduced for describing the coding and decoding process of the ANS, and the expressions are as follows:
s is the current symbol, x is the current number, x' is the encoded number, C () represents the encoded algorithm, and D () represents the decoded result of the decoding algorithm (x, s).
The whole symbol sequence is divided into a plurality of subsequences according to a certain rule, the subsequences are encoded by an ANS algorithm to generate a plurality of numbers, and the bit width of the numbers is set to be a fixed value for the encoding consistency (namely, the value of the encoded numbers has a fixed value).
A feasible ANS codec scheme, which needs to satisfy the following conditions:
1. the symbol sequence is ANS encoded to generate a number, and the decoding end reversely analyzes the number to obtain the whole sequence.
2. The intermediate number x (state) in the encoding and decoding process can only correspond to one symbol.
3.C(x,s 1 )≠C(x,s 2 ) Even if s 1 ,s 2 Are equal in probability (p) 1 =p 2 ) This is still true.
4.C(x 1 ,s)≠C(x 2 ,s),C(x 1 ,s m )≠C(x 2 ,s n )。
5. For any x and s, x ≠ C (x, s).
Therefore, in an embodiment of the present invention, an ANS packet coding and decoding method is provided, including an ANS coding method and an ANS decoding method, where, referring to fig. 1 and fig. 2, the ANS coding method includes the following steps:
s1, setting a coding bit width n, setting a threshold Thresh, wherein the bit width of each coding digit is equal;
s2, extracting each symbol according to a natural sequence, and coding according to a coding formula;
s3, obtaining a plurality of numbers with the bit width of n after the coding is finished according to the grouping rule and the coding symbol sequence;
as shown in fig. 3, the ANS decoding method includes the following steps:
s10, extracting each digit in sequence, and analyzing each symbol in sequence according to a decoding formula;
and S20, splicing all the subsequences according to a natural sequence to obtain the whole symbol sequence.
In the embodiment of the present invention, the relationship between the threshold Thresh and the coding bit width n is: thresh =2 n 。
In each set of codes, the initial value of the current number x is a fixed value. The fixed value is preferably 1.
In the embodiment of the present invention, each symbol is extracted according to a natural order, and when encoding according to an encoding formula, the method further includes:
setting the current symbol as s, x' = C (x, s);
if x '< thresh, update the value of x, x = x';
if x' > = thresh, outputting the current x code, wherein the bit width is x, and obtaining a group of ANS compressed data;
update the value of x to x = C (0,s); the next sub-sequence compilation is started.
In the embodiment of the present invention, each symbol (x, s) = D (x') is sequentially analyzed according to a decoding formula, s is a solved character, and x is an updated value;
if x is greater than 0, resolving the symbol and updating the value of x;
if x =0, the analysis is stopped, a subsequence is obtained, and the subsequences are arranged in reverse order.
In an embodiment of the present invention, the ANS packet coding and decoding method is further configured to split the entire symbol column into a plurality of subsequences according to a rule, and generate a plurality of digits after the subsequences are encoded by an ANS algorithm, where bit width of the digits is set as a fixed value.
The ANS grouping coding and decoding method executes coding and decoding and meets the following conditions:
generating a number after the symbol sequence is subjected to ANS coding, and reversely analyzing the number by a decoding end to obtain the whole sequence;
the intermediate number x can only correspond to one symbol in the encoding and decoding process;
C(x,s 1 )≠C(x,s 2 ) Even if the probabilities of s1, s2 are equal (p) 1 =p 2 ) And the same holds, wherein C () represents the encoding algorithm;
C(x 1 ,s)≠C(x 2 ,s),C(x 1 ,s m )≠C(x 2 ,s n );
for any x and s, x ≠ C (x, s).
In this embodiment, the data formula of the ANS decoding is constructed based on the mathematical principle of the ANS, wherein the mathematical principle of the ANS is as follows: combining the number x and the symbol s into a natural number x ', x'Is calculated by the formula
The ANS grouping coding and decoding method can improve the data compression effect.
Need to explain: the patent only changes the application mode of ANS, and the grouping mode is irrelevant to the ANS algorithm form represented by the formula (4) and is suitable for any ANS coding algorithm.
When ANS block coding is carried out, in each group of codes, the initial value of x is a fixed value, and the initial value of x in the scheme is 1;
setting a code bit width n (16, 32,64,128), wherein the bit width of each code number is equal;
setting a threshold Thresh, which is an upper limit of the coded number, and obviously, the upper limit has the following relation with the coded bit width n: thresh =2 n ;
Extracting each symbol according to a natural sequence, and coding according to a coding formula in a formula (4): assuming that the current symbol is s, x' = C (x, s);
if x '< thresh, update the value of x, x = x';
if x' > = thresh, the current x code needs to be output, the bit width is x, and then a group of ANS compressed data is obtained;
at the same time, the value of x is updated to x = C (0,s); the next sub-sequence encoding is turned on.
Grouping according to the above rules, and encoding the symbol sequence. After the encoding is completed, several numbers with bit width n will be obtained, and these numbers are assumed to be { X 1 ,X 2 ,…,X n }。
During decoding, extracting each number in sequence, and analyzing each symbol (x, s) = D (x') in sequence according to a decoding formula, wherein s is a decoded character, and x is an updated value;
if x >0, the ready to resolve symbol and update the value of x;
if x =0, the parsing is stopped, a subsequence is obtained at this time, and the subsequences are arranged in reverse order.
And splicing all the subsequences according to a natural sequence to obtain the whole symbol sequence.
It should be understood that although the steps are described above in a certain order, the steps are not necessarily performed in the order described. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, some steps of the present embodiment may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of performing the steps or stages is not necessarily sequential, but may be performed alternately or in turns with other steps or at least a part of the steps or stages in other steps.
It should be noted that, the pseudo code of the encoding process is:
it should be noted that the ANS decoding pseudo code is:
in a third aspect of the embodiments of the present invention, there is further provided a computer device 400 comprising a memory 420 and a processor 410, the memory having stored therein a computer program which, when executed by the processor, implements the method of any one of the above embodiments, including an ANS encoding method and an ANS decoding method, wherein the ANS encoding method comprises the steps of:
setting a coding bit width n, setting the bit width of each coding digit to be equal, and setting a threshold Thresh;
extracting each symbol according to a natural sequence, and coding according to a coding formula;
according to the grouping rule and the coding symbol sequence, obtaining a plurality of numbers with the bit width of n after the coding is finished;
wherein the ANS decoding method comprises the steps of:
extracting each number in turn, and resolving each symbol in turn according to a decoding formula;
and splicing all the subsequences according to a natural sequence to obtain the whole symbol sequence.
Fig. 5 is a schematic hardware structure diagram of an embodiment of a computer device for executing an ANS block coding and decoding method according to the present invention. Taking the computer device 400 shown in fig. 5 as an example, the computer device includes a processor 410 and a memory 420, and may further include: an input device 430 and an output device 440. The processor 410, the memory 420, the input device 430, and the output device 440 may be connected by a bus or other means, such as the bus connection in fig. 5. Input device 430 may receive input numeric or character information and generate signal inputs related to ANS packet codecs. The output device 440 may include a display device such as a display screen.
The memory 420 is a non-volatile computer readable storage medium, and can be used to store non-volatile software programs, non-volatile computer executable programs, and modules, such as program instructions/modules corresponding to the ANS packet coding and decoding method in the embodiments of the present application. The memory 420 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created by use of an ANS packet codec method, and the like. Further, the memory 420 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some embodiments, memory 420 may optionally include memory located remotely from processor 410, which may be connected to local modules via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The processor 410 executes the non-volatile software programs, instructions and modules stored in the memory 420 to perform various functional applications and data processing of the server, that is, the ANS packet coding method including the ANS coding method and the ANS decoding method, which implement the above method embodiments, wherein the ANS coding method includes the following steps:
setting a coding bit width n, setting the bit width of each coding digit to be equal, and setting a threshold Thresh;
extracting each symbol according to a natural sequence, and coding according to a coding formula;
according to the grouping rule and the coding symbol sequence, obtaining a plurality of numbers with the bit width of n after the coding is finished;
wherein the ANS decoding method comprises the steps of:
extracting each number in turn, and resolving each symbol in turn according to a decoding formula;
and splicing all the subsequences according to a natural sequence to obtain the whole symbol sequence.
In a fourth aspect of the embodiment of the present invention, a computer-readable storage medium is further provided, and fig. 4 is a schematic diagram of the computer-readable storage medium of the ANS packet coding and decoding method provided in the embodiment of the present invention. As shown in fig. 4, the computer-readable storage medium 300 stores computer program instructions 310, the computer program instructions 310 being executable by a processor. The computer program instructions 310 when executed implement a method of any of the above embodiments, comprising an ANS encoding method and an ANS decoding method, wherein the ANS encoding method comprises the steps of:
setting a coding bit width n, setting a threshold Thresh, wherein the bit width of each coding digit is equal;
extracting each symbol according to a natural sequence, and coding according to a coding formula;
according to the grouping rule and the coding symbol sequence, obtaining a plurality of numbers with the bit width of n after the coding is finished;
wherein the ANS decoding method comprises the steps of:
extracting each number in turn, and resolving each symbol in turn according to a decoding formula;
and splicing all the subsequences according to a natural sequence to obtain the whole symbol sequence.
It is to be understood that all of the embodiments, features and advantages set forth above with respect to the ANS packet codec method according to the present invention are equally applicable to the ANS packet codec system and storage medium according to the present invention without conflict therebetween.
Finally, it should be noted that the computer-readable storage medium (e.g., memory) herein can be either volatile memory or nonvolatile memory, or can include both volatile and nonvolatile memory. By way of example, and not limitation, nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM), which can act as external cache memory. By way of example and not limitation, RAM may be available in a variety of forms such as synchronous RAM (DRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchlink DRAM (SLDRAM), and Direct Rambus RAM (DRRAM). The storage devices of the disclosed aspects are intended to comprise, without being limited to, these and other suitable types of memory.
The ANS grouping coding and decoding method, the computer equipment and the storage medium divide the whole symbol sequence into a plurality of subsequences according to rules, generate a plurality of numbers after the subsequences are coded by an ANS algorithm, and set the bit width of the numbers as a fixed value. After the whole symbol sequence is divided into a plurality of subsequences, the subsequences can be coded by small natural numbers, and the digital bit widths obtained by coding the subsequences are consistent, so that the processing of a computer is facilitated. In addition, since each self-sequence is independently encoded, no dependency exists, and decoding can be performed in parallel during decoding.
The foregoing is an exemplary embodiment of the present disclosure, but it should be noted that various changes and modifications could be made herein without departing from the scope of the present disclosure as defined by the appended claims. The functions, steps and/or actions of the method claims in accordance with the disclosed embodiments described herein need not be performed in any particular order. Furthermore, although elements of the disclosed embodiments of the invention may be described or claimed in the singular, the plural is contemplated unless limitation to the singular is explicitly stated.
It should be understood that, as used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly supports the exception. It should also be understood that "and/or" as used herein is meant to include any and all possible combinations of one or more of the associated listed items. The numbers of the embodiments disclosed in the above embodiments of the present invention are merely for description, and do not represent the advantages or disadvantages of the embodiments.
Those of ordinary skill in the art will understand that: the discussion of any embodiment above is meant to be exemplary only, and is not intended to intimate that the scope of the disclosure, including the claims, of embodiments of the invention is limited to these examples; within the idea of an embodiment of the invention, also combinations between technical features in the above embodiments or in different embodiments are possible, and there are many other variations of the different aspects of the embodiments of the invention as described above, which are not provided in detail for the sake of brevity. Therefore, any omissions, modifications, substitutions, improvements, and the like that may be made without departing from the spirit and principles of the embodiments of the present invention are intended to be included within the scope of the embodiments of the present invention.
Claims (9)
1. An ANS packet coding/decoding method comprising an ANS coding method and an ANS decoding method, wherein the ANS coding method comprises the steps of:
setting a coding bit width n, setting a threshold Thresh, wherein the bit width of each coding digit is equal;
extracting each symbol according to a natural sequence, and coding according to a coding formula;
according to the grouping rule and the coding symbol sequence, obtaining a plurality of numbers with the bit width of n after the coding is finished;
wherein the ANS decoding method comprises the steps of:
extracting each number in turn, and resolving each symbol in turn according to a decoding formula;
and splicing all the subsequences according to a natural sequence to obtain the whole symbol sequence.
2. An ANS packet coding/decoding method according to claim 1, wherein the relation between the threshold Thresh and the coding bit width n is: thresh =2 n 。
3. The ANS block coding/decoding method according to claim 2, wherein an initial value of a current number x in each group coding is a fixed value.
4. The ANS block coding/decoding method according to claim 2, wherein each symbol is extracted in a natural order, and when coded according to a coding formula, further comprising:
setting the current symbol as s, x' = C (x, s);
if x '< thresh, update the value of x, x = x';
if x' > = thresh, outputting the current x code, wherein the bit width is x, and obtaining a group of ANS compressed data;
update the value of x to x = C (0,s); the next sub-sequence coding is started.
5. The ANS block coding/decoding method according to claim 4, wherein each symbol (x, s) = D (x') is sequentially parsed according to a decoding formula, s is a decoded character, and x is an updated value;
if x is greater than 0, resolving the symbol in readiness and updating the value of x;
if x =0, the analysis is stopped, a subsequence is obtained, and the subsequences are arranged in reverse order.
6. The ANS packet codec of claim 1, further configured to regularly split a sequence of entire symbols into subsequences, wherein the subsequences are encoded by an ANS algorithm to generate numbers, and wherein bit widths of the numbers are set to fixed values.
8. A computer device comprising a memory and a processor, the memory having stored therein a computer program, wherein the computer program, when executed by the processor, performs an ANS packet codec method as claimed in any one of claims 1 to 7.
9. A computer readable storage medium storing computer program instructions, characterized in that the computer program instructions, when executed, implement the ANS packet coding and decoding method of any one of claims 1-7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211180870.2A CN115801021A (en) | 2022-09-27 | 2022-09-27 | ANS (answer System) grouping coding and decoding method, computer equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211180870.2A CN115801021A (en) | 2022-09-27 | 2022-09-27 | ANS (answer System) grouping coding and decoding method, computer equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115801021A true CN115801021A (en) | 2023-03-14 |
Family
ID=85432239
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211180870.2A Pending CN115801021A (en) | 2022-09-27 | 2022-09-27 | ANS (answer System) grouping coding and decoding method, computer equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115801021A (en) |
-
2022
- 2022-09-27 CN CN202211180870.2A patent/CN115801021A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9454552B2 (en) | Entropy coding and decoding using polar codes | |
JP4786796B2 (en) | Entropy code mode switching for frequency domain audio coding | |
US11722148B2 (en) | Systems and methods of data compression | |
US7623047B2 (en) | Data sequence compression | |
JP3083730B2 (en) | System and method for compressing data information | |
JP2002533005A (en) | Codebook construction for variable-length to variable-length entropy coding | |
CN110021369B (en) | Gene sequencing data compression and decompression method, system and computer readable medium | |
CN109474281B (en) | Data encoding and decoding method and device | |
WO2019076177A1 (en) | Gene sequencing data compression preprocessing, compression and decompression method, system, and computer-readable medium | |
CN114513210B (en) | State selection method, system, storage medium and device for finite state entropy coding | |
US9698819B1 (en) | Huffman code generation | |
Maruyama et al. | Fully online grammar compression in constant space | |
CN114301468A (en) | FSE encoding method, device, equipment and storage medium | |
CN109981108B (en) | Data compression method, decompression method, device and equipment | |
CN115765755A (en) | ANS coding and decoding method, equipment and medium based on finite field multiplication | |
Ferragina et al. | Compression boosting in optimal linear time using the Burrows-Wheeler transform | |
CN116366071A (en) | Packaging method, packaging system, storage medium and packaging equipment based on ANS (analog to digital) coding | |
CN115801021A (en) | ANS (answer System) grouping coding and decoding method, computer equipment and storage medium | |
US7683809B2 (en) | Advanced lossless bit coding | |
US7193542B2 (en) | Digital data compression robust relative to transmission noise | |
CN112612762B (en) | Data processing method and related equipment | |
CN114429200A (en) | Standardized Huffman coding and decoding method and neural network computing chip | |
US10931303B1 (en) | Data processing system | |
US9843341B1 (en) | Methods and devices for sparse data compression through dimension coding | |
CN115776302A (en) | Novel ANS encoding and decoding method, computer equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |