CN116015313A - Encoding and decoding method, device, equipment and storage medium - Google Patents

Encoding and decoding method, device, equipment and storage medium Download PDF

Info

Publication number
CN116015313A
CN116015313A CN202310111341.5A CN202310111341A CN116015313A CN 116015313 A CN116015313 A CN 116015313A CN 202310111341 A CN202310111341 A CN 202310111341A CN 116015313 A CN116015313 A CN 116015313A
Authority
CN
China
Prior art keywords
sequence
target threshold
coding
sub
previous
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
Application number
CN202310111341.5A
Other languages
Chinese (zh)
Inventor
张永兴
吴睿振
孙华锦
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shandong Yunhai Guochuang Cloud Computing Equipment Industry Innovation Center Co Ltd
Original Assignee
Shandong Yunhai Guochuang Cloud Computing Equipment Industry Innovation Center Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Shandong Yunhai Guochuang Cloud Computing Equipment Industry Innovation Center Co Ltd filed Critical Shandong Yunhai Guochuang Cloud Computing Equipment Industry Innovation Center Co Ltd
Priority to CN202310111341.5A priority Critical patent/CN116015313A/en
Publication of CN116015313A publication Critical patent/CN116015313A/en
Pending legal-status Critical Current

Links

Images

Abstract

The application relates to the technical field of computers, and particularly discloses a coding and decoding method, a device, equipment and a storage medium, wherein the coding and decoding method comprises the following steps: acquiring a coded number and a target threshold value, which are obtained after the previous subsequence is coded according to an asymmetric digital system block coding mode; coding the current subsequence according to an asymmetric digital system block coding mode based on the coding number of the previous subsequence and a target threshold value to obtain a current coding number, and packaging the current coding number according to the coding number of the previous subsequence and the target threshold value to obtain the coding number of the current subsequence; and determining the spatial redundancy of the code number of the previous sub-sequence according to the target threshold of the previous sub-sequence, and expanding the target threshold of the previous sub-sequence according to the spatial redundancy to obtain an updated target threshold so as to determine the updated target threshold as the target threshold of the current sub-sequence. Spatial redundancy between sub-sequence codes can be eliminated, so that the coding result is convenient for computer processing.

Description

Encoding and decoding method, device, equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a coding and decoding method, device, apparatus, and storage medium.
Background
Entropy coding (or entropy coding) is a lossless data compression scheme. The core idea of entropy coding is by using lessThe frequently occurring symbols are represented by more bits (bits) representing less frequently occurring elements. Huffman coding and arithmetic coding are two most common entropy coding methods, the Huffman coding algorithm is simple in principle, and the code length is distributed based on probability ordering of symbol sets. Huffman coding always uses integer bits to represent one symbol and it encodes each symbol separately. So that the huffman code cannot guarantee an optimal compression effect. Huffman coding yields the best result when the probabilities of all symbols are negative integer powers of 2. In huffman codes, each occurrence of a symbol is always encoded into the same codeword. The Huffman coding has the advantage of fast coding rate. From the theory of information, the ideal codeword length of a single symbol is determined only by the probability of occurrence of the symbol: code-length (x) = -log p(x) If the probability of occurrence of one symbol is 0.4, then the ideal codeword length is 1.32 (-log) 0.4 ). Unfortunately, however, the code word length allocated by Huffman coding can only be an integer, which is also a pain point of Huffman coding algorithms. Arithmetic coding can solve this pain point of huffman coding, which is another entropy coding technique. It encodes the input data into a real 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 arithmetic coding uses almost precise probabilities unlike huffman coding, so it achieves a compression rate close to the theoretical limit. However, the algorithm principle of arithmetic coding is also more complex. The coding efficiency is very low (approximately 1/10 of that of Huffman coding), and the method has few applications in the field of data compression with high real-time requirements.
As such, a new algorithm Asymmetric Numeral Systems (ANS, asymmetric digital system) of "compression rate is close to arithmetic coding and coding efficiency is close to Huffman coding" has been developed, and the asymmetric digital system achieves a compression rate comparable to arithmetic coding while having a processing rate similar to Huffman coding. However, encoded by the ANS algorithm, the resulting number is very large, subject to bit width of computer data processing, and such large numbers are difficult for software and hardware to process. It can be said that it is almost impossible to implement such an ANS codec of "integral packing".
Accordingly, the above technical problems are to be solved by those skilled in the art.
Disclosure of Invention
In view of the above, an object of the present invention is to provide a coding and decoding method, apparatus, device and storage medium, which can eliminate spatial redundancy between sub-sequence codes, so that the coding result is convenient for computer processing. The specific scheme is as follows:
a first aspect of the present application provides a codec method, including:
in the encoding stage, an encoding number and a target threshold value obtained after encoding the previous subsequence according to an asymmetric digital system block encoding mode are obtained; the target threshold is a digital upper limit after coding according to an asymmetric digital system block coding mode;
coding the current subsequence according to an asymmetric digital system block coding mode based on the coding number of the previous subsequence and a target threshold value to obtain a current coding number, and packaging the current coding number according to the coding number of the previous subsequence and the target threshold value to obtain the coding number of the current subsequence;
and determining the spatial redundancy of the code number of the previous sub-sequence according to the target threshold of the previous sub-sequence, and expanding the target threshold of the previous sub-sequence according to the spatial redundancy to obtain an updated target threshold so as to determine the updated target threshold as the target threshold of the current sub-sequence.
Optionally, the encoding and decoding method further includes:
before encoding, setting an encoding bit width and determining an initial value of a target threshold according to a first relation; the first relation is:
Thresh=2 m
wherein Thresh is the initial value of the target threshold, and m is the code bit width.
Optionally, the encapsulating the current coding number according to the coding number of the previous sub-sequence and the target threshold value to obtain the coding number of the current sub-sequence includes:
calculating the difference value between the current coding number and the target threshold value of the previous subsequence, and summing the difference value calculation result and the coding number of the previous subsequence;
the result of the summation calculation is determined as the number of codes of the current sub-sequence.
Optionally, the determining the spatial redundancy of the coded numbers of the previous sub-sequence according to the target threshold of the previous sub-sequence includes:
calculating a target threshold of a previous sub-sequence to determine a difference value of the coded numbers of the previous sub-sequence, and determining the difference value calculation result as the spatial redundancy of the coded numbers of the previous sub-sequence.
Optionally, the expanding the target threshold of the previous sub-sequence according to the spatial redundancy to obtain an updated target threshold includes:
carrying out summation calculation on the target threshold value of the previous subsequence and the spatial redundancy, and determining the summation calculation result as an updated target threshold value; wherein the updated target threshold is the difference between the sum of the target thresholds of two previous sub-sequences and the code number of the previous sub-sequence.
Optionally, the encoding and decoding method further includes:
in the decoding phase, obtaining the spatial redundancy of the coded numbers of the previous sub-sequence;
and determining a decoding initial value corresponding to the current sub-sequence according to the spatial redundancy and the coding number of the current sub-sequence, and decoding the current sub-sequence according to an asymmetric digital system block decoding mode based on the decoding initial value corresponding to the current sub-sequence.
Optionally, the determining the decoding initial value corresponding to the current sub-sequence according to the spatial redundancy and the coding number of the current sub-sequence includes:
and carrying out summation calculation on the spatial redundancy and the coding number of the current sub-sequence, and determining the summation calculation result as a decoding initial value corresponding to the current sub-sequence.
A second aspect of the present application provides a codec device, including:
the acquisition module is used for acquiring the coded number and the target threshold value obtained after the previous subsequence is coded according to the asymmetric digital system block coding mode in the coding stage; the target threshold is a digital upper limit after coding according to an asymmetric digital system block coding mode;
the coding and packaging module is used for coding the current subsequence according to an asymmetric digital system block coding mode based on the coding number of the previous subsequence and a target threshold value to obtain a current coding number, and packaging the current coding number according to the coding number of the previous subsequence and the target threshold value to obtain the coding number of the current subsequence;
and the redundancy elimination module is used for determining the spatial redundancy of the coding number of the previous sub-sequence according to the target threshold value of the previous sub-sequence, and expanding the target threshold value of the previous sub-sequence according to the spatial redundancy to obtain an updated target threshold value so as to determine the updated target threshold value as the target threshold value of the current sub-sequence.
A third aspect of the present application provides an electronic device comprising a processor and a memory; wherein the memory is for storing a computer program that is loaded and executed by the processor to implement the aforementioned codec method.
A fourth aspect of the present application provides a computer readable storage medium having stored therein computer executable instructions that, when loaded and executed by a processor, implement the foregoing codec method.
In the application, in the encoding stage, firstly, an encoding number and a target threshold value obtained after encoding a previous subsequence according to an asymmetric digital system block encoding mode are obtained; the target threshold is a digital upper limit after coding according to an asymmetric digital system block coding mode; then coding the current subsequence according to an asymmetric digital system block coding mode based on the coding number of the previous subsequence and a target threshold value to obtain a current coding number, and packaging the current coding number according to the coding number of the previous subsequence and the target threshold value to obtain the coding number of the current subsequence; and finally, determining the spatial redundancy of the coding number of the previous sub-sequence according to the target threshold of the previous sub-sequence, and expanding the target threshold of the previous sub-sequence according to the spatial redundancy to obtain an updated target threshold so as to determine the updated target threshold as the target threshold of the current sub-sequence. Each sub-sequence in the application is obtained based on the principle of block coding, when the current sub-sequence is coded, the coding number of the current sub-sequence is further packaged after being coded based on the coding number of the previous sub-sequence and the target threshold value, and meanwhile, the target threshold value of the current sub-sequence is updated according to the target threshold value after the previous sub-sequence is amplified. Spatial redundancy between sub-sequence codes can be eliminated, so that the coding result is convenient for computer processing.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only embodiments of the present invention, and that other drawings can be obtained according to the provided drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flowchart of a coding and decoding method provided in the present application;
FIG. 2 is a schematic diagram of a specific codec method provided in the present application;
FIG. 3 is a flowchart of a specific coding and decoding method provided in the present application;
fig. 4 is a schematic structural diagram of a codec device provided in the present application;
fig. 5 is a block diagram of a codec electronic device provided in the present application.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The existing asymmetric digital system ANS algorithm achieves a compression rate comparable to arithmetic coding while having a processing rate similar to huffman coding. However, encoded by the ANS algorithm, the resulting number is very large, subject to bit width of computer data processing, and such large numbers are difficult for software and hardware to process. It can be said that it is almost impossible to implement such an ANS codec of "integral packing". Aiming at the technical defects, the application provides a coding and decoding scheme which can eliminate the space redundancy between sub-sequence codes, so that the coding result is convenient for computer processing.
Fig. 1 is a flowchart of a coding and decoding method provided in an embodiment of the present application. Referring to fig. 1, the encoding and decoding method includes:
s11: in the encoding stage, an encoding number and a target threshold value obtained after encoding the previous subsequence according to an asymmetric digital system block encoding mode are obtained; the target threshold is a digital upper limit after coding according to an asymmetric digital system block coding mode.
In this embodiment, in the encoding stage, for each current sub-sequence, the encoding number and the target threshold value obtained after encoding the previous sub-sequence according to the asymmetric digital system block encoding mode are obtained. The target threshold is a digital upper limit after coding according to an asymmetric digital system block coding mode. The coding mode of each sub-sequence is consistent, and the target threshold value is updated continuously.
For ease of understanding, the present embodiment discusses the principles of the ANS:
suppose that it is necessary to combine one set S of two symbols i The symbol sequence formed by e a= {0,1} is encoded into a number num, which can be encoded into num= Σsconsidering first the standard binary digital system i ·2 i At this point, each symbol ("0" or "1") in the sequence occupies 1 bit. The bit width n of the number num. Obviously binary digit system neglectThe frequency of occurrence of the two symbols (0, 1) is omitted, i.e. the binary digital system is suitable for the case of conforming to a uniform distribution of (0, 1).
As known from shannon information theory, assuming that the probability distribution of each symbol in a symbol sequence is { P1, P2, P3, … …, pn }, the average information amount (amount of information) of each symbol in the symbol set is:
Figure BDA0004077887420000061
the amount of information contained in a symbol S and the probability P of the symbol S Correlation log (1/P) s ). Two symbols S 1 、S 2 The amount of information taken together is:
Figure BDA0004077887420000062
assuming natural numbers
Figure BDA0004077887420000063
Then x and S 2 The amount of information bound together is:
Figure BDA0004077887420000064
combining the number x and the symbol s into a natural number x 'is encoded, and then the calculation formula of x' is as follows:
Figure BDA0004077887420000065
on this basis, for convenience in describing the codec flow of an ANS, two expressions are introduced as follows:
x′=C(x,s)
(x,s)=D(x′)
s is the current symbol, x is the current number, x' is the number after encoding, C (to) represents the algorithm of encoding, D (to) represents the decoding algorithm, and (x, s) is the result after decoding.
Formula (VI)
Figure BDA0004077887420000066
Describing the principle of natural number and (probability) symbol coding, it belongs to the local layer. The natural number and the symbol sequence are encoded by the following principle that the natural number x and the symbol sequence [ S1, S2, S3, … … Sn ] are assumed]Synthetic coding, the probability of each symbol is [ P1, P2, P3, … … Pn, respectively]。
Generating natural number x by synthesizing and encoding x and S1 1
Figure BDA0004077887420000067
Generating natural number x by synthesizing and encoding x1 and S2 2
Figure BDA0004077887420000068
Generating natural number x by x2 and S3 synthetic coding 3
Figure BDA0004077887420000069
……
Synthetic coding of Xn-1 and SN to generate natural number x n
Figure BDA00040778874200000610
From a macroscopic point of view, the symbol sequence is encoded by an ANS algorithm, and the final generated number is y:
Figure BDA0004077887420000071
it is apparent that the natural number y calculated from the above equation is a very large number. Such large numbers are difficult to process by software and hardware due to the bit width of computer data processing. It can be said that it is almost impossible to implement such an ANS codec of "integral packing". In other words, the symbol sequence is encoded by the ANS to obtain a very natural number, and the current mainstream computer cannot process such a large number, which limits the application scenario of the ANS.
Based on this, the present embodiment splits the whole symbol sequence into a plurality of sub-sequences according to a certain rule, encodes the sub-sequences by an ANS algorithm to generate a plurality of digits, and for the uniformity of encoding, the bit widths of the digits will be set to a fixed value (i.e., there is an upper limit on the value of the encoded digits). The splitting rule of the subsequence is as follows: ensuring that each subsequence is encoded by an ANS to generate a number as close to (not greater than) the upper limit as possible.
Specifically, before encoding, in each group of encoding, the initial value of x is a fixed value, and in this embodiment, the initial value of x is set to 1. Then, the code bit width is set, which may be set to n= (16, 32,64, 128), and the bit width of each code number is equal (upper limit). Then, the initial value of the target threshold is determined according to the first relation, namely, a threshold Thresh is set, the threshold is the upper limit of the coded number, and obviously, the upper limit has the following relation with the coded bit width m:
Thresh=2 m
wherein Thresh is the initial value of the target threshold, and m is the code bit width.
S12: and encoding the current sub-sequence according to an asymmetric digital system block coding mode based on the encoding number of the previous sub-sequence and the target threshold value to obtain a current encoding number, and encapsulating the current encoding number according to the encoding number of the previous sub-sequence and the target threshold value to obtain the encoding number of the current sub-sequence.
In this embodiment, after the code number and the target threshold value obtained after the coding of the previous sub-sequence are obtained, the current sub-sequence is coded according to the asymmetric digital system block coding mode based on the code number and the target threshold value of the previous sub-sequence to obtain the current code number, and the current code number is packaged according to the code number and the target threshold value of the previous sub-sequence to obtain the code number of the current sub-sequence.
In this embodiment, the specific process of encoding the current sub-sequence to obtain the current encoded number according to the asymmetric digital system block encoding mode based on the encoded number of the previous sub-sequence and the target threshold value is as follows: calculating the difference value between the current coding number and the target threshold value of the previous subsequence, and summing the difference value calculation result and the coding number of the previous subsequence; the result of the summation calculation is determined as the number of codes of the current sub-sequence.
Specifically, each symbol is extracted according to a natural sequence, and a coding formula is adopted
Figure BDA0004077887420000081
Coding, 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 m, and a set of ANS compressed data is obtained.
At the same time, the value of x is updated to x=c (0, s), and the next sub-sequence encoding is turned on.
On the basis, the current coding number is packaged according to the coding number of the previous sub-sequence and the target threshold value to obtain the coding number of the current sub-sequence. Specifically, the package value is Y+X n-1 Thresh, the current code number being Y, the target threshold value for the preceding subsequence being Thresh, the code number for the preceding subsequence being X n-1
S13: and determining the spatial redundancy of the code number of the previous sub-sequence according to the target threshold of the previous sub-sequence, and expanding the target threshold of the previous sub-sequence according to the spatial redundancy to obtain an updated target threshold so as to determine the updated target threshold as the target threshold of the current sub-sequence.
In this embodiment, the spatial redundancy of the code number of the previous sub-sequence is determined according to the target threshold of the previous sub-sequence, and the target threshold of the previous sub-sequence is expanded according to the spatial redundancy to obtain an updated target threshold, so as to determine the updated target threshold as the target threshold of the current sub-sequence. In the above-mentioned packet ANS codec scheme, ANS coding results { X1, X2, …, xn } of the respective packet sub-sequences are not present independently of each otherIn the dependency relationship, all elements in the { X1, X2, …, xn } set are smaller than the upper value threshold. Theoretical value space of each group is thresh=2 m However, each value is smaller than Thresh, and from the point of view of information theory, there is a value space redundancy in such packet ANS coding, and it is necessary to eliminate such redundancy as much as possible.
Specifically, calculating a target threshold of a previous subsequence and determining a difference value of coded numbers of the previous subsequence; the difference calculation is determined as said spatial redundancy of the coded number of the previous sub-sequence. In order to solve the above spatial redundancy, the redundant space is quantized into Thresh-X, the embodiment applies the spatial redundancy of the previous group to the coding flow of the next group of subsequences, performs summation calculation on the target threshold of the previous subsequence and the spatial redundancy, and determines the summation calculation result as the updated target threshold; wherein the updated target threshold is the difference between the sum of the target thresholds of two previous subsequences and the code number of the previous subsequence, and the formula is as follows:
Thresh n =Thresh+Thresh-X n-1 =2×Thresh-X n-1
the current subsequence number is ANS encoded to generate a sequence no greater than Thresh n Since the value of Y may be greater than Thresh, Y cannot be directly used for encapsulation encoding, and the final calculated encapsulation value is Y+X n-1 Thresh, obviously at this point X n Will be less than Thresh. Comprehensive analysis, the scheme of this embodiment resembles the CBC mode in the block encryption mode, and thus the above procedure is also ANS block coding based on the CBC mode.
Fig. 2 is a schematic diagram of the above encoding process, and the corresponding packet pseudo codes are as follows:
Figure BDA0004077887420000091
in the encoding stage, the encoding number and the target threshold value obtained after encoding the previous subsequence according to the asymmetric digital system block encoding mode are obtained; the target threshold is a digital upper limit after coding according to an asymmetric digital system block coding mode; then coding the current subsequence according to an asymmetric digital system block coding mode based on the coding number of the previous subsequence and a target threshold value to obtain a current coding number, and packaging the current coding number according to the coding number of the previous subsequence and the target threshold value to obtain the coding number of the current subsequence; and finally, determining the spatial redundancy of the coding number of the previous sub-sequence according to the target threshold of the previous sub-sequence, and expanding the target threshold of the previous sub-sequence according to the spatial redundancy to obtain an updated target threshold so as to determine the updated target threshold as the target threshold of the current sub-sequence. Each sub-sequence in the embodiment of the application is obtained based on the principle of block coding, when the current sub-sequence is coded, the coding number of the current sub-sequence is further packaged after being coded based on the coding number of the previous sub-sequence and the target threshold value, and meanwhile, the target threshold value of the current sub-sequence is updated according to the target threshold value after the previous sub-sequence is amplified. Spatial redundancy between sub-sequence codes can be eliminated, so that the coding result is convenient for computer processing.
Fig. 3 is a flowchart of a specific coding and decoding method according to an embodiment of the present application. Referring to fig. 3, the codec method includes:
s21: in the decoding stage, spatial redundancy of the coded numbers of the previous sub-sequence is obtained.
In this embodiment, for the specific process of the encoding stage, reference may be made to the corresponding content disclosed in the foregoing embodiment, and no further description is given here. In the decoding stage, when the current sub-sequence is decoded, the spatial redundancy of the coded number of the previous sub-sequence is acquired first.
S22: and determining a decoding initial value corresponding to the current sub-sequence according to the spatial redundancy and the coding number of the current sub-sequence, and decoding the current sub-sequence according to an asymmetric digital system block decoding mode based on the decoding initial value corresponding to the current sub-sequence.
In this embodiment, a decoding initial value corresponding to the current sub-sequence is determined according to the spatial redundancy and the coding number of the current sub-sequence, and the current sub-sequence is decoded according to an asymmetric digital system block decoding mode based on the decoding initial value corresponding to the current sub-sequence. Specifically, the spatial redundancy and the coding number of the current sub-sequence are summed, and the result of the summation calculation is determined as a decoding initial value corresponding to the current sub-sequence.
Specifically, assuming that the whole symbol sequence is subjected to the block coding scheme to obtain a coding result { X1, X2, …, xn }, a buffer is added in the decoding process, and the buffer is used for storing data related to the data of the previous sub-sequence. Assuming that the coding number of the current sub-sequence is Xn, the coding number of the previous sub-sequence is X n-1 Then the number stored in the buffer is NUM cache =Thresh-X n-1 . When decoding the current sub-sequence, the initial number used is NUM initial =NUM cache +X n =Thresh-X n-1 +X n
The packet pseudo code corresponding to the above procedure is as follows:
Figure BDA0004077887420000111
the block coding scheme of this embodiment splits the entire symbol sequence into several sub-sequences so that the sub-sequences can be encoded with small natural numbers. Because the subsequence codes obtain the consistent digital bit width, the method is convenient for computer processing. In addition, although each sub-sequence has a dependency relationship, it has an association relationship with only the output value (decoded input value) of the preceding group of sub-sequences, and parallel decoding is possible as in decoding.
Referring to fig. 4, the embodiment of the present application further correspondingly discloses a codec device, including:
the obtaining module 11 is configured to obtain, in an encoding stage, an encoding number and a target threshold value obtained after encoding a previous sub-sequence according to an asymmetric digital system block encoding manner; the target threshold is a digital upper limit after coding according to an asymmetric digital system block coding mode;
the coding and packaging module 12 is configured to code the current sub-sequence according to an asymmetric digital system block coding mode based on the coding number of the previous sub-sequence and the target threshold value to obtain a current coding number, and package the current coding number according to the coding number of the previous sub-sequence and the target threshold value to obtain the coding number of the current sub-sequence;
the redundancy elimination module 13 is configured to determine a spatial redundancy of the code number of the previous sub-sequence according to the target threshold of the previous sub-sequence, and perform expansion processing on the target threshold of the previous sub-sequence according to the spatial redundancy to obtain an updated target threshold, so as to determine the updated target threshold as the target threshold of the current sub-sequence.
In the encoding stage, the encoding number and the target threshold value obtained after encoding the previous subsequence according to the asymmetric digital system block encoding mode are obtained; the target threshold is a digital upper limit after coding according to an asymmetric digital system block coding mode; then coding the current subsequence according to an asymmetric digital system block coding mode based on the coding number of the previous subsequence and a target threshold value to obtain a current coding number, and packaging the current coding number according to the coding number of the previous subsequence and the target threshold value to obtain the coding number of the current subsequence; and finally, determining the spatial redundancy of the coding number of the previous sub-sequence according to the target threshold of the previous sub-sequence, and expanding the target threshold of the previous sub-sequence according to the spatial redundancy to obtain an updated target threshold so as to determine the updated target threshold as the target threshold of the current sub-sequence. Each sub-sequence in the embodiment of the application is obtained based on the principle of block coding, when the current sub-sequence is coded, the coding number of the current sub-sequence is further packaged after being coded based on the coding number of the previous sub-sequence and the target threshold value, and meanwhile, the target threshold value of the current sub-sequence is updated according to the target threshold value after the previous sub-sequence is amplified. Spatial redundancy between sub-sequence codes can be eliminated, so that the coding result is convenient for computer processing.
In some embodiments, the encoding and packaging module 12 specifically includes:
the first calculating unit is used for calculating the difference value between the current coding number and the target threshold value of the previous subsequence and summing the difference value calculation result and the coding number of the previous subsequence;
a first determining unit for determining the summation calculation result as the coding number of the current sub-sequence.
In some specific embodiments, the codec device further comprises:
the setting module is used for setting the coding bit width and determining the initial value of the target threshold according to the first relation before coding; the first relation is:
Thresh=2 m
wherein Thresh is the initial value of the target threshold, and m is the code bit width.
In some embodiments, the redundancy elimination module 13 specifically includes:
a first calculation unit for calculating a target threshold value of a previous sub-sequence to determine a difference value of the code numbers of the previous sub-sequence;
a second determining unit configured to determine a difference calculation result as the spatial redundancy of the coded number of the previous sub-sequence;
a third calculation unit, configured to sum the target threshold value of the previous sub-sequence with the spatial redundancy;
a third determining unit configured to determine the summation calculation result as an updated target threshold value; wherein the updated target threshold is the difference between the sum of the target thresholds of two previous sub-sequences and the code number of the previous sub-sequence.
In some specific embodiments, the codec device is further configured to:
in the decoding phase, obtaining the spatial redundancy of the coded numbers of the previous sub-sequence;
and determining a decoding initial value corresponding to the current sub-sequence according to the spatial redundancy and the coding number of the current sub-sequence, and decoding the current sub-sequence according to an asymmetric digital system block decoding mode based on the decoding initial value corresponding to the current sub-sequence.
Further, the embodiment of the application also provides electronic equipment. Fig. 5 is a block diagram of an electronic device 20, according to an exemplary embodiment, and the contents of the diagram should not be construed as limiting the scope of use of the present application in any way.
Fig. 5 is a schematic structural diagram of an electronic device 20 according to an embodiment of the present 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. Wherein the memory 22 is adapted to store a computer program, which is loaded and executed by the processor 21 to effect at least the following steps:
in the encoding stage, an encoding number and a target threshold value obtained after encoding the previous subsequence according to an asymmetric digital system block encoding mode are obtained; the target threshold is a digital upper limit after coding according to an asymmetric digital system block coding mode;
coding the current subsequence according to an asymmetric digital system block coding mode based on the coding number of the previous subsequence and a target threshold value to obtain a current coding number, and packaging the current coding number according to the coding number of the previous subsequence and the target threshold value to obtain the coding number of the current subsequence;
and determining the spatial redundancy of the code number of the previous sub-sequence according to the target threshold of the previous sub-sequence, and expanding the target threshold of the previous sub-sequence according to the spatial redundancy to obtain an updated target threshold so as to determine the updated target threshold as the target threshold of the current sub-sequence.
In this embodiment, the power supply 23 is configured to provide an 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 an external device, and the communication protocol to be followed is any communication protocol applicable to the technical solution of the present application, which is not specifically limited herein; the input/output interface 25 is used for acquiring external input data or outputting external output data, and the specific interface type thereof may be selected according to the specific application requirement, which is not limited herein.
The memory 22 may be a carrier for storing resources, such as a read-only memory, a random access memory, a magnetic disk, or an optical disk, and the resources stored thereon may include an operating system 221, a computer program 222, data 223, and the like, and the storage may be temporary storage or permanent storage.
The operating system 221 is used for managing and controlling various hardware devices on the electronic device 20 and the computer program 222, so as to implement the operation and processing of the processor 21 on the mass data 223 in the memory 22, which may be Windows Server, netware, unix, linux, etc. The computer program 222 may further include a computer program that can be used to perform other specific tasks in addition to the computer program that can be used to perform the codec method performed by the electronic device 20 disclosed in any of the previous embodiments. The data 223 may include coded numbers collected by the electronic device 20, target thresholds, and the like.
Further, the embodiments of the present application also disclose a storage medium having a computer program stored therein, which when loaded and executed by a processor, performs at least the following steps:
in the encoding stage, an encoding number and a target threshold value obtained after encoding the previous subsequence according to an asymmetric digital system block encoding mode are obtained; the target threshold is a digital upper limit after coding according to an asymmetric digital system block coding mode;
coding the current subsequence according to an asymmetric digital system block coding mode based on the coding number of the previous subsequence and a target threshold value to obtain a current coding number, and packaging the current coding number according to the coding number of the previous subsequence and the target threshold value to obtain the coding number of the current subsequence;
and determining the spatial redundancy of the code number of the previous sub-sequence according to the target threshold of the previous sub-sequence, and expanding the target threshold of the previous sub-sequence according to the spatial redundancy to obtain an updated target threshold so as to determine the updated target threshold as the target threshold of the current sub-sequence.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described in a different point from other embodiments, so that the same or similar parts between the embodiments are referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant points refer to the description of the method section.
Finally, it is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The coding and decoding methods, devices, equipment and storage media provided by the invention are described in detail, and specific examples are applied to illustrate the principles and embodiments of the invention, and the description of the above examples is only used for helping to understand the method and core ideas of the invention; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in accordance with the ideas of the present invention, the present description should not be construed as limiting the present invention in view of the above.

Claims (10)

1. A method of encoding and decoding, comprising:
in the encoding stage, an encoding number and a target threshold value obtained after encoding the previous subsequence according to an asymmetric digital system block encoding mode are obtained; the target threshold is a digital upper limit after coding according to an asymmetric digital system block coding mode;
coding the current subsequence according to an asymmetric digital system block coding mode based on the coding number of the previous subsequence and a target threshold value to obtain a current coding number, and packaging the current coding number according to the coding number of the previous subsequence and the target threshold value to obtain the coding number of the current subsequence;
and determining the spatial redundancy of the code number of the previous sub-sequence according to the target threshold of the previous sub-sequence, and expanding the target threshold of the previous sub-sequence according to the spatial redundancy to obtain an updated target threshold so as to determine the updated target threshold as the target threshold of the current sub-sequence.
2. The codec method of claim 1, further comprising:
before encoding, setting an encoding bit width and determining an initial value of a target threshold according to a first relation; the first relation is:
Thresh=2 m
wherein Thresh is the initial value of the target threshold, and m is the code bit width.
3. The method according to claim 1, wherein the encapsulating the current encoded number according to the encoded number of the previous sub-sequence and the target threshold value to obtain the encoded number of the current sub-sequence comprises:
calculating the difference value between the current coding number and the target threshold value of the previous subsequence, and summing the difference value calculation result and the coding number of the previous subsequence;
the result of the summation calculation is determined as the number of codes of the current sub-sequence.
4. The method of claim 1, wherein determining the spatial redundancy of the encoded number of the previous sub-sequence based on the target threshold of the previous sub-sequence comprises:
calculating a target threshold of a previous sub-sequence and determining a difference value of coded numbers of the previous sub-sequence;
the difference calculation is determined as said spatial redundancy of the coded number of the previous sub-sequence.
5. The method according to claim 4, wherein the expanding the target threshold of the previous sub-sequence according to the spatial redundancy to obtain the updated target threshold comprises:
carrying out summation calculation on the target threshold value of the previous subsequence and the spatial redundancy, and determining the summation calculation result as an updated target threshold value; wherein the updated target threshold is the difference between the sum of the target thresholds of two previous sub-sequences and the code number of the previous sub-sequence.
6. The codec method according to any one of claims 1 to 5, further comprising:
in the decoding phase, obtaining the spatial redundancy of the coded numbers of the previous sub-sequence;
and determining a decoding initial value corresponding to the current sub-sequence according to the spatial redundancy and the coding number of the current sub-sequence, and decoding the current sub-sequence according to an asymmetric digital system block decoding mode based on the decoding initial value corresponding to the current sub-sequence.
7. The method according to claim 6, wherein the determining a decoding initial value corresponding to a current sub-sequence according to the spatial redundancy and the coding number of the current sub-sequence comprises:
and carrying out summation calculation on the spatial redundancy and the coding number of the current sub-sequence, and determining the summation calculation result as a decoding initial value corresponding to the current sub-sequence.
8. A codec apparatus, comprising:
the acquisition module is used for acquiring the coded number and the target threshold value obtained after the previous subsequence is coded according to the asymmetric digital system block coding mode in the coding stage; the target threshold is a digital upper limit after coding according to an asymmetric digital system block coding mode;
the coding and packaging module is used for coding the current subsequence according to an asymmetric digital system block coding mode based on the coding number of the previous subsequence and a target threshold value to obtain a current coding number, and packaging the current coding number according to the coding number of the previous subsequence and the target threshold value to obtain the coding number of the current subsequence;
and the redundancy elimination module is used for determining the spatial redundancy of the coding number of the previous sub-sequence according to the target threshold value of the previous sub-sequence, and expanding the target threshold value of the previous sub-sequence according to the spatial redundancy to obtain an updated target threshold value so as to determine the updated target threshold value as the target threshold value of the current sub-sequence.
9. An electronic device comprising a processor and a memory; wherein the memory is for storing a computer program to be loaded and executed by the processor for implementing the codec method of any one of claims 1 to 7.
10. A computer readable storage medium storing computer executable instructions which, when loaded and executed by a processor, implement the codec method of any one of claims 1 to 7.
CN202310111341.5A 2023-02-10 2023-02-10 Encoding and decoding method, device, equipment and storage medium Pending CN116015313A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310111341.5A CN116015313A (en) 2023-02-10 2023-02-10 Encoding and decoding method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310111341.5A CN116015313A (en) 2023-02-10 2023-02-10 Encoding and decoding method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116015313A true CN116015313A (en) 2023-04-25

Family

ID=86021574

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310111341.5A Pending CN116015313A (en) 2023-02-10 2023-02-10 Encoding and decoding method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116015313A (en)

Similar Documents

Publication Publication Date Title
Parakh et al. Space efficient secret sharing for implicit data security
JP3017379B2 (en) Encoding method, encoding device, decoding method, decoder, data compression device, and transition machine generation method
US8130228B2 (en) System and method for processing low density parity check codes using a deterministic caching apparatus
JP5705106B2 (en) Method for performing soft decision decoding of Euclidean space Reed-Muller code
TWI406510B (en) Method for efficient encoding and decoding quantized sequence in wyner-ziv coding of video
JP2002533005A (en) Codebook construction for variable-length to variable-length entropy coding
JP2004147318A (en) Ldpc decoding apparatus and method thereof
US11722148B2 (en) Systems and methods of data compression
Nagaraj et al. Arithmetic coding as a non-linear dynamical system
US20220224947A1 (en) Coding method and related device
CN112821894A (en) Lossless compression method and lossless decompression method based on weighted probability model
Rahmani et al. An efficient histogram-based index mapping mechanism for reversible data hiding in VQ-compressed images
CN106878757B (en) Method, medium, and system for encoding digital video content
Alhassan et al. The Huffman’s method of secured data encoding and error correction using residue number system (RNS)
CN115765755A (en) ANS coding and decoding method, equipment and medium based on finite field multiplication
WO2017041233A1 (en) Encoding and storage node repairing method for functional-repair regenerating code
CN116015313A (en) Encoding and decoding method, device, equipment and storage medium
US8320687B2 (en) Universal lossy compression methods
KR101030726B1 (en) Memory efficient multimedia huffman decoding method and apparatus for adapting huffman table based on symbol from probability table
CN116366071A (en) Packaging method, packaging system, storage medium and packaging equipment based on ANS (analog to digital) coding
KR100359118B1 (en) Lossless data compression method for uniform entropy data
US8537038B1 (en) Efficient compression method for sorted data representations
US7193542B2 (en) Digital data compression robust relative to transmission noise
JP2005521324A (en) Method and apparatus for lossless data compression and decompression
De Agostino The greedy approach to dictionary-based static text compression on a distributed system

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