ANS entropy coding and decoding method and system for deep learning encoding and decoding model

By optimizing the ANS entropy encoding and entropy decoding process in the deep learning codec model, the slower problem in the existing technology is solved, and the effect of doubled the entropy encoding speed and 3 times the entropy decoding speed is achieved.

CN115834913BActive Publication Date: 2025-04-08SHANGHAI SHUANGSHEN INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211481453.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-24
Publication Date
2025-04-08
Estimated Expiration
2042-11-24

AI Technical Summary

Technical Problem

In the existing deep learning codec models, ANS entropy encoding and entropy decoding are slower, resulting in low image codec efficiency.

Method used

By obtaining the quantitative features obtained by the deep learning codec model processing, it is converted into a finite symbol sequence, and using the M interval mapping symbol probability, it optimizes the ANS entropy encoding and entropy decoding process, including improved state calculation, threshold setting and binary search optimization.

Benefits of technology

Compared with the existing ANS entropy encoding, the entropy encoding speed is twice as high as the entropy decoding speed is 3 times, while ensuring the quality of the reconstructed image.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115834913B_ABST
    Figure CN115834913B_ABST
Patent Text Reader

Abstract

The present invention discloses an ANS entropy coding and entropy decoding method and system for a deep learning coding and decoding model. By combining the distribution of quantized features generated by deep learning coding and decoding, the entropy coding and entropy decoding processes are improved. Compared with the existing ANS, the entropy coding speed can be doubled, the entropy decoding speed can be increased by 3 times, and the quality of the reconstructed image can also be guaranteed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of entropy coding technology, and in particular to an ANS entropy coding and entropy decoding method and system for a deep learning coding and decoding model. Background Art

[0002] When generating real bitstreams, deep learning encoding and decoding algorithms tend to use arithmetic coding (AC) and asymmetric digital system (ANS) to achieve lossless entropy coding. AC and ANS are the best methods in lossless entropy coding in terms of compression efficiency.

[0003] Since the number of quantized features of the deep learning encoding and decoding algorithm is large, it takes a lot of time to use AC encoding. Although ANS encoding can reduce the time cost compared to AC encoding, the speed of existing ANS encoding still has a lot of room for improvement. Summary of the invention

[0004] The purpose of the present invention is to provide an ANS entropy coding and entropy decoding method and system for a deep learning coding and decoding model, so as to improve the speed of entropy decoding and entropy coding.

[0005] The objective of the present invention is achieved through the following technical solutions:

[0006] An ANS entropy coding and decoding method for a deep learning coding and decoding model, comprising:

[0007] Obtain the quantitative features of the image after being processed by the encoding network and the quantization module, convert the quantitative features into a finite symbol sequence, map the probability corresponding to each symbol in the finite symbol sequence to an M interval, and obtain the frequency of each symbol; where M = 2 K , K is a set positive integer, and M is in the interval [0,M];

[0008] The steps of ANS entropy coding include: step S11, calculating the state of the current symbol based on the frequency of the current symbol, the state of the previous symbol and K; step S12, using M to set a first threshold, when the state of the current symbol is greater than or equal to the first threshold, right-shifting the state of the current symbol by K bits, and adding the right-shifted K bits to the code stream; step S13, looping through steps S11 and S12 to entropy code each symbol until all symbols in the finite symbol sequence have completed entropy coding;

[0009] The steps of ANS entropy decoding include: step S21, calculating the interval slot of the state of the previous symbol based on the state of the current symbol; step S22, using an optimized binary search method to determine the cumulative frequency interval to which the interval slot of the state of the previous symbol belongs, and recording the lower limit of the determined cumulative frequency interval as C t , and combined with Ct Calculate the remainder of the state of the previous symbol; step S23, calculate the state of the previous symbol in combination with the remainder of the state of the previous symbol; step S24, use M to set the second threshold, when the state of the previous symbol is less than the second threshold, shift the state of the previous symbol left by K bits, and move the first K bits of the code stream into the low K bits of the state of the previous symbol; step S25, loop through steps S21 and S24 to complete entropy decoding of all symbol states in a finite symbol sequence.

[0010] An ANS entropy coding and decoding system for a deep learning coding and decoding model, comprising:

[0011] The information acquisition and conversion module is used to obtain the quantitative features of the image processed by the encoding network and the quantization module, convert the quantitative features into a finite symbol sequence, map the probability corresponding to each symbol in the finite symbol sequence to an M interval, and obtain the frequency of each symbol; where M = 2 K , K is a set positive integer, and M is in the interval [0,M];

[0012] The ANS entropy coding module is used to perform ANS entropy coding, and the steps include: step S11, calculating the state of the current symbol based on the frequency of the current symbol, the state of the previous symbol and K; step S12, using M to set a first threshold, when the state of the current symbol is greater than or equal to the first threshold, right-shifting the state of the current symbol by K bits, and adding the right-shifted K bits to the code stream; step S13, looping through step S11 and step S12 until all symbols in the finite symbol sequence are entropy coded;

[0013] The ANS entropy decoding module is used to perform ANS entropy decoding, and the steps include: step S21, based on the state of the current symbol, calculating the interval slot of the state of the previous symbol; step S22, using the optimized binary search method to determine the cumulative frequency interval to which the interval slot of the state of the previous symbol belongs, and recording the lower limit of the determined cumulative frequency interval as the determined C t , and combined with C t Calculate the remainder of the state of the previous symbol; step S23, calculate the state of the previous symbol in combination with the remainder of the state of the previous symbol; step S24, use M to set the second threshold, when the state of the previous symbol is less than the second threshold, shift the state of the previous symbol left by K bits, and move the first K bits of the code stream into the low K bits of the state of the previous symbol; step S25, loop through steps S21 and S24 to complete entropy decoding of all symbol states in a finite symbol sequence.

[0014] A processing device, comprising: one or more processors; a memory for storing one or more programs;

[0015] When the one or more programs are executed by the one or more processors, the one or more processors implement the aforementioned method.

[0016] A readable storage medium stores a computer program, which implements the above method when the computer program is executed by a processor.

[0017] It can be seen from the technical solution provided by the present invention that by combining the distribution of quantization features generated by deep learning encoding and decoding, the process of entropy coding and entropy decoding is improved. Compared with the existing ANS, the entropy coding speed can be doubled and the entropy decoding speed can be increased by 3 times. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0019] Figure 1 A schematic diagram of input information for entropy coding provided by an embodiment of the present invention;

[0020] Figure 2 A flowchart of an ANS entropy encoding and decoding method for a deep learning encoding and decoding model provided by an embodiment of the present invention;

[0021] Figure 3 A schematic diagram of an ANS entropy coding and decoding system for a deep learning coding and decoding model provided by an embodiment of the present invention;

[0022] Figure 4 A schematic diagram of a processing device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0023] The following is a clear and complete description of the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the protection scope of the present invention.

[0024] First, the terms that may be used in this article are explained as follows:

[0025] The terms "include", "comprises", "contains", "has" or other descriptions with similar semantics should be interpreted as non-exclusive inclusion. For example, including certain technical feature elements (such as raw materials, components, ingredients, carriers, dosage forms, materials, dimensions, parts, components, mechanisms, devices, steps, procedures, methods, reaction conditions, processing conditions, parameters, algorithms, signals, data, products or products, etc.) should be interpreted as including not only certain technical feature elements explicitly listed, but also other technical feature elements known in the art that are not explicitly listed.

[0026] The following is a detailed description of an ANS entropy encoding and decoding scheme for a deep learning encoding and decoding model provided by the present invention. The contents not described in detail in the embodiments of the present invention belong to the prior art known to professional and technical personnel in the field. If no specific conditions are specified in the embodiments of the present invention, they shall be carried out according to the conventional conditions in the field or the conditions recommended by the manufacturer.

[0027] Embodiment 1

[0028] The embodiment of the present invention provides an ANS entropy coding and entropy decoding method for a deep learning encoding and decoding model. For ease of understanding, the background of entropy coding and the existing ANS entropy coding and entropy decoding schemes are first introduced.

[0029] 1. Entropy coding background.

[0030] Entropy is a measure of information in coding. The larger the entropy, the more information it contains. For high-frequency events, they contain less information, so their corresponding entropy is smaller. For low-frequency events, they contain more information and their corresponding entropy is larger. Shannon's entropy coding theoretical value calculation formula is:

[0031]

[0032] Among them, p i represents the probability of the occurrence of the i-th symbol, and n+1 represents the total number of symbols.

[0033] The input information of entropy coding generally includes:

[0034] (1) Random initialization state X.

[0035] (2) Finite symbol sequence S = {S0, S1, ..., S n}, each element in the sequence is a symbol, there are n+1 symbols in total, and a quantitative feature element can be directly regarded as a symbol. For example, the value corresponding to a symbol can be 1.

[0036] (3) Frequency F = {F0, F1, ..., F n}, each symbol corresponds to a frequency, and the frequency corresponding to the symbol can be calculated through deep learning. Specifically: deep learning can calculate the mean and variance of the Gaussian distribution of each position, so it can be converted into probability. Since entropy coding requires the use of integers, the probability corresponding to the symbol is converted into the corresponding frequency.

[0037] (4) Cumulative frequency C = {C0, C1, ..., C n}, where C t represents the cumulative frequency of the t-th symbol (that is, the current symbol), that is, the sum of the frequencies of all symbols before the t-th symbol, t = 0, 1, ..., n, if t = 0, then C0 = 0, otherwise C t =F0+…+F t-1 , for example, C1=F0,C n =F0+F1+…+F n-1 .

[0038] (5) Total frequency M = F0 + F1 + ... + F n .

[0039] The finite symbol sequence S comes from the quantized features output by the deep learning coding model. Generally, the quantized features of an RGB image of size H*W*3 after being encoded by the deep learning coding model are (H / s, W / s, 192), s is the downsampling ratio (for example, s=16), and the features are generally distributed in (-255~+255) and present a zero-mean Laplace distribution.

[0040] like Figure 1 As shown, the frequency of each point in the quantized feature is also given the corresponding probability by the encoding network. The probability range is generally between (0, 1), and the left and right intervals are opened. Generally, the probability is mapped to the M interval to obtain the corresponding frequency, and the M interval is [0, M].

[0041] 2. Existing ANS entropy coding and entropy decoding schemes.

[0042] (1) Existing ANS entropy coding scheme.

[0043] Step S11: Based on the frequency F of the current symbol t and the state X of the previous symbol t-1 , calculate the state X of the current symbol t ,

[0044] It is expressed as:

[0045] Among them, t = 0, ..., n, t is the serial number of the current symbol, and one symbol is processed at one time. Therefore, t can also be regarded as the serial number of the current time, and t = 0 can be regarded as the initial time; floor (.) means rounding down, mod (.) means modulo operation, C t Indicates the cumulative frequency of the current symbol.

[0046] Step S12: Before executing step S11, when encountering X t Greater than or equal to the threshold 2*factor*F st When (factor is the set coefficient), the loop will output X t The binary low bit (circular right shift X t One bit), until it is less than the threshold, and then step S11 is executed.

[0047] Since the minimum value of t is 0, and when t=0, there is also an initial value, therefore, step S12 is a judgment before step S11.

[0048] Step S13: loop through steps S11 and S12 to entropy encode each symbol until the symbol sequence S is entropy encoded.

[0049] The above entropy coding process can be understood as follows: given the initial state X0 (i.e. the state of symbol S0), X1 is the state of the first symbol coded based on the initial state, and the state of the next symbol is entropy coded based on the state of the previous symbol, then X t This means the state of all t-1 symbols before entropy coding.

[0050] (2) Existing ANS entropy decoding scheme.

[0051] Step S21: Based on the state X of the current symbol t , calculate the state X of the previous symbol when encoding t-1 The interval slot is expressed as:

[0052] slot=mod(X t ,M)=C t +mod(X t-1 ,F t )

[0053] Step S22: Use binary search to determine the cumulative frequency interval to which the range of the interval slot belongs, and determine the lower limit (low-bound) of the cumulative frequency interval as C t , then the state X of the previous symbol t-1 F t The remainder is slot-C t .

[0054] Step S23: Calculate the previous state X during encoding t-1 .

[0055] X t-1 =floor(X t ,M)·F t +(slot-C t )

[0056] Step S24: After executing step S23, when X t-1 When it is less than the threshold factor*M, the code stream is shifted leftwards one bit at a time into X. t-1 , until it is greater than or equal to the threshold factor*M.

[0057] Those skilled in the art will understand that left shift in a computer means to t-1 The value of is enlarged. Since the computer is in binary form, shifting one bit left means X t-1 Multiply by 2.

[0058] Step S25: loop through steps S21 to S24 to perform entropy decoding on each symbol respectively, thereby completing entropy decoding of all symbol states.

[0059] Considering that the existing ANS entropy coding and decoding speeds are slow, resulting in low image coding and decoding efficiency. Therefore, an embodiment of the present invention provides an improved ANS entropy coding and decoding method to improve the speed of entropy coding and decoding, such as Figure 2 As shown, it mainly includes:

[0060] 1. Information acquisition and transformation.

[0061] This part is similar to conventional technology, mainly performing some preparatory work before entropy coding, including: the image to be encoded is first processed by the encoding network and quantization module to obtain quantized features (this part can be achieved by conventional technology, so it is not repeated here), the quantized features are converted into a finite symbol sequence, the probability corresponding to each symbol in the finite symbol sequence is mapped to an M interval, and the frequency of each symbol is obtained; where M = 2 K , K is a set positive integer.

[0062] For example, K=16 can be set, then M=2 16 =65536.

[0063] 2. ANS entropy coding.

[0064] In order to intuitively reflect the improvements of the present invention, the same step numbers as those of the existing ANS entropy coding are used.

[0065] Step S11, based on the frequency F of the current symbol st , the state of the previous symbol Xt-1 And K calculates the state of the current symbol.

[0066] In an embodiment of the present invention, assuming K = 16, then M = 65536. Since the image encoding and decoding method based on deep learning has the numerical range of symbols between [-255, +255], there are a total of 511 symbols. That is to say, n + 1 can be equal to 511, and the finite symbol sequence S is {S0, S1, … S510}. The numerical values of the symbols correspond to the numerical range in sequence, that is: symbol S0 corresponds to the numerical value -255, …, symbol S255 corresponds to the numerical value 0, …, symbol S510 corresponds to the numerical value 255. The total frequency M of 65536 can exactly map the network-generated corresponding probabilities into frequencies. Moreover, when M is 65536, the multiplication operation can be converted into a right shift operation by K bits. Based on this, the formula for calculating the state of the current symbol is:

[0067]

[0068] where << represents a shift operation (<<K is equivalent to multiplying by 2 in a computer K ), X t represents the state of the current symbol, and X t-1 represents the state of the previous symbol; it should be noted that in an embodiment of the present invention, the state of the symbol can be represented by a numerical value, but it is not limited to the numerical representation form. In practical applications, users can use other methods for representation according to needs or actual situations.

[0069] In an embodiment of the present invention, in the finite symbol sequence S{S0, S1, … Sn}, according to the order of the symbol numbers, the numerical values corresponding to each symbol increase in sequence. Taking the 511 symbols listed above as an example, that is to say, n + 1 can be equal to 511, and the finite symbol sequence S is {S0, S1, … S510}. The numerical values of the symbols correspond to the numerical range in sequence, that is: symbol S0 corresponds to the numerical value -255, …, symbol S255 corresponds to the numerical value 0, …, symbol S510 corresponds to the numerical value 255.

[0070] Step S12: Set the first threshold using M. When the state of the current symbol is greater than or equal to the first threshold, shift the state of the current symbol to the right by K bits, and add the shifted K bits to the code stream.

[0071] Since when circularly shifting to the right by X t , firstly, it is not conducive to parallel encoding processing, and secondly, the loop efficiency is relatively low. Considering that there is a case where the frequency corresponding to the feature is equal to 1; therefore, set the first threshold thr1 using M: thr1 = M·F t ; once X t exceeds the first threshold, directly perform an operation on X tShift right by K bits and add the right-shifted K bits to the bit stream. Since K bits are moved at one time, it is more efficient than circular movement. Of course, this is also combined with the characteristics of the deep learning model to perform a one-time move of K bits.

[0072] In the embodiment of the present invention, the left shift and right shift operations involved are conventional computer binary value operations. For example, the binary representation of 2 is 10, so shifting right by 1 bit removes the rightmost 0 and turns it into 1. The value added to the bit stream is 0, that is, the value shifted right by K bits is added to the bit stream, and the remaining value continues to be entropy coded.

[0073] Step S13, looping through steps S11 and S12 to entropy encode each symbol until all symbols in the finite symbol sequence S have completed entropy encoding.

[0074] 3. ANS entropy decoding.

[0075] Similarly, in order to intuitively reflect the improvements of the present invention, the same step numbers as those of the existing ANS entropy decoding are used.

[0076] Step S21, based on the state X of the current symbol t , calculate the state X of the previous symbol t-1 The interval slot.

[0077] Similar to the existing solution, the calculation formula for this step is:

[0078] slot=mod(X t ,M)=C t +mod(X t-1 ,F t )

[0079] Among them, X t Indicates the status of the current symbol, X t-1 Indicates the state of the previous symbol.

[0080] Step S22, using an optimized binary search method to determine the state X of the previous symbol t-1 The cumulative frequency interval to which the interval slot belongs, and the lower limit (low-bound) of the cumulative frequency interval is determined to be C t , and calculate the state X of the previous symbol t-1 The remainder of .

[0081] The complexity of the existing binary search method is O(logn). The present invention optimizes the existing binary search method to reduce the complexity.

[0082] In the embodiment of the present invention, the deep learning image encoding and decoding technology is mainly used. Since the feature distribution is a zero-mean Laplace distribution, the values ​​of more than 70% of the quantized features (that is, the values ​​obtained by mapping the RGB image space to the latent space) are -2 to +2, most of which are 0. Therefore, the optimized binary search method is as follows:

[0083] (1) Check whether the interval slot belongs to the cumulative frequency interval of the symbol corresponding to the value 0; if so, determine that the interval slot belongs to the cumulative frequency interval of the symbol corresponding to the value 0; the cumulative frequency interval of each symbol is the interval formed by the cumulative frequency of the current symbol and the cumulative frequency of the next symbol, which is a left-closed and right-open interval; among them, for the current symbol, its cumulative frequency interval is [C t ,C t+1 ], C t is the cumulative frequency of the current symbol, C t+1 is the cumulative frequency of the next symbol, the cumulative frequency C t is the sum of the frequencies of all symbols before the current symbol, that is, C t =F0+…+F t-1 , cumulative frequency C t+1 is the sum of the frequencies of all symbols before the next symbol, that is, C t+1 =F0+…+F t ; F0,…,+F t-1 ,F t Indicates the frequency of the 0th symbol, the current symbol, and the next symbol.

[0084] (2) If it does not belong to the cumulative frequency interval of the symbol corresponding to the value 0, and the upper limit of the interval slot is less than the lower limit (low-bound) of the cumulative frequency interval of the symbol corresponding to the value 0, then search in the cumulative frequency interval of the symbol corresponding to the value -2 and the cumulative frequency interval of the symbol corresponding to the value -1. If the upper limit of the interval slot is less than the lower limit (low-bound) of the cumulative frequency interval of the symbol corresponding to the value -2, then perform a binary search in the cumulative frequency intervals of the symbols corresponding to the values ​​of -255 to -3, and finally determine the cumulative frequency interval to which the interval slot belongs.

[0085] (3) If it does not belong to the cumulative frequency interval of the symbol 0 corresponding to the value 0, and the lower limit of the interval slot is greater than the upper limit (high-bound) of the cumulative frequency interval of the symbol corresponding to the value 0, then search in the cumulative frequency interval of the symbol corresponding to the value 1 and the cumulative frequency interval of the symbol corresponding to the value 2. If the lower limit of the interval slot is greater than the upper limit (high-bound) of the cumulative frequency interval of the symbol corresponding to the value 2, then perform a binary search in the cumulative frequency intervals of the symbols corresponding to the values ​​3 to 255, and finally determine the cumulative frequency interval to which the interval slot belongs.

[0086] The above optimized binary search method is designed based on the potential space distribution of deep learning image encoding and decoding. Since the most common quantized feature value is 0, first determine whether it is the cumulative frequency interval of the symbol corresponding to the value 0; if not, then confirm one by one in the high-frequency area, that is, the cumulative frequency intervals of the symbols corresponding to the values ​​1, 2, -1, and -2. If none of them are, then perform a regular binary search on the cumulative frequency intervals of the symbols corresponding to the values ​​-255 to -3 and 3 to 255. After determining the cumulative frequency interval to which the interval slot belongs, the low-bound of the interval is C t , the state X of the previous symbol t-1 The remainder is slot–C t .

[0087] Step S23, calculating the state of the previous symbol in combination with the remainder of the state of the previous symbol.

[0088] Similar to the existing solution, the calculation formula for this step is:

[0089] X t-1 =floor(X t ,M)·F t +(slot-C t )

[0090] Among them, X t-1 Indicates the state of the previous symbol, slot-C t is the remainder of the state of the previous symbol.

[0091] Step S24, using M to set the second threshold, when the state of the previous symbol is less than the second threshold, the state of the previous symbol is shifted left by K bits, and the first K bits of the code stream are moved into the lower K bits (i.e., the 1st to Kth bits) of the state of the previous symbol.

[0092] In the embodiment of the present invention, a second threshold thr2 is set: thr2=M.

[0093] Step S25, looping through step S21 and step S24, thereby completing entropy decoding of all symbol states in the finite symbol sequence.

[0094] The above information acquisition and conversion as well as the entropy coding part are completed at the encoding end. After the entropy coding is completed, it is transmitted to the decoding end, which performs subsequent entropy decoding work and decodes the features obtained by entropy decoding to obtain the reconstructed image.

[0095] In the above scheme provided by the embodiment of the present invention, the entropy coding and entropy decoding processes are improved by combining the distribution of quantization features generated by deep learning encoding and decoding. Compared with the existing ANS, the entropy coding speed can be doubled, and the entropy decoding speed can be increased by 3 times. Moreover, since the ANS entropy coding is a lossless entropy coding, the quality of the reconstructed image can also be guaranteed.

[0096] Embodiment 2

[0097] The present invention also provides an ANS entropy coding and decoding system for a deep learning coding and decoding model, which is mainly implemented based on the method provided in the above embodiment, such as Figure 3 As shown, the system mainly includes:

[0098] The information acquisition and conversion module is used to obtain the quantitative features of the image processed by the encoding network and the quantization module, convert the quantitative features into a finite symbol sequence, map the probability corresponding to each symbol in the finite symbol sequence to an M interval, and obtain the frequency of each symbol; where M = 2 K , K is a set positive integer, and M is in the interval [0,M];

[0099] The ANS entropy coding module is used to perform ANS entropy coding, and the steps include: step S11, calculating the state of the current symbol based on the frequency of the current symbol, the state of the previous symbol and K; step S12, using M to set a first threshold, when the state of the current symbol is greater than or equal to the first threshold, right-shifting the state of the current symbol by K bits, and adding the right-shifted K bits to the code stream; step S13, looping through step S11 and step S12 until all symbols in the finite symbol sequence are entropy coded;

[0100] The ANS entropy decoding module is used to perform ANS entropy decoding, and the steps include: step S21, calculating the interval slot of the state of the previous symbol based on the state of the current symbol; step S22, using an optimized binary search method to determine the cumulative frequency interval described in the interval slot of the state of the previous symbol, and recording the lower limit of the determined cumulative frequency interval as C t , and combined with C tCalculate the remainder of the state of the previous symbol; step S23, calculate the state of the previous symbol in combination with the remainder of the state of the previous symbol; step S24, use M to set the second threshold, when the state of the previous symbol is less than the second threshold, shift the state of the previous symbol left by K bits, and move the first K bits of the code stream into the low K bits of the state of the previous symbol; step S25, loop through steps S21 and S24 to complete entropy decoding of all symbol states in a finite symbol sequence.

[0101] Technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the system can be divided into different functional modules to complete all or part of the functions described above.

[0102] Embodiment 3

[0103] The present invention also provides a processing device, such as Figure 4 As shown, it mainly includes: one or more processors; a memory for storing one or more programs; wherein, when the one or more programs are executed by the one or more processors, the one or more processors implement the methods provided in the aforementioned embodiments.

[0104] Furthermore, the processing device also includes at least one input device and at least one output device; in the processing device, the processor, memory, input device, and output device are connected via a bus.

[0105] In the embodiment of the present invention, the specific types of the memory, input device and output device are not limited; for example:

[0106] The input device may be a touch screen, an image acquisition device, a physical button or a mouse, etc.;

[0107] The output device may be a display terminal;

[0108] The memory may be a random access memory (RAM) or a non-volatile memory, such as a disk memory.

[0109] Embodiment 4

[0110] The present invention also provides a readable storage medium storing a computer program, which implements the method provided in the above embodiment when the computer program is executed by a processor.

[0111] In the embodiment of the present invention, the readable storage medium is a computer-readable storage medium and can be set in the aforementioned processing device, for example, as a memory in the processing device. In addition, the readable storage medium can also be a U disk, a mobile hard disk, a read-only memory (ROM), a disk or an optical disk, etc., which can store program codes.

[0112] The above is only a preferred specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims

1. An ANS entropy coding and entropy decoding method for a deep learning coding and decoding model, characterized in that: include: The quantized features of the image are obtained by processing the encoding network and the quantization module, and the quantized features are converted into a finite symbol sequence. The probability corresponding to each symbol in the finite symbol sequence is mapped to an M interval to obtain the frequency of each symbol; where M = 2 K , K is a set positive integer, and M is in the interval [0,M]; The steps of ANS entropy coding include: step S11, calculating the state of the current symbol based on the frequency of the current symbol, the state of the previous symbol and K; step S12, using M to set a first threshold, when the state of the current symbol is greater than or equal to the first threshold, right-shifting the state of the current symbol by K bits, and adding the right-shifted K bits to the code stream; step S13, looping through steps S11 and S12 to entropy code each symbol until all symbols in the finite symbol sequence have completed entropy coding; The steps of ANS entropy decoding include: step S21, calculating the interval slot of the state of the previous symbol based on the state of the current symbol; step S22, using an optimized binary search method to determine the cumulative frequency interval to which the interval slot of the state of the previous symbol belongs, and recording the lower limit of the determined cumulative frequency interval as C t , and combined with C t Calculate the remainder of the state of the previous symbol; step S23, calculate the state of the previous symbol in combination with the remainder of the state of the previous symbol; step S24, use M to set the second threshold, when the state of the previous symbol is less than the second threshold, shift the state of the previous symbol left by K bits, and move the first K bits of the code stream into the low K bits of the state of the previous symbol; step S25, loop through steps S21 and S24 to complete entropy decoding of all symbol states in a finite symbol sequence.

2. The ANS entropy coding and decoding method for a deep learning coding and decoding model according to claim 1, characterized in that: The formula for calculating the state of the current symbol based on the frequency of the current symbol, the state of the previous symbol and K is: Among them, X t Indicates the status of the current symbol, X t-1 Indicates the state of the previous symbol, t = 0, ..., n, t is the serial number of the current symbol, and the total number of symbols is n + 1; floor (.) means rounding down, mod (.) means modulo operation, F t is the frequency of the current symbol, << represents the shift operation, C t Represents the cumulative frequency of the current symbol, that is, the sum of the frequencies of all symbols before the current symbol.

3. The ANS entropy coding and entropy decoding method for a deep learning coding and decoding model according to claim 1 or 2, characterized in that: The method of setting the first threshold using M is expressed as: thr1=M·F t Wherein, thr1 represents the first threshold.

4. The ANS entropy coding and entropy decoding method for a deep learning coding and decoding model according to claim 1, characterized in that: The formula for calculating the interval slot of the state of the previous symbol based on the state of the current symbol is: slot=mod(X t ,M)=C t +mod(X t-1 ,F t ) Among them, X t Indicates the status of the current symbol, X t-1 Indicates the state of the previous symbol, mod(.) indicates the modulus operation, F t is the frequency of the current symbol, C t Represents the cumulative frequency of the current symbol, that is, the sum of the frequencies of all symbols before the current symbol.

5. The ANS entropy coding and decoding method for a deep learning coding and decoding model according to claim 1, characterized in that: The step of using the optimized binary search method to determine the cumulative frequency interval to which the interval slot of the state of the previous symbol belongs includes: Check whether the interval slot belongs to the cumulative frequency interval of the symbol corresponding to the value 0; if so, determine that the interval slot belongs to the cumulative frequency interval of the symbol corresponding to the value 0; the cumulative frequency interval of each symbol is the interval formed by the cumulative frequency of the current symbol and the cumulative frequency of the next symbol; among them, for the current symbol, its cumulative frequency interval is [C t ,C t+1 ], C t is the cumulative frequency of the current symbol, C t+1 is the cumulative frequency of the next symbol, the cumulative frequency C t is the sum of the frequencies of all symbols before the current symbol, that is, C t =F0+…+F t-1 , cumulative frequency C t+1 is the sum of the frequencies of all symbols before the next symbol, that is, C t+1 =F0+…+F t ; F0,…,+F t-1 ,F t Indicates the frequency of the 0th symbol, the current symbol and the next symbol; If it does not belong to the cumulative frequency interval of the symbol corresponding to the value 0, and the upper limit of the interval slot is less than the lower limit of the cumulative frequency interval of the symbol corresponding to the value 0, then search in the cumulative frequency interval of the symbol corresponding to the value -2 and the cumulative frequency interval of the symbol corresponding to the value -1. If the upper limit of the interval slot is less than the lower limit of the cumulative frequency interval of the symbol corresponding to the value -2, then perform binary search in the cumulative frequency intervals of the symbols corresponding to the values ​​of -255 to -3, and finally determine the cumulative frequency interval to which the interval slot belongs; If it does not belong to the cumulative frequency interval of the symbol 0 corresponding to the value 0, and the lower limit of the interval slot is greater than the upper limit of the cumulative frequency interval of the symbol corresponding to the value 0, then search in the cumulative frequency interval of the symbol corresponding to the value 1 and the cumulative frequency interval of the symbol corresponding to the value 2. If the lower limit of the interval slot is greater than the upper limit of the cumulative frequency interval of the symbol corresponding to the value 2, then perform a binary search in the cumulative frequency intervals of the symbols corresponding to the values ​​3 to 255, and finally determine the cumulative frequency interval to which the interval slot belongs.

6. The ANS entropy coding and entropy decoding method for a deep learning coding and decoding model according to claim 1, characterized in that: The formula for calculating the state of the previous symbol by combining the remainder of the state of the previous symbol is: X t-1 =floor(X t ,M)·F t +(slot-C t ) Among them, X t-1 Indicates the state of the previous symbol, F t is the frequency of the current symbol, slot–C t It is the remainder of the state of the previous symbol, and floor(.) means rounding down.

7. The ANS entropy coding and decoding method for a deep learning coding and decoding model according to claim 1, characterized in that: The method of setting the second threshold by using M is expressed as: thr2=M Wherein, thr2 represents the second threshold.

8. An ANS entropy coding and decoding system for a deep learning coding and decoding model, characterized in that: The method according to any one of claims 1 to 7 is implemented, and the system comprises: The information acquisition and conversion module is used to obtain the quantitative features of the image processed by the encoding network and the quantization module, convert the quantitative features into a finite symbol sequence, map the probability corresponding to each symbol in the finite symbol sequence to an M interval, and obtain the frequency of each symbol; where M = 2 K , K is a set positive integer, and M is in the interval [0,M]; The ANS entropy coding module is used to perform ANS entropy coding, and the steps include: step S11, calculating the state of the current symbol based on the frequency of the current symbol, the state of the previous symbol and K; step S12, using M to set a first threshold, when the state of the current symbol is greater than or equal to the first threshold, right-shifting the state of the current symbol by K bits, and adding the right-shifted K bits to the code stream; step S13, looping through step S11 and step S12 until all symbols in the finite symbol sequence are entropy coded; The ANS entropy decoding module is used to perform ANS entropy decoding, and the steps include: step S21, based on the state of the current symbol, calculating the interval slot of the state of the previous symbol; step S22, using the optimized binary search method to determine the cumulative frequency interval to which the interval slot of the state of the previous symbol belongs, and recording the lower limit of the determined cumulative frequency interval as the determined C t , and combined with C t Calculate the remainder of the state of the previous symbol; step S23, calculate the state of the previous symbol in combination with the remainder of the state of the previous symbol; step S24, use M to set the second threshold, when the state of the previous symbol is less than the second threshold, shift the state of the previous symbol left by K bits, and move the first K bits of the code stream into the low K bits of the state of the previous symbol; step S25, loop through steps S21 and S24 to complete entropy decoding of all symbol states in a finite symbol sequence.

9. A processing device, characterized in that: include: one or more processors; A memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.

10. A readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Mixed boolean-token ANS coefficient coding

    CN108605145A

  • Cross-platform entropy coding method and decoding method for deep learning coding

    CN112019865A