Data encoding method, data decoding method, and related device

The proposed data encoding method addresses the inefficiencies of ANS-based encoding by using a mapping relationship to reduce memory and delay in encoding and decoding processes, enhancing computational efficiency.

JP2026503281APending Publication Date: 2026-01-28HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
JP2025540186
Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-03-22
Filing Date
2024-01-09
Publication Date
2026-01-28

AI Technical Summary

Technical Problem

Existing asymmetric numeral systems (ANS)-based encoding and decoding methods are time-consuming due to division, modulo operations, and require large memory for encoding and decoding tables, especially in scenarios with wide distributions like AI compression.

Method used

A data encoding method that uses a first and second operation to obtain encoded data without division, reducing memory usage by employing a mapping relationship that includes first and second information, and updating status information without decision operations.

Benefits of technology

Balances memory and delay by reducing memory consumption and computational complexity in encoding and decoding processes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2026503281000001_ABST
    Figure 2026503281000001_ABST
Patent Text Reader

Abstract

A data encoding method and a data decoding method are provided and are applicable to the data coding field. The method includes: obtaining a target symbol; obtaining first information and second information corresponding to the target symbol based on a first mapping relationship, where the first information and second information are obtained based on probability information corresponding to the target symbol; obtaining first encoded data through a first operation based on the first information and status information of an encoder; and updating the status information through a second operation based on the second information to obtain second encoded data. The first encoded data and second encoded data are used to obtain an encoding result of the target symbol, and the first operation and the second operation do not include a division operation. In this application, index information in the encoding table only includes the symbol, and the mapped object only includes the first information and the second information. This is equivalent to reducing memory usage in the encoding table, avoiding operations that consume a large amount of memory, and balancing memory and delay.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical Field]

[0001] This application claims priority to Chinese Patent Application No. 202310028884.0, filed with the State Intellectual Property Office of China on January 9, 2023, entitled "Data Encoding Method, Data Decoding Method, and Related Apparatus," and to Chinese Patent Application No. 202310295323.7, filed with the State Intellectual Property Office of China on March 22, 2023, entitled "Data Encoding Method, Data Decoding Method, and Related Apparatus," both of which are incorporated herein by reference in their entireties.

[0002] The present application relates to the field of data coding, and in particular to a data encoding method, a data decoding method, and related devices. [Background technology]

[0003] Artificial intelligence (AI) is the theory, method, technology, and application system that simulates, augments, and expands human intelligence by using digital computers or machines controlled by digital computers to perceive the environment, acquire knowledge, and achieve optimal results based on that knowledge. In other words, AI is a field of computer science that aims to understand the nature of intelligence and create new intelligent machines that can respond in a manner similar to human intelligence. AI is the study of the design principles and implementation methods for various intelligent machines so that they possess perception, reasoning, and decision-making capabilities.

[0004] Media compression generally includes one or more stages of prediction, frequency transformation, and quantization followed by entropy coding. Corresponding media decompression generally includes entropy decoding followed by one or more stages of inverse quantization, inverse frequency transformation, and prediction. Generally, entropy coding converts input symbols into coded data with a lower bit rate by exploiting redundancy in the input symbols (e.g., by using patterns of multiple input symbols with common values ​​and multiple input symbols with rate values). Entropy decoding converts the coded data into output symbols corresponding to the input symbols. There are many variants of entropy coding / decoding that offer different tradeoffs in terms of compression efficiency and computational complexity. For example, Huffman coding / decoding is computationally simple but has poor compression efficiency for some distributions of input symbol values. In addition, arithmetic coding / decoding usually has much better compression efficiency at the expense of much higher computational complexity.

[0005] Asymmetric coding system (ANS) encoding / decoding offers potentially high compression efficiency and low computational complexity. However, existing ANS-based encoding involves division, modulo operation, and decision, and existing ANS-based decoding involves binary search operation, all of which are time-consuming. In addition, a large number of entries in the encoding and decoding tables are used during encoding and decoding. In scenarios with wide distribution, such as AI compression, the encoding and decoding tables occupy a large amount of memory. Summary of the Invention

[0006] The present application provides a data encoding method and a data decoding method to balance memory and delay.

[0007] According to a first aspect, the present application provides a data encoding method, the method comprising: obtaining a target symbol; obtaining first information and second information corresponding to the target symbol based on a first mapping relationship, where the first information and the second information are obtained based on probability information corresponding to the target symbol; obtaining first encoded data through a first operation based on the first information and status information of the encoder; and updating the status information through a second operation based on the second information to obtain second encoded data. The first encoded data and the second encoded data are used to obtain an encoding result of the target symbol, and the first operation and the second operation do not include a division operation.

[0008] In this application, the index information in the encoding table only includes the symbol, and the mapped object only includes the first information and the second information, which is equivalent to reducing the memory usage in the encoding table, avoiding operations that consume a large amount of memory, and balancing memory and delay.

[0009] In a possible implementation, the first information or the second information represents an integer value.

[0010] In a possible implementation, the first operation and the second operation do not include a decision operation.

[0011] In a possible implementation, the first operation includes: performing a summation operation on the first information and the status information, and performing a bit shift operation on the summation result of the summation operation; and selecting some bits from the status information as the first encoded data, wherein the location of the some bits in the status information is determined based on the shift result of the bit shift operation.

[0012] In a possible implementation, the second operation includes: performing a summation operation on the status information and a value M, and performing a bit shift operation on a summation result of the summation operation, where the probability information includes quantized probabilities and M is a denominator of the quantized probabilities; and performing a summation operation on a shifted result of the bit shift operation and the second information.

[0013] In a possible implementation, the probability information includes a value of a probability mass function PMF, and the value of the PMF is constructed in the following manner: sequentially determining a value of the PMF for each of a plurality of symbols, where the plurality of symbols includes the target symbol.

[0014] Once the value of the PMF of the target symbol is determined, the total value of the remaining PMFs other than the PMF of the determined symbol is multiplied by the probability of the target symbol, and a ratio between the multiplication result and the remaining probability obtained by excluding the determined symbol is calculated, and the PMF of the target symbol is determined based on the relationship between the ratio and a preset fifth value.

[0015] In a possible implementation, the fifth value is 1 and the relationship takes on a larger value.

[0016] In a possible implementation, the probability information includes values ​​of a cumulative distribution function CDF, and the values ​​of the CDF are constructed in the following manner: sequentially determining the value of the CDF of each symbol in a preset order, where the preset order is determined based on the relationship between the values ​​of PMF corresponding to the plurality of symbols, and the plurality of symbols includes the target symbol, and if the probability distribution corresponding to the probability information of the target symbol is a symmetric distribution, the preset order is an alternating order along both sides of a peak point in the symmetric distribution; or if the probability distribution corresponding to the probability information of the target symbol is a discrete distribution, the preset order is specifically descending order; or if the probability distribution corresponding to the probability information of the target symbol is a discrete distribution, the preset order is specifically ascending order.

[0017] In a possible implementation, the target symbol is obtained by transforming pixel data of an image, wherein the data obtained by transforming the pixel data of the image satisfies a predetermined distribution, and the transformation is further used to obtain distribution characteristics of the pixel data, wherein the distribution characteristics include a mean value or a variance; the method further comprises: determining the first mapping relationship corresponding to the distribution characteristic from the multiple mapping relationships based on the distribution characteristic.

[0018] In a possible implementation, the plurality of distribution features include a first distribution feature and a second distribution feature, wherein the entropy of the first distribution feature is greater than the entropy of the second distribution feature; and the value of the denominator of the quantization probability in the mapping relationship corresponding to the second distribution feature is greater than the value of the denominator of the quantization probability in the mapping relationship corresponding to the first distribution feature.

[0019] In a multi-distribution scenario, different quantization probability denominators may be used to reduce the coding length. During data coding, a prediction model and entropy coding may be included, where the prediction model may input original data and output distribution indices and uncoded data (e.g., target symbols in this application). The entropy may be calculated based on the distribution indices. A larger quantization probability denominator may be used for a distribution with smaller entropy.

[0020] In a possible implementation, the first information in the first mapping relationship is constructed in the following manner: performing a summation operation on a preset sixth value and the amount of consecutive leftmost bits that are 0 in the value of the PMF of the target symbol; and performing a bit shift operation on the summation result of the summation operation, and performing a subtraction operation on the shifted result of the bit shift operation and the shifted result of the bit shift operation performed on the value of the PMF of the target symbol to obtain first information; or performing a bit shift operation on the summation result of the summation operation, performing a subtraction operation on the shifted result of the bit shift operation and the shifted result of the bit shift operation performed on the value of the PMF of the target symbol, and performing a summation operation on the result of the subtraction operation and a value M to obtain the first information, wherein the probability information includes a quantization probability, and M is the denominator of the quantization probability.

[0021] In the embodiment of the present application, the PMF calculation method and the CDF calculation method can ensure that the codeword length is reduced without changing the memory and delay.

[0022] In a possible implementation, the second information in the first mapping relationship is constructed in the following manner: performing a subtraction operation on the value of the CDF of the target symbol and the value of the PMF of the target symbol to obtain the second information; or performing a subtraction operation on the value of the CDF of the target symbol and the value of the PMF of the target symbol, and performing a summation operation on the result of the subtraction operation and the value M to obtain the second information, where the probability information includes the quantized probability and M is the denominator of the quantized probability.

[0023] In a possible implementation, the second information in the first mapping relationship is constructed in the following manner: if the result of a subtraction operation performed on the value of the CDF of the target symbol and the value of the PMF of the target symbol is greater than or equal to 0, using the result of the subtraction operation as the second information; or if the result of the subtraction operation performed on the value of the CDF of the target symbol and the value of the PMF of the target symbol is less than 0, performing a summation operation on the result of the subtraction operation and the value M to obtain the second information, wherein the probability information includes the quantized probability, and M is the denominator of the quantized probability.

[0024] In a possible implementation, to further reduce memory usage, the first information and the second information may be combined and then stored, and after obtaining the combined data, the encoder may restore the first information and the second information according to certain calculation rules.

[0025] In a possible implementation, an integer value corresponding to the target symbol may be obtained based on a first mapping relationship; and the integer value is restored to first information and second information through a third operation, where the first information and the second information are each integer values. The above-mentioned scheme can reduce memory consumption, shorten memory read time, and further improve throughput on some hardware devices (e.g., servers).

[0026] For example, multiple integer parameters (at most one of which is a signed integer) may be combined into a single parameter by placing the signed integer at the leftmost position, then sequentially storing the parameters bit by bit based on the amount of bits in each parameter through shifting and bitwise ORing; and when a symbol is read, restoring each parameter through shifting and bitwise ANDing.

[0027] In a possible implementation, the probability information includes PMF information corresponding to each symbol, the PMF information including a first value and a second value; a sum of the first value and the second value is the value of the PMF; the probability information further includes CDF information corresponding to each symbol, the CDF information including a third value and a fourth value; and the third value and the fourth value are expressed in the following manner: sequentially determining a third value corresponding to each symbol in the predetermined order through accumulation based on the first values ​​of the plurality of symbols; and sequentially determining a fourth value corresponding to each symbol in the predetermined order through accumulation based on the second and third values ​​of the plurality of symbols; It is constructed in

[0028] In a possible implementation, the second information includes first sub-information (which may also be referred to as status addend 1), second sub-information (which may also be referred to as status threshold), and third sub-information (which may also be referred to as status addend 2).

[0029] The first sub-information in the first mapping relationship is constructed in the following manner: performing a subtraction operation on a third value of the target symbol and the value of the PMF of the target symbol to obtain the first sub-information.

[0030] The second sub-information in the first mapping relationship is constructed in the following manner: performing a summation operation on the third value of the target symbol and the first value of the target symbol, and performing a subtraction operation on the result of the summation operation and 1 to obtain the second sub-information.

[0031] The third sub-information in the first mapping relationship is constructed in the following manner: performing a subtraction operation on a fourth value of the target symbol and the third value of the target symbol, and performing a subtraction operation on a result of the subtraction operation and the first value of the target symbol to obtain the third sub-information.

[0032] In a possible implementation, the second operation is: performing a summation operation on the status information and the value M, and performing the bit shifting operation on a summation result of the summation operation, where the probability information includes the quantization probabilities and M is the denominator of the quantization probabilities; and performing a summation operation on a shifted result of the bit shifting operation and the first sub-information; and if the result of the summation operation is greater than the second sub-information, using the sum of the result of the summation operation and the third sub-information as the second encoded data; or If the result of the summation is less than the second sub-information, the result of the summation is used as the second encoded data. Includes.

[0033] The above scheme may be applicable to, but is not limited to, single-peak symmetric distributions (e.g., Gaussian, logistic, or Laplace distributions) and is used to reduce the coding length, but at the expense of increased coding computation.

[0034] In a possible implementation, when the value M is 256, the first information is stored by using 10 bits, the first sub-information is stored by using 8 bits, the second sub-information is stored by using 7 bits, and the third sub-information is stored by using 7 bits, the sum of the first values ​​of the plurality of symbols is 128, and the third sub-information is less than 128.

[0035] The present application further provides a data encoding method applicable to an asymmetric code system ANS-based encoder, comprising: obtaining a first symbol, wherein a sum of a quantization probability corresponding to the first symbol and a quantization probability corresponding to a second symbol is 1, a difference between the quantization probability corresponding to the first symbol and 1 is less than a threshold, and a difference between the quantization probability corresponding to the second symbol and 0 is less than the threshold; and, if a value relationship between encoder status information and a value M satisfies a first condition, performing a first operation on the status information and the value M to obtain first encoded data and update the status information to 0; or, if a value relationship between the encoder status information and the value M does not satisfy a first condition, adding 1 to the status information.

[0036] In a possible implementation, the method further comprises: obtaining the second symbol; and using the status information of the encoder as the first encoded data and updating the status information to the difference between the values ​​M and 1.

[0037] The above embodiment may be specific to the encoding and decoding solution for the case where there are a total of two types of symbols and the probability of a single symbol is close to 1. In this embodiment, there is no need to build an encoding and decoding table, so no additional memory is required to store the table.

[0038] According to a second aspect, the present application provides a data decoding method, comprising: acquiring status information and memory bits of a decoder, where the status information corresponds to a first bit, the first bit being a currently undecoded bit; and determining first information, second information, and third information corresponding to the status information based on a first mapping relationship, where the first information is a target symbol corresponding to the first bit, the target symbol being a decoding result of the first bit, the second information indicating an amount of bits selected from the memory bits, the third information being used to perform a summation operation with bits selected from the memory bits based on the second information, and the result of the summation operation being used to update the status information, where the updated status information corresponds to a second bit, the second bit being an undecoded bit after the first bit.

[0039] In a possible implementation, the method further comprises: removing the selected bit from the memory bits to obtain updated memory bits.

[0040] In a possible implementation, the first information, the second information, or the third information represents an integer value.

[0041] In a possible implementation, the first information in the first mapping relationship is constructed by using x as the first information, which satisfies the following formula: C(x)≦s<(C(x)+P(x)), where C represents the value of the CDF, P represents the value of the PMF, and s represents the status information.

[0042] In a possible implementation, the first information in the first mapping relationship is in the following manner: Constructed by using, as the first information, an x that satisfies C1(x) ≤ s < C1(x) + P1(x) or C2(x) ≤ s < C2(x) + P2(x), where C1 represents a third value corresponding to the CDF, P1 represents a first value corresponding to the PMF, C2 represents a fourth value corresponding to the CDF, P2 represents a second value corresponding to the PMF, s represents the status information, and the sum of the first value and the second value is the value of the PMF.

[0043] In a possible implementation, the second information in the first mapping relationship is in the following manner: Constructed by using, as the second information, the value of clz(s' - C(x) + P(x)) + X, where clz represents taking the amount of the leftmost bit that is consecutive 0s in the value, X is a preset fifth value, and s' is in the following manner: When C2(x) ≤ s, s' = P1(x) + s - C2(x) + P(x); or when C2(x) > s, s' = s - C1(x) + P(x) obtained in.

[0044] In a possible implementation, the third information in the first mapping relationship is constructed by performing a bit shift operation on the value of s' - C(x) + P(x) to obtain the third information, where the shift amount of the bit shift operation is obtained based on the second information.

[0045] In a possible implementation, the second information in the first mapping relationship is in the following manner: Constructed by using, as the second information, the value of clz(s - C(x) + P(x)) + X, where clz represents taking the amount of the leftmost bit that is consecutive 0s in the value, and X is a preset fifth value.

[0046] In a possible implementation, the third information in the first mapping relationship is in the following manner: performing a bit shift operation on the value of sC(x)+P(x) to obtain the third information, where the shift amount of the bit shift operation is obtained based on the second information; or performing a bit shift operation on the value of sC(x)+P(x); and subtracting a value M from a result of the bit shift operation to obtain the third information, where M is the denominator of the quantization probability, and a shift amount of the bit shift operation is obtained based on the second information; It is constructed in

[0047] In a possible implementation, the first information, the second information, or the third information is obtained based on probability information; the probability information includes a value of a probability mass function PMF; the value of the PMF is constructed in the following manner: sequentially determining a value of a PMF for each of a plurality of symbols, where the plurality of symbols includes the target symbol, and once the value of the PMF of the target symbol is determined, the total value of the remaining PMFs other than the PMF of the determined symbol is multiplied by the probability of the target symbol, and a ratio between the multiplication result and the remaining probability obtained by excluding the determined symbol is calculated, and the PMF of the target symbol is determined based on a relationship between the ratio and a preset value.

[0048] In a possible implementation, the preset value is 1 and the relationship takes on a larger value.

[0049] In a possible implementation, the first information, the second information, or the third information is obtained based on the probability information, the probability information including the value of the cumulative distribution function CDF, and the value of the CDF is calculated in the following manner: sequentially determining a CDF value for each symbol in a predetermined order, where the predetermined order is determined based on a relationship between PMF values ​​corresponding to the plurality of symbols, the plurality of symbols including the target symbol; When the probability distribution corresponding to the probability information of the target symbol is a symmetric distribution, the preset order is an alternating order along both sides of a peak point in the symmetric distribution; or When the probability distribution corresponding to the probability information of the target symbol is a discrete distribution, the preset order is specifically a descending order; or When the probability distribution corresponding to the probability information of the target symbol is a discrete distribution, the preset order is specifically an ascending order.

[0050] In a possible implementation, the method comprises: obtaining an encoding result, wherein the encoding result is obtained by encoding pixel data of an image, and the status information and the memory bit are obtained based on the encoding result; processing the encoding result to obtain distribution characteristics of the pixel data, where the distribution characteristics include a mean or a variance; and determining the first mapping relationship corresponding to the distribution feature from a plurality of mapping relationships based on the distribution feature; Further provided with:

[0051] The present application further provides a data decoding method adapted for use with an asymmetric coding system ANS-based decoder, said method comprising: obtaining status information of the decoder, where the status information corresponds to a first bit, the first bit being a currently undecoded bit; and determining that the decoding result of the first bit is a second symbol if the status information is a difference between the value M and 1, and updating the status information to the result of reading the value M bits from a memory bit; or determining that the decoded result of the first bit is a first symbol if the status information is not the difference between values ​​M and 1; updating the status information to a sum result of the difference between values ​​M and 2 and the value of 1 bit read from the memory bit if the status information is 0; or updating the status information to a difference between the status information and 1 if the status information is not 0, wherein the updated status information corresponds to a second bit, the second bit being an undecoded bit after the first bit. Equipped with.

[0052] According to a third aspect, the present application provides a data encoding apparatus, the apparatus comprising: an acquisition module configured to acquire a target symbol; and An encoding module: obtaining first information and second information corresponding to the target symbol based on a first mapping relationship, where the first information and the second information are obtained based on probability information corresponding to the target symbol; obtaining first encoded data through a first operation based on the first information and status information of the encoder; and updating the status information through a second operation based on the second information to obtain second encoded data; an encoding module configured to: Equipped with.

[0053] The first encoded data and the second encoded data are used to obtain an encoding result of the target symbol, and the first operation and the second operation do not include a division operation.

[0054] In a possible implementation, the first information or the second information represents an integer value.

[0055] In a possible implementation, the first operation and the second operation do not include a decision operation.

[0056] In a possible implementation, the first operation is: performing a summation operation on the first information and the status information, and performing a bit shift operation on a summation result of the summation operation; and selecting some bits from the status information as the first encoded data; and the location of the number of bits in the status information is determined based on a shift result of the bit shift operation.

[0057] In a possible implementation, the second operation is: performing a summation operation on the status information and a value M, and performing a bit shift operation on a summation result of the summation operation, where the probability information includes quantized probabilities, and M is a denominator of the quantized probabilities; and performing a summation operation on the shift result of the bit shift operation and the second information; Includes.

[0058] In a possible implementation, the probability information comprises values ​​of a probability mass function PMF, the values ​​of the PMF being determined in the following manner: The PMF is constructed by sequentially determining a value of a PMF for each of a plurality of symbols, where the plurality of symbols includes the target symbol, and once the value of the PMF for the target symbol is determined, the total value of the remaining PMFs other than the PMF of the determined symbol is multiplied by the probability of the target symbol, and a ratio between the multiplication result and the remaining probability obtained by excluding the determined symbol is calculated, and the PMF for the target symbol is determined based on the relationship between the ratio and a preset fifth value.

[0059] In a possible implementation, the fifth value is 1 and the relationship takes on a larger value.

[0060] In a possible implementation, the probability information comprises values ​​of a cumulative distribution function CDF, and the values ​​of the CDF are calculated in the following manner: sequentially determining a CDF value for each symbol in a predetermined order, where the predetermined order is determined based on a relationship between PMF values ​​corresponding to the plurality of symbols, the plurality of symbols including the target symbol; Wherein, if the probability distribution corresponding to the probability information of the target symbol is a symmetric distribution, the preset order is an alternating order along both sides of a peak point in the symmetric distribution; or When the probability distribution corresponding to the probability information of the target symbol is a discrete distribution, the preset order is specifically a descending order; or When the probability distribution corresponding to the probability information of the target symbol is a discrete distribution, the preset order is specifically an ascending order.

[0061] In a possible implementation, the target symbol is obtained by transforming pixel data of an image, where the data obtained by transforming the pixel data of the image satisfies a preset distribution, and the transformation is further used to obtain distribution characteristics of the pixel data, where the distribution characteristics include a mean value or a variance; the obtaining module: The method is further configured to determine the first mapping relationship corresponding to the distribution feature from a plurality of mapping relationships based on the distribution feature.

[0062] In a possible implementation, the plurality of distribution features includes a first distribution feature and a second distribution feature, and an entropy of the first distribution feature is greater than an entropy of the second distribution feature; The value of the denominator of the quantization probability in the mapping relationship corresponding to the second distribution feature is greater than the value of the denominator of the quantization probability in the mapping relationship corresponding to the first distribution feature.

[0063] In a possible implementation, the first information in the first mapping relationship is in the following manner: performing a summation operation on a preset sixth value and the amount of consecutive zero-valued left-most bits in the value of the PMF of the target symbol; and performing a bit shift operation on a summation result of the summation operation, and performing a subtraction operation on the shifted result of the bit shift operation and the shifted result of the bit shift operation performed on the value of the PMF of the target symbol to obtain the first information; or performing a bit shift operation on a summation result of the summation operation; performing a subtraction operation on the shift result of the bit shift operation and the shift result of the bit shift operation performed on the value of the PMF of the target symbol; and performing a summation operation on the operation result of the subtraction operation and the value M to obtain the first information. where the probability information includes the quantized probabilities and M is the denominator of the quantized probabilities.

[0064] In a possible implementation, the second information in the first mapping relationship is in the following manner: performing a subtraction operation on the value of the CDF of the target symbol and the value of the PMF of the target symbol to obtain the second information; or performing a subtraction operation on the value of the CDF of the target symbol and the value of the PMF of the target symbol, and performing a summation operation on the result of the subtraction operation and a value M to obtain the second information. where the probability information includes the quantized probabilities and M is the denominator of the quantized probabilities.

[0065] In a possible implementation, the second information in the first mapping relationship is in the following manner: using the result of the subtraction operation performed on the value of the CDF of the target symbol and the value of the PMF of the target symbol as the second information if the result of the subtraction operation is greater than or equal to zero; or if a result of the subtraction operation performed on the value of the CDF of the target symbol and the value of the PMF of the target symbol is less than zero, performing a summation operation on the result of the subtraction operation and value M to obtain the second information. where the probability information includes the quantized probabilities and M is the denominator of the quantized probabilities.

[0066] In a possible implementation, the encoding module: Obtaining an integer value corresponding to the target symbol based on the first mapping relationship; and recovering the integer value into the first information and the second information through a third operation, wherein the first information and the second information are each integer values; The present invention is particularly configured to:

[0067] In a possible implementation, the probability information includes PMF information corresponding to each symbol, the PMF information including a first value and a second value; a sum of the first value and the second value is the value of the PMF; the probability information further includes CDF information corresponding to each symbol, the CDF information including a third value and a fourth value; and the third value and the fourth value are expressed in the following manner: sequentially determining a third value corresponding to each symbol in the predetermined order through accumulation based on the first values ​​of the plurality of symbols; and sequentially determining a fourth value corresponding to each symbol in the predetermined order through accumulation based on the second and third values ​​of the plurality of symbols; It is constructed in

[0068] In a possible implementation, the second information includes first sub-information, second sub-information, and third sub-information.

[0069] The first sub-information in the first mapping relationship is constructed in the following manner: performing a subtraction operation on a third value of the target symbol and the value of the PMF of the target symbol to obtain the first sub-information.

[0070] The second sub-information in the first mapping relationship is constructed in the following manner: performing a summation operation on the third value of the target symbol and the first value of the target symbol, and performing a subtraction operation on the result of the summation operation and 1 to obtain the second sub-information.

[0071] The third sub-information in the first mapping relationship is constructed in the following manner: performing a subtraction operation on a fourth value of the target symbol and the third value of the target symbol, and performing a subtraction operation on a result of the subtraction operation and the first value of the target symbol to obtain the third sub-information.

[0072] In a possible implementation, the second operation is: performing a summation operation on the status information and the value M, and performing the bit shifting operation on a summation result of the summation operation, where the probability information includes the quantization probabilities and M is the denominator of the quantization probabilities; and performing a summation operation on a shifted result of the bit shifting operation and the first sub-information; and if the result of the summation operation is greater than the second sub-information, using the sum of the result of the summation operation and the third sub-information as the second encoded data; or If the result of the summation is less than the second sub-information, the result of the summation is used as the second encoded data. Includes.

[0073] In a possible implementation, when the value M is 256, the first information is stored by using 10 bits, the first sub-information is stored by using 8 bits, the second sub-information is stored by using 7 bits, and the third sub-information is stored by using 7 bits, the sum of the first values ​​of the plurality of symbols is 128, and the third sub-information is less than 128.

[0074] The present application further provides a data encoding device for use in an asymmetric code system ANS-based encoder, the device comprising: an acquisition module configured to acquire a first symbol, wherein a sum of a quantized probability corresponding to the first symbol and a quantized probability corresponding to a second symbol is 1, a difference between the quantized probability corresponding to the first symbol and 1 is less than a threshold, and a difference between the quantized probability corresponding to the second symbol and 0 is less than the threshold; and An encoding module: If a value relationship between the status information of the encoder and a value M satisfies a first condition, performing a first operation on the status information and the value M to obtain first encoded data and update the status information to 0; or If a value relationship between the status information of the encoder and a value M does not satisfy a first condition, adding 1 to the status information. an encoding module configured to: Equipped with.

[0075] In a possible implementation, the acquisition module: It is further configured to obtain the second symbol.

[0076] The encoding module is further configured to: use status information of the encoder as the first encoded data, and update the status information to the difference between the values ​​M and one.

[0077] According to a fourth aspect, the present application provides a data decoding apparatus, said apparatus comprising: an acquisition module configured to acquire decoder status information and memory bits, where the status information corresponds to a first bit, and the first bit is a currently undecoded bit; and a decoding module configured to determine first information, second information, and third information corresponding to the status information based on a first mapping relationship, wherein the first information is a target symbol corresponding to the first bit, the target symbol being a decoding result of the first bit, the second information indicating an amount of bits selected from the memory bits, the third information being used to perform a summation operation with bits selected from the memory bits based on the second information, and the result of the summation operation being used to update the status information, wherein the updated status information corresponds to a second bit, the second bit being an undecoded bit after the first bit; Equipped with.

[0078] In a possible implementation, the decoding module: The method is further configured to remove the selected bit from the memory bits to obtain updated memory bits.

[0079] In a possible implementation, the first information, the second information, or the third information represents an integer value.

[0080] In a possible implementation, the first information in the first mapping relationship is in the following manner: Using x satisfying C(x)≦s<(C(x)+P(x)) as the first information, where C represents a CDF value, P represents a PMF value, and s represents the status information; or Using x that satisfies C1(x) ≤ s < C1(x) + P1(x) or C2(x) ≤ s < C2(x) + P2(x) as the first information, where C1 represents the third value corresponding to the CDF, P1 represents the first value corresponding to the PMF, C2 represents the fourth value corresponding to the CDF, P2 represents the second value corresponding to the PMF, s represents the status information, and the sum of the first value and the second value is the value of the PMF. is constructed in.

[0081] In a possible implementation, the second information in the first mapping relationship is in the following manner: Using the value of clz(s - C(x) + P(x)) + X as the second information, where clz represents taking the amount of the leftmost bit that is consecutive 0s in the value, and X is a preset fifth value; or Performing a bit shift operation on the value of s - C(x) + P(x) to obtain the third information, where the shift amount of the bit shift operation is obtained based on the second information; or Performing a bit shift operation on the value of s - C(x) + P(x), and subtracting a value M from the operation result of the bit shift operation to obtain the third information, where M is the denominator of the quantization probability, and the shift amount of the bit shift operation is obtained based on the second information; or Using the value of clz(s' - C(x) + P(x)) + X as the second information is constructed in, where clz represents taking the amount of the leftmost bit that is consecutive 0s in the value, X is a preset fifth value, and s' is in the following manner: When C2(x) ≤ s, s' = P1(x) + s - C2(x) + P(x); or when C2(x) > s, s' = s - C1(x) + P(x) is obtained in.

[0082] In a possible implementation, the third information in the first mapping relationship is in the following manner: performing the bit shift operation on the value of sC(x)+P(x) to obtain the third information, where the shift amount of the bit shift operation is obtained based on the second information; or performing the bit shifting operation on the value of sC(x)+P(x), and subtracting the value M from the result of the bit shifting operation to obtain the third information, where M is the denominator of the quantization probability, and the shift amount of the bit shifting operation is obtained based on the second information; or performing a bit shift operation on the value of s'-C(x)+P(x) to obtain the third information, where a shift amount of the bit shift operation is obtained based on the second information; It is constructed in

[0083] In a possible implementation, the first information, the second information, or the third information is obtained based on probability information, the probability information including a value of a probability mass function PMF; the value of the PMF is determined in the following manner: The PMF is constructed by sequentially determining a value of a PMF for each of a plurality of symbols, where the plurality of symbols includes the target symbol, and once the value of the PMF for the target symbol is determined, the total value of the remaining PMFs other than the PMF of the determined symbol is multiplied by the probability of the target symbol, and a ratio between the multiplication result and the remaining probability obtained by excluding the determined symbol is calculated, and the PMF for the target symbol is determined based on the relationship between the ratio and a preset value.

[0084] In a possible implementation, the preset value is 1 and the relationship takes on a larger value.

[0085] In a possible implementation, the first information, the second information, or the third information is obtained based on the probability information, the probability information including the value of the cumulative distribution function CDF, and the value of the CDF is calculated in the following manner: sequentially determining a CDF value for each symbol in a predetermined order, where the predetermined order is determined based on a relationship between PMF values ​​corresponding to the plurality of symbols, the plurality of symbols including the target symbol; When the probability distribution corresponding to the probability information of the target symbol is a symmetric distribution, the preset order is an alternating order along both sides of a peak point in the symmetric distribution; or When the probability distribution corresponding to the probability information of the target symbol is a discrete distribution, the preset order is specifically a descending order; or When the probability distribution corresponding to the probability information of the target symbol is a discrete distribution, the preset order is specifically an ascending order.

[0086] In a possible implementation, the acquisition module: obtaining an encoding result, wherein the encoding result is obtained by encoding pixel data of an image, and the status information and the memory bit are obtained based on the encoding result; processing the encoding result to obtain distribution characteristics of the pixel data, where the distribution characteristics include a mean or a variance; and determining the first mapping relationship corresponding to the distribution feature from a plurality of mapping relationships based on the distribution feature; The device is further configured to:

[0087] The present application further provides a data decoding device for use in an asymmetric coding system ANS-based decoder, the device comprising: an acquisition module configured to acquire status information of the decoder, where the status information corresponds to a first bit, the first bit being a current undecoded bit; and A decryption module: determining that the decoding result of the first bit is a second symbol if the status information is a difference between the value M and 1, and updating the status information to the result of reading the value M bits from a memory bit; or determining that the decoded result of the first bit is a first symbol if the status information is not the difference between values ​​M and 1; updating the status information to a sum result of the difference between values ​​M and 2 and the value of 1 bit read from the memory bit if the status information is 0; or updating the status information to a difference between the status information and 1 if the status information is not 0, wherein the updated status information corresponds to a second bit, and the second bit is an undecoded bit after the first bit. a decoding module configured to: Equipped with.

[0088] According to a fifth aspect, an embodiment of the present application provides a data encoding apparatus, the apparatus may include a storage, a processor, and a bus system, the storage configured to store a program, and the processor configured to execute the program in the storage to perform any optional method of the first aspect.

[0089] According to a sixth aspect, an embodiment of the present application provides a data decoding apparatus, the apparatus may include a storage, a processor, and a bus system, the storage configured to store a program, and the processor configured to execute the program in the storage to perform any optional method of the second aspect.

[0090] According to a seventh aspect, an embodiment of the present application provides a computer-readable storage medium storing a computer program that, when executed on a computer, enables the computer to perform the method according to the first aspect and any optional implementation thereof, and the second aspect and any optional implementation thereof.

[0091] According to an eighth aspect, an embodiment of the present application provides a computer program product comprising code which, when executed, implements a method according to the first aspect and any optional implementation of the first aspect, and a method according to the second aspect and any optional implementation of the second aspect.

[0092] According to a ninth aspect, the present application provides a chip system. The chip system includes a processor configured to implement the functions of the aforementioned aspects, e.g., to support an execution device or a training device in sending or processing data or information in the aforementioned methods. In a possible design, the chip system further includes storage. The storage is configured to store program instructions and data required for the execution device or the training device. The chip system may include a chip, or may include a chip and other discrete components. [Brief explanation of the drawings]

[0093] [Figure 1A] 1 is a block diagram of an example video coding system that may be used to implement embodiments of the present invention;

[0094] [Figure 1B] FIG. 2 is a block diagram of another example video coding system that may be used to implement embodiments of the present invention.

[0095] [Figure 2]FIG. 2 is a block diagram of an exemplary structure of an encoder that may be used to implement embodiments of the present invention.

[0096] [Figure 3] FIG. 2 is a block diagram of an exemplary structure of a decoder that may be used to implement embodiments of the present invention.

[0097] [Figure 4] 1 is a block diagram of an example of a video coding device that may be used to implement embodiments of the present invention.

[0098] [Figure 5] 1 is a schematic flowchart of a data encoding method according to an embodiment of the present application;

[0099] [Figure 6] 1 is a schematic flowchart of a data encoding method according to an embodiment of the present application;

[0100] [Figure 7] 1 is a schematic flowchart of a data encoding method according to an embodiment of the present application;

[0101] [Figure 8] 1 is a schematic flowchart of a data encoding method according to an embodiment of the present application;

[0102] [Figure 9] 1 is a schematic flowchart of a data decoding method according to an embodiment of the present application;

[0103] [Figure 10A] 1 is a schematic flowchart of a data decoding method according to an embodiment of the present application;

[0104] [Figure 10B] 1 is a schematic flowchart of a data decoding method according to an embodiment of the present application;

[0105] [Figure 11] 1 is a diagram of the structure of a data encoding device according to an embodiment of the present application;

[0106] [Figure 12] 1 is a diagram of the structure of a data decoding device according to an embodiment of the present application;

[0107] [Figure 13] FIG. 1 is a diagram of an execution device according to an embodiment of the present application.

[0108] [Figure 14] FIG. 2 is a diagram of a server according to an embodiment of the present application.

[0109] [Figure 15] FIG. 1 is a diagram of a chip according to an embodiment of the present application. DETAILED DESCRIPTION OF THE INVENTION

[0110] The following describes the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. The terms used in the embodiments of the present invention are only intended to describe specific embodiments of the present invention, and are not intended to limit the present invention.

[0111] The following describes embodiments of the present application with reference to the accompanying drawings. Those skilled in the art may understand that with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application can also be applied to similar technical problems.

[0112] In the specification, claims, and accompanying drawings of this application, the terms "first," "second," and the like, are intended to distinguish between similar objects, but do not necessarily indicate a particular order or sequence. Terms used in this manner are interchangeable under appropriate circumstances, and it should be understood that this is merely a distinguishing mechanism used when objects having the same attributes are described in embodiments of this application. In addition, the terms "comprise," "have," and any other variations are meant to cover a non-exclusive inclusion, whereby a process, method, system, product, or device that includes a set of units is not necessarily limited to those units and may include other units not expressly listed or inherent to such process, method, system, product, or device.

[0113] In embodiments of the present invention, "at least one" means one or more, and "multiple" means two or more. "And / or" describes the relationship of association between associated objects and indicates that three relationships may exist. For example, A and / or B may represent the following cases: A alone, A and B both, and B alone, where A and B may be singular or plural. The symbol " / " generally indicates an "or" relationship between associated objects. "At least one item (piece) of" or similar expressions means any combination of these items, including a single item (piece) or any combination of multiple items (pieces). For example, at least one item (piece) of a, b, or c may represent a, b, c, a and b, a and c, b and c, or a, b, and c, where a, b, and c may be singular or plural.

[0114] Many of the techniques and tools described in the embodiments of the present application are described with reference to a media encoder / decoder system, such as a video encoder / decoder system, an audio encoder / decoder system, or a texture encoder / decoder system. Alternatively, the techniques and tools described in the embodiments of the present application may be implemented in a data encoder / decoder system generally used to encode / decode text data or other types of data.

[0115] The terms used in the embodiments of the present invention are intended to describe specific embodiments of the present invention only, and are not intended to limit the present invention. The following will first briefly explain some concepts that can be used in the embodiments of the present invention.

[0116] It should be understood that the present application is not limited to video coding, but can also be used for audio, texture, or image coding. The following uses video coding as an example for illustration purposes.

[0117] Video coding typically refers to the processing of a sequence of pictures that form a video or video sequence. In the field of video coding, the terms "picture," "frame," or "image" may be used synonymously. Video coding, as used herein, refers to video encoding or video decoding. Video encoding is performed at the source side and typically involves processing (e.g., compressing) original video pictures to reduce the amount of data required to represent the video pictures, so that they can be stored and / or transmitted more efficiently. Video decoding is performed at the destination side and typically involves the reverse process to the encoder to reconstruct the video pictures. "Coding" a video picture in the embodiments should be understood as "encoding" or "decoding" a video sequence. The combination of the encoding and decoding parts is also referred to as coding (encoding and decoding).

[0118] A video sequence includes a series of images (pictures), where an image is further partitioned into multiple slices, and a slice is further partitioned into multiple blocks. In video coding, the coding process is performed in units of blocks. In some new video coding standards, the concept of a "block" is further expanded. For example, a macroblock (MB) is introduced in the H.264 standard, and a macroblock can be further partitioned into multiple prediction blocks (partitions) for predictive coding. In the high efficiency video coding (HEVC) standard, multiple block units are functionally divided based on basic concepts such as a coding unit (CU), a prediction unit (PU), and a transform unit (TU), and are described by using a new tree-based structure. For example, a CU can be partitioned into smaller CUs based on a quadtree, and one smaller CU can be further partitioned to generate a quadtree structure. A CU is the basic unit for partitioning and coding an uncoded image. PUs and TUs also have a similar tree structure. A PU may correspond to a prediction block and is a basic unit of predictive coding. A CU is further partitioned into multiple PUs in a partitioning mode. A TU may correspond to a transform block and is a basic unit for transforming a prediction residual. However, all of CUs, PUs, and TUs are essentially concepts of blocks (or image blocks). For the concepts of image blocks (e.g., first image blocks and second image blocks) in the embodiments of the present application, please refer to the description in this specification.

[0119] For example, in HEVC, one CTU is partitioned into multiple CUs by using a quad-tree structure represented as a coding tree. The decision as to whether to code a picture area using inter-picture (temporal) prediction or intra-picture (spatial) prediction is made at the CU level. Each CU may be further partitioned into one, two, or four PUs based on the PU partitioning type. The same prediction process is applied within a PU, and related information is transmitted to the decoder on a PU-by-PU basis. After the residual block is obtained by applying the prediction process based on the PU partitioning type, the CU may be partitioned into transform units (TUs) based on another quad-tree structure similar to the coding tree used for the CU. In the latest development of video compression technology, quad-tree and binary tree (QTBT) partition frames are used to partition coding blocks. In the QTBT block structure, CUs may be square or rectangular.

[0120] In this specification, for ease of explanation and understanding, an unprocessed image block (abbreviated as unprocessed image block) in an image currently being coded may be referred to as a current block. For example, in coding, the unprocessed image block is the block currently being coded; in decoding, the unprocessed image block is the block currently being decoded. A decoded image block in a reference image and used to predict a current block is referred to as a reference block. In other words, a reference block is a block that provides a reference signal for the current block. The reference signal represents pixel values ​​in an image block. A block in a reference image that provides a prediction signal for the current block may be referred to as a prediction block. The prediction signal represents pixel values, sampling values, or sampling signals in a prediction block. For example, after multiple reference blocks are traversed, an optimal reference block is found, and this optimal reference block provides a prediction for the current block and may be referred to as a prediction block.

[0121] In lossless video coding, the original video picture can be reconstructed, i.e., the reconstructed video picture has the same quality as the original video picture (assuming no transmission or other data loss occurs during storage or transmission). In lossy video coding, further compression is performed, for example through quantization, to reduce the amount of data required to represent the video picture, and the video picture cannot be perfectly reconstructed at the decoder side, i.e., the quality of the reconstructed video picture is lower or worse than the quality of the original video picture.

[0122] Some H.261 video coding standards belong to "lossy hybrid video coding" (i.e., spatial and temporal prediction in the sample domain is combined with 2D transform coding to apply quantization in the transform domain). Each picture of a video sequence is usually partitioned into a set of non-overlapping blocks, and coding is usually performed at the block level. In other words, at the encoder side, video is usually processed, i.e., coded, at the block (video block) level. For example, a predictive block is generated through spatial (intra-picture) prediction and temporal (inter-picture) prediction, and the predictive block is subtracted from a current block (a block currently processed or unprocessed) to obtain a residual block, which is transformed and quantized in the transform domain to reduce the amount of data to be transmitted (compressed). At the decoder side, the inverse process to that of the encoder is applied to the coded or compressed block to reconstruct the current block for representation. Additionally, the encoder replicates the decoder processing loop, so that the encoder and decoder generate the same predictions (e.g., intra-prediction and inter-prediction) and / or reconstructions for processing, i.e., coding, subsequent blocks.

[0123] The following describes a system architecture to which an embodiment of the present invention is applied. FIG. 1A is a block diagram of an example of a video encoding and decoding system 10 to which an embodiment of the present invention is applied. As shown in FIG. 1A, the video encoding and decoding system 10 may include a source device 12 and a destination device 14. The source device 12 generates encoded video data. Therefore, the source device 12 may be referred to as a video encoding apparatus. The destination device 14 may decode the encoded video data generated by the source device 12. Therefore, the destination device 14 may be referred to as a video decoding apparatus. Various implementation solutions of the source device 12, the destination device 14, or the source device 12 and the destination device 14 may include one or more processors and storage coupled to the one or more processors. The storage, as described herein, may include, but is not limited to, RAM, ROM, EEPROM, flash memory, or any other medium that can be used to store desired program code in the form of computer-accessible instructions or data structures. The source device 12 and the destination device 14 may include a variety of devices, including desktop computers, mobile computing devices, notebook (e.g., laptop) computers, tablet computers, set-top boxes, handheld telephones, such as so-called "smart" phones, televisions, cameras, display devices, digital media players, video game consoles, in-vehicle computers, wireless communication devices, or the like.

[0124] 1A as separate devices, an embodiment of the device may alternatively include both the source device 12 and the destination device 14 or the functionality of both the source device 12 and the destination device 14, i.e., the source device 12 or the corresponding functionality of the source device 12 and the destination device 14 or the corresponding functionality of the destination device 14. In such an embodiment, the source device 12 or the corresponding functionality of the source device 12 and the destination device 14 or the corresponding functionality of the destination device 14 may be implemented using the same hardware and / or software, separate hardware and / or software, or any combination thereof.

[0125] The source device 12 may be communicatively coupled to the destination device 14 through a link 13, and the destination device 14 may receive encoded video data from the source device 12 through the link 13. The link 13 may include one or more media or devices capable of moving the encoded video data from the source device 12 to the destination device 14. In one example, the link 13 may include one or more communication media that enable the source device 12 to transmit the encoded video data directly to the destination device 14 in real time. In this example, the source device 12 may modulate the encoded video data according to a communication standard (e.g., a wireless communication protocol) and transmit the modulated video data to the destination device 14. The one or more communication media may include a wireless communication medium and / or a wired communication medium, e.g., a radio frequency (RF) spectrum or one or more physical transmission lines. The one or more communication media may form part of a packet-based network, which may be, for example, a local area network, a wide area network, or a global network (e.g., the Internet). The one or more communication media may include a router, a switch, a base station, or another device that facilitates communication from source device 12 to destination device 14 .

[0126] Source device 12 includes an encoder 20. Optionally, source device 12 may further include a picture source 16, a picture preprocessor 18, and a communication interface 22. In a particular implementation, encoder 20, picture source 16, picture preprocessor 18, and communication interface 22 may be hardware components in source device 12 or may be software programs in source device 12. The following describes the components separately.

[0127] Picture source 16 may include or be, for example, any type of picture capture device configured to capture real-world pictures and / or any type of picture or commentary (in the case of screen content coding, even some text on the screen is considered part of the uncoded picture or image). For example, the picture capture device may be a computer graphics processor configured to generate computer-animated pictures, or any type of device configured to acquire and / or provide real-world pictures, computer-animated pictures (e.g., screen content, virtual reality (VR) pictures), and / or any combination thereof (augmented reality (AR) pictures). Picture source 16 may be a camera configured to capture pictures or storage configured to store pictures. Picture source 16 may further include any type of interface (internal or external) through which previously captured or generated pictures are stored and / or through which pictures are acquired or received. If the picture source 16 is a camera, the picture source 16 may be, for example, a local camera or an integrated camera integrated in the source device. If the picture source 16 is storage, the picture source 16 may be local storage or, for example, integrated storage integrated in the source device. If the picture source 16 includes an interface, the interface may be, for example, an external interface for receiving pictures from an external video source. The external video source may be, for example, an external picture capture device such as a camera, external storage, or an external picture generation device. The external picture generation device may be, for example, an external computer graphics processor, computer, or server. The interface may be any type of interface, for example, a wired or wireless interface, or an optical interface, according to any proprietary or standardized interface protocol.

[0128] A picture may be considered as a two-dimensional array or matrix of picture elements. A picture element in the array may also be referred to as a sampling point. The amount of sampling points in the horizontal and vertical directions (or axes) of the array or picture is used to define the size and / or resolution of the picture. Typically, three color components are used to represent color. Specifically, a picture may be represented as or include three sampling arrays. For example, in an RBG format or color space, a picture includes corresponding red, green, and blue sampling arrays. On the other hand, in video coding, each pixel is typically represented in a luma / chrominance format or color space. For example, a picture in a YUV format includes a luma component denoted by Y (sometimes denoted by L) and two chrominance components denoted by U and V. The luma component Y represents brightness or gray-level intensity (e.g., both are the same in a grayscale picture), and the two chrominance components U and V represent chrominance or color information components. Correspondingly, a picture in YUV format includes a luma sampling array of luma sampling values ​​(Y) and two chroma sampling arrays of chroma values ​​(U and V). A picture in RGB format may be transformed or converted to a picture in YUV format, and vice versa. This process is also referred to as color conversion or transformation. If the picture is monochrome, the picture may include only a luma sampling array. In an embodiment of the present invention, the picture transmitted from the picture source 16 to the picture processor may also be referred to as raw picture data 17.

[0129] The picture pre-processor 18 may be configured to: receive raw picture data 17 and pre-process the raw picture data 17 to obtain a pre-processed picture 19 or pre-processed picture data 19. For example, the pre-processing performed by the picture pre-processor 18 may include cropping, color format conversion (e.g., conversion from RGB format to YUV format), color correction, or noise removal.

[0130] The encoder 20 (or referred to as encoder 20) is configured to: receive pre-processed picture data 19 and process the pre-processed picture data 19 in an associated prediction mode to provide encoded picture data 21. (The following describes further structural details of the encoder 20 based on Figure 2, 4 or 5.) In some embodiments, the encoder 20 may be configured to perform the embodiments described below in order to implement the video encoding method described in the present invention.

[0131] The communication interface 22 may be configured to: receive the coded picture data 21 and transmit the coded picture data 21 over the link 13 to the destination device 14 or any other device (e.g., storage) for storage or direct reconstruction. The any other device may be any device configured for decoding or storage. The communication interface 22 may be configured, for example, to encapsulate the coded picture data 21 in a suitable format, for example, data packets, for transmission over the link 13.

[0132] Destination device 14 includes a decoder 30. Optionally, destination device 14 may further include a communication interface 28, a picture post-processor 32, and a display device 34. The following describes the components separately.

[0133] The communication interface 28 may be configured to receive the coded picture data 21 from the source device 12 or any other source. The any other source may be, for example, a storage device. The storage device may be, for example, a coded picture data storage device. The communication interface 28 may be configured to transmit or receive the coded picture data 21 between the source device 12 and the destination device 14 over the link 13 or over any type of network. The link 13 may be, for example, a direct wired or wireless connection, and the any type of network may be, for example, a wired or wireless network or any combination thereof, any type of private or public network, or any combination thereof. The communication interface 28 may be configured, for example, to decapsulate data packets transmitted over the communication interface 22 to obtain the coded picture data 21.

[0134] Both communication interface 28 and communication interface 22 may be configured as one-way or two-way communication interfaces, e.g., configured to send and receive messages to establish connections and to acknowledge and exchange communications links and / or any other information related to data transmission, e.g., encoded picture data transmission.

[0135] The decoder 30 (also referred to as decoder 30) is configured to: receive encoded picture data 21 and provide decoded picture data 31 or decoded pictures 31 (the following explains further structural details of the decoder 30 based on Figure 3, Figure 4 or Figure 5). In some embodiments, the decoder 30 may be configured to perform the embodiments described below in order to implement the video decoding method described in the present invention.

[0136] The picture post-processor 32 is configured to post-process the decoded picture data 31 (also referred to as reconstructed picture data) to obtain post-processed picture data 33. The post-processing performed by the picture post-processor 32 may include color format conversion (e.g., conversion from YUV format to RGB format), color correction, cropping, resampling, or any other processing, and may be further configured to send the post-processed picture data 33 to a display device 34.

[0137] Display device 34 is configured to receive the post-processed picture data 33 and display the picture, for example, to a user or viewer. Display device 34 may be or include any type of display configured to present the reconstructed picture, for example, an integrated or external display or monitor. For example, the display may include a liquid crystal display (LCD), an organic light emitting diode (OLED) display, a plasma display, a projector, a micro LED display, a liquid crystal on silicon (LCoS), a digital light processor (DLP), or any other type of display.

[0138] Although the source device 12 and the destination device 14 are shown as separate devices in FIG. 1A, the device embodiments may alternatively include both the source device 12 and the destination device 14 or the functions of both the source device 12 and the destination device 14, that is, the source device 12 or the corresponding function of the source device 12 and the destination device 14 or the corresponding function of the destination device 14. In such embodiments, the source device 12 or the corresponding function of the source device 12 and the destination device 14 or the corresponding function of the destination device 14 may be implemented by using the same hardware and / or software, separate hardware and / or software, or any combination thereof.

[0139] One of ordinary skill in the art will clearly learn, based on the description, that the functions of the different units or the presence and (exact) division of the functions of the source device 12 and / or the destination device 14 shown in FIG. 1A may differ with the actual devices and applications. The source device 12 and the destination device 14 may include any one of a variety of devices, such as any type of handheld or stationary device, e.g., a notebook or laptop computer, a mobile phone, a smartphone, a tablet or tablet computer, a video camera, a desktop computer, a set-top box, a television, a camera, an in-vehicle device, a display device, a digital media player, a video game console, a video streaming transmitting device (such as a content service server or a content distribution server, etc.), a broadcast receiver device, and a broadcast transmitter device, and may or may not use any type of operating system.

[0140] Both the encoder 20 and the decoder 30 may be implemented as any one of a variety of suitable circuits, such as one or more microprocessors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), discrete logic, hardware, or any combination thereof. Where the techniques are implemented in part using software, a device may store software instructions on a suitable non-transitory computer-readable storage medium and execute the instructions using hardware, such as one or more processors, to perform the techniques of this disclosure. Any one of the foregoing (including hardware, software, and combinations of hardware and software, and the like) may be considered one or more processors.

[0141] In some cases, the video encoding and decoding system 10 shown in FIG. 1A is merely an example, and the techniques of the present invention may be applied to video coding settings (e.g., video encoding or video decoding) that are not required to include any data communication between encoding and decoding devices. In another example, data may be retrieved from local storage, streamed over a network, or the like. A video encoding device may encode data and store the data in storage, and / or a video decoding device may retrieve data from storage and decode the data. In some examples, encoding and decoding are performed by devices that simply encode data to storage and / or retrieve data from storage and decode the data, rather than communicating with each other.

[0142] It should be understood that the encoder 20 may be deployed on a terminal device or a cloud-side server, and the decoder 30 may be deployed on a terminal device or a cloud-side server; or the encoder 20 and the decoder 30 may be jointly deployed on a terminal device or a cloud-side server.

[0143] In one scenario, the encoder 20 and the decoder 30 may be deployed on a terminal device. The encoder 20 may encode and compress video on the terminal device, perform secondary compression (also called incremental storage compression) based on the video encoding method provided in the embodiments of the present application, and store the compressed data. When the video needs to be played, the stored compressed data may be decoded.

[0144] In one scenario, the encoder 20 and the decoder 30 may be deployed on multiple terminal devices. The encoder 20 may encode and compress video on the terminal device, perform secondary compression (also called incremental storage compression) based on the video encoding method provided in the embodiments of the present application, and send the compressed data to another terminal device. When the other device needs to play the video, the other device may decode the stored compressed data.

[0145] In one scenario, the encoder 20 and the decoder 30 may be deployed on a terminal device and a cloud-side server. The encoder 20 may encode and compress video on the terminal device, perform secondary compression (also called incremental storage compression) based on the video encoding method provided in the embodiments of the present application, and send the compressed data to the server.

[0146] 1B is an illustration of an example video coding system 40 including the encoder 20 of FIG. 2 and / or the decoder 30 of FIG. 3 according to an example embodiment. The video coding system 40 may implement a combination of various techniques according to embodiments of the present invention. In the illustrated implementation, the video coding system 40 may include an imaging device 41, the encoder 20, the decoder 30 (and / or a video encoder / decoder implemented by using logic circuitry in a processing unit 46), an antenna 42, one or more processors 43, one or more storages 44, and / or a display device 45.

[0147] 1B, imaging device 41, antenna 42, processing unit 46, logic circuitry, encoder 20, decoder 30, processor 43, storage 44, and / or display device 45 may be in communication with one another. As will be described, although video coding system 40 is illustrated with encoder 20 and decoder 30, video coding system 40 may include only encoder 20 or only decoder 30 in different examples.

[0148] In some examples, antenna 42 may be configured to transmit or receive encoded data of video data. Further, in some examples, display device 45 may be configured to present the video data. In some examples, the logic circuitry may be implemented using processing unit 46. Processing unit 46 may include application-specific integrated circuit (ASIC) logic, a graphics processing unit, a general-purpose processor, and the like. Video coding system 40 may also include optional processor 43. Similarly, optional processor 43 may include application-specific integrated circuit (ASIC) logic, a graphics processing unit, a general-purpose processor, and the like. In some examples, the logic circuitry may be implemented by hardware, e.g., dedicated video coding hardware, and processor 43 may be implemented by general-purpose software, an operating system, or the like. Additionally, storage 44 may be any type of storage, such as volatile memory (e.g., static random access memory (SRAM), dynamic random access memory (DRAM)), or non-volatile memory (e.g., flash memory). In a non-limiting example, storage 44 may be implemented using cache memory. In some examples, logic circuitry may access storage 44 (e.g., to implement an image buffer). In other examples, logic circuitry and / or processing unit 46 may include storage (e.g., cache) to implement an image buffer or the like.

[0149] In some examples, encoder 20 implemented using logic circuitry may include an image buffer (e.g., implemented using processing unit 46 or storage 44) and a graphics processing unit (e.g., implemented using processing unit 46). The graphics processing unit may be communicatively coupled to the image buffer. The graphics processing unit may include encoder 20 implemented using logic circuitry to implement the various modules described with reference to FIG. 2 and / or any other encoder system or subsystem described herein. The logic circuitry may be configured to perform various operations described herein.

[0150] In some examples, decoder 30 may be implemented using logic circuitry in a similar manner to implement the various modules described with reference to decoder 30 in FIG. 3 and / or any other decoder system or subsystem described herein. In some examples, decoder 30 implemented using logic circuitry may include an image buffer (implemented using processing unit 2820 or storage 44) and a graphics processing unit (e.g., implemented using processing unit 46). The graphics processing unit may be communicatively coupled to the image buffer. The graphics processing unit may include decoder 30 implemented using logic circuitry to implement the various modules described with reference to FIG. 3 and / or any other decoder system or subsystem described herein.

[0151] In some examples, antenna 42 may be configured to receive encoded data of the video data. As described, the encoded data may include data, indicators, index values, mode selection data, and the like, associated with encoded video frames and described herein, such as data related to coding partitioning (e.g., transform coefficients or quantized transform coefficients, optional indicators (as discussed), and / or data defining the coding partitioning). Video coding system 40 may further include a decoder 30 coupled to antenna 42 and configured to decode the encoded data. Display device 45 is configured to display the video frames.

[0152] In embodiments of the present invention, for examples described with reference to encoder 20, it should be understood that decoder 30 may be configured to perform the inverse process. With respect to signaling syntax elements, decoder 30 may be configured to: receive and parse such syntax elements and correspondingly decode associated video data. In some examples, encoder 20 may entropy encode syntax elements into encoded video data. In such examples, decoder 30 may parse such syntax elements and correspondingly decode associated video data.

[0153] Figure 2 is a schematic / conceptual block diagram of an example of an encoder 20 configured to implement embodiments of the present invention. In the example of Figure 2, the encoder 20 includes a residual calculation unit 204, a transform processing unit 206, a quantization unit 208, an inverse quantization unit 210, an inverse transform processing unit 212, a reconstruction unit 214, a buffer 216, a loop filter unit 220, a decoded picture buffer (DPB) 230, a prediction processing unit 260, and an entropy coding unit 270. The prediction processing unit 260 may include an inter prediction unit 244, an intra prediction unit 254, and a mode selection unit 262. The inter prediction unit 244 may include a motion estimation unit and a motion compensation unit (not shown). The encoder 20 shown in Figure 2 may also be referred to as a hybrid video encoder or a video encoder based on a hybrid video coder.

[0154] For example, the residual calculation unit 204, the transform processing unit 206, the quantization unit 208, the prediction processing unit 260, and the entropy coding unit 270 form the forward signal path of the encoder 20; the inverse quantization unit 210, the inverse transform processing unit 212, the reconstruction unit 214, the buffer 216, the loop filter 220, the decoded picture buffer (DPB) 230, and the prediction processing unit 260 form the backward signal path of the encoder. The backward signal path of the encoder corresponds to the signal path of the decoder (see decoder 30 in FIG. 3).

[0155] The encoder 20 receives, for example, via an input 202, a picture 201 or an image block 203 of said picture 201, e.g., a picture in a sequence of pictures forming a video or a video sequence. The image block 203 may also be referred to as a current coded block or an uncoded image block, and the picture 201 may be referred to as a current picture or an uncoded picture (particularly if the current picture is to be distinguished from another picture in video coding, e.g., the other picture is a previously coded and / or decoded picture in the same video sequence, i.e., a video sequence that also includes the current picture).

[0156] In one embodiment, the encoder 20 may include a partitioning unit (not shown in FIG. 2) configured to partition the picture 201 into multiple blocks, such as image blocks 203. The picture 201 is typically partitioned into multiple non-overlapping blocks. The partitioning unit may be configured to use the same block size for all pictures in the video sequence and a corresponding grid that defines this block size, or to vary the block size between pictures, subsets, or groups of pictures, and to partition each picture into corresponding blocks.

[0157] In one example, prediction processing unit 260 of encoder 20 may be configured to perform any combination of the partitioning techniques described above.

[0158] For example, like picture 201, image block 203 may also be or be considered to be a two-dimensional array or matrix of sampling points having sampling values, but the size of image block 203 is smaller than the size of picture 201. In other words, image block 203 may include, for example, one sampling array (e.g., a luma array in the case of monochrome picture 201), three sampling arrays (e.g., one luma array and two chroma arrays in the case of a color picture), or any other quantity and / or type of arrays, depending on the applied color format. The quantity of sampling points in the horizontal and vertical directions (or axes) of image block 203 is used to define the size of image block 203.

[0159] The encoder 20 shown in FIG. 2 is arranged to code a picture 201 block-by-block, for example performing coding and prediction for each image block 203 .

[0160] The residual calculation unit 204 is configured to calculate the residual block 205 based on the picture image block 203 and the prediction block 265 (further details regarding the prediction block 265 are provided below), for example, to obtain the residual block 205 in the sample domain by subtracting the sample values ​​of the prediction block 265 from the sample values ​​of the picture image block 203 on a sample-by-sample (pixel-by-pixel) basis.

[0161] The transform processing unit 206 is configured to apply a transform, such as a discrete cosine transform (DCT) or a discrete sine transform (DST), to the sample values ​​of the residual block 205 to obtain transform coefficients 207 in a transform domain. The transform coefficients 207 may also be referred to as transform residual coefficients and may represent the residual block 205 in the transform domain.

[0162] The transform processing unit 206 may be configured to apply an integer approximation of a DCT / DST, such as the transform specified in HEVC / H.265. Compared to an orthogonal DCT transform, such an integer approximation is typically scaled by a factor. Applying an additional scale factor to preserve the norm of the residual block processed by the forward and inverse transforms is part of the transform process. The scale factor is typically selected based on some constraints. For example, the scale factor is a power of two for a shift operation, the bit depth of the transform coefficients, or a trade-off between accuracy and implementation cost. For example, a specific scale factor may be specified for the inverse transform, e.g., by the inverse transform processing unit 212 on the decoder 30 side (a specific scale factor may be specified for the corresponding inverse transform, e.g., by the inverse transform processing unit 212 on the encoder 20 side), and the corresponding scale factor for the forward transform may be specified accordingly, e.g., by the transform processing unit 206 on the encoder 20 side.

[0163] The quantization unit 208 is configured to quantize the transform coefficients 207, for example, through scalar quantization or vector quantization, to obtain quantized transform coefficients 209. The quantized transform coefficients 209 may also be referred to as quantized residual coefficients 209. The quantization process may reduce a bit depth associated with some of the transform coefficients 207 or the entire transform coefficients 207. For example, an n-bit transform coefficient may be truncated to an m-bit transform coefficient during quantization, where n is greater than m. The degree of quantization may be modified by adjusting a quantization parameter (QP). For example, in the case of scalar quantization, different scales may be applied to achieve finer or coarser quantization. A smaller quantization step size corresponds to finer quantization, and a larger quantization step size corresponds to coarser quantization. An appropriate quantization step size may be indicated by the quantization parameter (QP). For example, the quantization parameter may be an index into a predefined set of appropriate quantization step sizes. For example, a smaller quantization parameter may correspond to finer quantization (smaller quantization step size), and a larger quantization parameter may correspond to coarser quantization (larger quantization step size), or vice versa. Quantization may include division by the quantization step size and corresponding quantization or inverse quantization, performed, for example, by using inverse quantization 210, or may include multiplication by the quantization step size. Implementations according to some standards, such as HEVC, may use the quantization parameter to determine the quantization step size. Generally, the quantization step size may be calculated based on the quantization parameter by using a fixed-point approximation of an equation involving division. Additional scale factors may be introduced for quantization and dequantization to restore the norm of the residual block, where the norm of the residual block may be modified due to the scale used in the fixed-point approximation of the equation used for the quantization step size and the quantization parameter. In an example implementation, the scale of the inverse transform may be combined with the scale of the dequantization.Alternatively, a customized quantization table, for example included in the encoded data, may be used and transmitted over a signal from the encoder to the decoder. Quantization is a lossy operation, and the larger the quantization step size, the greater the loss exhibited.

[0164] The inverse quantization unit 210 is configured to apply the inverse quantization of the quantization unit 208 to the quantized coefficients to obtain dequantized coefficients 211, and to apply an inverse quantization scheme of the quantization scheme applied by the quantization unit 208, e.g., based on or using the same quantization step size as the quantization step size used by the quantization unit 208. The dequantized coefficients 211, also referred to as dequantized residual coefficients 211, may correspond to the transform coefficients 207. However, due to losses caused by quantization, the dequantized coefficients are typically different from the transform coefficients.

[0165] The inverse transform processing unit 212 is configured to apply an inverse transform of the transform applied by the transform processing unit 206, for example, an inverse discrete cosine transform (DCT) or an inverse discrete sine transform (DST), to obtain an inverse transform block 213 in the sample domain. The inverse transform block 213 may also be referred to as an inverse transformed dequantized block 213 or an inverse transformed residual block 213.

[0166] The reconstruction unit 214 (e.g., summer 214) is configured to add the inverse transform block 213 (i.e., the reconstructed residual block 213) to the prediction block 265 to obtain a reconstructed block 215 in the sample domain. For example, the sample values ​​of the reconstructed residual block 213 are added to the sample values ​​of the prediction block 265.

[0167] Optionally, a buffer unit 216 (shortly referred to as "buffer" 216) of the line buffer 216 is configured to buffer or store the reconstructed blocks 215 and corresponding sample values, e.g., for intra prediction. In other embodiments, the encoder may be configured to use the unfiltered reconstructed blocks and / or corresponding sample values ​​stored in the buffer unit 216 for any type of estimation and / or prediction, e.g., for intra prediction.

[0168] For example, in one embodiment, encoder 20 may be configured such that buffer unit 216 is not only configured to store reconstructed blocks 215 for intra prediction 254, but also for loop filter unit 220 (not shown in FIG. 2), and / or such that buffer unit 216 and decoded picture buffer unit 230 form one buffer, for example. In another embodiment, encoder 20 may be configured to use filtered blocks 221 and / or blocks or samples from decoded picture buffer 230 (such blocks or samples are not shown in FIG. 2) as input or basis for intra prediction 254.

[0169] The loop filter unit 220 (or simply referred to as "loop filter" 220) is configured to filter the reconstructed block 215 to obtain a filtered block 221, thereby smoothing pixel transitions or improving video quality. The loop filter unit 220 is intended to represent one or more loop filters, such as a deblocking filter, a sample-adaptive offset (SAO) filter, or another filter, such as a bilateral filter, an adaptive loop filter (ALF), a sharpening or smoothing filter, or a collaborative filter. Although the loop filter unit 220 is illustrated as an in-loop filter in FIG. 2, the loop filter unit 220 may be implemented as a post-loop filter in other configurations. The filtered block 221 may also be referred to as a filtered reconstructed block 221. The decoded picture buffer 230 may store the reconstructed coded block after the loop filter unit 220 performs a filtering operation on the reconstructed coded block.

[0170] In one embodiment, encoder 20 (and correspondingly, loop filter unit 220) may be configured to output loop filter parameters (e.g., sample adaptive offset information). For example, the loop filter parameters may be output directly or may be entropy coded by entropy coding unit 270 or any other entropy coding unit for output, so that, for example, decoder 30 may receive and apply the same loop filter parameters for decoding.

[0171] The entropy coding unit 270 is configured to perform entropy coding based on the output from the quantization unit 208 (e.g., quantized transform coefficients) and side information. The entropy coding unit 270 may be configured to determine parameters such as transform coefficients representing quantization, side information, and the like. The entropy coding unit 270 may be configured to: predict values ​​of parameters based on context information, and then encode the difference between the actual value and the predicted value. For target symbols representing uncoded values, the entropy coding unit 270 may be configured to perform entropy coding in various manners. Exemplary entropy coding techniques include Exponential-Golomb coding, Golomb-Rice coding, Context-Adaptive Binary Arithmetic Coding ("CABAC"), Differential Coding, Huffman coding, Run-Length Coding, Lempel-Ziv ("LZ") coding, Dictionary Coding, RANS Coding, ANS Coding, TANS Coding, or other variants of ANS Coding, and combinations thereof. In embodiments of the present application, the entropy encoding unit 270 may perform one or more variants of ANS coding.

[0172] The decoded picture buffer (DPB) 230 may be a reference picture storage that stores reference picture data for use in video data encoding by the encoder 20. The DPB 230 may be formed by any one of a number of storage devices, such as dynamic random access memory (DRAM) (including synchronous DRAM (SDRAM), magnetoresistive RAM (MRAM), and resistive RAM (RRAM)), or another type of storage device. The DPB 230 and the buffer 216 may be provided by the same storage device or separate storage devices. In one example, the decoded picture buffer (DPB) 230 is configured to store the filtered block 221. The decoded picture buffer 230 may be further configured to store other previously filtered blocks, e.g., previously reconstructed and filtered blocks 221, of the same current picture or a different picture, e.g., a previously reconstructed picture, and may provide a complete previously reconstructed, i.e., decoded, picture (and corresponding reference blocks and samples) and / or a partially reconstructed current picture (and corresponding reference blocks and samples), e.g., for inter-prediction. In one example, the decoded picture buffer (DPB) 230 is configured to store the reconstructed block 215 if the reconstructed block 215 is reconstructed without in-loop filtering.

[0173] The prediction processing unit 260, also referred to as block prediction processing unit 260, is configured to: receive or obtain an image block 203 (the current image block 203 of the current picture 201) and reconstructed picture data, e.g., reference samples of the same (current) picture from the buffer 216 and / or reference picture data 231 of one or more previously decoded pictures from the decoded picture buffer 230, and process such data for prediction, i.e., provide a prediction block 265, which may be an inter prediction block 245 or an intra prediction block 255.

[0174] The mode selection unit 262 may be configured to select a prediction mode (e.g., intra or inter prediction mode) and / or a corresponding prediction block 245 or 255 to be used as the prediction block 265 for the calculation of the residual block 205 and the reconstruction of the reconstructed block 215.

[0175] In one embodiment, mode selection unit 262 may be configured to select a prediction mode (e.g., select from prediction modes supported by prediction processing unit 260) that provides the best match or smallest residual (smallest residual means better compression in transmission or storage), or that provides the smallest signaling overhead (smallest signaling overhead means better compression in transmission or storage), or that considers or balances both. Mode selection unit 262 may be configured to determine the prediction mode based on rate distortion optimization (RDO), i.e., select a prediction mode that provides the smallest rate distortion optimization, or select a prediction mode whose associated rate distortion at least meets a prediction mode selection criterion.

[0176] The following provides a detailed description of the prediction process performed by an example encoder 20 (eg, by prediction processing unit 260) and the mode selection performed by an example encoder 20 (eg, by mode selection unit 262).

[0177] As explained above, the encoder 20 is configured to determine or select a best or optimal prediction mode from a (predetermined) set of prediction modes, which may include, for example, intra-prediction modes and / or inter-prediction modes.

[0178] In a possible implementation, the set of intra prediction modes may include multiple different intra prediction modes, such as a non-directional mode, such as a DC (or average) mode and a planar mode, or a directional mode as defined in H.265, or may include 67 different intra prediction modes, such as a non-directional mode, such as a DC (or average) mode and a planar mode, or a directional mode as defined in the currently developing H.266.

[0179] In a possible implementation, the set of inter prediction modes depends on available reference pictures (i.e., at least some of the decoded pictures stored in DBP 230) and other inter prediction parameters, such as whether the entire reference picture or only a portion of the reference picture is used, whether a search window area around the area of ​​the current block is searched for a best-matching reference block, and / or whether pixel interpolation, such as half-pixel and / or quarter-pixel interpolation, is applied. The set of inter prediction modes may include an Advanced Motion Vector Prediction (AMVP) mode and a merge mode. In a specific implementation, the set of inter prediction modes may include an affine motion model-based prediction mode described in an embodiment of the present invention, such as an affine motion model-based advanced motion vector prediction mode (Affine AMVP mode) or an affine motion model-based merge mode (Affine Merge mode). Specific examples are the control point-based AMVP mode (internal control point motion vector prediction method or constructed control point motion vector prediction method) and the control point-based merging mode (internal control point motion vector prediction method or constructed control point motion vector prediction method). The set of inter prediction modes may further include an advanced temporal motion vector prediction (ATMVP) method, a PLANAER method, or the like, or may include a sub-block based merging mode formed by combining an affine motion model-based merging mode, an ATMVP method, and / or a PLANAR method, or the like. In this embodiment of the present invention, inter prediction for unprocessed image blocks may be applied to unidirectional prediction (forward or backward), bidirectional prediction (forward and backward), or multi-frame prediction.When inter prediction for an unprocessed image block is applied to bi-prediction, a generalized bi-prediction (GBi) of block-level bi-prediction, also referred to as a weighted prediction method, may be used. In one example, the intra prediction unit 254 may be configured to perform any combination of the inter prediction techniques described below.

[0180] In addition to the aforementioned prediction modes, skip mode and / or direct mode may also be applied in this embodiment of the present invention.

[0181] The prediction processing unit 260 may be further configured to: partition the image block 203 into smaller block partitions or sub-blocks, for example, by iteratively using quad-tree (QT) partitioning, binary-tree (BT) partitioning, ternary-tree (TT) partitioning, or any combination thereof; and perform prediction for each of the block partitions or sub-blocks, for example. Mode selection includes selecting a tree structure for the partitioned image block 203 and selecting a prediction mode to be used for each of the block partitions or sub-blocks.

[0182] The inter prediction unit 244 may include a motion estimation (ME) unit (not shown in FIG. 2) and a motion compensation (MC) unit (not shown in FIG. 2). The motion estimation unit is configured to: receive or obtain the picture image block 203 (the current picture image block 203 of the current picture 201) and at least one or more previously reconstructed blocks, such as the decoded picture 231 or a reconstructed block of one or more other / different previously decoded pictures 231; and perform motion estimation based on the determined inter prediction mode. For example, a video sequence may include the current picture and the previously decoded picture 31, or in other words, the current picture and the previously decoded picture 31 may be part of or form a sequence of pictures that form the video sequence.

[0183] For example, the encoder 20 may be configured to: select a reference block from multiple reference blocks of the same or different pictures among multiple other pictures (reference images); and provide a motion estimation unit (not shown in FIG. 2 ) with an offset (spatial offset) between the position (X, Y coordinates) of the reference picture and / or reference block and the position of the current block as an inter-prediction parameter. The offset is also referred to as a motion vector (MV).

[0184] The motion compensation unit is configured to: obtain inter prediction parameters and perform inter prediction based on or by using the inter prediction parameters to obtain an inter prediction block 245. The motion compensation performed by the motion compensation unit (not shown in FIG. 2) may include deriving or generating a prediction block (predictor) based on a motion / block vector determined by using motion estimation (possibly by performing interpolation with sub-pixel accuracy). Additional pixel samples may be generated from known pixel samples by using interpolation filtering, potentially increasing the amount of candidate prediction blocks that can be used to encode the picture block. Upon receiving the motion vector for the PU of the current picture block, the motion compensation unit 246 may locate the prediction block to which the motion vector points in a reference picture list. The motion compensation unit 246 may further generate syntax elements associated with the block and the video slice for use by decoder 30 in decoding picture blocks of the video slice.

[0185] Specifically, the inter prediction unit 244 may send a syntax element to the entropy encoding unit 270, where the syntax element includes, for example, inter prediction parameters (e.g., indication information of an inter prediction mode used for predicting a current block and selected after multiple inter prediction modes have been traversed) and an index number of a candidate motion vector list, and optionally further includes a GBi index number, a reference frame index, and the like. In a possible application scenario, if there is only one inter prediction mode, the inter prediction parameters may not be carried in the syntax element. In this case, the decoder 30 side may directly perform decoding in a default prediction mode. It may be understood that the inter prediction unit 244 may be configured to perform any combination of inter prediction techniques.

[0186] The intra prediction unit 254 is configured to obtain, e.g., receive, a picture block 203 (current picture block) of the same picture and one or more previously reconstructed blocks, e.g., reconstructed neighboring blocks, for intra estimation. For example, the encoder 20 may be configured to select one intra prediction mode from a plurality of (predetermined) intra prediction modes.

[0187] In one embodiment, the encoder 20 may be configured to select an intra-prediction mode according to an optimization criterion, for example, based on the smallest residual (e.g., the intra-prediction mode that provides the predicted block 255 that is most similar to the current picture block 203) or the smallest rate distortion.

[0188] The intra prediction unit 254 is further configured to determine the intra prediction block 255 based on, for example, intra prediction parameters of the selected intra prediction mode. In any case, after selecting an intra prediction mode for a block, the intra prediction unit 254 is further configured to provide the intra prediction parameters, i.e., information indicating the selected intra prediction mode for the block, to the entropy coding unit 270. In one example, the intra prediction unit 254 may be configured to perform any combination of intra prediction techniques.

[0189] Specifically, the intra prediction unit 254 may send a syntax element to the entropy encoding unit 270, where the syntax element includes intra prediction parameters (e.g., indication information of the intra prediction mode used for predicting the current block after multiple intra prediction modes have been traversed). In a possible application scenario, if there is only one intra prediction mode, the intra prediction parameters may not be carried in the syntax element. In this case, the decoder 30 may directly perform decoding in the default prediction mode.

[0190] The entropy encoding unit 270 is configured to apply an entropy coding algorithm or scheme (e.g., a variable length coding (VLC) scheme, a context adaptive VLC (CAVLC) scheme, an arithmetic coding scheme, context adaptive binary arithmetic coding (CABAC), syntax-based context-adaptive binary arithmetic coding (SBAC), probability interval partitioning entropy (PIPE) coding, or other entropy encoding and decoding method or technique) to one or all (or none) of the quantized residual coefficients 209, the inter-prediction parameters, the intra-prediction parameters, and / or the loop filter parameters to obtain coded picture data 21, which may be output by an output 272, for example, in the form of coded data 21. The coded data may be transmitted to the decoder 30 or archived for later transmission or retrieval by the decoder 30. Entropy encoding unit 270 may further be configured to entropy encode another syntax element of the current video slice being encoded.

[0191] Other structural variations of the encoder 20 may be used to encode the video stream. For example, a non-transform-based encoder 20 may directly quantize the residual signal for some blocks or frames without using the transform processing unit 206. In another implementation, the encoder 20 may have the quantization unit 208 and the inverse quantization unit 210 combined into a single unit.

[0192] It should be understood that other structural variations of the encoder 20 may be used to encode the video stream. For example, for some image blocks or image frames, the encoder 20 may directly quantize the residual signal without processing by the transform processing unit 206 and correspondingly without processing by the inverse transform processing unit 212. Alternatively, for some image blocks or image frames, the encoder 20 does not generate residual data, thereby eliminating the need for processing by the transform processing unit 206, the quantization unit 208, the inverse quantization unit 210, and the inverse transform processing unit 212. Alternatively, the encoder 20 may directly store the reconstructed image block as a reference block without processing by the filter 220. Alternatively, the quantization unit 208 and the inverse quantization unit 210 in the encoder 20 may be combined together. The loop filter 220 is optional, and in lossless compression encoding, the transform processing unit 206, the quantization unit 208, the inverse quantization unit 210, and the inverse transform processing unit 212 are optional. It should be understood that in different application scenarios, the inter prediction unit 244 and the intra prediction unit 254 may be selectively used.

[0193] 3 is a schematic / conceptual block diagram of an example of a decoder 30 configured to implement embodiments of the present invention. The decoder 30 is configured to receive coded picture data (e.g., coded data) 21 coded by the encoder 20 to obtain a decoded picture 231. In the decoding process, the decoder 30 receives video data from the encoder 20, e.g., coded video data representing picture blocks of coded video slices and associated syntax elements.

[0194] 3, decoder 30 includes an entropy decoding unit 304, an inverse quantization unit 310, an inverse transform processing unit 312, a reconstruction unit 314 (e.g., summer 314), a buffer 316, a loop filter 320, a decoded picture buffer 330, and a prediction processing unit 360. Prediction processing unit 360 may include an inter prediction unit 344, an intra prediction unit 354, and a mode selection unit 362. In some examples, decoder 30 may perform a decoding pass that is substantially the inverse of the encoding pass performed by encoder 20 described above with reference to FIG.

[0195] The entropy decoding unit 304 is configured to entropy decode the coded picture data 21 to obtain, e.g., the quantized coefficients 309 and / or decoded coding parameters (not shown in FIG. 3), e.g., any one or all of the following: (decoded) inter-prediction parameters, intra-prediction parameters, loop filter parameters, and / or other syntax elements. The entropy decoding unit 304 is further configured to forward the inter-prediction parameters, intra-prediction parameters, and / or other syntax elements to the prediction processing unit 360. The decoder 30 may receive syntax elements at the video slice level and / or the video block level.

[0196] The entropy decoding unit 304 is configured to entropy decode the encoded data to generate output symbols for the parameters. The entropy decoding unit 304 may be configured to reconstruct parameters representing quantized transform coefficients and side information. The entropy decoding unit 304 may be configured to perform entropy decoding in various manners. Typical entropy decoding techniques include exponential Columbus decoding, Columbus-Rice decoding, context-adaptive binary arithmetic decoding, Huffman decoding, run-length decoding, Lempel-Ziv (“LZ”) decoding, dictionary decoding, RANS decoding and ANS decoding, TANS decoding, or other variants of ANS decoding, and combinations thereof. In an embodiment of the present application, the entropy decoding unit 304 may perform one or more variants of ANS decoding.

[0197] The inverse quantization unit 310 may have the same functionality as the inverse quantization unit 110, the inverse transform processing unit 312 may have the same functionality as the inverse transform processing unit 212, the reconstruction unit 314 may have the same functionality as the reconstruction unit 214, the buffer 316 may have the same functionality as the buffer 216, the loop filter 320 may have the same functionality as the loop filter 220, and the decoded picture buffer 330 may have the same functionality as the decoded picture buffer 230.

[0198] Prediction processing unit 360 may include an inter prediction unit 344 and an intra prediction unit 354. Inter prediction unit 344 may have functionality similar to inter prediction unit 244, and intra prediction unit 354 may have functionality similar to intra prediction unit 254. Prediction processing unit 360 is typically configured to: perform block prediction and / or obtain a prediction block 365 from the coded data 21, and to receive or obtain (explicitly or implicitly) prediction-related parameters and / or information regarding a selected prediction mode, e.g., from entropy decoding unit 304.

[0199] If the video slice is coded into an intra-coded (I) slice, intra prediction unit 354 in prediction processing unit 360 is configured to generate a prediction block 365 for a picture block of the current video slice based on an intra prediction mode represented based on signals and data from previously decoded blocks of the current frame or picture. If the video frame is coded into an inter-coded (i.e., B or P) slice, inter prediction unit 344 (e.g., a motion compensation unit) in prediction processing unit 360 is configured to generate a prediction block 365 for a video block of the current video slice based on a motion vector and another syntax element received from entropy decoding unit 304. For inter prediction, the prediction block may be generated from one reference picture in a reference picture list. Decoder 30 may construct reference frame lists: List 0 and List 1 by using a default construction technique based on the reference pictures stored in DPB 330.

[0200] Prediction processing unit 360 is configured to: determine prediction information for video blocks of the current video slice by parsing motion vectors and other syntax elements, and use the prediction information to generate a predictive block for the current video block being decoded. In one example of the invention, prediction processing unit 360 uses some received syntax elements to determine the prediction (e.g., intra- or inter-prediction) mode used to encode the video blocks of the video slice, the inter-prediction slice type (e.g., B slice, P slice, or GPB slice), construction information for one or more reference picture lists for the slice, motion vectors for each inter-coded video block of the slice, inter-prediction status for each inter-coded video block of the slice, and other information, thereby decoding the video blocks of the current video slice. In another example of this disclosure, syntax elements received by decoder 30 from the coded data include syntax elements in one or more of an adaptive parameter set (APS), a sequence parameter set (SPS), a picture parameter set (PPS), or a slice header.

[0201] Inverse quantization unit 310 may be configured to inverse quantize (i.e., dequantize) quantized transform coefficients provided in the encoded data and decoded by entropy decoding unit 304. The inverse quantization process may include using quantization parameters calculated by encoder 20 for each video block in a video slice to determine the degree of quantization to be applied, and also to determine the degree of inverse quantization to be applied.

[0202] Inverse transform processing unit 312 is configured to apply an inverse transform (e.g., an inverse DCT, an inverse integer transform, or a conceptually similar inverse transform process) to the transform coefficients to produce residual blocks in the pixel domain.

[0203] The reconstruction unit 314 (e.g., summer 314) is configured to add the inverse transform block 313 (i.e., the reconstructed residual block 313) to the prediction block 365, for example, by adding the sample values ​​of the reconstructed residual block 313 to the sample values ​​of the prediction block 365, to obtain a reconstructed block 315 in the sample domain.

[0204] Loop filter unit 320 is configured to filter reconstructed block 315 (either during the encoding loop or after the encoding loop) to obtain filtered block 321, thereby smoothing pixel transitions or improving video quality. In one example, loop filter unit 320 may be configured to perform any combination of the filtering techniques described below. Loop filter unit 320 is intended to represent one or more loop filters, such as a deblocking filter, a sample-adaptive offset (SAO) filter, or another filter, such as a bilateral filter, an adaptive loop filter (ALF), a sharpening or smoothing filter, or a collaborative filter. Although loop filter unit 320 is shown in FIG. 3 as an in-loop filter, loop filter unit 320 may be implemented as a post-loop filter in other configurations.

[0205] The decoded video blocks 321 in a given frame or picture are then stored in a decoded picture buffer 330, which stores reference pictures used for subsequent motion compensation.

[0206] The decoder 30 is arranged to output the decoded pictures 31 via an output 332, for example for presentation to or viewing by a user.

[0207] Other variations of the decoder 30 may be used to decode the compressed encoded data. For example, the decoder 30 may generate an output video stream without using the loop filter unit 320. For example, the non-transform-based decoder 30 may directly inverse quantize the residual signal for some blocks or frames without using the inverse transform processing unit 312. In another implementation, the decoder 30 may have the inverse quantization unit 310 and the inverse transform processing unit 312 combined into a single unit.

[0208] In a particular embodiment, the decoder 30 may be configured to implement the data decoding method described in the following embodiment corresponding to FIG.

[0209] It should be understood that in the encoder 20 and decoder 30 of the present invention, the processing result of a particular phase may be further processed and then output to the next phase. For example, after interpolation filtering, motion vector derivation, or loop filtering, further operations such as clipping or shift-shifting may be performed on the processing result of the corresponding phase.

[0210] 4 is a diagram of the structure of a video coding device 400 (e.g., video encoding device 400 or video decoding device 400) according to one embodiment of the present invention. Video coding device 400 is suitable for implementing embodiments described herein. In one embodiment, video coding device 400 may be a video decoder (e.g., decoder 30 in FIG. 1A) or a video encoder (e.g., encoder 20 in FIG. 1A). In another embodiment, video coding device 400 may be one or more components in decoder 30 in FIG. 1A or encoder 20 in FIG. 1A.

[0211] Video coding device 400 includes an ingress port 410 and a receiver (Rx) 420 configured to receive data, a processor, logic unit, or central processing unit (CPU) 430 configured to process the data, a transmitter (Tx) 440 and an egress port 450 configured to transmit the data, and storage 460 configured to store the data. Video coding device 400 may include optical-to-electrical conversion components and electrical-to-optical (EO) components coupled to ingress port 410, receiver 420, transmitter 440, and egress port 450 for the egress or ingress of optical or electrical signals.

[0212] The processor 430 is implemented by hardware and software. The processor 430 may be implemented as one or more CPU chips, cores (e.g., multi-core processors), FPGAs, ASICs, and DSPs. The processor 430 communicates with the ingress port 410, the receiver 420, the transmitter 440, the egress port 450, and the storage 460. The processor 430 includes a coding module 470 (e.g., an encoding module 470 or a decoding module 470). The encoding / decoding module 470 implements the embodiments disclosed herein to implement the chroma block prediction method provided in the embodiments of the present invention. For example, the encoding / decoding module 470 implements, processes, or provides various coding operations. Thus, the encoding / decoding module 470 provides significant improvements to the functionality of the video coding device 400 and affects the transition of the video coding device 400 to different states. Alternatively, the encoding / decoding module 470 is implemented by using instructions stored in the storage 460 and executed by the processor 430.

[0213] Storage 460 may include one or more disks, tape drives, and solid state drives, and may be used as an overflow data storage device to store programs when the programs are selectively executed, and to store instructions and data read during program execution. Storage 460 may be volatile and / or non-volatile, and may be read-only memory (ROM), random access memory (RAM), random access memory (ternary content addressable memory, TCAM), and / or static random access memory (SRAM).

[0214] 5 is a simplified block diagram of an apparatus that can be used as any one or two of source device 12 and destination device 14 in FIG. 1A according to an example embodiment. The apparatus may implement the techniques of the present invention. In other words, FIG. 5 is a block diagram of an implementation of an encoding or decoding device (shortly referred to as a coding device) according to an embodiment of the present invention. The decoding device may include a processor 510, a storage 530, and a bus system 550. The processor and the storage are connected through the bus system. The storage is configured to store instructions. The processor is configured to execute the instructions stored in the storage. The storage of the coding device may store program code, and the processor may invoke the program code stored in the storage to perform various video encoding or decoding methods described in the present invention. To avoid repetition, details will not be described herein.

[0215] In this embodiment of the invention, processor 510 may be a Central Processing Unit (abbreviated "CPU"), or processor 510 may be another general-purpose processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, or the like. The general-purpose processor may be a microprocessor, or the processor may be any conventional processor or the like.

[0216] Storage 530 may include a read-only memory (ROM) device or a random access memory (RAM) device. Any other suitable type of storage device may be used as storage 530. Storage 530 may include code and data 531 accessed by processor 510 through bus 550. Storage 530 may further include an operating system 533 and application programs 535, which include at least one program that enables processor 510 to perform the video encoding or decoding methods described in the present invention. For example, application programs 535 may include applications 1-N and may further include a video encoding or decoding application (referred to as a video coding application) that performs the video encoding or decoding methods described in the present invention.

[0217] In addition to a data bus, the bus system 550 may further include a power bus, a control bus, a status signal bus, and the like. However, for clarity of explanation, various types of buses in the figures are marked as the bus system 550.

[0218] Optionally, the coding device may further include one or more output devices, such as a display 570. In one example, the display 570 may be a touch display that combines a display and a touch unit that operatively detects touch input. The display 570 may be connected to the processor 510 through the bus 550.

[0219] Although the processor 510 and storage 530 of the device are shown in FIG. 5 as being integrated into a single unit, other configurations may be used. The operations of the processor 510 may be distributed across multiple machines (each machine having one or more processors) that may be directly coupled, or may be distributed across a local area or another network. The storage 530 may be distributed across multiple machines, such as network-based storage or storage within multiple machines running the device. While only a single bus is shown herein, the bus 550 of the device may include multiple buses. Furthermore, the storage 530 may be directly coupled to another component of the device or may be accessed over a network and may include a single integrated unit, e.g., a storage card, or multiple units, e.g., multiple storage cards. Thus, the device may be implemented in multiple configurations.

[0220] 6 is a diagram of an embodiment of a data encoding method according to an embodiment of the present application. As shown in FIG. 6, the data encoding method provided in this embodiment of the present application includes the following steps:

[0221] 601: Acquire target symbol.

[0222] The data encoding method corresponding to Figure 6 may be applied to an asymmetric code system ANS-based encoder. Specifically, the ANS-based encoder may be used as an entropy encoding unit in the data encoding process. For ease of description, the asymmetric code system ANS-based encoder will be referred to as an ANS encoder in the following for short.

[0223] In a possible implementation, an ANS encoder may receive an input symbol stream (including target symbols), encode the input symbol stream, and output the encoded data (which may be referred to as the encoding result) as part of a bitstream. The total number of output bits is generally less than the total number of input bits to provide a compression effect.

[0224] In a possible implementation, the ANS encoder may include an input symbol buffer configured to store unencoded input symbols. Target symbols are used as an example. The target symbols may be parameters for quantized transform coefficients from a medium (e.g., video, image, audio, or graphics texture), parameters for other residual data from the medium, or other data.

[0225] In a possible implementation, the bits (which may be referred to as codewords) obtained by encoding an input symbol stream may include status information and memory bits, where the status information s is an integer and supports operations such as summation, subtraction, multiplication, division, shifting, and AND / OR / NOT, and the memory bits are a first-in-first-out bitstream and support writing a specified amount of bits and reading a specified amount of bits. After any valid number is written to a specific amount of bits, it must be ensured that the number can be restored by reading the same amount of bits. The encoding order is generally opposite to the decoding order, e.g., reverse encoding and forward decoding.

[0226] In the ANS, probability information needs to be calculated. The probability information may include a quantized probability, a probability mass function (PMF), and a cumulative distribution function (CDF) corresponding to each of a plurality of input symbols. Specifically, the PMF and the CDF may be calculated based on the quantized probabilities.

[0227] In a possible implementation, the probability of each symbol may be quantized into a proportion. For example, the denominator (denoted as the value M) of all quantized probabilities is equal and is an integer power of 2 (M=2 m The probability mass function PMF (denoted as P(x)) and cumulative distribution function CDF (denoted as C(x)) of each symbol x are calculated based on the quantized probability. P(x) is the numerator of the quantized probability, and in a possible implementation, C(x) is the sum of P(x) for symbols less than x.

[0228] In a possible implementation, the plurality of distribution features include a first distribution feature and a second distribution feature, wherein the entropy of the first distribution feature is greater than the entropy of the second distribution feature; and the value of the denominator of the quantization probability in the mapping relationship corresponding to the second distribution feature is greater than the value of the denominator of the quantization probability in the mapping relationship corresponding to the first distribution feature.

[0229] In a multi-distribution scenario, different quantization probability denominators may be used to reduce the coding length. During data coding, a prediction model and entropy coding may be included, where the prediction model may input original data and output distribution indices and uncoded data (e.g., target symbols in this application). The entropy may be calculated based on the distribution indices. A larger quantization probability denominator may be used for a distribution with smaller entropy.

[0230] During encoding or decoding, different quantization probability denominators may be used for different distributions, specifically, larger quantization probability denominators are used for more concentrated distributions, for example:

[0231] 1. In the Gaussian distribution type, a larger quantization probability denominator is used for distributions with smaller variances, and a smaller quantization probability denominator is used for distributions with larger variances.

[0232] 2. In the logistic distribution type, larger quantized probability denominators are used for distributions with smaller dispersions and smaller quantized probability denominators are used for distributions with larger dispersions.

[0233] 3. In the Laplace distribution type, a larger quantized probability denominator is used for distributions with smaller scale parameters, and a smaller quantized probability denominator is used for distributions with larger scale parameters.

[0234] In a possible implementation, the probability information includes a value of a probability mass function PMF, and the value of the PMF is constructed in the following manner: sequentially determining a value of the PMF for each of a plurality of symbols, where the plurality of symbols includes a target symbol; once the value of the PMF of the target symbol is determined, the total value of the remaining PMFs other than the PMF of the determined symbol is multiplied by the probability of the target symbol, and a ratio between the multiplication result and the remaining probability obtained by excluding the determined symbol is calculated, and the PMF of the target symbol is determined based on the relationship between the ratio and a predetermined fifth value.

[0235] In a possible implementation, the fifth value is 1 and the above relation takes on a larger value.

[0236] For example, the total remaining PMF value may be initialized to M, and the total remaining probability may be initialized to 1. All symbols in the value range are sorted in ascending order of probability. The PMF value of each sorted symbol is obtained in the following manner: multiplying the total remaining PMF value by the probability of the symbol, dividing the multiplication result by the total remaining probability, rounding up the division result, and obtaining the greater of 1 and the rounded up result; and subtracting the PMF value of the symbol from the total remaining PMF value, and subtracting the probability of the symbol from the total remaining probability.

[0237] In a possible implementation, the probability information includes values ​​of a cumulative distribution function CDF, the CDF values ​​being calculated in the following manner: The CDF value of each symbol is constructed by sequentially determining the CDF value of each symbol in a preset order, where the preset order is determined based on the relationship between the PMF values ​​corresponding to multiple symbols, and the multiple symbols include a target symbol, where if the probability distribution corresponding to the probability information of the target symbol is a symmetric distribution, the preset order is an alternating order along both sides of the peak point in the symmetric distribution; or if the probability distribution corresponding to the probability information of the target symbol is a discrete distribution, the preset order is specifically descending order; or if the probability distribution corresponding to the probability information of the target symbol is a discrete distribution, the preset order is specifically ascending order.

[0238] For example, for a single-peak symmetric distribution (e.g., a Gaussian distribution, a Laplace distribution, or a logistic distribution), C(x) at the peak point x may be equal to 0, and the values ​​of the PMF may be accumulated on both sides from the peak point, i.e., in the order x, x-1, x+1, x-2, x+2, ..., to obtain the value of the CDF corresponding to each symbol.

[0239] For example, in the case of a discrete distribution, all symbols in a value range may be sorted in descending order of PMF values, denoted as x(0), x(1), x(2), ..., where C(x(0)) for x(0) is equal to 0, and the PMF values ​​are accumulated in the order of x(1), x(2), ... to obtain the CDF value corresponding to each symbol.

[0240] Optionally, when the CDF is calculated, the order from the center to both sides may be x, x+1, x-1, x+2, x-2, ...; when the PMF values ​​are equal, multiple possible ways may be selected to overcome the drawback, for example, indexes in ascending order (in descending order) and random seeds.

[0241] Table 1 is an example of probability information. [Table 1]

[0242] In this embodiment of the present application, the PMF and CDF calculation methods can ensure that the codeword length is reduced without changing the memory and delay.

[0243] In a possible implementation, an encoding table (i.e., the mapping relationship in this embodiment of the present application, for example, the first mapping relationship) needs to be further obtained. The following describes how to construct the encoding table, using the first mapping relationship as an example.

[0244] In a possible implementation, the first mapping relationship may include a symbol, a corresponding bit addend (which may be referred to as first information), and a corresponding status addend (which may be referred to as second information).

[0245] For example, the symbol is a target symbol. In a possible implementation, the first information in the first mapping relationship is constructed in the following manner: performing a summation operation on the amount of consecutive 0 leftmost bits in the preset sixth value and the value of the PMF of the target symbol; and performing a bit shift operation on the summation result of the summation operation, and performing a subtraction operation on the shift result of the bit shift operation and the shift result of the bit shift operation performed on the value of the PMF of the target symbol to obtain the first information.

[0246] In a possible implementation, the sixth value may be m-31, where m is an integer power of two in the denominator of the quantized probabilities.

[0247] In a possible implementation, performing a bit shift operation on the summation result of the summation operation may specifically be performing a left m-bit shift operation on the summation result of the summation operation, and performing a bit shift operation on the value of the PMF of the target symbol may specifically be performing a left b(x) bit shift operation on the value of the PMF of the target symbol, where b(x) may be a preset sixth value and the summation result of the aforementioned summation operation performed on the amount of consecutive leftmost bits that are 0 in the value of the PMF of the target symbol.

[0248] For example, when a coding table is constructed, for each symbol x, the construction method is as follows (method 1):

[0249] Each time x is encoded, the amount of basic bits written to memory bits is calculated: b(x) = clz(P(x)) + m - 31. The clz function calculates the amount of consecutive leftmost zero bits in a 32-bit integer.

[0250] The result of computing the bit addend is (b(x)<<m)-(P(x)<<b(x))+M, in the range [0,m×M], and the result is

number

[0251] For example, the symbol is a target symbol. In a possible implementation, the first information in the first mapping relationship is constructed in the following manner: performing a bit shift operation on a summation result of a summation operation, performing a subtraction operation on the shift result of the bit shift operation and the shift result of the bit shift operation performed on the value of the PMF of the target symbol, and performing a summation operation on the operation result of the subtraction operation and a value M to obtain the first information, where the probability information includes quantization probabilities, and M is a denominator of the quantization probabilities.

[0252] For example, when a coding table is constructed, for each symbol x, the method for constructing the first information is as follows (Method 2):

[0253] In Scheme 2, compared to Scheme 1, the result of the "bit addend" is changed from (b(x)<<m)-(P(x)<<b(x))+M to (b(x)<<m)-(P(x)<<b(x)), and the range is changed to [-M,(m-1)×M], resulting in

number

[0254] In a possible implementation, the second information in the first mapping relationship is constructed in the following manner (Method 1): performing a subtraction operation on the value of the CDF of the target symbol and the value of the PMF of the target symbol to obtain the second information.

[0255] For example, if a coding table is constructed, for each symbol x, the method for constructing the second information is as follows:

[0256] The result of the "status addend" is changed from C(x)-P(x) to C(x)-P(x)+M, the range is changed to [1,M×2-2], and the result is represented by an (m+1)-bit unsigned integer.

[0257] In a possible implementation, the second information in the first mapping relationship is constructed in the following manner (Method 2): performing a subtraction operation on the value of the CDF of the target symbol and the value of the PMF of the target symbol, and performing a summation operation on the result of the subtraction operation and a value M to obtain the second information, where the probability information includes quantized probabilities, and M is the denominator of the quantized probabilities.

[0258] For example, when a coding table is constructed, for each symbol x, the method for constructing the first information is as follows (Method 2):

[0259] In Scheme 2, compared with Scheme 1, the calculation result of the "status addend" is changed from C(x)-P(x) to "if C(x)-P(x)≧0, the "status addend" is C(x)-P(x); or if C(x)-P(x)<0, the "status addend" is C(x)-P(x)+M." In this case, the value range of the "status addend" is [0,M-1], and the "status addend" may be represented by an m-bit unsigned integer. The additional bitwise OR operation increases the calculation overhead, which can further improve coding efficiency, but on the other hand, increases memory consumption by a small amount. This scheme is applicable to scenarios requiring high coding efficiency.

[0260] In a possible implementation, the second information in the first mapping relationship is constructed in the following manner (Scheme 3): when the result of the subtraction operation performed on the CDF value of the target symbol and the PMF value of the target symbol is greater than or equal to 0, the result of the subtraction operation is used as the second information. The above manner can further reduce memory consumption while slightly reducing coding efficiency. This manner is applicable to scenarios where memory saving is maximized.

[0261] In a possible implementation, the second information in the first mapping relationship is constructed in the following manner: if the result of a subtraction operation performed on the value of the CDF of the target symbol and the value of the PMF of the target symbol is less than 0, then performing a summation operation on the result of the subtraction operation and a value M to obtain the second information, where the probability information includes quantized probabilities and M is the denominator of the quantized probabilities.

[0262] For example, when a coding table is constructed, for each symbol x, the method for constructing the first information is as follows (Method 2):

[0263] In Method 2, compared to Method 1, the calculation result of the "status addend" is changed from C(x)-P(x) to "if C(x)-P(x)≧0, the "status addend" is C(x)-P(x); or if C(x)-P(x)<0, the "status addend" is C(x)-P(x)+M." In this case, the value range of the "status addend" is [0,M-1], and the "status addend" may be represented by an m-bit unsigned integer.

[0264] Table 2 is an example of the first mapping relationship established in Method 1. [Table 2]

[0265] Table 3 is an example of the first mapping relationship established in Method 2. [Table 3]

[0266] Table 4 is an example of the first mapping relationship established in Method 3. [Table 4]

[0267] In a possible implementation, the first information or the second information may represent an integer value, i.e., a single integer. For example, the first information may represent an integer value, and the second information may represent an integer value. In this embodiment of the present application, the index information in the encoding table includes only symbols, and the mapped object includes only the first information and the second information. This reduces the memory usage of the encoding table.

[0268] It should be understood that different mapping relationships (including the first mapping relationship) may further be configured for different probability distributions.

[0269] In a possible implementation, the target symbol may be obtained by transforming pixel data of an image, where the data obtained by transforming the pixel data of the image satisfies a preset distribution, and the transformation is further used to obtain a distribution characteristic of the pixel data, where the distribution characteristic includes a mean value or a variance, and a first mapping relationship corresponding to the distribution characteristic may be determined from a plurality of mapping relationships based on the distribution characteristic. In other words, the first mapping relationship corresponding to the distribution characteristic may be determined from a plurality of mapping relationships based on the distribution characteristic as an index.

[0270] FIG. 8 is a diagram of the encoding process.

[0271] The model may include two parts. The first part is an image data processing module. The model transforms the image data so that the distribution of the transformed data is simpler, which facilitates the entropy coding process. The model may be a neural network that processes the image data into transformed data and obtains a distribution index of the transformed data in each dimension. The model may also be a pre-processing and quantization process for image color conversion. For example, a YUV or discrete Fourier transform is performed on an RGB image to obtain transformed data and establish a specific distribution index for the transformed data.

[0272] The second part is to predefine some probability distribution (e.g., Gaussian and logistic distributions with different variances) and establish the corresponding distribution index and the corresponding coding table, which is constructed based on the calculated discrete PMF and the calculated discrete CDF.

[0273] In the encoding process, a distribution index corresponding to the transformed data in each dimension may be found, and thus a corresponding encoding table is found; entropy encoding is performed to form an encoded codeword, and the encoded codeword is stored. The codeword may further store a basic header file, such as the length and width of the image, and some necessary parameters.

[0274] In a possible implementation, to further reduce memory usage, the first information and the second information may be combined and then stored, and after obtaining the combined data, the encoder may restore the first information and the second information according to certain calculation rules.

[0275] In a possible implementation, an integer value corresponding to the target symbol may be obtained based on a first mapping relationship; and the integer value is restored to first information and second information through a third operation, where the first information and the second information are each integer values. The above-mentioned scheme can reduce memory consumption, shorten memory read time, and further improve throughput on some hardware devices (e.g., servers).

[0276] For example, multiple integer parameters (at most one of which is a signed integer) may be combined into a single parameter by placing the signed integer at the leftmost position, then sequentially storing the parameters bit by bit based on the amount of bits in each parameter through shifting and bitwise ORing; and when a symbol is read, restoring each parameter through shifting and bitwise ANDing.

[0277] Table 7 is an example of the coding table before the information is combined, Table 8 is a diagram of the coding table after the information is combined, and Table 9 is a summary of the parameter lengths of the coding table. [Table 5] [Table 6] [Table 7]

[0278] 603: Obtain first encoded data through a first operation based on the first information and the status information of the encoder.

[0279] 604: Based on the second information, update the status information through a second operation to obtain second encoded data, where the first encoded data and the second encoded data are used to obtain an encoding result of the target symbol, and the first operation and the second operation do not include a division operation.

[0280] The first encoded data may be a memory bit and the second encoded data may be a state s.

[0281] In a possible implementation, at least one of the first operation and the second operation may not include a division operation, thereby reducing computation delay.

[0282] In a possible implementation, at least one of the first operation and the second operation may not include a decision operation, thereby reducing computation delay.

[0283] In a possible implementation, at least one of the first operation and the second operation may not include a binary search operation, thereby reducing computational delay.

[0284] In a possible implementation, the first operation includes: performing a summation operation on the first information and the status information, and performing a bit shift operation on the summation result of the summation operation; and selecting some bits from the status information as the first encoded data, wherein the location of the some bits in the status information is determined based on the shift result of the bit shift operation.

[0285] In a possible implementation, the second operation includes: performing a summation operation on the status information and a value M, and performing a bit shift operation on the summation result of the summation operation, where the probability information includes quantized probabilities and M is a denominator of the quantized probabilities; and performing a summation operation on the shifted result of the bit shift operation and the second information.

[0286] For example, during encoding, 0 ≦ s < M. s is initialized to 0.

[0287] For the encoded symbol x, the "bit addition number" and the "status addition number" are obtained by table lookup based on x; the amount of bits b written to the memory bit is calculated in the following manner: shifting the sum of the current state s and the "bit addition number" to the right by m bits; writing the rightmost b bits of the current state s to the memory bit; and updating the state s to the sum of the "status addition number" and the result obtained by shifting the sum of the current state s and M to the right by b bits.

[0288] s may be represented in the binary format of an m-bit unsigned integer, and combined with the memory bit to obtain the encoding result, that is, the codeword.

[0289] Table 5 shows that AAABA is encoded into 00101110 in the above-described manner (here, the first 3 bits 001 indicate that the state is 1, and 01110 is the memory bit). [Table 8]

[0290] FIG. 7 is a schematic flowchart for constructing an encoding table in the above-described method 1 and executing an encoding process through the first operation and the second operation described above.

[0291] In a possible implementation, when the encoding table is constructed in the above-described method 2, the second operation may include: when the status information is initialized to M, performing a bit shift operation on the status information; performing a sum operation on the shift result of the bit shift operation and the second information; and performing a subtraction operation on the sum result of the sum operation and M.

[0292] For example, throughout the encoding process, M ≦ s < M × 2, and during encoding, s is initialized to M.

[0293] The "sum of the status addend, and the sum of the results obtained by shifting the current state s and M to the right by b bits" may be changed to the "sum of the status addend, and the sum of the results obtained by shifting the current state s to the right by b bits"; s - M is represented in the binary form of an m-bit unsigned integer and combined with memory bits.

[0294] Table 6 shows that AAABA is encoded as 00101110 in the aforementioned manner (where the first 3 bits 001 indicate that the state is 1, and 01110 are memory bits).

Table 9

[0295] One embodiment of the present application provides a data encoding method applied to an asymmetric code system ANS-based encoder. The method includes: obtaining a target symbol; obtaining first information and second information corresponding to the target symbol based on a first mapping relationship, where the first information and the second information are obtained based on probability information corresponding to the target symbol; obtaining first encoded data through a first operation based on the first information and the status information of the encoder; and obtaining second encoded data by updating the status information through a second operation based on the second information. The first encoded data and the second encoded data are used to obtain the encoding result of the target symbol, and the first operation and the second operation do not include a division operation. In the present application, the index information in the encoding table only includes symbols, and the mapped object only includes the first information and the second information. This is equivalent to reducing the memory usage in the encoding table, avoiding operations that consume a large amount of memory, and achieving a balance between memory and latency.

[0296] In a possible implementation, the second information includes first sub-information (which may also be referred to as status addend 1), second sub-information (which may also be referred to as status threshold), and third sub-information (which may also be referred to as status addend 2).

[0297] The first sub-information in the first mapping relationship is constructed in the following manner: performing a subtraction operation on the third value of the target symbol and the value of the PMF of the target symbol to obtain the first sub-information.

[0298] The second sub-information in the first mapping relationship is constructed in the following manner: performing a summation operation on the third value of the target symbol and the first value of the target symbol, and performing a subtraction operation on the result of the summation operation and 1 to obtain the second sub-information.

[0299] The third sub-information in the first mapping relationship is constructed in the following manner: performing a subtraction operation on the fourth value of the target symbol and the third value of the target symbol, and performing a subtraction operation on the result of the subtraction operation and the first value of the target symbol to obtain the third sub-information.

[0300] In a possible implementation, the second operation is: performing a summation operation on the status information and a value M, and performing a bit shift operation on a summation result of the summation operation, where the probability information includes quantized probabilities and M is a denominator of the quantized probabilities; and performing a summation operation on a shifted result of the bit shift operation and the first sub-information; and if the result of the summation operation is greater than the second sub-information, using the sum of the result of the summation operation and the third sub-information as the second coded data; or If the result of the summation operation is less than the second sub-information, the result of the summation operation is used as the second coded data. Includes.

[0301] The above scheme may be applicable to, but is not limited to, single-peak symmetric distributions (e.g., Gaussian, logistic, or Laplace distributions) and is used to reduce the coding length, but at the expense of increased coding computation.

[0302] 1. The PMF value for each symbol is divided into two parts: P(x) = P1(x) + P2(x).

[0303] 2. C1(x) is calculated as the sum of P1(x) for symbols less than x; C2(x) is calculated as the sum of all values ​​of P1(x) for symbols less than x and the sum of P2(x).

[0304] The table below shows a specific example. [Table 10]

[0305] If an encoding table is constructed, for each symbol x, one example of how it can be constructed is as follows:

[0306] (1) Each time x is encoded, the amount of basic bits written to memory bits is calculated: b(x) = clz(P(x)) + m - 31. The clz function calculates the amount of consecutive zeros in the leftmost bits of a 32-bit integer.

[0307] (2) The result of computing the bit addend is (b(x)<<m)-(P(x)<<b(x))+M, and the range is [2,m×M]. The result is

number

[0308] (3) The result of calculating the status addend 1 is C1(x)-P(x).

[0309] (4) The result of calculating the status threshold is C1(x)+P1(x)-1.

[0310] (5) The result of calculating the status addend 2 is C2(x) - C1(x) - P1(x).

[0311] The following table shows an example of an encoding table: [Table 11]

[0312] During encoding, the codeword may include the state s and the memory.

[0313] For example, throughout the encoding process, 0 ≤ s < M. s is initialized to 0.

[0314] Encoded symbol x:

[0315] (1) The "bit addend", "status addend 1", "status threshold", and "status addend 2" are obtained by table lookup based on x.

[0316] (2) The amount of bits b written to the memory bit is calculated by shifting the sum of the current state s and the "bit addend" to the right by m bits. <​​​​​​​​​​​​​​​ [Table 12]

[0321] In a possible implementation, when the value M is 256, the first information is stored using 10 bits, the first sub-information is stored using 8 bits, the second sub-information is stored using 7 bits, and the third sub-information is stored using 7 bits, the sum of the first values ​​of the multiple symbols is 128, and the third sub-information is less than 128.

[0322] When M=256 (m=8), the following conditions are met:

[0323] The "bit addend", "status addend 1", "status threshold", and "status addend 2" of each symbol require 10 bits, 8 bits, 7 bits, and 7 bits, respectively, i.e., a total of 32 bits. The sum of all P1(x) is exactly 128, and the value of "status addend 2" is always less than 128.

[0324] If M=256 (m=8), then "Bit Addend", "Status Addend 1", "Status Threshold", and "Status Addend 2" require 12 bits, 8 bits, 8 bits, 8 bits, and 8 bits, respectively, i.e., a total of 36 bits, which cannot be represented by 4 bytes. These four parts may be represented using a total of 32 bits by using the following method:

[0325] 1. The bit addend B is originally an even number between [2, 2048] and requires 12 bits, and B / 2-1 may be represented by using 10 bits.

[0326] 2. The values ​​of P1(x) and P2(x) are adjusted so that the sum of all P1(x) is exactly 128 and the value of "status addend 2" is always less than 128. In this case, the ranges of "status threshold" and "status addend 2" are both [0,127], and "status threshold" and "status addend 2" may be represented by using 7 bits.

[0327] According to this solution, the "bit addend", "status addend 1", "status threshold", and "status addend 2" of each symbol require 10 bits, 8 bits, 7 bits, and 7 bits respectively, i.e., a total of 32 bits.

[0328] The present application further provides a data encoding method applicable to an asymmetric code system ANS-based encoder, the method including: obtaining a first symbol, where a sum of a quantization probability corresponding to the first symbol and a quantization probability corresponding to a second symbol is 1, a difference between the quantization probability corresponding to the first symbol and 1 is less than a threshold, and a difference between the quantization probability corresponding to the second symbol and 0 is less than a threshold; and, if a value relationship between the status information of the encoder and a value M satisfies a first condition, performing a first operation on the status information and a value M to obtain first encoded data and update the status information to 0; or, if the value relationship between the status information of the encoder and the value M does not satisfy the first condition, adding 1 to the status information.

[0329] In a possible implementation, the method further includes: obtaining the second symbol; and using status information of the encoder as the first encoded data and updating the status information to the difference between the values ​​M and 1.

[0330] The foregoing embodiments may be specific to encoding and decoding solutions for cases where there are a total of two types of symbols and the probability of a single symbol is close to 1. In this embodiment, there is no need to construct encoding and decoding tables. Therefore, no additional memory is required to store the tables. Assume that there are a total of two types of symbols, a and b, and the probability of symbol a is close to 1. In this case, the encoding algorithm is as follows:

[0331] When symbol a is compressed as follows: if the state s ≥ M - 2, then s - M + 2 (0 or 1) is written to the 1-bit and the memory bit, and then s is updated to 0; or if the state s < M - 2, then s is updated to s + 1.

[0332] When symbol b is compressed as follows: all m bits of s are written to the memory bit, and s is updated to M - 1.

[0333] FIG. 9 is a diagram of an embodiment of a data decoding method according to an embodiment of the present application. As shown in FIG. 9, the data decoding method provided in this embodiment of the present application includes the following steps:

[0334] 901: Obtain the status information of the decoder and the memory bit, where the status information corresponds to the first bit, and the first bit is the current un-decoded bit.

[0335] For example, FIG. 10A is a specific diagram of a data decoding method according to an embodiment of the present application.

[0336] The status information (decoding status) may be obtained from the encoder side, or may be the status information obtained by updating the status information in the decoding process. The memory bit may be obtained from the encoder side, or may be the memory bit obtained by updating the memory bit in the decoding process.

[0337] 902: Determine first information, second information, and third information corresponding to status information based on a first mapping relationship, where the first information is a target symbol corresponding to the first bit, the target symbol is a decoding result of the first bit, the second information indicates an amount of bits selected from the memory bits, the third information is used to perform a summation operation with the bits selected from the memory bits based on the second information, the result of the summation operation is used to update the status information, the updated status information corresponds to the second bit, and the second bit is an undecoded bit after the first bit.

[0338] It should be understood that the first mapping relationship illustrated in Fig. 6 and the first mapping relationship illustrated in Fig. 9 are different mapping relationships. The first mapping relationship illustrated in Fig. 9 is a decoding table.

[0339] The first information may be referred to as a decoded symbol, the second information may be referred to as a quantity of read bits, and the third information may be referred to as a status cardinality.

[0340] In a possible implementation, the first information, the second information, or the third information is obtained based on probability information; the probability information includes a value of a probability mass function PMF; the value of the PMF is constructed in the following manner: sequentially determining a value of the PMF of each of a plurality of symbols, where the plurality of symbols includes a target symbol, and once the value of the PMF of the target symbol is determined, the total value of the remaining PMFs other than the PMF of the determined symbol is multiplied by the probability of the target symbol, and a ratio between the multiplication result and the remaining probability obtained by excluding the determined symbol is calculated, and the PMF of the target symbol is determined based on the relationship between the ratio and a preset value.

[0341] In a possible implementation, the first information, the second information, or the third information is obtained based on probability information, where the probability information includes a value of a cumulative distribution function (CDF); the CDF value is constructed in the following manner: sequentially determining the CDF value of each symbol in a preset order, where the preset order is determined based on the relationship between the PMF values ​​corresponding to multiple symbols, where the multiple symbols include a target symbol, and if the probability distribution corresponding to the probability information of the target symbol is a symmetric distribution, the preset order is an alternating order along both sides of the peak point in the symmetric distribution; or if the probability distribution corresponding to the probability information of the target symbol is a discrete distribution, the preset order is specifically descending order; or if the probability distribution corresponding to the probability information of the target symbol is a discrete distribution, the preset order is specifically ascending order.

[0342] In a possible implementation, the first information in the first mapping relationship is constructed by using x as the first information that satisfies the following formula: C(x)≦s<(C(x)+P(x)), where C represents the value of the CDF, P represents the value of the PMF, and s represents the status information.

[0343] In a possible implementation, the second information in the first mapping relationship is constructed in the following manner using the value of clz(sC(x)+P(x))+X as the second information, where clz represents taking the amount of consecutive 0 leftmost bits in the value, and X is a preset fifth value.

[0344] In a possible implementation, the third information in the first mapping relationship is constructed in the following manner: performing a bit shift operation on the value of sC(x)+P(x) to obtain the third information, where the shift amount of the bit shift operation is obtained based on the second information; or performing a bit shift operation on the value of sC(x)+P(x) and subtracting a value M from the result of the bit shift operation to obtain the third information, where M is the denominator of the quantization probability and the shift amount of the bit shift operation is obtained based on the second information.

[0345] For example, when the decoding table is constructed, for each status s, the construction method is as follows:

[0346] The "decoded symbol" is the value of x that satisfies C(x) ≤ s < C(x) + P(x), the value of the "amount of read bits" is clz(s - C(x) + P(x)) + m - 31, and the value of the "status cardinality" is the difference between the result obtained by shifting s - C(x) + P(x) to the left by the "amount of read bits" bits and M.

[0347] Table 10 is an example of the decoding table obtained in the foregoing manner. [Table 13]

[0348] In a possible implementation, the first information, the second information, or the third information is an integer value, that is, represents a single integer. For example, the first information may represent an integer value, the second information may represent an integer value, and the third information may represent an integer value. In this embodiment of the present application, the index information in the decoding table includes only symbols, and the mapped objects include only the first information, the second information, and the third information. Thereby, the memory usage of the encoding table is reduced.

[0349] It should be understood that different mapping relationships (including the first mapping relationship) may be further configured for different probability distributions.

[0350] In a possible implementation, an encoding result may be obtained, where the encoding result is obtained by encoding pixel data of the image, and status information and memory bits are obtained based on the encoding result; the encoding result is processed to obtain a distribution feature of the pixel data, where the distribution feature includes a mean value or a variance; and a first mapping relationship corresponding to the distribution feature is determined from the multiple mapping relationships based on the distribution feature.

[0351] FIG. 10B is a diagram of the decoding process.

[0352] The model includes three parts.

[0353] The first part is for decoding the header file in the codeword, such as the length and width of the image and some necessary parameters that may be used to establish a distribution index that corresponds to the decoded data (transformed data) for the information in the codeword.

[0354] The second part is to predefine some probability distribution (e.g., Gaussian and logistic distributions with different variances) and establish the corresponding distribution index and the corresponding decoding table. The encoding table is constructed based on the calculated discrete PMF and the calculated discrete CDF.

[0355] The third part is an image decoder that decodes the transformed data to recover the image. The decoder can be a neural network or a post-processing process of the image color transformation, such as an inverse Fourier transform or a YUV to RGB conversion.

[0356] During decoding, for each undecoded codeword, the basic structure in the header file is read by using the model, and the required distribution index of the decoded data is established based on the codeword. The decoding table corresponding to the decoded data (transformed data) in each dimension is found based on the distribution index, and the decoded transformed data is obtained through entropy decoding. Finally, the model is used to restore the transformed data to the original image.

[0357] In a possible implementation, an integer value corresponding to the status information may be obtained based on a first mapping relationship; the integer value is restored to first information, second information, and third information, where the first information, second information, and third information are each integer values.

[0358] For example, the "decoded symbols", "amount of read bits", and "status cardinality" may be combined according to the rules described above. The length of a single parameter is the amount of state M=2 m For ease of computer reading, the length is generally set to 24 or 32 bits.

[0359] Table 11 is an example of a summary of the parameter lengths of the decoding table. [Table 14]

[0360] In a possible implementation, the first information is a target symbol corresponding to the first bit, the target symbol is a decoding result of the first bit, the second information indicates an amount of bits selected from the memory bits, the third information is used to perform a summation operation with the selected bits from the memory bits based on the second information, the result of the summation operation is used to update the status information, the updated status information corresponds to the second bit, the second bit is an undecoded bit after the first bit. In addition, the selected bits may be removed from the memory bits to obtain updated memory bits.

[0361] For example, the "decoded symbols", "quantity of bits read", and "status cardinality" may be obtained through table lookup based on the current state values; s is updated to the sum of the "status cardinality" and the number obtained by reading the "quantity of bits read" bits from the memory bits.

[0362] Table 12 is a decoding example where 00101110 (state 001 represents 1 and 01110 is the memory bit) is decoded and the decoding result is AAABA. [Table 15]

[0363] It should be understood that the technical solutions in the embodiment corresponding to Figure 6 and the embodiment in Figure 9 may be combined with each other. For example, three sub-tables may be constructed:

[0364] Sub-table 1: For each state s, the "decoded symbol" is obtained. The method and results are the same as in the decoding process described above.

[0365] Sub-table 2: For each symbol x, the "status addend" is calculated. The method and results are the same as that of the "status addend" in scheme 1 described in the encoding process above.

[0366] Sub-table 3 (all distributions share one table): For each integer i∈[1,M×2−1], the “amount of status bits” is calculated as clz(i)+m−31.

[0367] The process for decoding a single symbol is as follows:

[0368] The current state s is replaced by sub-table 1 to obtain the "decoded symbol" x obtained through decoding.

[0369] The x obtained through decoding is substituted into sub-table 2 to obtain the "status addend".

[0370] The amount of bits that need to be read from the memory bit is calculated in the following manner: by subtracting the "status addend" from s and substituting the value obtained into sub-table 3 to obtain the "amount of status bits".

[0371] The state s is updated as follows: by shifting the result obtained by subtracting the "status addend" from the current value of s by "amount of status bits" bits to the left, and by using the value of the sum of the result of the shift operation and the value of the "amount of status bits" bits read from the memory bit modulo M.

[0372] According to the above method, the intermediate results of decoding at each stage are the same as the decoding process described in FIG.

[0373] Table 13 is an example of a decoding table obtained in the above-described manner. [Table 16]

[0374] This embodiment of the present application can reduce the compression time: compared to rANS, the coding time is improved by 3-4 times.

[0375] Table 14 is an example of a beneficial effect. [Table 17]

[0376] In this embodiment of the present application, the table memory is smaller. For a total number of symbols X and an amount of states M, if each element in the table is stored by using 32 bits, the size of the encoding table is 4X and the size of the decoding table is 3M. ​​If each element in the table is compressed to 24 bits for storage, the size of the encoding table is 3X and the size of the decoding table is 3M.

[0377] The memory usage of the table built for a specific distribution is less than 100KB (MASS=8, M=256). The table built for a specific distribution corresponds to a tANS table size of 10MB-20MB. Therefore, the table memory usage is significantly reduced.

[0378] Table 15 is an example of a beneficial effect. [Table 18]

[0379] In a possible implementation, the first information in the first mapping relationship is constructed by using, as the first information, an x that satisfies the following formula: C1(x) ≤ s < C1(x) + P1(x) or C2(x) ≤ s < C2(x) + P2(x), where C1 represents the third value corresponding to the CDF, P1 represents the first value corresponding to the PMF, C2 represents the fourth value corresponding to the CDF, P2 represents the second value corresponding to the PMF, s represents status information, and the sum of the first value and the second value is the value of the PMF.

[0380] In a possible implementation, the second information in the first mapping relationship is in the following formula: It is constructed by using, as the second information, the value of clz(s' - C(x) + P(x)) + X, where clz represents taking the amount of the leftmost bit that is consecutive 0s in the value, X is a preset fifth value, and s' is in the following formula: when C2(x) ≤ s, s' = P1(x) + s - C2(x) + P(x); or when C2(x) > s, s' = s - C1(x) + P(x) and is obtained therefrom.

[0381] In a possible implementation, the third information in the first mapping relationship is constructed by performing a bit shift operation on the value of s' - C(x) + P(x) to obtain the third information, where the shift amount of the bit shift operation is obtained based on the second information.

[0382] For each state s, the construction method is as follows:

[0383] 1. "Decoded symbol" is the value of x that satisfies C1(x) ≤ s < C1(x) + P1(x) or C2(x) ≤ s < C2(x) + P2(x).

[0384] 2. s' corresponding to s is calculated as follows: (a) when C2(x) ≤ s, s' = P1(x) + s - C2(x) + P(x); or (b) If C2(x)>s, then s'=s-C1(x)+P(x).

[0385] 3. s' is used to build a decoding table by using the same method as in embodiment 2.

[0386] (1) The value of the "amount of read bits" is clz(s'-C(x)+P(x))+m-31.

[0387] (2) The value of "status cardinality" is the difference between M and the result of shifting s'-C(x)+P(x) to the left by "amount of bits read" bits. [Table 19]

[0388] Additionally, each decoded symbol may correspond to one or two consecutive segments of state s. As shown in the table above, A corresponds to 0 to 2 and 4 to 5.

[0389] When a single symbol is decoded, the “decoded symbol”, “quantity of bits read”, and “status cardinality” may be obtained by table lookup based on the value of the current state s; s is updated to the sum of the numbers obtained by reading the “status cardinality” and “quantity of bits read” bits from the memory bits. [Table 20]

[0390] The present application further provides a data decoding method applied to an asymmetric coding system ANS-based decoder, the method comprising: obtaining decoder status information, where the status information corresponds to the first bit, the first bit being a currently undecoded bit; and When the status information is the difference between the value M and 1, determine that the decoding result of the first bit is the second symbol, and update the status information to the result of reading the value M bits from the memory bit; or When the status information is not the difference between the value M and 1, determine that the decoding result of the first bit is the first symbol; when the status information is 0, update the status information to the sum result of the difference between the value M and 2 and the value of 1 bit read from the memory bit; or when the status information is not 0, update the status information to the difference between the status information and 1, where the updated status information corresponds to the second bit, and the second bit is the undecoded bit after the first bit, including.

[0391] The foregoing embodiments are encoding and decoding solutions for the case where there are a total of two types of symbols and the probability of a single symbol is close to 1.

[0392] There are two types of symbols: a and b. In this embodiment, it is not necessary to construct an encoding and decoding table. Therefore, no additional memory is required to store the table. Assume that there are a total of two types of symbols a and b, and the probability of symbol a is close to 1. In this case, the encoding algorithm is as follows:

[0393] Symbol a is compressed as follows: When the state s≧M - 2, s - M + 2 (0 or 1) is written to the 1 bit and the memory bit, and then s is updated to 0; or when the state s < M - 2, s is updated to s + 1.

[0394] Symbol b is compressed as follows: All m bits of s are written to the memory bit, and s is updated to M - 1.

[0395] The decoding algorithm is as follows: if the current state s is M-1, then symbol b is decoded and s is updated to the result of reading m bits from the memory bits. Alternatively, if the current state s is not M-1, then a is decoded and then s is updated. (1) If s=0, then s is updated to the sum of M-2 and the value of 1 bit read from the memory bits; (2) Or if s≠0, then s is updated to s-1.

[0396] The following describes a data encoding device provided in an embodiment of the present application from the device perspective. Figure 11 is a structural diagram of a data encoding device according to an embodiment of the present application. As shown in Figure 11, the data encoding device 1100 provided in an embodiment of the present application includes: an acquiring module 1101 configured to acquire a target symbol;

[0397] Please refer to the description of step 601 in the above embodiment for a specific description of the acquisition module 1101. The details will not be described again in this specification.

[0398] The data encoding apparatus 1100 obtains, based on a first mapping relationship, first information and second information corresponding to a target symbol, where the first information and the second information are obtained based on probability information corresponding to the target symbol; obtaining first encoded data through a first operation based on the first information and the status information of the encoder; and updating the status information through a second operation based on the second information to obtain second encoded data; The encoding module 1102 further includes an encoding module configured to:

[0399] The first encoded data and the second encoded data are used to obtain an encoding result of the target symbol, and the first operation and the second operation do not include a division operation.

[0400] Please refer to the description of step 602 in the above embodiment for a specific description of the encoding module 1102. The details will not be described again in this specification.

[0401] In a possible implementation, the first information or the second information represents an integer value.

[0402] In a possible implementation, the first operation and the second operation do not include a decision operation.

[0403] In a possible implementation, the first operation is: performing a summation operation on the first information and the status information, and performing a bit shift operation on a summation result of the summation operation; and Selecting some bits from the status information as the first encoded data where the location of some bits in the status information is determined based on the shift result of the bit shift operation.

[0404] In a possible implementation, the second operation is: performing a summation operation on the status information and a value M, and performing a bit shift operation on a summation result of the summation operation, where the probability information includes quantized probabilities and M is a denominator of the quantized probabilities; and performing a summation operation on the shift result of the bit shift operation and the second information; Includes.

[0405] In a possible implementation, the probability information comprises values ​​of a probability mass function PMF, the values ​​of the PMF being calculated in the following manner: A PMF value is constructed by sequentially determining a value of each of a plurality of symbols, where the plurality of symbols includes a target symbol.

[0406] Once the value of the PMF of the target symbol is determined, the total value of the remaining PMFs other than the PMF of the determined symbol is multiplied by the probability of the target symbol, and a ratio between the multiplication result and the remaining probability obtained by excluding the determined symbol is calculated, and the PMF of the target symbol is determined based on the relationship between the ratio and a preset fifth value.

[0407] In a possible implementation, the fifth value is 1 and the above relation takes on a larger value.

[0408] In a possible implementation, the probability information includes values ​​of a cumulative distribution function CDF, the CDF values ​​being calculated in the following manner: and sequentially determining a CDF value for each symbol in a predetermined order, where the predetermined order is determined based on a relationship between PMF values ​​corresponding to a plurality of symbols, the plurality of symbols including a target symbol; If the probability distribution corresponding to the probability information of the target symbol is a symmetric distribution, the preset order is an alternating order along both sides of the peak point in the symmetric distribution; or When the probability distribution corresponding to the probability information of the target symbol is a discrete distribution, the preset order is specifically a descending order; or When the probability distribution corresponding to the probability information of the target symbol is a discrete distribution, the preset order is specifically an ascending order.

[0409] In a possible implementation, the target symbol is obtained by transforming pixel data of the image, and the data obtained by transforming the pixel data of the image meets a preset distribution, and the transformation is further used to obtain distribution characteristics of the pixel data, and the distribution characteristics include a mean value or a variance; the obtaining module: The method is further configured to determine, from the plurality of mapping relations based on the distribution feature, a first mapping relation corresponding to the distribution feature.

[0410] In a possible implementation, the plurality of distribution features includes a first distribution feature and a second distribution feature, and the entropy of the first distribution feature is greater than the entropy of the second distribution feature; The value of the denominator of the quantization probability in the mapping relationship corresponding to the second distribution feature is greater than the value of the denominator of the quantization probability in the mapping relationship corresponding to the first distribution feature.

[0411] In a possible implementation, the first information in the first mapping relationship is in the following manner: performing a summation operation on the quantity of consecutive zero-numbered leftmost bits in the preset sixth value and the value of the PMF of the target symbol; and performing a bit shift operation on a summation result of the summation operation, and performing a subtraction operation on the shift result of the bit shift operation and the shift result of the bit shift operation performed on the value of the PMF of the target symbol to obtain first information; or performing a bit shift operation on a summation result of the summation operation; performing a subtraction operation on the shift result of the bit shift operation and the shift result of the bit shift operation performed on the value of the PMF of the target symbol; and performing a summation operation on the operation result of the subtraction operation and the value M to obtain first information. where the probability information includes quantized probabilities and M is the denominator of the quantized probabilities.

[0412] In a possible implementation, the second information in the first mapping relationship is in the following manner: performing a subtraction operation on the CDF value of the target symbol and the PMF value of the target symbol to obtain second information; or performing a subtraction operation on the value of the CDF of the target symbol and the value of the PMF of the target symbol, and performing a summation operation on the result of the subtraction operation and the value M to obtain second information; where the probability information includes quantized probabilities and M is the denominator of the quantized probabilities.

[0413] In a possible implementation, the second information in the first mapping relationship is in the following manner: using the result of the subtraction operation performed on the value of the CDF of the target symbol and the value of the PMF of the target symbol as the second information if the result is greater than or equal to zero; or If the result of the subtraction operation performed on the value of the CDF of the target symbol and the value of the PMF of the target symbol is less than 0, perform a summation operation on the result of the subtraction operation and the value M to obtain second information. where the probability information includes quantized probabilities and M is the denominator of the quantized probabilities.

[0414] In a possible implementation, the encoding module: Obtaining an integer value corresponding to the target symbol based on the first mapping relationship; and recovering the integer value into the first information and the second information through a third operation, where the first information and the second information are each integer values; The present invention is particularly configured to:

[0415] In a possible implementation, the probability information includes PMF information corresponding to each symbol, the PMF information including a first value and a second value; a sum of the first value and the second value is the PMF value; the probability information further includes CDF information corresponding to each symbol, the CDF information including a third value and a fourth value; and the third value and the fourth value are expressed in the following manner: sequentially determining a third value corresponding to each symbol in a predetermined order through accumulation based on the first values ​​of the plurality of symbols; and sequentially determining a fourth value corresponding to each symbol in a predetermined order through accumulation based on the second values ​​and the third values ​​of the plurality of symbols; It is constructed in

[0416] In a possible implementation, the second information includes first sub-information, second sub-information, and third sub-information.

[0417] The first sub-information in the first mapping relationship is constructed in the following manner: performing a subtraction operation on the third value of the target symbol and the value of the PMF of the target symbol to obtain the first sub-information.

[0418] The second sub-information in the first mapping relationship is constructed in the following manner: performing a summation operation on the third value of the target symbol and the first value of the target symbol, and performing a subtraction operation on the result of the summation operation and 1 to obtain the second sub-information.

[0419] The third sub-information in the first mapping relationship is constructed in the following manner: performing a subtraction operation on the fourth value of the target symbol and the third value of the target symbol, and performing a subtraction operation on the result of the subtraction operation and the first value of the target symbol to obtain the third sub-information.

[0420] In a possible implementation, the second operation is: performing a summation operation on the status information and a value M, and performing a bit shift operation on a summation result of the summation operation, where the probability information includes quantized probabilities and M is a denominator of the quantized probabilities; and performing a summation operation on a shifted result of the bit shift operation and the first sub-information; and if the result of the summation operation is greater than the second sub-information, using the sum of the result of the summation operation and the third sub-information as the second coded data; or If the result of the summation operation is less than the second sub-information, the result of the summation operation is used as the second coded data. Includes.

[0421] In a possible implementation, when the value M is 256, the first information is stored using 10 bits, the first sub-information is stored using 8 bits, the second sub-information is stored using 7 bits, and the third sub-information is stored using 7 bits, the sum of the first values ​​of the multiple symbols is 128, and the third sub-information is less than 128.

[0422] The present application further provides a data encoding device for use in an asymmetric code system ANS-based encoder, the device comprising: an acquisition module configured to acquire a first symbol, where a sum of a quantized probability corresponding to the first symbol and a quantized probability corresponding to the second symbol is 1, a difference between the quantized probability corresponding to the first symbol and 1 is less than a threshold, and a difference between the quantized probability corresponding to the second symbol and 0 is less than a threshold; and An encoding module: If a value relationship between the status information of the encoder and the value M satisfies a first condition, performing a first operation on the status information and the value M to obtain first encoded data and update the status information to 0; or If the value relationship between the status information of the encoder and the value M does not satisfy the first condition, add 1 to the status information. an encoding module configured to: Includes.

[0423] In a possible implementation, the acquisition module: It is further configured to obtain a second symbol.

[0424] The encoding module is further configured to: use status information of the encoder as the first encoded data, and update the status information to the difference between the values ​​M and one.

[0425] The following describes a data decoding device provided in an embodiment of the present application from the device perspective. Figure 12 is a structural diagram of a data decoding device according to an embodiment of the present application. As shown in Figure 12, the data decoding device 1200 provided in an embodiment of the present application includes: an acquiring module 1201 configured to acquire status information and memory bits of a decoder, where the status information corresponds to a first bit, and the first bit is a currently undecoded bit.

[0426] Please refer to the description of step 901 in the above embodiment for a specific description of the acquisition module 1201. The details will not be described again in this specification.

[0427] The data decoding device 1200 further includes a decoding module 1202 configured to determine first information, second information, and third information corresponding to status information based on a first mapping relationship, where the first information is a target symbol corresponding to the first bit, the target symbol is a decoding result of the first bit, the second information indicates an amount of bits selected from the memory bits, the third information is used to perform a summation operation with the bits selected from the memory bits based on the second information, and the result of the summation operation is used to update the status information, where the updated status information corresponds to the second bit, and the second bit is an undecoded bit after the first bit.

[0428] Please refer to the description of step 902 in the above embodiment for a specific description of the decoding module 1202. The details will not be described again in this specification.

[0429] In a possible implementation, the decryption module: The memory bit is further configured to remove the selected bit from the memory bit to obtain an updated memory bit.

[0430] In a possible implementation, the first information, the second information, or the third information represents an integer value.

[0431] In a possible implementation, the first information in the first mapping relationship is in the following manner: Using x that satisfies C(x) ≤ s < (C(x) + P(x)) as the first information, where C represents the value of the CDF, P represents the value of the PMF, and s represents the status information; or Using x that satisfies C1(x) ≤ s < C1(x) + P1(x) or C2(x) ≤ s < C2(x) + P2(x) as the first information, where C1 represents the third value corresponding to the CDF, P1 represents the first value corresponding to the PMF, C2 represents the fourth value corresponding to the CDF, P2 represents the second value corresponding to the PMF, s represents the status information, and the sum of the first value and the second value is the value of the PMF. is constructed in.

[0432] In a possible implementation, the second information in the first mapping relationship is in the following manner: Using the value of clz(s - C(x) + P(x)) + X as the second information, where clz represents taking the amount of the leftmost bit that is consecutive 0s in the value, and X is a preset fifth value; or Performing a bit shift operation on the value of s - C(x) + P(x) to obtain the third information, where the shift amount of the bit shift operation is obtained based on the second information; or Performing a bit shift operation on the value of s - C(x) + P(x), and subtracting the value M from the operation result of the bit shift operation to obtain the third information, where M is the denominator of the quantization probability, and the shift amount of the bit shift operation is obtained based on the second information; or Using the value of clz(s' - C(x) + P(x)) + X as the second information is constructed in, where clz represents taking the amount of the leftmost bit that is consecutive 0s in the value, X is a preset fifth value, and s' is in the following manner: When C2(x) ≤ s, s' = P1(x) + s - C2(x) + P(x); or when C2(x) > s, s' = s - C1(x) + P(x) It is obtained at.

[0433] In a possible implementation, the third information in the first mapping relationship is in the following manner: performing a bit shift operation on the value of sC(x)+P(x) to obtain third information, where the shift amount of the bit shift operation is obtained based on the second information; or performing a bit shift operation on the value of sC(x)+P(x), and subtracting a value M from the result of the bit shift operation to obtain third information, where M is a denominator of the quantization probability, and the shift amount of the bit shift operation is obtained based on the second information; or performing a bit shift operation on the value of s'-C(x)+P(x) to obtain third information, where the shift amount of the bit shift operation is obtained based on the second information; It is constructed in

[0434] In a possible implementation, the first information, the second information, or the third information is obtained based on probability information, the probability information including a value of a probability mass function PMF, and the value of the PMF is calculated in the following manner: A PMF value is constructed by sequentially determining a value of each of a plurality of symbols, where the plurality of symbols includes a target symbol.

[0435] Once the value of the PMF of the target symbol is determined, the total sum of the remaining PMFs other than the PMF of the determined symbol is multiplied by the probability of the target symbol, and the ratio between the multiplication result and the remaining probability obtained by excluding the determined symbol is calculated, and the PMF of the target symbol is determined based on the relationship between the ratio and a preset value.

[0436] In a possible implementation, the preset value is 1 and the above relation takes on a larger value.

[0437] In a possible implementation, the first information, the second information, or the third information is obtained based on probability information, and the probability information includes a value of a cumulative distribution function CDF, and the value of the CDF is calculated in the following manner: and sequentially determining a CDF value for each symbol in a predetermined order, where the predetermined order is determined based on a relationship between PMF values ​​corresponding to a plurality of symbols, the plurality of symbols including a target symbol; If the probability distribution corresponding to the probability information of the target symbol is a symmetric distribution, the preset order is an alternating order along both sides of the peak point in the symmetric distribution; or When the probability distribution corresponding to the probability information of the target symbol is a discrete distribution, the preset order is specifically a descending order; or When the probability distribution corresponding to the probability information of the target symbol is a discrete distribution, the preset order is specifically an ascending order.

[0438] In a possible implementation, the acquisition module: obtaining an encoding result, wherein the encoding result is obtained by encoding pixel data of the image, and the status information and the memory bit are obtained based on the encoding result; processing the encoding result to obtain distribution characteristics of the pixel data, where the distribution characteristics include a mean or a variance; and determining a first mapping relationship corresponding to the distribution feature from the plurality of mapping relationships based on the distribution feature; The device is further configured to:

[0439] The present application further provides a data decoding device for use in an asymmetric coding system ANS-based decoder, the device comprising: an acquisition module configured to acquire status information of the decoder, where the status information corresponds to the first bit, the first bit being a currently undecoded bit; and A decryption module: determining that the decoding result of the first bit is the second symbol if the status information is a difference between the value M and 1, and updating the status information to the result of reading the value M bits from the memory bit; or determining that the decoding result of the first bit is the first symbol if the status information is not the difference between the values ​​M and 1; if the status information is 0, updating the status information to a sum result of the difference between the values ​​M and 2 and the value of the 1 bit read from the memory bit; or if the status information is not 0, updating the status information to the difference between the status information and 1, where the updated status information corresponds to the second bit, and the second bit is an undecoded bit after the first bit. a decoding module configured to: Includes.

[0440] The following describes an execution device provided in one embodiment of the present application. FIG. 13 is a diagram of the structure of an execution device according to one embodiment of the present application. The execution device 1300 may specifically be a mobile phone, a tablet computer, a notebook computer, an intelligent wearable device, a server, or the like. This is not limited herein. The execution device 1300 implements the functions of the data encoding method and the data decoding method in the embodiments corresponding to FIGS. 6 and 9. Specifically, the execution device 1300 includes a receiver 1301, a transmitter 1302, a processor 1303, and a storage 1304 (there may be one or more processors 1303 in the execution device 1300). The processor 1303 may include an application processor 13031 and a communication processor 13032. In some embodiments of the present application, the receiver 1301, the transmitter 1302, the processor 1303, and the storage 1304 may be connected via a bus or in another manner.

[0441] Storage 1304 may include read-only memory and random access memory to provide instructions and data to processor 1303. A portion of storage 1304 may further include non-volatile random access memory (NVRAM). Storage 1304 stores processor and operating instructions, executable modules or data structures, a subset thereof, or an extended set thereof. The operating instructions may include various operating instructions for implementing various operations.

[0442] The processor 1303 controls the operation of the execution device. In particular applications, the components of the execution device are coupled together through a bus system. In addition to a data bus, the bus system may further include a power bus, a control bus, a status signal bus, and the like. However, for clarity of explanation, the various types of buses in the figures will be referred to as a bus system.

[0443] The methods disclosed in the above embodiments of the present application may be applied to or implemented by the processor 1303. The processor 1303 may be an integrated circuit chip and have signal processing capabilities. In the implementation process, the steps of the above methods may be implemented by using hardware integrated logic circuits in the processor 1303 or by using instructions in the form of software. The processor 1303 may be a processor applicable to AI operations, such as a general-purpose processor, a digital signal processor (DSP), a microprocessor or microcontroller, a vision processing unit (VPU), or a tensor processing unit (TPU), and may further include an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or another programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component. The processor 1303 may implement or execute the methods, steps, and logical block diagrams disclosed in the embodiments of the present application. The general-purpose processor may be a microprocessor, or the processor may be any conventional processor or similar. The steps in the methods disclosed with reference to the embodiments of the present application may be directly executed and completed by a hardware decoding processor, or may be executed and completed by using a combination of hardware and software modules in the decoding processor. The software modules may be located in a storage medium that is mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, an electrically erasable programmable memory, or a register. The storage medium is located in the storage 1304.The processor 1303 reads the information in the storage 1304, and in combination with the hardware of the processor 1303, accomplishes the data encoding method and the data decoding method in the embodiment corresponding to FIG. 6 and FIG.

[0444] The receiver 1301 may be configured to: receive input numeric or textual information and generate signal inputs related to associated setting and function control of the execution device. The transmitter 1302 may be configured to output the numeric or textual information through the first interface. The transmitter 1302 may further be configured to send instructions to the disk group through the first interface to modify data in the disk group. The transmitter 1302 may further include a display device, such as a display.

[0445] An embodiment of the present application further provides a training device. FIG. 14 is a diagram of a server structure according to an embodiment of the present application. Specifically, the server 1400 may be implemented by one or more servers, which may vary greatly due to different configurations or capabilities, and may include one or more central processing units (CPUs) 1414 (e.g., one or more processors), storage 1432, and one or more storage media 1430 (e.g., one or more mass storage devices) that store application programs 1442 or data 1444. The storage 1432 and the storage media 1430 may be temporary or persistent storage. The program stored in the storage media 1430 may include one or more modules (not shown), each of which may include a set of instruction operations for the server. Furthermore, the central processing unit 1414 may be configured to communicate with the storage media 1430 and execute the set of instruction operations in the storage media 1430 on the server 1400.

[0446] The server 1400 may further include one or more power supplies 1426, one or more wired or wireless network interfaces 1450, one or more input / output interfaces 1458, or one or more operating systems 1441, such as Windows Server™, Mac OS X™, Unix™, Linux™, and FreeBSD™.

[0447] In particular, the server may perform the steps associated with model training in the above-described embodiments.

[0448] An embodiment of the present application further provides a computer program product, which, when executed on a computer, enables the computer to perform the data encoding method and the data decoding method in the embodiments corresponding to Figures 6 and 9.

[0449] An embodiment of the present application further provides a computer-readable storage medium, which stores a program used for signal processing, and when the program is executed on a computer, enables the computer to perform the data encoding method and the data decoding method in the embodiments corresponding to Figures 6 and 9.

[0450] The execution device, training device, or terminal device provided in the embodiments of the present application may specifically be a chip. The chip includes a processing unit and a communication unit. The processing unit may be, for example, a processor. The communication unit may be, for example, an input / output interface, a pin, or a circuit. The processing unit may execute computer-executable instructions stored in the storage unit, so that the chip in the execution device executes the data processing method described in the foregoing embodiments, or the chip in the training device executes the data processing method described in the foregoing embodiments. Optionally, the storage unit is a storage unit in the chip, for example, a register or a cache; or the storage unit may be a storage unit within the wireless access device and located outside the chip, for example, a read-only memory (ROM), another type of static storage device capable of storing static information and instructions, a random access memory (RAM), or the like.

[0451] 15 is a diagram of a chip structure according to an embodiment of the present application. The chip may be represented as a neural network processing unit (NPU) 1500. The NPU 1500 is mounted as a coprocessor in a host CPU, and the host CPU assigns tasks to the NPU. The core of the NPU is an arithmetic circuit 1503, and a controller 1504 controls the arithmetic circuit 1503 to extract matrix data in storage and perform multiplication operations.

[0452] The NPU 1500 may implement the data encoding method and the data decoding method in the embodiments corresponding to FIGS. 6 and 9 through mutual cooperation between internal components.

[0453] More specifically, in some implementations, the arithmetic circuitry 1503 in the NPU 1500 includes multiple processing units (processing engines, PEs). In some implementations, the arithmetic circuitry 1503 is a two-dimensional systolic array. Alternatively, the arithmetic circuitry 1503 may be a one-dimensional systolic array or another electronic circuit capable of performing mathematical operations such as multiplication and summation. In some implementations, the arithmetic circuitry 1503 is a general-purpose matrix processor.

[0454] For example, it is assumed that there is an input matrix A, a weight matrix B, and an output matrix C. The arithmetic circuit fetches corresponding data of matrix B from weight storage 1502 and buffers the data on each PE in the arithmetic circuit. The arithmetic circuit obtains the data of matrix A from input storage 1501 and performs a matrix operation with matrix B, thereby obtaining a partial or final result of the matrix, where the result is stored in accumulator 1508.

[0455] Unified storage 1506 is configured to store input data and output data. Weight data is transferred directly to weight storage 1502 by using a Direct Memory Access Controller (DMAC) DMAC 1505. Input data is also transferred to unified storage 1506 through the DMAC.

[0456] The BIU is a bus interface unit, ie, bus interface unit 1510 is configured for interaction between the AXI bus and the DMAC, and between the AXI bus and the Instruction Fetch Buffer (IFB) 1509.

[0457] The Bus Interface Unit 1510 (BIU for short) is used by the instruction fetch buffer 1509 to retrieve instructions from external storage, and is further used by the direct memory access controller 1505 to retrieve the original data of the input matrix A or the weight matrix B from external storage.

[0458] The DMAC is mainly configured to transfer input data in the external storage DDR to the unified storage 1506, transfer weight data to the weight storage 1502, or transfer input data to the input storage 1501.

[0459] The vector calculation unit 1507 includes multiple arithmetic processing units. If required, the vector calculation unit 1507 further processes the output of the arithmetic circuit 1503, for example, performing vector multiplication, vector summation, exponential operation, logarithm operation, or size comparison. The vector calculation unit 1507 is mainly used for non-convolutional / fully connected layer network calculations in neural networks, such as batch normalization, pixel-level summation, and upsampling of feature maps.

[0460] In some implementations, the vector computation unit 1507 can store the processed output vector in the unified storage 1506. For example, the vector computation unit 1507 may apply a linear or nonlinear function to the output of the computation circuit 1503, such as performing linear interpolation on a feature plane extracted by a convolutional layer, or, in another example, accumulating a vector of values ​​to generate an activation value. In some implementations, the vector computation unit 1507 generates a normalized value, a pixel-level summation value, or both a normalized value and a pixel-level summation value. In some implementations, the processed output vector can be used as an activation input to the computation circuit 1503, for example, for use in a subsequent layer in a neural network.

[0461] An instruction fetch buffer 1509 coupled to the controller 1504 is configured to store instructions used by the controller 1504 .

[0462] Unified storage 1506, input storage 1501, weight storage 1502, and instruction fetch buffer 1509 are all on-chip storage. External storage is private to the NPU's hardware architecture.

[0463] Any one of the processors mentioned above may be a general purpose central processing unit, a microprocessor, an ASIC, or one or more integrated circuits for controlling program execution.

[0464] Additionally, it should be noted that the described device embodiment is merely an example. Units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, located in one location, or distributed across multiple network units. To achieve the objectives of the solutions of the embodiments, some or all of these modules may be selected according to actual needs. In addition, in the accompanying drawings of the embodiments of the device provided by the present application, the connection relationships between modules indicate that the modules have communication connections with each other, which may be specifically implemented as one or more communication buses or signal cables.

[0465] Based on the above implementation description, those skilled in the art can clearly understand that the present application can be implemented by software in addition to the necessary general-purpose hardware, or by dedicated hardware including dedicated integrated circuits, dedicated CPUs, dedicated storage, dedicated components, and the like. Generally, any function that can be performed by a computer program can be easily implemented by using corresponding hardware. Moreover, the specific hardware structure used to achieve the same function may be in various forms, such as an analog circuit, a digital circuit, or a dedicated circuit. However, for the present application, in most cases, a software program implementation is a better implementation. Based on such understanding, the technical solution of the present application may essentially, or a part that contributes to the prior art, be implemented in the form of a software product. The computer software product is stored in a readable storage medium, such as a computer floppy disk, a USB flash drive, a removable hard disk, a ROM, a RAM, a magnetic disk, or an optical disk, and includes some instructions for instructing a computer device (which may be a personal computer, a training device, a network device, or the like) to perform the method in the embodiments of the present application.

[0466] All or some of the above embodiments may be implemented using software, hardware, firmware, or any combination thereof. If the above embodiments are implemented using software, all or some of the embodiments may be implemented in the form of a computer program product.

[0467] A computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the procedures or functions of the embodiments of the present application are generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored on a computer-readable storage medium or transmitted from a computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website, computer, training device, or data center to another website, computer, training device, or data center via a wired (e.g., coaxial cable, fiber optic, or digital subscriber line (DSL)) or wireless (e.g., infrared, radio, or microwave) method. The computer-readable storage medium may be any available medium capable of being stored by a computer, or a data storage device, such as a training device or data center, that incorporates one or more available media. The usable medium may be a magnetic medium (e.g., a floppy disk, hard disk, or magnetic tape), an optical medium (e.g., a DVD), a semiconductor medium (e.g., a solid state disk (SSD)), or the like.

Claims

1. 1. A method of encoding data to be applied to an asymmetric code system ANS-based encoder, said method comprising: obtaining a target symbol; obtaining first information and second information corresponding to the target symbol based on a first mapping relationship, wherein the first information and the second information are obtained based on probability information corresponding to the target symbol; obtaining first encoded data through a first operation based on the first information and status information of the encoder; and updating the status information through a second operation based on the second information to obtain second encoded data; wherein the first encoded data and the second encoded data are used to obtain an encoding result of the target symbol, and the first operation and the second operation do not include a division operation.

2. The method of claim 1 , wherein the first information or the second information represents an integer value.

3. The method of claim 1 or 2, wherein the first operation and the second operation do not include a decision operation.

4. The first operation is:

4. The method of claim 1, further comprising: performing a summation operation on the first information and the status information; and performing a bit shift operation on a summation result of the summation operation; and selecting some bits from the status information as the first encoded data, wherein locations of the some bits in the status information are determined based on a shift result of the bit shift operation.

5. The second operation is: performing a summation operation on the status information and a value M, and performing a bit shift operation on a summation result of the summation operation, where the probability information includes quantized probabilities and M is a denominator of the quantized probabilities; and performing a summation operation on a shifted result of the bit shift operation and the second information; or When the status information is initialized to M, performing a bit shift operation on the status information; performing a summation operation on a shift result of the bit shift operation and the second information; and performing a subtraction operation on a summation result of the summation operation and M. The method according to any one of claims 1 to 4, comprising:

6. The probability information includes a value of a probability mass function PMF, the value of the PMF being in the following manner:

6. The method according to claim 1, wherein the PMF value is constructed by sequentially determining a PMF value for each of a plurality of symbols, the plurality of symbols including the target symbol, and when the PMF value of the target symbol is determined, a total value of remaining PMFs other than the PMF of the determined symbol is multiplied by the probability of the target symbol, and a ratio between a multiplication result of the multiplication and a remaining probability obtained by excluding the determined symbol is calculated, and the PMF of the target symbol is determined based on a relationship between the ratio and a preset fifth value.

7. The method of claim 6 , wherein the first value is 1 and the relationship takes a greater value.

8. The probability information includes values ​​of a cumulative distribution function CDF, and the values ​​of the CDF are expressed in the following manner: sequentially determining a CDF value for each symbol in a predetermined order, the predetermined order being determined based on a relationship between PMF values ​​corresponding to the plurality of symbols, the plurality of symbols including the target symbol; When the probability distribution corresponding to the probability information of the target symbol is a symmetric distribution, the preset order is an alternating order along both sides of a peak point in the symmetric distribution; or When the probability distribution corresponding to the probability information of the target symbol is a discrete distribution, the preset order is specifically a descending order; or The method according to any one of claims 1 to 7, wherein when the probability distribution corresponding to the probability information of the target symbol is a discrete distribution, the pre-set order is specifically an ascending order.

9. The target symbol is obtained by transforming pixel data of an image, wherein the data obtained by transforming the pixel data of the image satisfies a preset distribution, and the transformation is further used to obtain distribution characteristics of the pixel data, wherein the distribution characteristics include a mean or a variance; the method includes: determining the first mapping relationship corresponding to the distribution feature from a plurality of mapping relationships based on the distribution feature; The method of any one of claims 1 to 8, further comprising:

10. The plurality of distribution features includes a first distribution feature and a second distribution feature, and an entropy of the first distribution feature is greater than an entropy of the second distribution feature; The method of claim 9 , wherein a value of a denominator of quantization probabilities in the mapping relationship corresponding to the second distribution feature is greater than a value of a denominator of quantization probabilities in the mapping relationship corresponding to the first distribution feature.

11. The first information in the first mapping relationship is in the following manner: performing a summation operation on a preset sixth value and the amount of consecutive zero-numbered leftmost bits in the value of the PMF of the target symbol; and performing a bit shift operation on a summation result of the summation operation, and performing a subtraction operation on the shifted result of the bit shift operation and the shifted result of the bit shift operation performed on the value of the PMF of the target symbol to obtain the first information; or performing a bit shift operation on a summation result of the summation operation; performing a subtraction operation on the shift result of the bit shift operation and the shift result of the bit shift operation performed on the value of the PMF of the target symbol; and performing a summation operation on the operation result of the subtraction operation and the value M to obtain the first information. The method of any one of claims 1 to 10, wherein the probability information comprises the quantized probabilities, and M is the denominator of the quantized probabilities.

12. The second information in the first mapping relationship is in the following manner: performing a subtraction operation on the value of the CDF of the target symbol and the value of the PMF of the target symbol to obtain the second information; or performing a subtraction operation on the value of the CDF of the target symbol and the value of the PMF of the target symbol, and performing a summation operation on a result of the subtraction operation and the value M to obtain the second information. The method of any one of claims 1 to 11, wherein the probability information comprises the quantized probabilities, and M is the denominator of the quantized probabilities.

13. The second information in the first mapping relationship is in the following manner: using a result of the subtraction operation performed on the value of the CDF of the target symbol and the value of the PMF of the target symbol as the second information if the result of the subtraction operation is greater than or equal to zero; or and if a result of the subtraction operation performed on the value of the CDF of the target symbol and the value of the PMF of the target symbol is less than zero, performing a summation operation on the result of the subtraction operation and the value M to obtain the second information. The method of any one of claims 1 to 11, wherein the probability information comprises the quantized probabilities, and M is the denominator of the quantized probabilities.

14. The step of obtaining the first information and the second information corresponding to the target symbol based on the first mapping relationship includes: Obtaining an integer value corresponding to the target symbol based on the first mapping relationship; and recovering the integer value into the first information and the second information through a third operation, wherein the first information and the second information are each integer values; The method according to any one of claims 1 to 13, comprising:

15. The probability information includes PMF information corresponding to each symbol, the PMF information including a first value and a second value; a sum of the first value and the second value is the value of the PMF; the probability information further includes CDF information corresponding to each symbol, the CDF information including a third value and a fourth value; and the third value and the fourth value are expressed in the following manner: sequentially determining a third value corresponding to each symbol in the preset order through accumulation based on the first values ​​of the plurality of symbols; and sequentially determining a fourth value corresponding to each symbol in the predetermined order through accumulation based on the second and third values ​​of the plurality of symbols. The method according to any one of claims 1 to 14, wherein the method is constructed in the following manner.

16. the second information includes first sub-information, second sub-information, and third sub-information; The first sub-information in the first mapping relationship is constructed in the following manner: performing a subtraction operation on a third value of the target symbol and the value of the PMF of the target symbol to obtain the first sub-information; The second sub-information in the first mapping relationship is constructed in the following manner: performing a summation operation on the third value of the target symbol and the first value of the target symbol, and performing a subtraction operation on a result of the summation operation and 1 to obtain the second sub-information; 16. The method of claim 15, wherein the third sub-information in the first mapping relationship is constructed in the following manner: performing a subtraction operation on a fourth value of the target symbol and the third value of the target symbol, and performing a subtraction operation on a result of the subtraction operation and the first value of the target symbol to obtain the third sub-information.

17. The second operation is: performing the summation operation on the status information and the value M, and performing the bit shift operation on the summation result of the summation operation, where the probability information includes the quantization probability and M is the denominator of the quantization probability; and performing a summation operation on the shift result of the bit shift operation and the first sub-information; and if the result of the summation is greater than the second sub-information, using the sum of the result of the summation and the third sub-information as the second encoded data; or If the result of the summation is less than the second sub-information, the result of the summation is used as the second encoded data.

17. The method of claim 16, comprising:

18. 18. The method according to claim 16 or 17, wherein, when the value M is 256, the first information is stored by using 10 bits, the first sub-information is stored by using 8 bits, the second sub-information is stored by using 7 bits, and the third sub-information is stored by using 7 bits, and the sum of the first values ​​of the plurality of symbols is 128 and the third sub-information is less than 128.

19. 1. A method of encoding data to be applied to an asymmetric code system ANS-based encoder, said method comprising: obtaining a first symbol, wherein a sum of a quantized probability corresponding to the first symbol and a quantized probability corresponding to a second symbol is 1, a difference between the quantized probability corresponding to the first symbol and 1 is less than a threshold, and a difference between the quantized probability corresponding to the second symbol and 0 is less than the threshold; and If a value relationship between the status information of the encoder and a value M satisfies a first condition, performing a first operation on the status information and the value M to obtain first encoded data and update the status information to 0; or adding 1 to the status information if a value relationship between the status information of the encoder and a value M does not satisfy a first condition; A method comprising:

20. The method comprises: obtaining the second symbol; and using the status information of the encoder as the first encoded data and updating the status information to the difference between the values ​​M and 1; 20. The method of claim 19 further comprising:

21. 1. A data decoding method applied to an asymmetric coding system ANS-based decoder, said method comprising: obtaining status information and a memory bit of the decoder, wherein the status information corresponds to a first bit, the first bit being a currently undecoded bit; and determining first information, second information, and third information corresponding to the status information based on a first mapping relationship, wherein the first information is a target symbol corresponding to the first bit, the target symbol being a decoding result of the first bit, the second information indicating an amount of bits selected from the memory bits, the third information being used to perform a summation operation with the bits selected from the memory bits based on the third information, and the result of the summation operation being used to update the status information, wherein the updated status information corresponds to a second bit, and the second bit is an undecoded bit after the first bit. A method comprising:

22. The method comprises: removing the selected bits from the memory bits to obtain updated memory bits; 22. The method of claim 21 further comprising:

23. 23. The method of claim 21 or 22, wherein the first information, the second information, or the third information represents an integer value.

24. The first information in the first mapping relationship is in the following manner:

24. The method of claim 21, wherein the first information is constructed using x such that C(x)≦s<(C(x)+P(x)), where C represents a CDF value, P represents a PMF value, and s represents the status information.

25. The first information in the first mapping relationship is in the following manner:

24. The method of claim 21, wherein the first information is constructed using x such that C1(x)≦s<C1(x)+P1(x) or C2(x)≦s<C2(x)+P2(x), wherein C1 represents a third value corresponding to a CDF, P1 represents a first value corresponding to a PMF, C2 represents a fourth value corresponding to the CDF, P2 represents a second value corresponding to the PMF, and s represents the status information, and a sum of the first value and the second value is the value of the PMF.

26. The second information in the first mapping relationship is in the following manner:

26. The method of any one of claims 21 to 25, wherein the second information is constructed using a value of clz(s-C(x)+P(x))+X, where clz represents taking the amount of consecutive leftmost bits that are 0 in the value, and X is a preset fifth value.

27. The second information in the first mapping relationship is in the following manner: A value of clz(s'-C(x)+P(x))+X is constructed using the second information, where clz represents taking the amount of consecutive leftmost bits that are 0 in the value, X is a preset fifth value, and s' is calculated in the following manner: If C2(x)≦s, then s′=P1(x)+s−C2(x)+P(x); or if C2(x)>s, then s′=s−C1(x)+P(x). The method according to any one of claims 21 to 25, wherein the method is obtained in

28. The third information in the first mapping relationship is in the following manner: performing a bit shift operation on the value of s-C(x)+P(x) to obtain the third information, where the shift amount of the bit shift operation is obtained based on the second information; or performing a bit shift operation on the value of s-C(x)+P(x), and subtracting a value M from the result of the bit shift operation to obtain the third information, where M is a denominator of the quantization probability, and the shift amount of the bit shift operation is obtained based on the second information; or performing a bit shift operation on the value of s'-C(x)+P(x) to obtain the third information, wherein a shift amount of the bit shift operation is obtained based on the second information; The method according to any one of claims 21 to 27, wherein the method is constructed in the following manner.

29. The first information, the second information, or the third information is obtained based on probability information; the probability information includes the value of the probability mass function PMF; and the value of the PMF is calculated in the following manner:

29. The method according to claim 21, wherein the method is constructed by sequentially determining a value of a PMF for each of a plurality of symbols, the plurality of symbols including the target symbol, and when the value of the PMF of the target symbol is determined, a total value of the remaining PMFs other than the PMF of the determined symbol is multiplied by the probability of the target symbol, and a ratio between a multiplication result and a remaining probability obtained by excluding the determined symbol is calculated, and the PMF of the target symbol is determined based on a relationship between the ratio and a preset value.

30. The first information, the second information, or the third information is obtained based on the probability information, wherein the probability information includes the value of the cumulative distribution function CDF, and the value of the CDF is calculated in the following manner: sequentially determining a CDF value for each symbol in a predetermined order, the predetermined order being determined based on a relationship between PMF values ​​corresponding to the plurality of symbols, the plurality of symbols including the target symbol; When the probability distribution corresponding to the probability information of the target symbol is a symmetric distribution, the preset order is an alternating order along both sides of a peak point in the symmetric distribution; or When the probability distribution corresponding to the probability information of the target symbol is a discrete distribution, the preset order is specifically a descending order; or The method according to any one of claims 21 to 29, wherein, when the probability distribution corresponding to the probability information of the target symbol is a discrete distribution, the preset order is specifically an ascending order.

31. The method comprises: obtaining an encoding result, wherein the encoding result is obtained by encoding pixel data of an image, and the status information and the memory bit are obtained based on the encoding result; processing the encoding result to obtain distribution characteristics of the pixel data, where the distribution characteristics include a mean or a variance; and determining the first mapping relationship corresponding to the distribution feature from a plurality of mapping relationships based on the distribution feature; The method of any one of claims 21 to 30, further comprising:

32. Determining the first information, the second information, and the third information corresponding to the status information based on the first mapping relationship includes: obtaining an integer value corresponding to the status information based on the first mapping relationship; and restoring the integer value to the first information, the second information, and the third information, wherein the first information, the second information, and the third information are each integer values. The method according to any one of claims 21 to 31, comprising:

33. 1. A data decoding method applied to an asymmetric coding system ANS-based decoder, said method comprising: obtaining status information of the decoder, wherein the status information corresponds to a first bit, the first bit being a currently undecoded bit; and determining that the decoding result of the first bit is a second symbol if the status information is the difference between the value M and 1, and updating the status information to the result of reading the value M bits from a memory bit; or determining that the decoded result of the first bit is a first symbol if the status information is not the difference between the values ​​M and 1; updating the status information to a sum result of the difference between the values ​​M and 2 and the value of 1 bit read from the memory bit if the status information is 0; or updating the status information to a difference between the status information and 1 if the status information is not 0, wherein the updated status information corresponds to a second bit, the second bit being an undecoded bit after the first bit. A method comprising:

34. 1. A data encoding apparatus for use in an asymmetric code system ANS-based encoder, the apparatus comprising: an acquisition module configured to acquire a target symbol; and An encoding module: obtaining first information and second information corresponding to the target symbol based on a first mapping relationship, where the first information and the second information are obtained based on probability information corresponding to the target symbol; obtaining first encoded data through a first operation based on the first information and status information of the encoder; and updating the status information through a second operation based on the second information to obtain second encoded data; an encoding module configured to: wherein the first encoded data and the second encoded data are used to obtain an encoding result of the target symbol, and the first operation and the second operation do not include a division operation.

35. 35. The apparatus of claim 34, wherein the first information or the second information represents an integer value.

36. 36. The apparatus of claim 34 or 35, wherein the first operation and the second operation do not include a decision operation.

37. The first operation is: performing a summation operation on the first information and the status information, and performing a bit shift operation on a summation result of the summation operation; and selecting some bits from the status information as the first encoded data; and wherein locations of the number of bits in the status information are determined based on a shift result of the bit shift operation.

38. The second operation is: performing a summation operation on the status information and a value M, and performing a bit shift operation on a summation result of the summation operation, where the probability information includes quantized probabilities, and M is a denominator of the quantized probabilities; and performing a summation operation on the shift result of the bit shift operation and the second information; 38. The apparatus of any one of claims 34 to 37, comprising:

39. The probability information includes a value of a probability mass function PMF, the value of the PMF being in the following manner:

39. The apparatus of claim 34, wherein the PMF is constructed by sequentially determining a value of a PMF for each of a plurality of symbols, the plurality of symbols including the target symbol, and when a value of the PMF of the target symbol is determined, a total value of remaining PMFs other than the PMF of the determined symbol is multiplied by a probability of the target symbol, and a ratio between a multiplication result and a remaining probability obtained by excluding the determined symbol is calculated, and the PMF of the target symbol is determined based on a relationship between the ratio and a preset fifth value.

40. 40. The apparatus of claim 39, wherein the fifth value is 1 and the relationship is greater than or equal to the fifth value.

41. The probability information includes values ​​of a cumulative distribution function CDF, and the values ​​of the CDF are expressed in the following manner: sequentially determining a CDF value for each symbol in a predetermined order, the predetermined order being determined based on a relationship between PMF values ​​corresponding to the plurality of symbols, the plurality of symbols including the target symbol; When the probability distribution corresponding to the probability information of the target symbol is a symmetric distribution, the preset order is an alternating order along both sides of a peak point in the symmetric distribution; or When the probability distribution corresponding to the probability information of the target symbol is a discrete distribution, the preset order is specifically a descending order; or The apparatus according to any one of claims 34 to 40, wherein, when the probability distribution corresponding to the probability information of the target symbol is a discrete distribution, the preset order is specifically an ascending order.

42. The target symbol is obtained by transforming pixel data of an image, where the data obtained by transforming the pixel data of the image satisfies a preset distribution, and the transformation is further used to obtain distribution characteristics of the pixel data, where the distribution characteristics include a mean or a variance; the obtaining module: The apparatus according to any one of claims 34 to 41, further configured to determine the first mapping relationship corresponding to the distribution feature from a plurality of mapping relationships based on the distribution feature.

43. The plurality of distribution features includes a first distribution feature and a second distribution feature, and an entropy of the first distribution feature is greater than an entropy of the second distribution feature; 43. The apparatus of claim 42, wherein a value of a denominator of quantized probabilities in a mapping relationship corresponding to the second distribution feature is greater than a value of a denominator of quantized probabilities in a mapping relationship corresponding to the first distribution feature.

44. The first information in the first mapping relationship is in the following manner: performing a summation operation on a preset sixth value and the amount of consecutive zero-numbered leftmost bits in the value of the PMF of the target symbol; and performing a bit shift operation on a summation result of the summation operation, and performing a subtraction operation on the shifted result of the bit shift operation and the shifted result of the bit shift operation performed on the value of the PMF of the target symbol to obtain the first information; or performing a bit shift operation on a summation result of the summation operation; performing a subtraction operation on the shift result of the bit shift operation and the shift result of the bit shift operation performed on the value of the PMF of the target symbol; and performing a summation operation on the operation result of the subtraction operation and the value M to obtain the first information.

44. The apparatus of claim 34, wherein the probability information comprises the quantized probabilities, and M is the denominator of the quantized probabilities.

45. The second information in the first mapping relationship is in the following manner: performing a subtraction operation on the value of the CDF of the target symbol and the value of the PMF of the target symbol to obtain the second information; or performing a subtraction operation on the value of the CDF of the target symbol and the value of the PMF of the target symbol, and performing a summation operation on a result of the subtraction operation and the value M to obtain the second information.

45. The apparatus of claim 34, wherein the probability information comprises the quantized probabilities, and M is the denominator of the quantized probabilities.

46. The second information in the first mapping relationship is in the following manner: using a result of the subtraction operation performed on the value of the CDF of the target symbol and the value of the PMF of the target symbol as the second information if the result of the subtraction operation is greater than or equal to zero; or and if a result of the subtraction operation performed on the value of the CDF of the target symbol and the value of the PMF of the target symbol is less than zero, performing a summation operation on the result of the subtraction operation and the value M to obtain the second information.

45. The apparatus of claim 34, wherein the probability information comprises the quantized probabilities, and M is the denominator of the quantized probabilities.

47. The encoding module: Obtaining an integer value corresponding to the target symbol based on the first mapping relationship; and recovering the integer value into the first information and the second information through a third operation, wherein the first information and the second information are each integer values; 47. Apparatus according to any one of claims 34 to 46, specifically adapted to:

48. The probability information includes PMF information corresponding to each symbol, the PMF information including a first value and a second value; a sum of the first value and the second value is the value of the PMF; the probability information further includes CDF information corresponding to each symbol, the CDF information including a third value and a fourth value; and the third value and the fourth value are expressed in the following manner: sequentially determining a third value corresponding to each symbol in the preset order through accumulation based on the first values ​​of the plurality of symbols; and sequentially determining a fourth value corresponding to each symbol in the predetermined order through accumulation based on the second and third values ​​of the plurality of symbols.

48. The apparatus of any one of claims 34 to 47, constructed in

49. the second information includes first sub-information, second sub-information, and third sub-information; The first sub-information in the first mapping relationship is constructed in the following manner: performing a subtraction operation on a third value of the target symbol and the value of the PMF of the target symbol to obtain the first sub-information; The second sub-information in the first mapping relationship is constructed in the following manner: performing a summation operation on the third value of the target symbol and the first value of the target symbol, and performing a subtraction operation on a result of the summation operation and 1 to obtain the second sub-information; 49. The apparatus of claim 48, wherein the third sub-information in the first mapping relationship is constructed in the following manner: performing a subtraction operation on a fourth value of the target symbol and the third value of the target symbol, and performing a subtraction operation on a result of the subtraction operation and the first value of the target symbol to obtain the third sub-information.

50. The second operation is: performing the summation operation on the status information and the value M, and performing the bit shift operation on the summation result of the summation operation, where the probability information includes the quantization probability and M is the denominator of the quantization probability; and performing a summation operation on the shift result of the bit shift operation and the first sub-information; and if the result of the summation is greater than the second sub-information, using the sum of the result of the summation and the third sub-information as the second encoded data; or If the result of the summation is less than the second sub-information, the result of the summation is used as the second encoded data.

50. The apparatus of claim 49, comprising:

51. 51. The apparatus according to claim 49 or 50, wherein when the value M is 256, the first information is stored by using 10 bits, the first sub-information is stored by using 8 bits, the second sub-information is stored by using 7 bits, and the third sub-information is stored by using 7 bits, and the sum of the first values ​​of the plurality of symbols is 128 and the third sub-information is less than 128.

52. 1. A data encoding apparatus for use in an asymmetric code system ANS-based encoder, the apparatus comprising: an acquisition module configured to acquire a first symbol, wherein a sum of a quantized probability corresponding to the first symbol and a quantized probability corresponding to a second symbol is 1, a difference between the quantized probability corresponding to the first symbol and 1 is less than a threshold, and a difference between the quantized probability corresponding to the second symbol and 0 is less than the threshold; and An encoding module: If a value relationship between the encoder status information and a value M satisfies a first condition, performing a first operation on the encoder status information and the value M to obtain first encoded data and update the encoder status information to 0; or adding 1 to the status information of the encoder if a value relationship between the status information of the encoder and a value M does not satisfy a first condition; an encoding module configured to: An apparatus comprising:

53. The acquisition module: further configured to obtain the second symbol; 53. The apparatus of claim 52, wherein the encoding module is further configured to: use the status information of the encoder as the first encoded data; and update the status information to the difference between the values ​​M and 1.

54. 1. A data decoding apparatus for use in an asymmetric coding system ANS-based decoder, the apparatus comprising: an acquisition module configured to acquire status information and memory bits of the decoder, where the status information corresponds to a first bit, and the first bit is a currently undecoded bit; and a decoding module configured to determine first information, second information, and third information corresponding to the status information based on a first mapping relationship, wherein the first information is a target symbol corresponding to the first bit, the target symbol being a decoding result of the first bit, the second information indicating an amount of bits selected from the memory bits, the third information being used to perform a summation operation with bits selected from the memory bits based on the third information, and the result of the summation operation being used to update the status information, wherein the updated status information corresponds to a second bit, the second bit being an undecoded bit after the first bit. An apparatus comprising:

55. The decoding module:

55. The apparatus of claim 54, further configured to remove the selected bit from the memory bits to obtain updated memory bits.

56. 56. The apparatus of claim 54 or 55, wherein the first information, the second information, or the third information represents an integer value.

57. The first information in the first mapping relationship is in the following manner: Using x satisfying C(x)≦s<(C(x)+P(x)) as the first information, where C represents a value of the CDF, P represents a value of the PMF, and s represents the status information; or using x satisfying C1(x)≦s<C1(x)+P1(x) or C2(x)≦s<C2(x)+P2(x) as the first information, where C1 represents a third value corresponding to a CDF, P1 represents a first value corresponding to a PMF, C2 represents a fourth value corresponding to the CDF, P2 represents a second value corresponding to the PMF, s represents the status information, and the sum of the first value and the second value is the value of the PMF; 57. The apparatus of any one of claims 54 to 56, constructed in

58. The second information in the first mapping relationship is in the following manner: Using the second information, a value of clz(s-C(x)+P(x))+X, where clz represents taking the amount of consecutive leftmost zero bits in the value, and X is a preset fifth value; or performing a bit shift operation on the value of s-C(x)+P(x) to obtain the third information, where the shift amount of the bit shift operation is obtained based on the second information; or performing a bit shift operation on the value of s-C(x)+P(x), and subtracting a value M from the result of the bit shift operation to obtain the third information, where M is a denominator of the quantization probability, and the shift amount of the bit shift operation is obtained based on the second information; or The value of clz(s'-C(x)+P(x))+X is used as the second information. where clz represents taking the amount of consecutive leftmost bits that are 0 in the value, X is a preset fifth value, and s′ is constructed in the following manner: If C2(x)≦s, then s′=P1(x)+s−C2(x)+P(x); or if C2(x)>s, then s′=s−C1(x)+P(x). obtained in 58. Apparatus according to any one of claims 54 to 57.

59. The third information in the first mapping relationship is in the following manner: performing the bit shift operation on the value of s-C(x)+P(x) to obtain the third information, wherein the shift amount of the bit shift operation is obtained based on the second information; or performing the bit shift operation on the value of s-C(x)+P(x), and subtracting the value M from the result of the bit shift operation to obtain the third information, where M is the denominator of the quantization probability and the shift amount of the bit shift operation is obtained based on the second information; or performing a bit shift operation on the value of s'-C(x)+P(x) to obtain the third information, wherein a shift amount of the bit shift operation is obtained based on the second information; 59. The apparatus of any one of claims 54 to 58, constructed in

60. The first information, the second information, or the third information is obtained based on probability information; the probability information includes the value of the probability mass function PMF; and the value of the PMF is calculated in the following manner:

60. The apparatus of any one of claims 54 to 59, wherein the PMF value is constructed by sequentially determining a PMF value for each of a plurality of symbols, the plurality of symbols including the target symbol, and once the PMF value of the target symbol is determined, a total value of remaining PMFs other than the PMF of the determined symbol is multiplied by the probability of the target symbol, and a ratio between a multiplication result and a remaining probability obtained by excluding the determined symbol is calculated, and the PMF of the target symbol is determined based on a relationship between the ratio and a preset value.

61. 61. The apparatus of claim 60, wherein the preset value is 1 and the relationship takes a greater value.

62. The first information, the second information, or the third information is obtained based on the probability information, wherein the probability information includes the value of the cumulative distribution function CDF, and the value of the CDF is calculated in the following manner: sequentially determining a CDF value for each symbol in a predetermined order, the predetermined order being determined based on a relationship between PMF values ​​corresponding to the plurality of symbols, the plurality of symbols including the target symbol; When the probability distribution corresponding to the probability information of the target symbol is a symmetric distribution, the preset order is an alternating order along both sides of a peak point in the symmetric distribution; or When the probability distribution corresponding to the probability information of the target symbol is a discrete distribution, the preset order is specifically a descending order; or The apparatus according to any one of claims 54 to 61, wherein when the probability distribution corresponding to the probability information of the target symbol is a discrete distribution, the preset order is specifically an ascending order.

63. The acquisition module: obtaining an encoding result, wherein the encoding result is obtained by encoding pixel data of an image, and the status information and the memory bit are obtained based on the encoding result; processing the encoding result to obtain distribution characteristics of the pixel data, where the distribution characteristics include a mean or a variance; and determining the first mapping relationship corresponding to the distribution feature from a plurality of mapping relationships based on the distribution feature; 63. The apparatus of any one of claims 54 to 62, further configured to:

64. The decoding module: Obtaining an integer value corresponding to the status information based on the first mapping relationship; and restoring the integer value to the first information, the second information, and the third information, wherein the first information, the second information, and the third information are each integer values.

64. Apparatus according to any one of claims 54 to 63, specifically adapted to:

65. 1. A data decoding apparatus for use in an asymmetric coding system ANS-based decoder, the apparatus comprising: an acquisition module configured to acquire status information of the decoder, where the status information corresponds to a first bit, the first bit being a current undecoded bit; and A decoding module: determining that the decoding result of the first bit is a second symbol if the status information is the difference between the value M and 1, and updating the status information to the result of reading the value M bits from a memory bit; or determining that the decoded result of the first bit is a first symbol if the status information is not the difference between the values ​​M and 1; updating the status information to a sum result of the difference between the values ​​M and 2 and the value of 1 bit read from the memory bit if the status information is 0; or updating the status information to a difference between the status information and 1 if the status information is not 0, wherein the updated status information corresponds to a second bit, the second bit being an undecoded bit after the first bit. a decoding module configured to: An apparatus comprising:

66. 34. A computing device comprising a storage and a processor, the storage storing code, the processor configured to: retrieve the code; and perform the method of any one of claims 1 to 33.

67. 34. A computer storage medium having stored thereon one or more instructions that, when executed by one or more computers, enable the one or more computers to perform the method of any one of claims 1 to 33.

68. A computer program product comprising code, which when executed implements the method of any one of claims 1 to 33.