Image encoding / decoding method, device, electronic device, and storage medium

The image encoding/decoding method addresses inefficiencies in video data processing by predicting pixels in a target order for parallel processing and optimizing bit usage, resulting in enhanced decoding efficiency and reduced resource consumption.

JP7810821B2Active Publication Date: 2026-02-03HANGZHOU HIKVISION DIGITAL TECHNOLOGY CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
JP2024557706
Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
Priority Date
2022-03-29
Filing Date
2023-03-28
Publication Date
2026-02-03
Estimated Expiration
2043-03-28

AI Technical Summary

Technical Problem

Existing video encoding/decoding technologies face inefficiencies in reducing redundant information and optimizing data representation, leading to suboptimal storage and transmission bandwidth usage.

Method used

An image encoding/decoding method that predicts pixels in a target prediction order, allowing parallel processing and reducing the need for caching residual values, while utilizing variable code length encoding and inverse quantization techniques to minimize bit usage.

Benefits of technology

Improves decoding efficiency by reducing cache space and computational resources, enhancing prediction accuracy, and optimizing bit usage, thereby improving overall image encoding/decoding performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007810821000018
    Figure 0007810821000018
  • Figure 0007810821000019
    Figure 0007810821000019
  • Figure 0007810821000020
    Figure 0007810821000020
Patent Text Reader

Abstract

An image coding / decoding method, device, electronic device, and storage medium relate to the technical field of image coding / decoding. The image decoding method includes: analyzing a code stream of a block to be decoded to determine a target prediction mode for predicting pixels in the block to be decoded; determining a target prediction order corresponding to the target prediction mode based on the target prediction mode; predicting each pixel in the block to be decoded in the target prediction order according to the target prediction mode; and reconstructing each pixel based on the predicted value of each pixel to obtain a reconstructed block of the block to be decoded. The method can improve the efficiency of image coding.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical Field]

[0001] This application claims priority from Chinese Patent Application No. 202210320915.5, filed with the China Patent Office on March 29, 2022, for the invention entitled "Image encoding / decoding method, device, electronic device and storage medium," the entire contents of which are incorporated herein by reference.

[0002] The present application relates to the field of image encoding / decoding technology, and in particular to an image encoding / decoding method, device, electronic device, and storage medium. [Background technology]

[0003] A complete image in a video is usually called a "frame," and a video composed of multiple frames in time sequence is called a video sequence. A video sequence contains a range of redundant information, including spatial redundancy, temporal redundancy, visual redundancy, information entropy redundancy, structural redundancy, knowledge redundancy, and importance redundancy. To eliminate as much redundant information as possible in a video sequence and reduce the amount of data representing the video, video coding techniques have been proposed to reduce storage space and transmission bandwidth. Video coding techniques are also known as video compression techniques.

[0004] With the development of technology, video data collection has become more and more convenient, and the volume of collected video data has also become larger and larger. Therefore, how to effectively encode and decode video data has become a problem that needs to be solved. Summary of the Invention

[0005] The present application provides an image encoding / decoding method, device, electronic device, and storage medium, and the image encoding / decoding method can improve the efficiency of image encoding / decoding.

[0006] In order to achieve the above object, the present application provides the following technical means. In a first aspect, the present application provides an image decoding method, the method including: analyzing a code stream of a block to be decoded to determine a target prediction mode for predicting pixels in the block to be decoded; determining a target prediction order corresponding to the target prediction mode based on the target prediction mode; predicting each pixel in the block to be decoded in the target prediction order according to the target prediction mode; and reconstructing each pixel based on the predicted value of each pixel to obtain a reconstructed block of the block to be decoded.

[0007] According to the image decoding method provided by the present application, when a pixel in a block to be decoded is predicted in a target prediction mode, the decoding side predicts the pixel in the block to be decoded in a target prediction order corresponding to the target prediction mode. During this process, when the decoding side predicts any pixel of the block to be decoded, the pixel for predicting the pixel has already been reconstructed. Therefore, the image decoding method provided by the present application predicts each pixel in the block to be decoded in a target prediction order according to the target prediction mode, and can predict some pixels in the block to be decoded in parallel, thereby improving prediction efficiency for the pixels in the block to be decoded. When the decoding side re-obtains a reconstructed value based on a predicted value and a residual value, there is no need to cache the residual value. Therefore, the decoding method provided by the embodiment of the present application not only saves cache space for caching residual values, but also improves decoding efficiency.

[0008] In one possible design form, when predicting any pixel in a block to be decoded in the target prediction order, the pixel for predicting that pixel has already been reconstructed. By predicting a pixel using the reconstructed pixel, the pixel used for prediction during the decoding process can be matched with the pixel used for prediction during the encoding process, thereby reducing the decoding error, making the predicted value of the pixel during the decoding process more accurate, and improving the decoding accuracy.

[0009] In another possible design, when the target prediction mode indicates that each pixel in the block to be decoded is predicted dot-by-dot in a target prediction order, predicting each pixel in the block to be decoded in the target prediction order in accordance with the target prediction mode includes predicting each pixel in the block to be decoded dot-by-dot along a direction indicated by the target prediction order in accordance with the target prediction mode, where the target prediction order is the first prediction order if the target prediction mode is a first target prediction mode, and the target prediction order is the second prediction order if the target prediction mode is a second target prediction mode, and the first prediction order and the second prediction order are different.

[0010] In other words, different prediction modes correspond to different prediction orders.In this way, when encoding on the encoding side, by selecting appropriate prediction orders for different prediction modes, the difference between the pixels in the encoding target block and the predicted value can be reduced, so that the encoding target block can be encoded with fewer bits, and accordingly, the bits to be decoded on the decoding side can be reduced, and the decoding efficiency can be improved.Therefore, the decoding method provided by this possible design can further improve the decoding efficiency of images.

[0011] In another possible design, for a block to be decoded having a first size, the target prediction mode predicts the block to be decoded in a third prediction order, and for a block to be decoded having a second size, the target prediction mode predicts the block to be decoded in a fourth prediction order, where the third prediction order is different from the fourth prediction order.

[0012] In other words, when the size of the block to be decoded is different, if the pixels in the block to be decoded are predicted using the same prediction mode, the prediction order may be different.In this way, when encoding on the encoding side, by selecting an appropriate prediction order according to the size of the block to be encoded, the difference between the pixels in the block to be encoded and the predicted value can be reduced, so that the block to be encoded can be encoded with fewer bits, and accordingly, the bits to be decoded on the decoding side can be reduced, and the decoding efficiency can be improved.Therefore, the decoding method provided by this possible design can further improve the image decoding efficiency.

[0013] In one possible design form, when the target prediction mode indicates that pixels in each sub-block of the block to be decoded are to be predicted sequentially in units of sub-blocks of a preset size in the block to be decoded, predicting each pixel in the block to be decoded in a target prediction order in accordance with the target prediction mode includes sequentially predicting pixels in each sub-block of the block to be decoded in a direction indicated by the target prediction order in accordance with the target prediction mode.

[0014] In another possible design form, the target prediction mode includes a prediction mode for each sub-block in the block to be decoded, and for a first sub-block in the block to be decoded, if the first sub-block includes a first pixel and a second pixel, the prediction mode of the first sub-block is used to predict the first pixel and the second pixel in parallel based on reconstructed pixels surrounding the first sub-block.

[0015] According to the two possible design forms, when predicting a sub-block, the decoding side can predict multiple pixels in the sub-block in parallel based on the reconstructed pixels around the sub-block, that is, such a prediction mode can further improve the prediction efficiency of the decoding side for the block to be decoded. Because the decoding side does not need to cache the residual value when obtaining the reconstructed value based on the predicted value and the residual value, the decoding method provided by the two possible design forms further saves cache space and improves decoding efficiency.

[0016] In another possible design form, reconstructing each pixel based on the predicted value of each pixel to obtain a reconstructed block of the block to be decoded includes: inverse quantizing a first residual block of the block to be decoded, which is obtained by analyzing the code stream of the block to be decoded, based on an inverse quantization parameter of each pixel in the block to be decoded and an inverse quantization preset array obtained by analyzing the code stream of the block to be decoded, to obtain a second residual block; and reconstructing each pixel based on the predicted value of each pixel and the second residual block to obtain a reconstructed block.

[0017] This possible design can perform inverse quantization based on a preset inverse quantization array, thereby reducing the number of multiplications during the inverse quantization process. Because multiplication operations take time, reducing the number of multiplication operations can improve the calculation efficiency of the inverse quantization process, that is, can efficiently realize the inverse quantization of the first residual block of the block to be decoded, so the decoding method provided by this possible design can further improve the decoding efficiency of images.

[0018] In one possible design form, analyzing the code stream of the block to be decoded includes analyzing the code stream of the block to be decoded using a variable code length decoding scheme to obtain a coding code length (CL) for encoding each value in the residual block corresponding to the block to be decoded and a first residual block.

[0019] According to this possible design, the residual block and CL of the block to be decoded are coded with fewer bits on the coding side, so that the corresponding bits to be decoded on the decoding side are reduced, thereby improving the decoding efficiency. Therefore, the decoding method provided by this possible design can further improve the decoding efficiency of images.

[0020] In a second aspect, the present application provides an image encoding method, the method including: determining a target prediction mode for a block to be encoded and determining a target prediction order corresponding to the target prediction mode; predicting each pixel in the block to be encoded in the target prediction order according to the target prediction mode; determining a residual block of the block to be encoded based on the predicted value of each pixel; and encoding the residual block in the target prediction order to obtain a codestream of the block to be encoded.

[0021] According to the image coding method provided by the present application, when predicting pixels in a block to be coded in a target prediction mode, the coding side predicts the pixels in the block to be coded in a target prediction order corresponding to the target prediction mode. During this process, when the coding side predicts a pixel in the block to be coded, the pixel for predicting the pixel has already been reconstructed. Therefore, the image coding method provided by the present application predicts each pixel in the block to be coded in a target prediction order according to the target prediction mode, and can predict some pixels in the block to be coded in parallel, thereby improving prediction efficiency for the pixels in the block to be coded. Since the coding side does not need to cache the residual value when re-obtaining the reconstructed value based on the predicted value and the residual value, the coding method provided by the present application not only saves cache space for caching the residual value, but also improves coding efficiency.

[0022] In one possible design form, when any pixel in the current block to be coded is predicted in the target prediction order, the pixels for predicting that pixel have already been reconstructed.

[0023] In another possible design form, when the target prediction mode indicates that each pixel in the current block to be encoded is predicted dot-by-dot in a target prediction order, predicting each pixel in the current block to be encoded in the target prediction order according to the target prediction mode includes predicting each pixel in the current block to be encoded dot-by-dot along a direction indicated by the target prediction order according to the target prediction mode. Here, if the target prediction mode is a first target prediction mode, the target prediction order is a first prediction order, and if the target prediction mode is a second target prediction mode, the target prediction order is a second prediction order, which are different from the first prediction order and the second prediction order. In other words, different prediction modes correspond to different prediction orders.

[0024] In another possible design, for a current block to be coded having a first size, the target prediction mode predicts the current block to be coded using a third prediction order. For a current block to be coded having a second size, the target prediction mode predicts the current block to be coded using a fourth prediction order, where the third prediction order is different from the fourth prediction order. In other words, when the current block to be coded has a different size, the prediction order may be different when pixels in the current block to be coded are predicted using the same prediction mode.

[0025] In another possible design form, when the target prediction mode indicates that pixels of each sub-block in the block to be coded are to be predicted sequentially in units of sub-blocks of a preset size in the block to be coded, predicting each pixel in the block to be coded in a target prediction order in accordance with the target prediction mode includes sequentially predicting pixels of each sub-block in the block to be coded in accordance with the target prediction mode along a direction indicated by the target prediction order.

[0026] In another possible design form, the target prediction mode includes a prediction mode for each sub-block in the block to be coded, and for a first sub-block in the block to be coded, if the first sub-block includes a first pixel and a second pixel, the prediction mode of the first sub-block is used to predict the first pixel and the second pixel in parallel based on reconstructed pixels surrounding the first sub-block.

[0027] In another possible design, before encoding the residual block in the target prediction order to obtain a codestream of the block to be encoded, the method includes determining a quantization parameter QP for each pixel in the block to be encoded. The residual block to be encoded is quantized based on the QP of each pixel and the quantization preset array to obtain a first residual block. In this way, encoding the residual block in the target prediction order to obtain a codestream of the block to be encoded includes encoding the first residual block in the target prediction order to obtain a codestream of the block to be encoded.

[0028] In another possible design form, encoding the first residual block in the target prediction order to obtain a codestream of the block to be encoded comprises encoding the first residual block in the target prediction order using a coding scheme with a variable code length to obtain a codestream of the block to be encoded.

[0029] Since the image encoding method provided by the second aspect and any of its possible design forms corresponds to the image decoding method provided by the first aspect and any of its possible design forms, it is understood that the beneficial effects of the technical means provided by the second aspect and any of its possible design forms refer to the description of the beneficial effects of the corresponding method in the first aspect, and redundant description will be omitted here.

[0030] In a third aspect, the present application provides an image decoding method, the method including: analyzing a code stream of a block to be decoded, and obtaining an inverse quantization parameter for each pixel in the block to be decoded and a first residual block of the block to be decoded; inverse quantizing the first residual block based on a QP indicated by the inverse quantization parameter for each pixel and an inverse quantization preset array, to obtain a second residual block; and reconstructing the block to be decoded based on the second residual block to obtain a reconstructed block.

[0031] In the image decoding method provided by the present application, the quantization processing method implemented based on the quantization preset array provided by the present application reduces the number of multiplication operations in the quantization process. Because multiplication operations occupy a large amount of computational resources, reducing the number of multiplication operations can reduce the computational resources occupied in the quantization process, thereby significantly saving computational resources on the encoding side. In addition, because the calculation speed of multiplication operations is slow, the quantization processing process in this image decoding method is significantly more efficient than the prior art, and the image decoding efficiency of this image decoding method is also significantly improved.

[0032] In one possible design, analyzing the code stream of the block to be decoded and obtaining an inverse quantization parameter for each pixel in the block to be decoded and a first residual block of the block to be decoded includes: determining, based on the code stream of the block to be decoded, a target prediction mode for predicting pixels in the block to be decoded and an inverse quantization parameter for each pixel in the block to be decoded; determining, based on the target prediction mode, a residual scanning order corresponding to the target prediction mode; and analyzing the code stream of the block to be decoded based on the residual scanning order to obtain the first residual block. Wherein, if the target prediction mode is the first target prediction mode, the residual scanning order is the first scanning order; and if the target prediction mode is the second target prediction mode, the residual scanning order is the second scanning order, and the first scanning order and the second scanning order are different. In other words, different prediction modes correspond to different residual scanning orders.

[0033] In another possible design, for a block to be decoded having a first size, a third scan order is used to analyze the code stream of the block to be decoded in the target prediction mode. For a block to be decoded having a second size, a fourth scan order is used to analyze the code stream of the block to be decoded in the target prediction mode, where the third scan order is different from the fourth scan order. In other words, when the sizes of the blocks to be decoded are different, if the same prediction mode is used to predict pixels in the blocks to be decoded, the residual scan order for analyzing the code stream of the blocks to be decoded may be different.

[0034] Based on these two possible design forms, when analyzing based on the residual scanning order to obtain the residual block to be decoded, if the predicted block of the block to be decoded is predicted in the same target prediction order as the residual scanning order, the efficiency of reconstructing the reconstructed block of the block to be decoded based on the residual block and the predicted block can be improved, that is, these two possible design forms can further improve the decoding efficiency of the image.In addition, when encoding, the encoding side can select a scanning order suitable for the target prediction mode, so that the residual block can be coded with fewer bits when coding, that is, the block to be coded is coded with fewer bits, and accordingly, the decoding side needs to decode fewer bits, and the decoding efficiency is improved.Therefore, the decoding method provided by these possible design forms can further improve the decoding efficiency of the image.

[0035] In another possible design form, in the above inverse quantization preset array, the interval between two adjacent numbers in the 1st to nth numbers is 1, the interval between two adjacent numbers in the n+1st to n+mth numbers is 2, and the interval between two adjacent numbers in the n+k*m+1st to n+k*m+mth numbers is 2. k+1 where n and m are integers greater than 1, and k is a positive integer.

[0036] In another possible design form, dequantizing the first residual block based on the QP of each pixel and the quantization preset array to obtain the second residual block includes: determining an amplification parameter corresponding to each pixel in the dequantization preset array based on the QP of each pixel; and performing an inverse quantization operation on the first residual block based on the amplification parameter corresponding to each pixel to obtain the second residual block.

[0037] In another possible design form, the step of inversely quantizing the first residual block based on the QP of each pixel and the quantization preset array to obtain the second residual block includes: determining an amplification parameter and a displacement parameter corresponding to each pixel based on the QP of each pixel and the quantization preset array; and performing an inverse quantization operation on the first residual block based on the amplification parameter and the displacement parameter corresponding to each pixel to obtain the second residual block, where the value of the amplification parameter corresponding to each pixel is the value corresponding to the QP of each pixel and a logical product of 7 in the inverse quantization preset array, and the value of the displacement parameter corresponding to each pixel is the value corresponding to 7 and the QP of each pixel. 3 The difference between the quotient obtained by dividing by

[0038] According to the above three possible design modes, the number of multiplication operations in the inverse quantization process can be further reduced based on a pre-defined inverse quantization preset array. Because multiplication operations occupy a large amount of computational resources, reducing the number of multiplication operations can reduce the computational resources occupied in the inverse quantization process. In other words, the inverse quantization processing method implemented based on the quantization preset array provided by the present application can significantly save computational resources on the decoding side. In addition, because the calculation speed of multiplication operations is slow, the efficiency of the inverse quantization processing process in this image decoding method is significantly improved compared to the prior art. Therefore, the decoding method provided by these possible design modes can further improve the efficiency of image decoding.

[0039] In another possible design form, reconstructing the block to be decoded based on the second residual block to obtain a reconstructed block includes inversely transforming the second residual block to reconstruct a residual value block of the block to be decoded, and reconstructing the block to be decoded based on the residual value block to obtain a reconstructed block.

[0040] In another possible design form, reconstructing the block to be decoded based on the second residual block includes predicting each pixel in the block to be decoded in a target prediction order corresponding to the target prediction mode according to a target prediction mode, and reconstructing the block to be decoded based on the predicted value of each pixel and the second residual block to obtain a reconstructed block.

[0041] As can be seen from the above, predicting the block to be decoded based on the target prediction mode provided by the present application can improve prediction efficiency, and therefore this possible design form can further improve the image decoding efficiency.

[0042] In another possible design, analyzing the code stream of the block to be decoded includes analyzing the code stream of the block to be decoded using a variable code length decoding scheme to obtain a coding code length CL for encoding each value in the residual block corresponding to the block to be decoded and a first residual block.

[0043] According to this possible design, the residual block and CL of the block to be decoded can be coded by the coding side with fewer bits, so that the corresponding bits to be decoded by the decoding side can be reduced, and the decoding efficiency can be improved. Therefore, the decoding method provided by this possible design can further improve the decoding efficiency of images.

[0044] In a fourth aspect, the present application provides an image encoding method, the method including: determining a second residual block of a block to be encoded and a quantization parameter QP for each pixel in the block to be encoded; quantizing the second residual block based on the QP for each pixel and the quantization preset array to obtain a first residual block; and encoding the first residual block to obtain a codestream of the block to be encoded.

[0045] In the image coding method provided by the present application, the quantization processing method implemented based on the quantization preset array provided by the present application reduces the number of multiplication operations in the quantization process. Because multiplication operations occupy a large amount of computational resources, reducing the number of multiplication operations can reduce the computational resources occupied in the quantization process, thereby significantly saving computational resources on the coding side. In addition, since multiplication operations take time, the calculation efficiency of the quantization process can be improved, and the image coding efficiency of the image coding method can be significantly improved.

[0046] In another possible design, encoding the first residual block to obtain a codestream of the current block includes determining a target prediction mode of the current block and a residual scanning order corresponding to the target prediction mode, and encoding the residual block in the residual scanning order to obtain a codestream of the current block, where if the target prediction mode is the first target prediction mode, the residual scanning order is the first scanning order, and if the target prediction mode is the second target prediction mode, the residual scanning order is the second scanning order, and the first scanning order and the second scanning order are different.

[0047] In another possible design, for a current block of a first size, the current block is coded using a third scan order in the target prediction mode. For a current block of a second size, the current block is coded using a fourth scan order in the target prediction mode, where the third scan order and the fourth scan order are different.

[0048] In another possible design form, the quantization preset array includes an amplification parameter array and a displacement parameter array, the amplification parameter array and the displacement parameter array include the same number of numerical values, and for an i-th value amp[i] of the amplification parameter array and an i-th value shift[i] of the displacement parameter array, 2 shift[i] The inverse quantization preset array consisting of the quotient of amp[i] and amp[i] is such that the interval between two adjacent numbers is 1 in the 1st to nth numbers, the interval between two adjacent numbers is 2 in the n+1st to n+mth numbers, and the interval between two adjacent numbers is 2 in the n+k*m+1st to n+k*m+mth numbers. k+1 where n and m are integers greater than 1, and i and k are both positive integers.

[0049] In another possible design form, quantizing the second residual block based on the QP of each pixel and the quantization preset array to obtain the first residual block includes: determining an amplification parameter for each pixel in an amplification parameter array and a displacement parameter for each pixel in a displacement parameter array based on the QP of each pixel; and performing a quantization operation on the second residual block based on the amplification parameter and the displacement parameter of each pixel to obtain the first residual block.

[0050] In another possible design form, quantizing the second residual block based on the QP of each pixel and the quantization preset array to obtain the first residual block includes: determining an amplification parameter and a displacement parameter corresponding to each pixel based on the QP of each pixel and the quantization preset array; and performing a quantization operation on the second residual block based on the amplification parameter and the displacement parameter corresponding to each pixel to obtain the second residual block, where the value of the amplification parameter corresponding to each pixel is the value corresponding to the QP of each pixel and 7 in the inverse quantization preset array, and the value of the displacement parameter corresponding to each pixel is the value corresponding to 7 and the QP of each pixel x 2 3 The sum of the quotient obtained by dividing by is the sum of the quotient and the quotient.

[0051] In another possible design form, the second residual block is an original residual value block of the block to be coded, or the second residual block is a residual coefficient block obtained by transforming the residual value block.

[0052] In another possible design form, determining the second residual block of the block to be encoded includes predicting each pixel in the block to be encoded in a target prediction order according to a target prediction mode, and determining the second residual block based on the predicted value of each pixel in the block to be encoded.

[0053] In another possible design, encoding the first residual block to obtain a codestream of the block to be encoded includes encoding the first residual block using a variable code length coding scheme to obtain a codestream of the block to be encoded.

[0054] Since the image encoding method provided by the fourth aspect and any of its possible design forms corresponds to the image decoding method provided by the third aspect and any of its possible design forms, it is understood that the beneficial effects of the technical means provided by the fourth aspect and any of its possible design forms refer to the description of the beneficial effects of the corresponding method in the third aspect, and redundant description will be omitted here.

[0055] In a fifth aspect, the present application provides an image coding method, the method including: determining a residual block corresponding to a block to be coded; and coding the residual block using a variable length code coding scheme to obtain a codestream of the block to be coded.

[0056] According to the coding method provided by the present application, when the coding side encodes the residual block of the current block using a variable code length coding method such as the exponential Columbus coding algorithm with degree conversion, the coding side can adaptively encode smaller residual values ​​with fewer bits, thereby saving bits and further increasing the compression rate of image coding, and the coding method provided by the present application can also improve coding efficiency.

[0057] In one possible design form, the variable code length encoding scheme includes an order-convertible exponential Columbus encoding scheme, and encoding the residual block using the variable code length encoding scheme to obtain a code stream for the block to be encoded includes determining an attribute type of each pixel in the block to be encoded; for a first value in the residual block corresponding to a third pixel of the block to be encoded, determining a target order for encoding the first value based on the preset policy and the attribute type of the third pixel; and encoding the first value using the exponential Columbus encoding algorithm of the target order to obtain a code stream.

[0058] In another possible design, the variable code length encoding scheme includes a preset order exponential Columbus encoding scheme, and encoding the residual block using the variable code length encoding scheme to obtain a code stream for the block to be encoded includes, for a first value in the residual block corresponding to a third pixel of the block to be encoded, encoding the first value using a preset order exponential Columbus encoding algorithm to obtain a code stream.

[0059] The two possible designs use exponential Columbus coding with variable order or preset order to implement variable-length coding of the residual values ​​in the residual block, which can adaptively encode smaller residual values ​​with fewer bits, thereby saving bits.

[0060] In another possible design, the method includes determining a syntax element corresponding to the residual block, the syntax element including an encoding code length CL for encoding each value in the residual block; and encoding the CL of each value using a variable code length encoding scheme to obtain a codestream.

[0061] In another possible design, the variable code length encoding scheme includes an order-convertible exponential Columbus coding scheme, and for any value in the residual block, encoding the CL of each value using the variable code length encoding scheme to obtain a codestream includes determining a target order for encoding the CL of any value, and encoding the CL of any value using the exponential Columbus coding algorithm of the target order to obtain a codestream.

[0062] The two possible designs use exponential Columbus coding with variable order or preset order to realize variable-length coding of the CL in the residual block, which can adaptively code smaller CLs with fewer bits, thereby saving bits.

[0063] In another possible design, for any value in the residual block, encoding the CL of each value using the above variable length code encoding scheme to obtain a codestream includes: encoding the CL of any value using a predetermined number of bits if the CL of any value is less than or equal to a threshold; and encoding the CL of any value using truncated unary coding to obtain a codestream if the CL of any value is greater than the threshold.

[0064] This possible design uses fixed-length coding and truncated unary coding to realize variable-length coding of the CL of the residual value in the residual block, which can adaptively code smaller CLs with fewer bits, thereby saving bits.

[0065] In another possible design form, the residual block is an original residual value block of the block to be coded, or the residual block is a residual coefficient block obtained by transforming the original residual value block, or the residual block is a quantized coefficient block obtained by quantizing the residual coefficient block.

[0066] In another possible design form, when the residual block is an original residual value block of the block to be coded, determining the residual block corresponding to the block to be coded includes: determining a target prediction mode of the block to be coded and determining a residual scanning order corresponding to the target prediction mode; predicting each pixel in the block to be coded in a target prediction order according to the target prediction mode; and determining the residual block based on the predicted value of each pixel in the block to be coded.

[0067] This possible design form can improve prediction efficiency by predicting the block to be coded based on the target prediction mode provided by the present application, and therefore this possible design form can further improve the coding efficiency of images.

[0068] In another possible design form, when the residual block is a quantized coefficient block obtained by quantizing a residual coefficient block, before encoding the residual block using the variable-length code encoding method to obtain a code stream of the block to be encoded, the method further includes: determining a quantization parameter QP for each pixel in the block to be encoded; and quantizing the residual value block to be encoded based on the QP for each pixel and the quantization preset array to obtain the residual block.

[0069] This possible design form enables quantization of the residual value block to be coded with fewer multiplication operations, and enables efficient quantization of the residual value block to be coded, so that the coding method provided by this possible design form can further improve the coding efficiency of images.

[0070] In a sixth aspect, the present application provides an image decoding method, the method including: analyzing a code stream of a block to be decoded using a variable code length decoding method to obtain a coding code length CL for encoding each value in a residual block corresponding to the block to be decoded; determining the residual block based on the CL for encoding each value; and reconstructing the block to be decoded based on the residual block to obtain a reconstructed block.

[0071] In another possible design, the variable code length decoding scheme includes an order-convertible or preset-order exponential Columbus decoding scheme, and analyzing the code stream of the block to be decoded using the variable code length decoding scheme to obtain an encoding code length CL for encoding each value in the residual block corresponding to the block to be decoded includes: determining a target order for analyzing the CL for encoding each value in the residual block; and analyzing the code stream using the target-order exponential Columbus decoding algorithm to obtain a CL for encoding each value in the residual block.

[0072] In another possible design, analyzing the code stream of the block to be decoded using the variable code length decoding scheme to obtain a coding code length CL for encoding each value in the residual block corresponding to the block to be decoded includes: if the number of bits of CL for encoding any value in the residual block is a predetermined number, analyzing the code stream based on a fixed length decoding policy to obtain a CL for encoding the any value; and if the number of bits of CL for encoding any value in the residual block is greater than the predetermined number, analyzing the code stream based on a truncated unary coding rule to obtain a CL for encoding the any value.

[0073] In another possible design form, determining the residual block based on the CL for encoding each value includes: determining a bit group corresponding to each pixel in the block to be decoded in the codestream based on the CL for encoding each value; determining an attribute type for each pixel in the block to be decoded; for a first bit group corresponding to a third pixel in the block to be decoded, determining a target order for parsing the first bit group based on the preset policy and the attribute type of the third pixel; and parsing the first bit group using an exponential Columbus decoding algorithm of the target order to obtain the residual block.

[0074] In another possible design form, determining the residual block based on the CL for encoding each value includes: determining a group of bits in the codestream corresponding to each pixel in the block to be decoded based on the CL for encoding each value; and for a first group of bits corresponding to a third pixel in the block to be decoded, analyzing the first group of bits using an exponential Columbus decoding algorithm of a preset order to obtain the residual block.

[0075] In another possible design form, reconstructing the block to be decoded based on the residual block to obtain a reconstructed block includes reconstructing a residual value block of the block to be decoded by performing inverse quantization and inverse transformation on the residual block or inverse quantizing the residual block, and reconstructing the block to be decoded based on the residual value block to obtain a reconstructed block.

[0076] In another possible design form, reconstructing the block to be decoded based on the residual block to obtain a reconstructed block includes: determining a target prediction mode for predicting pixels in the block to be decoded based on a code stream of the block to be decoded; determining a target prediction order corresponding to the target prediction mode based on the target prediction mode; predicting each pixel in the block to be decoded in the target prediction order according to the target prediction mode; and reconstructing the block to be decoded based on the predicted value of each pixel in the block to be decoded and the residual block to obtain a reconstructed block.

[0077] In another possible design form, inverse quantizing the residual block includes inverse quantizing the residual block based on an inverse quantization parameter for each pixel in the block to be decoded obtained by analyzing a codestream of the block to be decoded and an inverse quantization preset array.

[0078] Since the image decoding method provided by the sixth aspect and any of its possible design forms corresponds to the image encoding method provided by the fifth aspect and any of its possible design forms, it is understood that the beneficial effects of the technical means provided by the sixth aspect and any of its possible design forms refer to the explanation of the beneficial effects of the corresponding method in the fifth aspect, and redundant explanations will be omitted here.

[0079] In a seventh aspect, the present application provides an image decoding device. The decoding device may be a video decoder or a device equipped with a video decoder. The decoding device includes modules for implementing the method according to any of the feasible aspects of the first, third, or sixth aspects. The decoding device has a function for implementing the operations of the examples of the related method. The functions may be implemented by hardware, or may be implemented by causing the hardware to execute corresponding software. The hardware or software includes one or more modules corresponding to the functions. For beneficial effects thereof, please refer to the description of the corresponding method, and redundant description will be omitted here.

[0080] In an eighth aspect, the present application provides an image encoding device. The encoding device may be a video encoder or a device equipped with a video encoder. The encoding device includes modules for implementing the method according to any of the second, fourth, or fifth aspects. The encoding device has a function for implementing the operations of the examples of the related method. The functions may be implemented by hardware, or may be implemented by causing the hardware to execute corresponding software. The hardware or software includes one or more modules corresponding to the functions. For beneficial effects thereof, please refer to the description of the corresponding method, and redundant description will be omitted here.

[0081] In a ninth aspect, the present application provides an electronic device, the electronic device comprising a processor and a memory, the memory being used to store computer instructions, and the processor being used to call and execute the computer instructions from the memory to implement a method in any of the feasible aspects of the first to sixth aspects. For example, the electronic device may be a video encoder or a device equipped with a video encoder. For example, the electronic device may be a video decoder or a device that includes a video decoder.

[0082] In a tenth aspect, the present application provides a computer-readable storage medium having stored thereon a computer program or instructions which, when executed by a processor, implements a method in any of the possible implementations of the first to sixth aspects.

[0083] In an eleventh aspect, the present application provides a computer program product, the computer program product including instructions, which when executed on a computing device or processor, cause the computing device or processor to execute the instructions to implement a method in any of the possible embodiments of the first to sixth aspects.

[0084] In a twelfth aspect, the present application provides a chip, the chip comprising a memory and a processor, the memory being adapted to store computer instructions, and the processor being adapted to retrieve and execute the computer instructions from the memory to implement a method in any of the possible aspects of the first to sixth aspects.

[0085] In a thirteenth aspect, the present application provides an image encoding / decoding system, the image encoding / decoding system comprising an encoding side and a decoding side, the decoding side being used to realize a corresponding decoding method provided by the first, second or sixth aspect, and the encoding side being used to realize the corresponding encoding method.

[0086] The present application may further combine the above aspects to provide more embodiments in addition to the embodiments provided by each aspect. Alternatively, any possible implementation form of any of the above aspects may be applied to other aspects as long as it is not inconsistent, thereby obtaining new embodiments. For example, any of the image decoding methods provided by the first, third, and sixth aspects may be combined with two aspects or three aspects without inconsistency to obtain new image decoding methods. [Brief explanation of the drawings]

[0087] The drawings described herein constitute a part of this application for a better understanding of the present application. The exemplary embodiments and the description thereof are for the purpose of interpreting the present application and do not constitute undue limitations on the present application.

[0088] [Figure 1]FIG. 1 is a schematic diagram of the architecture of an encoding / decoding system 10 applied to an embodiment of the present application. [Figure 2] FIG. 2 is a schematic block diagram of an example of an encoder 112 for implementing the method of the present invention. [Figure 3] FIG. 3 is a schematic diagram of the correspondence between images, parallel encoding means, independent encoding means and encoding means provided by an embodiment of the present application. [Figure 4] FIG. 4 is a schematic flow chart of the encoding process provided by an embodiment of the present application. [Figure 5] FIG. 5 is a schematic block diagram of an example of a decoder 122 for implementing the method of the present embodiment. [Figure 6a] FIG. 6a is a schematic flowchart of an image encoding method provided by an embodiment of the present application. [Figure 6b] FIG. 6b is a schematic flowchart of an image decoding method provided by an embodiment of the present application. [Figure 6c] FIG. 6c is a schematic flowchart of another image encoding method provided by an embodiment of the present application. [Figure 7a] FIG. 7a is a schematic diagram of the prediction order provided by an embodiment of the present application. [Figure 7b] FIG. 7b is a schematic diagram of another prediction order provided by an embodiment of the present application. [Figure 7c-1] FIG. 7c-1 is a schematic diagram of another prediction order provided by an embodiment of the present application. [Figure 7c-2] FIG. 7c-2 is a schematic diagram of another prediction order provided by an embodiment of the present application. [Figure 7d-1] FIG. 7d-1 is a schematic diagram of another prediction order provided by an embodiment of the present application. [Figure 7d-2] FIG. 7d-2 is a schematic diagram of another prediction order provided by an embodiment of the present application. [Figure 7d-3] FIG. 7d-3 is a schematic diagram of another prediction order provided by an embodiment of the present application. [Figure 7e] FIG. 7e is a schematic diagram of yet another prediction order provided by an embodiment of the present application. [Figure 7f] FIG. 7f is a schematic diagram of yet another prediction order provided by an embodiment of the present application. [Figure 7g] FIG. 7g is a schematic diagram of yet another sequence provided by an embodiment of the present application. [Figure 8] FIG. 8 is a schematic flowchart of another image decoding method provided by an embodiment of the present application. [Figure 9a] FIG. 9a is a schematic flowchart of another image encoding method provided by an embodiment of the present application. [Figure 9b] FIG. 9b is a schematic flowchart of another image decoding method provided by an embodiment of the present application. [Figure 10a] FIG. 10a is a schematic flowchart of another image encoding method provided by an embodiment of the present application. [Figure 10b] FIG. 10b is a schematic flowchart of another image decoding method provided by an embodiment of the present application. [Figure 11] FIG. 11 is a schematic diagram of the structure of a decoding device 1100 provided by an embodiment of the present application. [Figure 12] FIG. 12 is a schematic diagram of the structure of an encoding device 1200 provided by an embodiment of the present application. [Figure 13] FIG. 13 is a schematic diagram of the structure of a decoding device 1300 provided by an embodiment of the present application. [Figure 14] FIG. 14 is a schematic diagram of the structure of an encoding device 1400 provided by an embodiment of the present application. [Figure 15] FIG. 15 is a schematic diagram of the structure of an encoding device 1500 provided by an embodiment of the present application. [Figure 16] FIG. 16 is a schematic diagram of the structure of a decoding device 1600 provided by an embodiment of the present application. [Figure 17] FIG. 17 is a schematic diagram of the structure of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION OF THE INVENTION

[0089] In the following, in order to clarify the understanding of the embodiments of the present application, some of the terms or techniques related to the embodiments of the present application will be explained.

[0090] 1),Prediction Mode A combination of prediction methods used to predict the predicted value of each pixel in a current image block (e.g., a current image block to be coded (hereinafter simply referred to as a current block to be coded) or a current image block to be decoded (hereinafter simply referred to as a current block to be decoded)) is called a prediction mode. Here, different prediction methods or the same prediction method may be used to predict different pixels in the current image block, and the prediction methods used to predict all pixels in the current image block may be called the (or corresponding) prediction mode of the current image block.

[0091] Preferably, the prediction modes include a dot-by-dot prediction mode, an intra prediction mode, a block copy mode, and an original value mode (i.e., a mode in which a reconstructed value of a fixed bit width is decoded as is).

[0092] For example, the dot-by-dot prediction mode refers to a prediction mode in which a reconstructed value of a neighboring pixel around a pixel to be predicted is used as a predicted value of the pixel to be predicted. The dot-by-dot prediction mode includes one or more combinations of prediction methods such as vertical prediction, horizontal prediction, vertical average prediction, and horizontal average prediction.

[0093] Here, vertical prediction is a method of obtaining a predicted value (PointPredData) of a pixel to be predicted using a reconstructed value of a pixel above the pixel to be predicted (which may be an adjacent pixel above, or a pixel not adjacent but close above). In the embodiment of the present application, a prediction method using vertical prediction is called a T prediction method. As an example, the reconstructed value of an adjacent pixel above the pixel to be predicted is used as the predicted value of the pixel to be predicted.

[0094] Horizontal prediction is a method of obtaining a predicted value of a pixel to be predicted using a reconstructed value of a pixel to the left of the pixel to be predicted (which may be an adjacent pixel to the left, or a pixel to the left that is not adjacent but close). In the embodiments of the present application, a prediction method using horizontal prediction is called an L prediction method. As an example, the reconstructed value of the pixel to be predicted that is adjacent to the left of the pixel to be predicted is used as the predicted value of the pixel to be predicted.

[0095] Vertical average prediction is a method of obtaining a predicted value of a pixel to be predicted using reconstructed values ​​of pixels above and below the pixel to be predicted. In the embodiment of the present application, a prediction method using vertical average prediction is called a TB prediction method. As an example, the predicted value of the pixel to be predicted is the average value of the reconstructed value of the pixel vertically above the pixel to be predicted and the reconstructed value of the pixel vertically below the pixel to be predicted.

[0096] In horizontal average prediction, a predicted value of a pixel to be predicted is obtained using reconstructed values ​​of pixels to the left and right of the pixel to be predicted. In the embodiment of the present application, a prediction method using horizontal average prediction is called an RL prediction method. As an example, the predicted value of the pixel to be predicted is the average value of the reconstructed value of the pixel to the left of the pixel to be predicted and the reconstructed value of the pixel to the right of the pixel to be predicted.

[0097] Illustratively, the intra prediction mode is a prediction mode in which a reconstructed value of a pixel in a neighboring block surrounding a block to be predicted is used as a predicted value.

[0098] Illustratively, the block copy mode is a prediction mode in which the reconstructed values ​​of pixels in a (decoded) block (not necessarily adjacent) are used as prediction values.

[0099] Illustratively, the original value mode is a mode in which a reconstructed value of a fixed bit width is decoded as is, that is, a no-reference prediction mode.

[0100] 2) Residual coding mode The manner of coding the residual (i.e., the residual block, which is a block of residual values ​​for each pixel in the current image block) of a current image block (e.g., a block to be coded or decoded) is called a residual coding mode, which may include a residual skip coding mode and a normal residual coding mode.

[0101] There is no need to code (decode) the residual coefficients in the residual skip coding mode, in which the residual values ​​of the pixels in the current image block are all zero, and the reconstructed value of each pixel is equal to the predicted value of that pixel.

[0102] The residual coefficients need to be coded (decoded) in a normal residual coding mode, in which the residual values ​​of the pixels in the current image block are not all zero, and the reconstructed value of each pixel can be obtained based on the predicted value and the residual value of that pixel.

[0103] In one example, the residual coefficient of a pixel may be equivalent to the residual value of this pixel. In another example, the residual coefficient of a pixel may be obtained by processing the residual value of this pixel.

[0104] 3) Quantization and dequantization In the process of image coding, in order to compress an image, a residual block of a block to be coded is usually quantized, or a residual coefficient block obtained by processing this residual block is quantized, so that the quantized residual block or residual coefficient block can be coded with fewer bits. It is understood that the residual block is a residual value block obtained based on the original pixel block and predicted block of the block to be coded, and the residual coefficient block is a coefficient block obtained by transforming the residual block.

[0105] For example, the encoding device may quantize a residual block, for example, by dividing each residual value in the residual block of the current block by a quantization coefficient to reduce the residual value in the residual block. In this way, the quantized and reduced residual value can be coded with fewer bits than the unquantized residual value, thereby achieving compression coding of the image.

[0106] As such, to reconstruct an image block from a compression-encoded codestream, a decoding device can dequantize a residual block or residual coefficient block analyzed from the codestream, thereby reconstructing an unquantized residual block or residual coefficient block corresponding to the image block. The decoding device then reconstructs the image block based on the reconstructed residual block or residual coefficient block to obtain a reconstructed block of the image.

[0107] As an example, a decoding device analyzes a quantized residual block of a block to be decoded from a codestream, and an encoding device can dequantize the residual block. Specifically, the encoding device multiplies each residual value in the analyzed residual block by a quantization coefficient to reconstruct the residual value of an unquantized residual block corresponding to the block to be decoded, thereby obtaining a reconstructed residual block. Here, the quantization coefficient is the quantization coefficient used when the encoding device quantizes the residual block of the block to be decoded when encoding the block to be decoded. In this way, the decoding device can reconstruct the block to be decoded based on the residual block reconstructed after dequantization, and obtain a reconstructed block of the block to be decoded.

[0108] 4) Other terms In the examples of this application, the term "at least one (kind)" includes one (kind) or multiple (kinds). "Multiple (kinds)" means two (kinds) or more than two (kinds). For example, "at least one of A, B, and C" includes A's sole presence, B's sole presence, A and B's simultaneous presence, A and C's simultaneous presence, B and C's simultaneous presence, and A, B, and C's simultaneous presence. In this description, unless otherwise specified, " / " means "or," e.g., A / B means A or B. In this application, the term "and / or" is used only to describe the relationship between related objects and indicates that three types of relationships can exist, e.g., A and / or B can indicate three situations: A's sole presence, A and B's simultaneous presence, and B's sole presence. "Multiple" means two or more. Furthermore, in order to clearly describe the technical solutions according to the embodiments of the present application, the embodiments of the present application use the terms "first" and "second" to distinguish between identical or similar items that have substantially the same functions and actions. Those skilled in the art will understand that the terms "first" and "second" do not limit the quantity or execution order, and the terms "first" and "second" do not necessarily limit "different".

[0109] The system architecture applied to the embodiments of the present application will be described below.

[0110] Referring to Fig. 1, Fig. 1 shows a schematic architecture diagram of an encoding / decoding system 10 applied to an embodiment of the present application. As shown in Fig. 1, the encoding / decoding system 10 may include a source device 11 and a target device 12. Here, the source device 11 is used to encode images, so the source device 11 may be referred to as an image encoding device or a video encoding device. The target device 12 is used to decode encoded image data generated by the source device 11, so the target device 12 may be referred to as an image decoding device or a video decoding device.

[0111] The specific forms of the source device 11 and the target device 12 may be various devices and are not limited in the embodiments of the present application. For example, the source device 11 and the target device 12 may be a desktop computer, a mobile computing device, a notebook (e.g., laptop) computer, a tablet computer, a set-top box, a mobile phone such as a so-called "smartphone," a television, a camera, a display device, a digital media player, a video game console, an in-vehicle computer, or other similar devices.

[0112] 1 may be two separate devices, or the source device 11 and the target device 12 may be the same device, i.e., the source device 11 or a corresponding function and the target device 12 or a corresponding function may be integrated into the same device.

[0113] Communication is possible between the source device 11 and the target device 12. For example, the target device 12 can receive encoded image data from the source device 11. As an example, one or more communication media for transmitting the encoded image data may be included between the source device 11 and the target device 12. The one or more communication media may include a router, a switch, a base station, or other devices that facilitate communication from the source device 11 to the target device 12, and is not limited to this embodiment.

[0114] As shown in FIG. 1 , the source device 11 includes an encoder 112. Preferably, the source device 11 also includes an image preprocessor 111 and a communication interface 113. The image preprocessor 111 is used to perform preprocessing on the received image to be encoded. For example, the preprocessing performed by the image preprocessor 111 may include cropping, color format conversion (e.g., conversion from RGB format to YUV format), color correction, or noise removal. The encoder 112 is used to receive the image preprocessed by the image preprocessor 111, process the preprocessed image using an associated prediction mode, and provide encoded image data. In some embodiments, the encoder 112 is used to perform the encoding process in various embodiments described below. The communication interface 113 may be used to transmit the encoded image data to the target device 12 or another device (e.g., a memory) for storage or direct reconstruction, or the other device may be a device for decoding or storage. The communication interface 113 may encapsulate the encoded image data in an appropriate format before transmitting it.

[0115] Preferably, the image preprocessor 111, the encoder 112, and the communication interface 113 may be hardware components in the source device 11, or may be software programs in the source device 11, and are not limited in the embodiments of the present application.

[0116] The target device 12 includes a decoder 122. Preferably, the target device 12 may also include a communication interface 121 and an image post-processor 123. Here, the communication interface 121 is used to receive encoded image data from the source device 11 or another source device, such as a storage device. The communication interface 121 may also decapsulate data transmitted by the communication interface 113 to obtain encoded image data. The decoder 122 is used to receive the encoded image data and output decoded image data (also referred to as reconstructed image data or reconstructed image data). In some embodiments, the decoder 122 is used to perform the decoding process in various embodiments described below. The image post-processor 123 is used to perform post-processing on the decoded image data to obtain post-processed image data. The post-processing performed by the image post-processor 123 may include color format conversion (e.g., from YUV format to RGB format), color correction, polishing or resampling, or any other processing, and the image post-processor 123 is used to transfer the post-processed image data to a display device for display.

[0117] Preferably, the communication interface 121, the decoder 122, and the image post-processor 123 may be hardware components in the target device 12, or may be software programs in the target device 12, and are not limited to these in the embodiments of the present application.

[0118] Next, the configurations of the encoder 112 and decoder 122 in FIG. 1 will be briefly described.

[0119] Referring to Fig. 2, Fig. 2 shows a schematic block diagram of an example of an encoder 112 for implementing the method of the embodiment of the present application. As shown in Fig. 2, the encoder 112 includes a prediction processing means 201, a residual calculation means 202, a residual transformation means 203, a quantization means 204, an encoding means 205, an inverse quantization means (also referred to as a dequantization means) 206, a residual inverse transformation means 207, a reconstruction means (or referred to as a reconstruction means) 208, and a filter means 209. Preferably, the encoder 112 can also include a buffer and a decoded image buffer. Here, the buffer is used to buffer the reconstructed block (or to become the reconstructed block) output from the reconstruction means 208, and the decoded image buffer is used to buffer the filtered image block output from the filter means 209.

[0120] In one example, the input of the encoder 112 is an image block of an image to be encoded (i.e., a block to be encoded or an encoding means). As another example, the input of the encoder 112 is an image to be encoded, and the encoder 112 may include a dividing means (not shown in FIG. 2 ) for dividing the image to be encoded into a plurality of image blocks. The encoder 112 is used to perform encoding on a block-by-block basis to complete the encoding of the image to be encoded. For example, the encoder 112 performs an encoding process on each image block to complete the encoding of the image to be encoded.

[0121] In one example, a method for dividing an image to be encoded into a plurality of image blocks includes the following steps.

[0122] Step 1: Divide one frame of image into one or more parallel encoding means that do not overlap with each other, and there is no dependency between the parallel encoding means, so that they can be encoded and decoded in parallel / independently.

[0123] Step 2: For each parallel encoding means, the encoding side can be divided into one or more independent encoding means that do not overlap with each other, and the independent encoding means do not need to depend on each other, but can share some of the header information of the parallel encoding means.

[0124] Step 3: The encoding side can divide each independent encoding means into one or more non-overlapping encoding means. Here, when the independent encoding means is divided into multiple non-overlapping encoding means, the division method can be horizontal equal division, vertical equal division, or horizontal and vertical equal division. Of course, this is not the only concrete implementation. Each encoding means within the independent encoding means can be interdependent, that is, they can refer to each other during the process of performing the prediction step.

[0125] The width of the encoding means is w_cu and the height is h_cu, preferably the width is greater than the height (unless it is an edge region). In general, the encoding means has a fixed w_cu x h_cu, and both w_cu and h_cu may be a power of 2N (N is 0 or greater), such as 16x4, 8x4, 16x2, 8x2, 8x2, 4x2, 8x1, 4x1, etc.

[0126] The encoding means may include three components: luminance Y, chrominance Cb, and chrominance Cr (or three components: red R, green G, and blue B), or only one of them. If three components are included, the sizes of some of the components may be identical or different, depending on the image input format.

[0127] As shown in Figure 3, Figure 3 is a schematic diagram of the correspondence between an image, a parallel encoding means, an independent encoding means, and an encoding means. For example, the parallel encoding means 1 and the parallel encoding means 2 in Figure 3 divide an image according to an image area ratio of 3:1, where the parallel encoding means 1 comprises one independent encoding means divided into four encoding means.

[0128] The prediction processing means 201 receives or acquires the true value of the block to be coded and the data of the reconstructed image, predicts the block to be coded based on the correlation data in the data of the reconstructed image, and obtains a predicted block of the block to be coded.

[0129] The residual calculation means 202 calculates the residual value between the true value of the block to be coded and the predicted block of the block to be coded, and obtains a residual block. For example, the residual block is obtained by subtracting the pixel value of the predicted block from the true pixel value of the block to be coded pixel by pixel.

[0130] In one example, the residual transform unit 203 is used to determine residual coefficients based on the residual block. Preferably, this process includes performing a transform, such as a discrete cosine transform (DCT) or a discrete sine transform (DST), on the residual block to obtain transform coefficients in a transform domain, where the transform coefficients may also be referred to as transform residual coefficients or residual coefficients, and the residual coefficients can represent the residual block in the transform domain. Of course, the encoder 112 may not include a residual transform step in the process of encoding the current block.

[0131] The quantization means 204 applies scalar quantization or vector quantization to quantize the transform coefficients or residual values ​​to obtain quantized residual coefficients (or quantized residual values). The quantization process can reduce the bit depth associated with some or all of the residual coefficients. For example, p-bit transform coefficients may be truncated to q-bit transform coefficients during quantization, where p is greater than q. The degree of quantization can be modified by adjusting a quantization parameter (QP). For example, for scalar quantization, fine or coarse quantization can be achieved by applying different scales. A small quantization step size corresponds to fine quantization, and a large quantization step size corresponds to coarse quantization. The appropriate quantization step size can be indicated by QP.

[0132] The encoding means 205 encodes the quantized residual coefficients (or quantized residual values) and outputs the encoded image data (i.e., the encoding result of the current block to be encoded) as an encoded bitstream (also called a codestream), which can be transferred to a decoder or stored and then transferred to a decoder or used for retrieval. The encoding means 205 is also used to encode syntax elements of the block to be encoded, such as encoding the prediction mode used for the block to be encoded into the codestream.

[0133] In one example, the encoding unit 205 encodes the residual coefficients using a semi-fixed-length coding scheme as a viable scheme. First, the maximum value of the residual absolute value in a residual block (RB) is defined as modified maximum (mm). The number of coding bits for the residual coefficients in this RB (the number of coding bits for residual coefficients in the same RB is the same), i.e., the coding code length CL, is determined from mm. For example, if the CL of the current RB is 2 and the current residual coefficient is 1, encoding residual coefficient 1 requires 2 bits, which is shown as 01. In one specific case, if the CL of the current RB is 7, it represents encoding an 8-bit residual coefficient and a 1-bit code bit. Here, the CL is determined by searching for the smallest M value that satisfies the condition that all residuals in the current RB are within the range [-2^(M-1), 2^(M-1)], and the found M is set as the CL of the current RB. If the current RB has both boundary values ​​2^(M-1) and 2^(M-1) at the same time, M must be increased by 1, i.e., all residuals in the current RB must be coded with M+1 bits. If the current RB has only one of the two boundary values ​​2^(M-1) and 2^(M-1), the trailing bit (least significant) must be coded to determine whether it is 2^(M-1) or 2^(M-1). If none of the residuals in the current RB are 2^(M-1) or 2^(M-1), there is no need to code the trailing bit.

[0134] Of course, other residual coefficient coding methods can be used, such as exponential Golomb (Columbus coding algorithm) coding, Golomb-Rice (a variant of the Columbus coding algorithm) coding, truncated unary coding, run-length coding, or direct coding of the original residual values.

[0135] In addition, in certain cases, the encoding means 205 may directly encode the original values ​​rather than the residual values.

[0136] The inverse quantization means 206 is used to inverse quantize the quantized residual coefficients (or quantized residual values) to obtain inverse quantized residual coefficients (or inverse quantized residual values), where the inverse quantization is an inverse application of the quantization means 204, for example, applying an inverse quantization method of the quantization method applied by the quantization means 204 based on or using the same quantization step length as the quantization means 204.

[0137] The residual inverse transform means 207 is used to inversely transform (or inversely transform) the dequantized residual coefficients to obtain a reconstructed residual block. Preferably, the inverse transform may include an inverse discrete cosine transform (DCT) or an inverse discrete sine transform (DST). In this way, the inverse transform values ​​obtained by inversely transforming (or inversely transforming) the dequantized residual coefficients are residual values ​​reconstructed in the pixel domain (also called the sample domain). That is, the block obtained by inversely transforming the dequantized residual coefficient block by the residual inverse transform means 207 is a reconstructed residual block. Of course, if the encoder 112 does not include the residual transform means 203, the encoder 112 may not include the inverse transform step.

[0138] The reconstruction means 208 is used to add the reconstructed residual block to the prediction block to obtain a reconstructed block in the sample domain, and the reconstruction means 208 may be an adder. For example, the reconstruction means 208 adds residual values ​​in the reconstructed residual block to predicted values ​​of corresponding pixels in the prediction block to obtain reconstructed values ​​of the corresponding pixels. The reconstructed block output by the reconstruction means 208 may then be used to predict other image blocks to be coded.

[0139] The filter means 209 (or simply called "filter") is used to filter the reconstructed block to obtain a filtered block, thereby smoothing pixel transitions and improving image quality.

[0140] In one example, the encoding process is shown in FIG. 4. Specifically, the encoder determines whether to use a dot-by-dot prediction mode. If the dot-by-dot prediction mode is used, the encoder predicts pixels in the current block based on the dot-by-dot prediction mode, encodes the current block, and then performs inverse quantization and reconstruction steps on the encoded result, thereby achieving the encoding process. If the dot-by-dot prediction mode is not used, the encoder determines whether to use an original value mode. If the original value mode is used, the encoder performs encoding in the original value mode. If the original value mode is not used, the encoder determines to predict and encode using another prediction mode, such as an intra prediction mode or a block copy mode. Then, if it is determined to perform residual skip, the encoder directly performs a reconstruction step on the encoded result. If it is determined not to perform residual skip, the encoder performs an inverse quantization step on the encoded result to obtain an inverse quantized residual block, and then determines whether to use a block copy prediction mode. When it is determined that the block copy prediction mode is used, in one case, if it is determined that a transform skip is performed, a reconstruction step is directly performed on the dequantized residual block, and in another case, if it is determined that a transform skip is not performed, an inverse transform and reconstruction step is performed on the dequantized residual block to realize the encoding process.When it is determined that the block copy mode is not used (in this case, the prediction mode used is an intra prediction mode), an inverse transform and reconstruction step is performed on the dequantized residual block to realize the encoding process.

[0141] Specifically, in the embodiment of the present application, the encoder 112 is used to implement the encoding method described in the following embodiment.

[0142] In one example, the encoding process implemented by the encoder 112 may include the following steps.

[0143] Step 11: The prediction processing means 201 determines a prediction mode, predicts the block to be coded based on the determined prediction mode and a reconstructed block of the coded image block, and obtains a predicted block of the block to be coded. Here, the reconstructed block of the coded image block is obtained by the inverse quantization means 206, the residual inverse transform means 207 and the reconstruction means 208 sequentially processing the quantized residual coefficient block of the coded image block.

[0144] Step 12: The residual calculation means 202 obtains a residual block of the block to be coded based on the predicted block and the original pixel values ​​of the block to be coded.

[0145] Step 13: The residual transform means 203 transforms the residual block to obtain a residual coefficient block.

[0146] Step 14: The quantization means 204 quantizes the residual coefficient block to obtain a quantized residual coefficient block.

[0147] Step 15: The encoding means 205 encodes the quantized residual coefficient block and encodes related syntax elements (eg, prediction mode, coding mode) to obtain a codestream of the block to be encoded. 5, which shows a schematic block diagram of an example of a decoder 122 for implementing the method of the embodiment of the present application. The decoder 122, for example, receives image data encoded by the encoder 112 (i.e., an encoded bitstream, for example, including an encoded bitstream of an image block and associated syntax elements) to obtain a decoded image block.

[0148] 5, the decoder 122 includes a codestream analysis means 301, an inverse quantization means 302, a residual inverse transform means 303, a prediction processing means 304, a reconstruction means 305, and a filter means 306. In some examples, the decoder 122 can perform a decoding process that is substantially the reverse of the encoding process described by the encoder 112 of FIG. 2. Preferably, the decoder 122 includes a buffer and a filtered image buffer, where the buffer is used to buffer the reconstructed image blocks output by the reconstruction means 305, and the filtered image buffer is used to buffer the filtered image blocks output by the filter means 306.

[0149] The codestream analysis means 301 decodes the coded bitstream to obtain quantized residual coefficients (or quantized residual values) and / or decoding parameters (e.g., the decoding parameters include any one or all of inter-prediction parameters, intra-prediction parameters, filter parameters, and / or other syntax elements performed on the coding side). The codestream analysis means 301 is also used to transfer the decoding parameters to the prediction processing means 304 so that the prediction processing means 304 performs a prediction process based on the decoding parameters.

[0150] The function of the inverse quantization means 302 may be the same as that of the inverse quantization means 206 of the encoder 112, and is used to inverse quantize the quantized residual coefficients decoded and output by the codestream analysis means 301.

[0151] The function of the residual inverse transform means 303 may be the same as that of the residual inverse transform means 207 of the encoder 112, and is used to inverse transform (e.g., inverse DCT, inverse integer transform, or a conceptually similar inverse transform process) the dequantized residual coefficients to obtain reconstructed residual values. The block obtained by inverse transform is a residual block of the current block reconstructed in the pixel domain.

[0152] The functionality of the reconstruction means 305 (eg, an adder) may be the same as the functionality of the reconstruction means 208 of the encoder 112 .

[0153] The prediction processing means 304 is used to receive or obtain coded image data (e.g., the coded bitstream of the current image block) and reconstructed image data, and the prediction processing means 304 may, for example, receive or obtain relevant parameters of the prediction mode and / or information about the selected prediction mode (i.e., the above-mentioned decoding parameters) from the codestream analysis means 301, and may also predict the current image block based on the relevant data and decoding parameters in the reconstructed image data to obtain a predicted block of the current image block.

[0154] The reconstruction means 305 is used to add the reconstructed residual block to the prediction block to obtain a reconstructed block of the image to be decoded in the sample domain, for example by adding the residual values ​​in the reconstructed residual block and the prediction values ​​in the prediction block.

[0155] The filter means 306 is used to filter the reconstructed block to obtain a filtered block, which is the decoded image block.

[0156] Specifically, in the embodiment of the present application, the decoder 122 is used to implement the decoding method described in the embodiment below.

[0157] It should be understood that in the encoder 112 and decoder 122 according to the embodiment of the present application, the processing result of a certain step may be further processed and output to the next step, for example, after a step such as interpolation filtering, motion vector derivation or filtering, an operation such as clip or shift may be performed on the processing result of the corresponding step.

[0158] In one example, the decoding process implemented by the decoder 122 may include the following steps:

[0159] Step 21: The codestream analysis means 301 analyzes the prediction mode and the residual coding mode.

[0160] Step 22: The codestream analyzing means 301 analyzes the quantization-related value (for example, a near value (a value indicating a quantization step size) or a QP value) based on the prediction mode and the residual coding mode.

[0161] Step 23: The inverse quantization means 302 analyzes the residual coefficients based on the prediction mode and the quantization-related value.

[0162] Step 24: The prediction processing means 304 obtains a predicted value for each pixel in the current image block according to the prediction mode.

[0163] Step 25: The residual inverse transform means 303 inverse transforms the residual coefficients to reconstruct the residual values ​​of each pixel in the current image block.

[0164] Step 26: The reconstruction means 305 obtains a reconstruction value for each pixel of the current encoding means based on the predicted value and the residual value thereof.

[0165] Hereinafter, the following image encoding / decoding method will be described in accordance with the embodiments of the present application with reference to the drawings.

[0166] Note that the encoding side in any embodiment of the present application may be the encoder 112 in Fig. 1 or Fig. 2 above, or the source device 11 in Fig. 1 above. The decoding side in any embodiment of the present application may be the decoder 122 in Fig. 1 or Fig. 5 above, or the target device 12 in Fig. 1 above, and the embodiments of the present application are not limited thereto.

[0167] 6a, which shows a schematic flowchart of an image encoding method provided by an embodiment of the present application, the method may include the following steps:

[0168] S11: The encoding side determines a target prediction mode for a block to be encoded, and also determines a target prediction order corresponding to the target prediction mode. For a detailed explanation of S11, please refer to the explanation of S101 to be described later, and a duplicate explanation will be omitted here.

[0169] S12: The encoding side predicts each pixel in the encoding target block in the target prediction order according to the target prediction mode. Here, for a detailed explanation of S12, please refer to the explanation of S102 to be described later, and a duplicate explanation will be omitted here.

[0170] S13: The encoding side determines a residual block of the block to be encoded based on the predicted value of each pixel in the block to be encoded. Here, for a detailed explanation of S13, please refer to the explanation of S103 to be described later, and a duplicate explanation will be omitted here.

[0171] S14 (optional), the encoding side performs a transform process on the residual block of the block to be encoded, and obtains a transformed residual coefficient block.

[0172] S15: The encoding side performs a quantization process on the residual coefficient block to obtain a quantized residual coefficient block. It is understood that if the encoding side does not perform S14, the encoding side can directly quantize the residual block to obtain a quantized residual block. Here, for a detailed description of the quantization process of the residual block or residual coefficient block on the encoding side, reference may be made to the description of the quantization of the residual block in S301-S302 described later, and redundant description will be omitted here.

[0173] S16: The encoding side encodes the quantized residual coefficient block to obtain a code stream of the block to be encoded. If the encoding side does not perform S14, it is understood that the encoding side encodes the quantized residual block to obtain the codestream of the block to be encoded. Here, the process of encoding the quantized residual coefficient block (or residual block) on the encoding side may refer to the description of S502 to be described later, and redundant description will be omitted here.

[0174] The residual scanning order in which the encoding side encodes the residual coefficient block may be the same as the target prediction order in S11. In this way, the decoding side can predict the predicted values ​​of pixels in the block to be decoded in the target prediction order, decode the residual block of the block to be decoded in the residual scanning order that is the same as the target prediction order, and further efficiently obtain a reconstructed block of the block to be decoded.

[0175] In the image coding method described in S11 to S16, the target prediction mode used on the coding side for predicting pixels in the block to be coded has high prediction efficiency, and the quantization method used on the coding side for quantizing the residual block or residual coefficient block can reduce the multiplication operations on the coding side, that is, can improve the quantization efficiency.And the coding method used on the coding side can reduce the number of bits for coding the residual block or residual coefficient block, so according to the method provided by the embodiment of the present application, the coding efficiency on the coding side can be significantly improved.

[0176] Referring to Figure 6b, Figure 6b shows a schematic flowchart of an image decoding method provided by an embodiment of the present application, which may include the following steps:

[0177] S21: The decoding side analyzes the code stream of the block to be decoded and determines a target prediction mode for predicting pixels in the block to be decoded. For a detailed explanation of S21, please refer to the explanation of S201 to be described later, and a duplicate explanation will be omitted here.

[0178] S22: The decoding side determines a target prediction order corresponding to the target prediction mode based on the target prediction mode. For a detailed explanation of S22, please refer to the explanation of S202 to be described later, and a duplicate explanation will be omitted here.

[0179] S23: The decoding side predicts each pixel in the block to be decoded in the target prediction order according to the target prediction mode, and obtains a predicted value for each pixel.

[0180] S24: The decoding side analyzes the code stream of the block to be decoded using a variable code length decoding method to obtain the CL of each value in the residual block corresponding to the block to be decoded, and based on the CL, analyzes the code stream of the block to be decoded according to the target prediction order to obtain the first residual block of the block to be decoded. Here, the residual scanning order may be the same as the target prediction order. If the residual scanning order is the same as the target prediction order, that is, if the decoding side predicts pixels in the block to be decoded in the target prediction order, the decoding side further analyzes the first residual block of the block to be decoded from the code stream of the block to be decoded according to the residual scanning order that is the same as the target prediction order. This can improve the decoding efficiency of the decoding side. Here, the decoding side analyzes the code stream of the block to be decoded using a variable code length decoding method, and the process of obtaining the CL of each value in the residual block corresponding to the block to be decoded can refer to the description of S601 below. The description of how the decoding side determines the first residual block based on the CL is the same as the method of obtaining the residual block of the block to be decoded described in S602, so redundant description will be omitted here.

[0181] S25: The decoding side analyzes the code stream of the block to be decoded to obtain the inverse quantization parameter of each pixel in the block to be decoded. Here, for a detailed explanation of the inverse quantization parameters, the explanation of S401 to be described later may be referred to, and a duplicate explanation will be omitted here.

[0182] At S26, the decoding side dequantizes the first residual block based on the QP indicated by the dequantization parameter of each pixel in the block to be decoded and the dequantization preset array, to obtain a second residual block. Here, for a detailed explanation of S26, please refer to the explanation of S402 to be described later, and a duplicate explanation will be omitted here. Note that the embodiment of the present application does not limit the order of execution of S23 and S24 to S26, and for example, S23 and S24 to S26 can be executed simultaneously.

[0183] S27 (optional), the decoding side performs an inverse transform process on the second residual block to obtain an inverse transformed second residual block. If the image encoding process includes the above S14, it is understood that the decoding side executes S27.

[0184] S28: The decoding side reconstructs the block to be decoded based on the inversely transformed second residual block and the predicted value of each pixel in the block to be decoded, to obtain a reconstructed block. If the decoding side does not perform S27, it is understood that the decoding side directly reconstructs the block to be decoded based on the second residual block and the predicted value of each pixel in the block to be decoded to obtain a reconstructed block.

[0185] The image decoding methods of S21 to S28 correspond to the image coding methods of S11 to S16. In the image decoding methods described in S21 to S28, the target prediction mode used on the decoding side to predict pixels in a block to be decoded has high prediction efficiency, and the inverse quantization method used on the decoding side to inverse quantize a residual block or a residual coefficient block can reduce multiplication operations on the decoding side, that is, can improve inverse quantization efficiency. Furthermore, the decoding method used on the decoding side can reduce the number of bits for decoding a residual block or a residual coefficient block, so that the method provided by the embodiment of the present application can significantly improve the decoding efficiency on the decoding side.

[0186] Example 1 As shown in Figure 6c, which is a schematic flowchart of another image encoding method provided by an embodiment of the present application, the method shown in Figure 6c includes the following steps:

[0187] At step S101, the encoding side determines a target prediction mode for a block to be encoded, and also determines a target prediction order corresponding to the target prediction mode.

[0188] Specifically, the encoding side can predict each block to be encoded using different prediction modes, predict the encoding performance of the block to be encoded based on the predicted values ​​in the different prediction modes, and determine the target prediction mode.

[0189] For example, the encoding side predicts each of the blocks to be encoded using different prediction modes, and after obtaining the predicted blocks based on the different prediction mode predictions, the encoding side executes the above-mentioned steps 13 to 16 to obtain the code streams of the blocks to be encoded in the different prediction modes.The encoding side determines the time required to obtain the code streams of the blocks to be encoded in the different prediction modes, and determines the prediction mode that takes the shortest time as the target prediction mode.In other words, the encoding side determines the prediction mode with the highest coding efficiency as the target prediction mode.

[0190] In addition to conventional prediction modes, the present embodiment provides multiple prediction modes. In the prediction modes provided by the present embodiment, the encoding side can sequentially predict pixels in a block to be encoded in a predetermined order. Sequentially predicting pixels in a block to be encoded in a predetermined order by the encoding side means that the encoding side sequentially predicts pixels in the block to be encoded along a predetermined trajectory. In this process, when the encoding side predicts any pixel in the block to be encoded, the pixel for predicting that pixel has already been reconstructed. For a detailed description of the prediction modes provided by the present embodiment, please refer to the following, and a redundant description will be omitted here.

[0191] The encoding side predicts the encoding performance of the block to be encoded based on different prediction modes, determines the target prediction mode, and then determines the target prediction order when predicting pixels in the block to be encoded in the target prediction mode.

[0192] Here, the target prediction order may be a prediction order for pixels in the current block to be coded, or may be a prediction order for sub-blocks in the current block to be coded.

[0193] S102: The encoding side predicts each pixel in the encoding target block in the target prediction order according to the target prediction mode.

[0194] Preferably, the target prediction mode can indicate that each pixel in the block to be coded is predicted dot by dot in a target prediction order. For example, when the target prediction mode is one of the first to fifth prediction modes described below, the target prediction order is used to predict each pixel in the block to be coded dot by dot along a trajectory direction indicated by the target prediction order.

[0195] In this case, the encoding side predicts each pixel in the block to be encoded sequentially dot by dot along the trajectory direction indicated by the target prediction order, and obtains a predicted value for each pixel.

[0196] Preferably, the target prediction mode can indicate that pixels in each sub-block in the block to be coded are predicted sequentially in units of sub-blocks having a preset size in the block to be coded. For example, when the target prediction mode is a sixth prediction mode described later, the target prediction mode is used to indicate that pixels in each sub-block in the block to be coded are predicted sequentially in units of sub-blocks having a preset size in the block to be coded.

[0197] In this case, the target prediction mode includes a prediction mode in each sub-block in the block to be coded. In this way, the coding side can sequentially predict pixels in each sub-block in the block to be coded in accordance with the target prediction mode along the direction indicated by the target prediction order. Furthermore, when the coding side predicts one sub-block in the block to be coded, the coding side can predict each pixel in the sub-block in parallel based on the reconstructed pixels around the sub-block.

[0198] At step S103, the encoding side determines a residual block of the block to be encoded based on the predicted value of each pixel in the block to be encoded.

[0199] The encoding side can determine the residual block of the block to be encoded based on the predicted value of each pixel in the block to be encoded and the original pixel value in the block to be encoded.

[0200] For example, the encoding side can use the residual calculation means 202 shown in Figure 2 to calculate the difference between the predicted value of each pixel in the block to be encoded and the original pixel value in the block to be encoded, to obtain a residual block of the block to be encoded.

[0201] S104: The encoding side encodes the residual block in the residual scanning order to obtain a code stream of the block to be encoded.

[0202] Here, the residual scanning order corresponds to the target prediction mode, and preferably may be the same as the target prediction order.

[0203] For example, when the encoding target block is a 16x2 size image block, if the target prediction mode is a prediction mode shown in Table 1 described later, the residual scanning order may be the order shown by the preset trajectory shown in Figure 7a. If the target prediction mode is a prediction mode shown in Table 2 described later, the residual scanning order may be the order shown by the preset trajectory shown in Figure 7b. If the target prediction mode is a prediction mode shown in Table 3-1 described later, the residual scanning order may be the order shown by the preset trajectory shown in Figure 7c-1. If the target prediction mode is a prediction mode shown in Table 4-1 described later, the residual scanning order may be the order shown by the preset trajectory shown in Figure 7d-1.

[0204] Furthermore, for example, when the encoding target block is an 8x2 size image block, if the target prediction mode is a prediction mode shown in Table 3-2 described later, the residual scanning order may be the order shown by the preset trajectory shown in Figure 7c-2. If the target prediction mode is a prediction mode shown in Table 4-2 described later, the residual scanning order may be the order shown by the preset trajectory shown in Figure 7d-2.

[0205] Furthermore, for example, when the encoding target block is an 8x1 size image block, if the target prediction mode is a prediction mode shown in Table 4-3 described later, the residual scanning order may be the order shown by the preset trajectory shown in Figure 7d-3. If the target prediction mode is a prediction mode shown in Table 5 described later, the residual scanning order may be the order shown by the preset trajectory shown in Figure 7e.

[0206] Furthermore, for example, if the block to be coded is an image block of 16x2 size, and the target prediction mode is the prediction mode shown in Figure 7f described below, the residual scanning order may be the order shown by the pre-set trajectory shown in Figure 7g.

[0207] Preferably, the encoding side may perform a transform process on the residual block of the current block to obtain a residual coefficient block of the current block, quantize the residual coefficient block to obtain a quantized residual coefficient block, and then encode the quantized residual coefficient block in the target prediction order to obtain a coded codestream of the current block.

[0208] For example, the encoding side may first perform a transform process on the residual block of the block to be encoded using the residual transform means 203 shown in Fig. 2 to obtain a residual coefficient block of the block to be encoded. The encoding side may also quantize the residual coefficient block using the quantization means 204 shown in Fig. 2 to obtain a quantized residual coefficient block. Then, the encoding side may encode the quantized residual coefficient block using the encoding means 205 shown in Fig. 2 in the target prediction order to obtain a coded codestream of the block to be encoded.

[0209] Preferably, the encoding side directly quantizes the residual block of the current block to obtain a quantized residual block, and then encodes the quantized residual block in the target prediction order to obtain a coded codestream of the current block.

[0210] For example, the encoding side can directly quantize the residual block of the block to be encoded using the quantization means 204 shown in Fig. 2 to obtain a quantized residual block. Then, the encoding side can encode the quantized residual block in the target prediction order using the encoding means 205 shown in Fig. 2 to obtain an encoded codestream of the block to be encoded.

[0211] Preferably, the encoding side sets the target prediction mode as a syntax element of the block to be encoded, or sets the target prediction mode and the corresponding target prediction order as syntax elements of the block to be encoded, and encodes the syntax elements. The encoding side can also add the encoded syntax element data to an encoded codestream of the block to be encoded.

[0212] In the embodiments of the present application, the method for quantizing the residual block or residual coefficient block of the block to be coded is not particularly limited. For example, the residual block or residual coefficient block of the block to be coded can be quantized using the quantization method described in Example 2 below, and of course, this is not limited.

[0213] In the embodiments of the present application, the specific encoding method used by the encoding side to encode the quantized residual blocks or residual coefficients and related syntax elements is not particularly limited. For example, the encoding can be performed using a variable code length encoding method described in Example 3 below, and of course, there is no limitation thereto.

[0214] The prediction modes provided by the embodiments of the present application will be described in detail below. Note that the prediction mode for predicting one encoding target block can include at least one prediction method among the above-mentioned T prediction method, TB prediction method, L prediction method and RL prediction method. Here, one pixel in the encoding target block can be predicted by any one of the prediction methods of T prediction method, TB prediction method, L prediction method or RL prediction method.

[0215] Note that any of the prediction modes below can be applied to a flow in which the encoding side encodes an image, and can also be applied to a flow in which the decoding side decodes image data, and the embodiments of the present application are not limited to this.

[0216] In the first prediction mode, as shown in Table 1, taking the size of the block to be coded as 16x2 as an example, Table 1 shows the prediction modes for predicting each pixel in the block to be coded having a size of 16x2. In this prediction mode, the prediction order in which the coding side predicts pixels in the block to be coded may be the order indicated by a preset trajectory as shown in Figure 7a. In other words, when the coding side sequentially predicts pixels in the block to be coded according to the preset trajectory shown in Figure 7a, each pixel in the block to be coded is predicted using a specific prediction method in the prediction mode shown in Table 1.

[0217] [Table 1]

[0218] It should be understood that the prediction method shown in each grid in Table 1 is used to predict the predicted value of the pixel at the corresponding position in the block to be coded shown in Figure 7a. For example, the T prediction method shown in the first row, first grid in Table 1 is used to predict the predicted value of pixel 1-1 located in the first row, first grid in the block to be coded shown in Figure 7a. For example, the RL prediction method shown in the first row, second grid in Table 1 is used to predict the predicted value of pixel 1-2 located in the first row, second grid in the block to be coded shown in Figure 7a. For example, the T prediction method shown in the second row, first grid in Table 1 is used to predict the predicted value of pixel 2-1 located in the second row, first grid in the block to be coded shown in Figure 7a. For example, the T prediction method shown in the second row, fifteenth grid in Table 1 is used to predict the predicted value of pixel 1-15 located in the second row, fifteenth grid in the block to be coded shown in Figure 7a.

[0219] It should also be understood that the two 16x2 blocks shown in Figure 7a represent the same image block (e.g., the current block) in the image to be coded. In Figure 7a, the current block is represented by two blocks only to clearly show the predetermined trajectory when the coding side sequentially predicts pixels in the current block, and this predetermined trajectory is shown by the black solid line with an arrow in Figure 7a. Here, the origin is the starting point of the predetermined trajectory, and the pixel points on both ends of the black dashed line are two adjacent pixel points on the predetermined trajectory.

[0220] In this way, for example, when the encoding side predicts the block to be encoded according to the preset trajectory shown in Figure 7a, the encoding side first predicts pixel 1-1 shown in Figure 7a using the T prediction method shown in Table 1. That is, the predicted value of pixel 1-1 = P T1-1 and P T1-1 is the pixel above pixel 1-1 (e.g., a pixel in the upper image block of the block to be coded). It should be understood that the upper and left image blocks of the block to be coded are usually coded before the current block, and therefore the pixel values ​​in the upper and left image blocks of the block to be coded have already been reconstructed. It should be understood that after obtaining a predicted value of pixel 1-1, the coding side can determine a reconstructed value of pixel 1-1 based on the predicted value of pixel 1-1 (e.g., after obtaining a predicted value of pixel 1-1, the coding side performs steps 13 to 16 described above to reconstruct a residual value of the pixel by performing inverse quantization and inverse transform, and further obtains a reconstructed value of pixel 1-1 based on the predicted value and the reconstructed residual value).

[0221] Also, for example, the encoding side predicts pixel 1-1 according to the preset trajectory shown in FIG. 7a, and then predicts pixel 2-1 shown in FIG. 7a using the T prediction method shown in Table 1. That is, the predicted value of pixel 2-1=P T2-1 and P T2-1 is the reconstructed value of the pixel above pixel 2-1 (eg, reconstructed pixel 1-1).

[0222] Further, for example, the encoding side predicts pixel 2-15 according to the preset trajectory shown in FIG. 7a, and then predicts pixel 1-2 shown in FIG. 7a using the RL prediction method shown in Table 1. That is, the predicted value of pixel 1-2=(P R1-2 +P L1-2 +1)>>1, and (P R1-2 +P L1-2 +1)>>1 is (P R1-2 +P L1-2 +1) shifted one bit to the right, and the mathematical result, (P R1-2 +P L1-2 +1) divided by 21. R1-2 is the reconstructed value of the pixel to the right of pixel 1-2 (e.g., reconstructed pixel 1-3, since pixel 1-3 is before pixel 1-2 in the prediction order), and P L1-2 is the reconstructed value of the pixel to the left of pixel 1-2 (e.g., reconstructed pixel 1-1).

[0223] In the second prediction mode, as shown in Table 2, taking the size of the block to be coded as 16x2 as an example, Table 2 shows another prediction mode for predicting each pixel in the block to be coded having a size of 16x2. In this prediction mode, the prediction order in which the coding side predicts pixels in the block to be coded may be the order indicated by the preset trajectory shown in FIG. 7b. That is, when the coding side sequentially predicts pixels in the block to be coded using the preset trajectory shown in FIG. 7b, each pixel in the block to be coded is predicted using a specific prediction method in the prediction mode shown in Table 2. Here, for a detailed description of predicting each pixel in the block to be coded using the prediction method shown in Table 2, please refer to the description of predicting each pixel in the block to be coded using the prediction method shown in Table 1 above. For a description of the preset trajectory shown in FIG. 7b, please refer to the description of the preset trajectory in FIG. 7a, and redundant description will be omitted here.

[0224] [Table 2]

[0225] In this way, for example, when the encoding side predicts the block to be encoded according to the preset trajectory shown in Figure 7b, the encoding side first predicts pixel 2-1 shown in Figure 7b using the L prediction method shown in Table 2. That is, the predicted value of pixel 2-1 = P L2-1 and P L2-1 is the reconstructed value of the pixel to the left of pixel 2-1 (for example, the pixel in the left image block of the current block to be coded).

[0226] Further, for example, the encoding side predicts pixel 2-16 according to the preset trajectory shown in FIG. 7b, and then predicts pixel 1-1 shown in FIG. 7b using the TB prediction method shown in Table 2. That is, the predicted value of pixel 1-1=(P T1-1 +P B1-1 +1)>>1. P T1-1 is the reconstructed value of the pixel above pixel 1-1 (for example, the pixel in the upper image block of the block to be coded), and P B1-1 is the reconstructed value of the pixel below pixel 1-1 (e.g., reconstructed pixel 2-1, since pixel 2-1 comes before pixel 1-1 in the prediction order).

[0227] In the third prediction mode, as shown in Table 3-1, taking the size of the block to be coded as 16x2 as an example, Table 3-1 shows another prediction mode for predicting each pixel in the block to be coded having a size of 16x2. In this prediction mode, the prediction order in which the coding side predicts pixels in the block to be coded may be the order shown by the preset trajectory shown in Figure 7c-1. That is, when the coding side sequentially predicts pixels in the block to be coded using the preset trajectory shown in Figure 7c-1, each pixel in the block to be coded is predicted using a specific prediction method in the prediction mode shown in Table 3-1. Here, for a detailed description of predicting each pixel in the block to be coded using the prediction method shown in Table 3-1, please refer to the description regarding predicting each pixel in the block to be coded using the prediction method shown in Table 1 above. For a description of the preset trajectory shown in Figure 7c-1, please refer to the description of the preset trajectory in Figure 7a, and redundant description will be omitted here.

[0228] [Table 3-1]

[0229] In the third prediction mode, as shown in Table 3-2, taking the size of the block to be coded as an example of 8x2, Table 3-2 shows prediction modes for predicting each pixel in the block to be coded having a size of 8x2. In this prediction mode, the prediction order in which the coding side predicts pixels in the block to be coded may be the order shown by the preset trajectory shown in Figure 7c-2. That is, when the coding side sequentially predicts pixels in the block to be coded using the preset trajectory shown in Figure 7c-2, each pixel in the block to be coded is predicted using a specific prediction method in the prediction mode shown in Table 3-2. Here, for a detailed explanation of predicting each pixel in the block to be coded using the prediction method shown in Table 3-2, please refer to the explanation regarding predicting each pixel in the block to be coded using the prediction method shown in Table 1 above. For an explanation of the preset trajectory shown in Figure 7c-2, please refer to the explanation of the preset trajectory in Figure 7a, and redundant explanations will be omitted here.

[0230] [Table 3-2]

[0231] In the fourth prediction mode, as shown in Table 4-1, taking the size of the block to be coded as 16x2 as an example, Table 4-1 shows another prediction mode for predicting each pixel in the block to be coded having a size of 16x2. In this prediction mode, the prediction order in which the coding side predicts pixels in the block to be coded may be the order shown by the preset trajectory shown in Figure 7d-1. That is, when the coding side sequentially predicts pixels in the block to be coded using the preset trajectory shown in Figure 7d-1, each pixel in the block to be coded is predicted using a specific prediction method in the prediction mode shown in Table 4-1. Here, for a detailed description of predicting each pixel in the block to be coded using the prediction method shown in Table 4-1, please refer to the description of predicting each pixel in the block to be coded using the prediction method shown in Table 1 above. For a description of the preset trajectory shown in Figure 7d-1, please refer to the description of the preset trajectory in Figure 7a, and redundant description will be omitted here.

[0232] [Table 4-1]

[0233] In the fourth prediction mode, as shown in Table 4-2, taking the size of the block to be coded as an example of 8x2, Table 4-2 shows another prediction mode for predicting each pixel in the block to be coded having a size of 8x2. In this prediction mode, the prediction order in which the coding side predicts pixels in the block to be coded may be the order shown by the preset trajectory shown in Figure 7d-2. That is, when the coding side sequentially predicts pixels in the block to be coded using the preset trajectory shown in Figure 7d-2, each pixel in the block to be coded is predicted using a specific prediction method in the prediction mode shown in Table 4-2. Here, for a detailed explanation of predicting each pixel in the block to be coded using the prediction method shown in Table 4-2, please refer to the explanation regarding predicting each pixel in the block to be coded using the prediction method shown in Table 1 above. For an explanation of the preset trajectory shown in Figure 7d-2, please refer to the explanation of the preset trajectory in Figure 7a, and redundant explanations will be omitted here.

[0234] [Table 4-2]

[0235] In the fourth prediction mode, as shown in Table 4-3, taking the size of the block to be coded as an example of 8×1, Table 4-3 shows another prediction mode for predicting each pixel in the block to be coded having a size of 8×1. In this prediction mode, the prediction order in which the coding side predicts pixels in the block to be coded may be the order shown by the preset trajectory shown in FIG. 7d-3. That is, when the coding side sequentially predicts pixels in the block to be coded using the preset trajectory shown in FIG. 7d-3, each pixel in the block to be coded is predicted using a specific prediction method in the prediction mode shown in Table 4-3. Here, for a detailed description of predicting each pixel in the block to be coded using the prediction method shown in Table 4-3, please refer to the description of predicting each pixel in the block to be coded using the prediction method shown in Table 1 above. For a description of the preset trajectory shown in FIG. 7d-3, please refer to the description of the preset trajectory in FIG. 7a, and redundant description will be omitted here.

[0236] [Table 4-3]

[0237] In the fifth prediction mode, as shown in Table 5, taking the size of the block to be coded as an example of 8×1, Table 5 shows prediction modes for predicting each pixel in the block to be coded having a size of 8×1. In this prediction mode, the prediction order in which the coding side predicts pixels in the block to be coded may be the order shown by the preset trajectory shown in FIG. 7e. That is, when the coding side sequentially predicts pixels in the block to be coded using the preset trajectory shown in FIG. 7e, each pixel in the block to be coded is predicted using a specific prediction method in the prediction mode shown in Table 5. Here, for a detailed description of predicting each pixel in the block to be coded using the prediction method shown in Table 5, please refer to the description of predicting each pixel in the block to be coded using the prediction method shown in Table 1 above. For a description of the preset trajectory shown in FIG. 7e, please refer to the description of the preset trajectory in FIG. 7a, and redundant description will be omitted here.

[0238] [Table 5]

[0239] As can be seen from the above, each prediction mode corresponds to a different prediction order.For example, when the prediction mode is a first prediction mode, the prediction order is a first prediction order, and when the prediction mode is a second prediction mode, the prediction order is a second prediction order, and the first prediction order and the second prediction order are different.The first prediction order and the second prediction order may be one of the prediction orders corresponding to the first to sixth prediction modes in the above-mentioned example.

[0240] Also, as can be seen, in the same prediction mode, when the size of the block to be coded is different, the corresponding prediction order is also different.For example, for the block to be coded of a first size, the first prediction mode predicts the block to be coded in the third prediction order, and for the block to be coded of a second size, which is different from the third prediction order and the fourth prediction order, the first prediction mode predicts the block to be coded in the fourth prediction order.For example, for the block to be coded of three different sizes, 16x2, 8x2, and 8x1, the fourth prediction mode can use three different prediction orders, as shown in Figure 7d-1, Figure 7d-2, and Figure 7d-3.

[0241] Here, the first prediction order, the second prediction order, the third prediction order, and the fourth prediction order can all represent prediction trajectories for pixels within the block to be coded, and can also represent prediction trajectories for sub-blocks in the block to be coded.

[0242] The sixth prediction mode is used to indicate that the encoding side sequentially predicts each sub-block in the current block to be encoded along a direction indicated by a prediction order corresponding to the prediction mode, with each sub-block having a preset size in the current block as a unit. In this prediction mode, when predicting any of the sub-blocks in the current block to be encoded, the encoding side can predict pixels in the sub-block in parallel based on reconstructed pixels around the sub-block.

[0243] In such a prediction mode, the encoding side can divide the block to be encoded into multiple non-overlapping sub-blocks of a preset size, and arrange the divided sub-blocks in the direction indicated by the prediction order corresponding to the prediction mode.

[0244] As an example, refer to FIG. 7f, which shows a schematic diagram of one sub-block of the block to be coded provided by an embodiment of the present application.

[0245] As shown in (a) of Figure 7f, assuming that the sub-blocks having a preset size are 2x2 sub-blocks, for a 16x2 block to be coded, the block to be coded can be divided into eight non-overlapping 2x2 sub-blocks as shown by the thick black frames in (a) of Figure 7f. The arrangement direction of these eight sub-blocks, that is, the direction indicated as the prediction order corresponding to the prediction mode, is, for example, the direction indicated by the arrow shown in (a) of Figure 7f.

[0246] As shown in (b) of Figure 7f, assuming that the sub-blocks having the preset size are 4x2 sub-blocks, for a 16x2 block to be coded, the block to be coded can be divided into four non-overlapping 4x2 sub-blocks as shown by the thick black frames in (b) of Figure 7f. The arrangement direction of these four sub-blocks, that is, the direction indicated as the prediction order corresponding to the prediction mode, is, for example, the direction indicated by the arrow shown in (b) of Figure 7f.

[0247] As shown in (c) of Figure 7f, assuming that the sub-blocks having the preset size are 8x2 sub-blocks, for a 16x2 block to be coded, the block to be coded can be divided into two non-overlapping 8x2 sub-blocks as shown by the thick black frames in (c) of Figure 7f. The arrangement direction of these two sub-blocks, that is, the direction indicated as the prediction order corresponding to the prediction mode, is, for example, the direction indicated by the arrow shown in (c) of Figure 7f.

[0248] Specifically, for any sub-block in the current block to be coded, the sixth prediction mode indicates that pixels in the sub-block are predicted based on reconstructed values ​​of pixels above (adjacent or not), to the left (adjacent or not), and diagonally above (adjacent or not) the sub-block. Note that in this prediction mode, one pixel in one sub-block is not predicted depending on other pixels in the same sub-block. For simplicity's sake, in this embodiment, this prediction mode indicates that pixels in the sub-block are predicted based on reconstructed values ​​of neighboring pixels above, to the left, and diagonally above the sub-block.

[0249] The sixth prediction mode indicates that each sub-block in the block to be coded is predicted sequentially in the direction indicated by the prediction order corresponding to the prediction mode, with the sub-block shown in (a) of Figure 7f as a unit. Assuming that one of the sub-blocks is sub-block a, and the gray grid shown in (a) of Figure 7f is the pixel adjacent to the upper, left, and diagonally upper side of sub-block a. The pixels in sub-block a are Y0, Y1, Y2, and Y3, respectively, and the upper pixel in sub-block a includes T0 and T1, the left pixel in sub-block a includes L0 and L1, and the diagonally upper pixel in sub-block a is LT.

[0250] In one possible embodiment, the sixth prediction mode can specifically indicate that the predicted value of Y0 in sub-block a is obtained based on T0, L0 and LT, the predicted value of Y1 in sub-block a is obtained based on T1, L0 and LT, the predicted value of Y2 in sub-block a is obtained based on T0, L1 and LT, and the predicted value of Y3 in sub-block a is obtained based on T1, L1 and LT.

[0251] Preferably, the first prediction method specifically indicated by the sixth prediction mode may be to determine a predicted value of any pixel in any sub-block of the block to be encoded based on the horizontal gradient or vertical gradient of the pixel above, to the left of, and diagonally above the pixel.

[0252] Referring to FIG. 7f(a), taking pixel Y0 of subblock a as an example, if the encoding side determines that the reconstructed values ​​of the pixel T0 above Y0, the pixel L0 to the left of Y0, and the pixel L0 diagonally above Y0 satisfy condition 1, the encoding side determines the reconstructed value of the pixel L0 to the left of Y0 as the predicted value of Y0. Here, condition 1 is used to indicate that the horizontal gradient of the pixels surrounding Y0 is minimum. Specifically, condition 1 is |reconstructed value of T0−reconstructed value of L0|≦|reconstructed value of L0−reconstructed value of L0| and |reconstructed value of T0−reconstructed value of L0+reconstructed value of T0−2*LT|. If the encoding side determines that the reconstructed values ​​of the pixel T0 above Y0, the pixel L0 to the left of Y0, and the pixel L0 diagonally above Y0 satisfy condition 2, the encoding side determines the reconstructed value of the pixel T0 above Y0 as the predicted value of Y0. Here, condition 2 is used to indicate that the vertical gradient of the pixels surrounding Y0 is minimum. Specifically, condition 2 is |reconstructed value of T0-reconstructed value of LT|≦|reconstructed value of L0+reconstructed value of T0-2*LT|. If the encoding side determines that the reconstructed values ​​of the pixel T0 above Y0, the pixel L0 to the left, and the pixel LT diagonally above Y0 do not satisfy conditions 1 and 2, the encoding side determines the reconstructed value of the pixel LT diagonally above Y0 as the Y0 predicted value.

[0253] Preferably, the prediction method 2 specifically indicated by the sixth prediction mode may be to determine a predicted value of any pixel in any sub-block of the block to be coded based on the average value of the reconstructed values ​​of the pixel above, the pixel to the left of, and the pixel diagonally above the pixel.

[0254] Continuing to refer to (a) of Figure 7f, taking pixel Y0 of sub-block a as an example, the predicted value of Y0 may be (reconstructed value of L0+reconstructed value of T0+2*LT)>>2, where (reconstructed value of L0+reconstructed value of T0+2*LT) represents the binary value of (reconstructed value of L0+reconstructed value of T0+2*LT) shifted right by 2 bits.

[0255] In another possible embodiment, the sixth prediction mode specifically indicates that a reconstructed value of a pixel above, to the left of, or diagonally above any pixel in a sub-block of a current block is determined as a predicted value of the pixel. Here, the prediction direction may be a 45-degree diagonal left direction or a 45-degree diagonal right direction of the pixel, and the embodiment of the present application is not limited thereto.

[0256] As an example, the sixth prediction mode is used to indicate that each sub-block in the block to be coded is predicted sequentially according to the prediction order corresponding to the prediction mode, with the sub-block shown in (b) of Figure 7f as a unit. Referring to (b) of Figure 7f, assume that one of the sub-blocks is sub-block b, and the gray grid shown in (b) of Figure 7f is the pixels adjacent to the upper, left, and diagonally upper side of sub-block b. The pixels in sub-block b are Y0, Y1, Y2, Y3, Y4, Y5, Y6, and Y7, respectively, the upper pixels in sub-block b include T0, T1, T2, T3, T4, and T5, the left pixels in sub-block b include L0 and L1, and the diagonally upper pixel in sub-block b is LT.

[0257] When the prediction direction is a 45-degree diagonal left direction of the pixel to be predicted, the sixth prediction mode specifically determines the reconstructed value of LT at 45 degrees diagonal left direction of Y0 in sub-block b as the predicted value of Y0, determines the reconstructed value of T0 at 45 degrees diagonal left direction of Y1 in sub-block b as the predicted value of Y1, determines the reconstructed value of T1 at 45 degrees diagonal left direction of Y2 in sub-block b as the predicted value of Y2, and determines the reconstructed value of T2 at 45 degrees diagonal left direction of Y3 in sub-block b as the predicted value of Y3. It shows that the reconstructed value is determined as the predicted value of Y3, the reconstructed value of L0 at a 45-degree diagonal angle to the left of Y4 in sub-block b is determined as the predicted value of Y4, the reconstructed value of LT at a 45-degree diagonal angle to the left of Y5 in sub-block b is determined as the predicted value of Y5, the reconstructed value of T0 at a 45-degree diagonal angle to the left of Y6 in sub-block b is determined as the predicted value of Y6, and the reconstructed value of T1 at a 45-degree diagonal angle to the left of Y7 in sub-block b is determined as the predicted value of Y7.

[0258] When the prediction direction is a 45-degree diagonal right direction of the pixel to be predicted, the sixth prediction mode specifically determines the reconstructed value of T1 at 45 degrees diagonal right direction of Y0 in sub-block b as the predicted value of Y0, determines the reconstructed value of T2 at 45 degrees diagonal right direction of Y1 in sub-block b as the predicted value of Y1, determines the reconstructed value of T3 at 45 degrees diagonal right direction of Y2 in sub-block b as the predicted value of Y2, and determines the reconstructed value of T4 at 45 degrees diagonal right direction of Y3 in sub-block b as the predicted value of Y1. The reconstructed value of Y3 is determined as the predicted value of Y3, the reconstructed value of T2 at a 45-degree diagonal angle to the right of Y4 in sub-block b is determined as the predicted value of Y4, the reconstructed value of T3 at a 45-degree diagonal angle to the right of Y5 in sub-block b is determined as the predicted value of Y5, the reconstructed value of T4 at a 45-degree diagonal angle to the right of Y6 in sub-block b is determined as the predicted value of Y6, and the reconstructed value of T5 at a 45-degree diagonal angle to the right of Y7 in sub-block b is determined as the predicted value of Y7.

[0259] Preferably, when the target prediction mode includes a prediction mode for each sub-block in the block to be decoded, for a first sub-block in the block to be decoded, if the first sub-block includes a first pixel and a second pixel, the prediction mode of the first sub-block is used to predict the first pixel and the second pixel in parallel based on reconstructed pixels around the first sub-block.

[0260] Here, the first subblock is a subblock in the block to be decoded that is currently being predicted. For example, as shown in (a) of FIG. 7f, if the size of each subblock in the block to be decoded is 2×2, the block to be decoded can be divided into eight subblocks. When starting prediction of the block to be coded shown in (a) of FIG. 7f, the first subblock is the first subblock from left to right. After completing reconstruction of the pixels in the first subblock, reconstruction of the pixels in the second subblock from left to right can begin, and at this time, the first subblock is the second subblock. The first pixel and the second pixel included in the first subblock may be two sets of non-overlapping pixels in the first subblock, and the first pixel or the second pixel may include one or more pixels in the first subblock. For example, taking subblock a in (a) of FIG. 7f as an example, in one case, the first pixel in subblock a may include Y0, and the second pixel in subblock a may include Y1, Y2, and Y3. Alternatively, the first pixel in sub-block a may include Y0 and Y1, and the second pixel in sub-block a may include Y2 and Y3. Alternatively, the first pixel in sub-block a may include Y1, and the second pixel in sub-block a may include Y2.

[0261] In addition, when the encoding side predicts pixels in the block to be encoded using the sixth prediction mode, when the encoding side encodes the residual block or residual coefficient block corresponding to the block to be encoded, the encoding can be performed in the order shown by the trajectory in Figure 7g.

[0262] According to the encoding method described in S101 to S104 above, when predicting pixels in a block to be encoded in a target prediction mode, the encoding side predicts the pixels in the block to be encoded in a target prediction order corresponding to the target prediction mode. In this process, when the encoding side predicts any pixel in the block to be encoded, the pixel for predicting that pixel has already been reconstructed. Therefore, the encoding method provided by the embodiment of the present application predicts each pixel in the block to be encoded in a target prediction order according to the target prediction mode, and can predict some pixels in the block to be encoded in parallel, thereby improving prediction efficiency for pixels in the block to be encoded. When re-obtaining reconstructed values ​​based on predicted values ​​and residual values, the encoding side does not need to cache the residual values. Therefore, the encoding method provided by the embodiment of the present application not only saves cache space for caching residual values, but also improves coding efficiency.

[0263] Furthermore, if the target prediction mode indicates that each sub-block in the block to be coded is predicted sequentially in units of sub-blocks, in this prediction mode, when predicting a sub-block, the coding side can predict multiple pixels in the sub-block in parallel based on the reconstructed pixels around the sub-block, that is, this prediction mode allows the coding side to further improve the prediction efficiency for the block to be coded. Furthermore, when the coding side re-obtains the reconstructed value based on the predicted value and the residual value, the coding side does not need to cache the residual value, so the coding method provided by the embodiment of the present application further saves cache space and improves coding efficiency.

[0264] As shown in Figure 8, which is a schematic flowchart of another image decoding method provided by an embodiment of the present application, the method shown in Figure 8 includes the following steps:

[0265] In step S201, the decoding side analyzes the code stream of the block to be decoded and determines a target prediction mode for predicting pixels in the block to be decoded. Here, the code stream of the block to be decoded may be a code stream received by the decoding side from the encoding side, or may be a code stream obtained from another device, for example, a code stream obtained from a storage device, and the embodiments of the present application are not limited to this. Here, the target prediction mode is used to predict pixels in the block to be decoded to obtain predicted values ​​of the pixels in the block to be decoded, and is understood to be a prediction mode used by the encoding side to predict pixels in the image block when encoding.

[0266] Specifically, the decoding side can obtain the target prediction mode by analyzing the code stream of the block to be decoded using a decoding method corresponding to the encoding side.

[0267] In step S202, the decoding side determines a target prediction order corresponding to the target prediction mode based on the target prediction mode. Here, the above description can be referred to for the description of the prediction modes and the prediction orders corresponding to the prediction modes, and a redundant description will be omitted here.

[0268] Preferably, a correspondence relationship between a plurality of prediction modes and a corresponding prediction order may be set in advance on the decoding side. In this way, when the decoding side determines a prediction mode as a target prediction mode, it can determine a target prediction order corresponding to the target prediction mode from the preset correspondence relationships.

[0269] In step S203, the decoding side predicts each pixel in the block to be decoded in the target prediction order according to the target prediction mode, and obtains a predicted value for each pixel. Here, for an explanation of predicting each pixel in the block to be decoded in a prediction order corresponding to the prediction mode based on the prediction mode, please refer to the detailed explanation of the prediction mode described above, and redundant explanation will be omitted here.

[0270] In step S204, the decoding side reconstructs each pixel based on the predicted value of each pixel in the block to be decoded, and obtains a reconstructed block of the block to be decoded.

[0271] Preferably, the decoding side can first obtain a residual block of the block to be decoded by analyzing the codestream. Then, the decoding side dequantizes the residual block to obtain a reconstructed residual block of the block to be decoded. In this way, the decoding side can obtain a reconstructed block of the block to be decoded based on the predicted values ​​of pixels in the block to be decoded obtained above and the residual values ​​in the reconstructed residual block.

[0272] For example, the decoding side first analyzes the code stream of the block to be decoded using the code stream analysis means 301 shown in Fig. 5 to obtain a residual block of the block to be decoded. Then, the decoding side inversely quantizes the residual block using the inverse quantization means 302 shown in Fig. 5 to obtain a reconstructed residual block of the block to be decoded. In this way, the decoding side can obtain a reconstructed block of the block to be decoded using the reconstruction means 305 based on the predicted values ​​of the pixels in the block to be decoded obtained above and the residual values ​​in the reconstructed residual block.

[0273] Preferably, the decoding side can first obtain a residual coefficient block of the block to be decoded by analyzing the codestream. Then, the decoding side inversely quantizes the residual block to obtain a dequantized residual coefficient block. Next, the decoding side inversely transforms the dequantized residual coefficient block to obtain a reconstructed residual block of the block to be decoded. In this way, the decoding side can obtain a reconstructed block of the block to be decoded based on the predicted values ​​of pixels in the block to be decoded obtained above and the residual values ​​in the reconstructed residual block.

[0274] For example, the decoding side first analyzes the code stream of the block to be decoded using the code stream analysis means 301 shown in Fig. 5 to obtain a residual coefficient block of the block to be decoded. Then, the decoding side inversely quantizes the residual coefficient block using the inverse quantization means 302 shown in Fig. 5 to obtain a dequantized residual coefficient block. Next, the decoding side inversely transforms the dequantized residual coefficient block using the residual inverse transform means 303 shown in Fig. 5 to obtain a reconstructed residual block of the block to be decoded. In this way, the decoding side can obtain a reconstructed block of the block to be decoded using the reconstruction means 305 based on the predicted values ​​of pixels in the block to be decoded obtained above and the residual values ​​in the reconstructed residual block.

[0275] Here, the decoding side can analyze the code stream of the block to be decoded using a decoding method corresponding to the encoding side to obtain a residual block or a residual coefficient block of the block to be decoded. For example, the residual scanning order in which the decoding side decodes the code stream of the block to be decoded is the target prediction order for predicting pixels in the block to be decoded. Here, the target prediction order corresponds to the target prediction mode for predicting the block to be decoded. For an explanation of the residual scanning order, please refer to the above explanation, and redundant explanation will be omitted here.

[0276] Note that the image decoding method shown in Figure 8 corresponds to the image encoding method shown in Figure 6c, and therefore this image decoding method contributes to improving prediction efficiency for the block to be decoded, and when reconstructing the block to be decoded based on the predicted value and the residual value to obtain the reconstructed value of the block to be decoded, it is possible to save cache space for caching the residual value, thereby improving decoding efficiency.

[0277] In the embodiments of the present application, the method for inverse quantizing the residual block or residual coefficient block of the block to be decoded is not particularly limited. For example, the residual block or residual coefficient block of the block to be decoded can be inverse quantized using the inverse quantization method described in the embodiment 2 below, and of course, this is not limited.

[0278] Furthermore, in the embodiments of the present application, the method by which the decoding side decodes the code stream of the block to be decoded is not particularly limited, and for example, decoding can be performed using a variable code length decoding method described in Example 3 below, and of course, there is no limitation thereto.

[0279] Example 2 As shown in Figure 9a, which is a schematic flowchart of another image encoding method provided by an embodiment of the present application, the method shown in Figure 9a includes the following steps:

[0280] In step S301, the encoding side determines a second residual block of the encoding target block and a quantization parameter QP for each pixel in the encoding target block. Here, the second residual block may be the original residual value block of the block to be coded, or may be a residual coefficient block obtained by transforming this original residual value block.

[0281] Here, the original residual value block of the block to be coded is a residual block obtained by the coding side based on the original pixel values ​​of the block to be coded and a predicted block of the block to be coded. The process by which the coding side predicts pixels in the block to be coded to obtain a predicted block can be realized based on the method described in Example 1, and of course, can be obtained based on any method for obtaining a predicted block of the block to be coded in the prior art, and it is understood that this is not limited in the embodiments of the present application. The residual coefficient block is obtained by performing a transform process on the original residual value block on the coding side, and the embodiments of the present application do not specifically limit the process by which the coding side performs a transform process on the original residual value block.

[0282] For ease of explanation, the following embodiments of the present application will be described taking as an example that the second residual block is the original residual value block of the current block to be coded.

[0283] The encoding side may also determine a quantization parameter QP for each pixel in the current block before or after obtaining the second residual block of the current block. For example, the encoding side may read a preset quantization parameter QP. Here, the embodiment of the present application does not specifically limit the process by which the encoding side determines a quantization parameter QP for each pixel in the current block.

[0284] S302: The encoding side quantizes the second residual block based on the QP of each pixel in the block to be encoded and the quantization preset array, to obtain a first residual block. Here, the quantization preset array is used to quantize the values ​​in the second residual block.

[0285] In a first possible embodiment, the quantization preset array includes an amplification parameter array and a displacement parameter array, and the amplification parameter array and the displacement parameter array include the same number of numerical values. When the amplification parameter in the amplification parameter array is represented by amp and the displacement parameter in the displacement parameter array is represented by shift, the encoding side can perform quantization processing on each value in the second residual block based on Equation (1).

[0286]

number

[0287] Here, amp[QP] represents the QPth amplification parameter in the amplification parameter array, shift[QP] represents the QPth displacement parameter in the displacement parameter array, and (pre-quantization residual value × amp[QP]) >> shift[QP] represents a right shift of shift[QP] bits for the (pre-quantization residual value × amp[QP]) binary value.

[0288] In the embodiment of the present application, for the value amp[i] of the i-th amplification parameter in the amplification parameter array and the value shift[i] of the i-th displacement parameter in the displacement parameter array,shift[i] In the inverse quantization preset array consisting of the quotient of amp[i] and amp[i], the interval between two adjacent numbers is 1 in the 1st to nth numbers in the inverse quantization preset array, the interval between two adjacent numbers is 2 in the n+1st to n+mth numbers, and the interval between two adjacent numbers is 2 in the n+k*m+1st to n+k*m+mth numbers. k+1 where n and m are integers greater than 1, and i and k are both positive integers.

[0289] Here, the inverse quantization preset array is used to realize the inverse quantization process of the first residual block obtained by quantization, and the inverse quantization operation realized by the inverse quantization preset array and the quantization operation realized by the quantization preset array are mutually inverse. Therefore, based on the inverse quantization preset array having the above rules, it is possible to determine the amplification parameter array and the displacement parameter array for realizing the quantization operation in the reverse direction.

[0290] As an example, the amplification parameter in the dequantization preset array is represented by mult, and the dequantization preset array includes 42 amplification parameters. For example, the above n is set to 12 and m is set to 6, and the dequantization preset array having the above rule is as follows:

number

number

number

[0291] In this way, the encoding side can determine the amplification parameter for each pixel in the amplification parameter array based on the determined QP of the pixel in the current block to be encoded, and determine the displacement parameter for each pixel in the displacement parameter array, and then perform a quantization operation on the second residual block based on the amplification parameter and displacement parameter corresponding to each pixel in the current block to obtain a first residual block.

[0292] For example, for any pixel in the block to be coded, the coding side can search the amplification parameter array based on the determined QP of the pixel, determine the QPth value in the amplification parameter array as the amplification parameter for the pixel, and determine the QPth value in the displacement parameter array as the displacement parameter for the pixel.The coding side then quantizes the residual value corresponding to the pixel in the second residual block using Equation (1) based on the amplification parameter and displacement parameter corresponding to the pixel, thereby obtaining a quantized residual value corresponding to the pixel.When the coding side completes the quantization process for all residual values ​​in the second residual block, a first residual block is obtained.

[0293] With this feasible embodiment, the encoding side only needs to perform up to six types of multiplication when quantizing the residual values ​​in the second residual block, and compared with the prior art, this method significantly reduces the amount of calculation on the encoding side, that is, this method significantly saves the computing resources on the encoding side.

[0294] In a second possible embodiment, the quantization preset array can include fewer values ​​than the first possible embodiment. In this embodiment, the encoding side can implement the quantization process of each residual value in the second residual block according to Equation (2).

[0295]

number

[0296] Here, amp is an amplification parameter determined by the encoding side based on the QP of each pixel in the block to be encoded and the quantization preset array, and shift is a displacement parameter determined by the encoding side based on the QP of each pixel in the block to be encoded and the quantization preset array, and offset is an offset parameter that can round off the residual value after quantization, and (residual value before quantization × amp + offset) "shift" represents a right shift of the shift bit for the binary value of (residual value before quantization × amp + offset).

[0297] Specifically, the value of the amplification parameter amp corresponding to each pixel in the block to be coded determined by the coding side is the value corresponding to the logical product of the QP of each pixel and 7 in the quantization preset array, and the value of the displacement parameter shift corresponding to each pixel in the block to be coded determined by the coding side is the logical product of 7 and the QP of each pixel 3 It is the sum of the quotients obtained by dividing by .

[0298] That is, assuming that the values ​​in the quantization preset array are represented by quant_scal, the amplification parameter amp can be calculated by quant_scale[QP&0x07], and the displacement parameter shift can be calculated by 7+(QP>>3). Here, [QP&0x07] represents the logical product of the binary value of QP and 7 (equivalent to the mathematical result of dividing QP by 8 and taking the remainder), and quant_scale[QP&0x07] is the QP&0x07th value in the quantization preset array. QP>>3 indicates a right shift of 3 bits for the binary value of QP.

[0299] Also, offset can be calculated as 1<<(shift-1), which represents a left shift of (shift-1) for the binary value of 1 (the mathematical result is 1 multiplied by 2 to the power of (shift-1)).

[0300] In the embodiment of the present application, when the encoding side implements the quantization process of the second residual block using equation (2), the quantization preset array may be quant_scal[8]={128, 140, 153, 166, 182, 197, 216, 234}.

[0301] In this way, the encoding side calculates the gain parameter and displacement parameter corresponding to each pixel in the determined encoding target block based on the QP of the pixel and the quantization preset array, and then quantizes the second residual block using equation (2) based on the calculated gain parameter, displacement parameter, and offset parameter of each pixel in the encoding target block to obtain the first residual block.

[0302] As can be seen, according to this possible embodiment, the encoding side needs to perform up to eight kinds of multiplications when quantizing the residual values ​​in the second residual block. Compared with the prior art, this method greatly reduces the amount of calculation on the encoding side, that is, this method greatly saves the computing resources on the encoding side.

[0303] In a third possible embodiment, the encoding side can implement the quantization process of each residual value in the second residual block by equation (3).

[0304]

number

[0305] Here, shift represents a displacement parameter, and the value of shift is related to QP and is a monotonically non-decreasing integer. Alternatively, if QP is increasing, shift corresponds one-to-one to QP, and the value of shift is a monotonically non-increasing integer. For an explanation of offset, please refer to the above explanation, and a redundant explanation will be omitted here. The offset is determined by (shift==0)?0:(1<<(shift-1)). Specifically, when shift is 0, the offset is set to 0, and when shift is not 0, the offset is set to (1<<(shift-1)) (i.e., the value obtained by shifting (shift-1) bits to the left for a binary value of 1).

[0306] In this way, the encoding side can determine the displacement parameter of each pixel in the determined encoding target block based on the QP of the pixel, and further determine the corresponding offset parameter. Then, the encoding side can quantize the second residual block according to Equation (3) based on the displacement parameter and offset parameter of each pixel in the determined encoding target block to obtain the first residual block.

[0307] As can be seen, according to this possible embodiment, the encoding side does not need to perform multiplication operations when quantizing the residual values ​​in the second residual block. Compared with the prior art, in encoding scenarios where the requirements for quantization granularity are not high, this method can greatly reduce the computational complexity of the encoding side, that is, this method can greatly save the computational resources of the encoding side.

[0308] S303: The encoding side encodes the first residual block to obtain a codestream of the block to be encoded.

[0309] The encoding side obtains and encodes the first residual block to obtain an encoded codestream of the block to be encoded.

[0310] Preferably, the encoding side encodes the syntax elements of the current block, including the QPs corresponding to each pixel when quantizing the second residual block and the quantization method specifically used, and adds the encoded syntax element data to the encoded codestream of the current block.

[0311] Preferably, the residual scanning order in which the encoding side encodes the first residual block may be a target prediction order in which the encoding side predicts pixels in the block to be encoded. Here, the target prediction order corresponds to a target prediction mode in which the block to be decoded is predicted. For the description of the target prediction mode and the target prediction order, please refer to the above description, and redundant description will be omitted here.

[0312] In the embodiments of the present application, the specific mode for predicting the block to be coded is not particularly limited, and for example, the prediction mode described in Example 1 above can be used to predict the block to be coded, and of course, there is no limitation thereto.

[0313] Furthermore, the embodiments of the present application do not specifically limit the specific encoding method used by the encoding side to encode the first residual block and related syntax elements, and for example, the encoding can be performed using the variable code length encoding method described in Example 3.

[0314] According to the image coding method described in S301 to S303 above, a quantization processing method that can save computational resources on the coding side is used in the image coding process, that is, the efficiency of the quantization processing process in this image coding method is greatly improved, so that according to this image coding method, the image coding efficiency is greatly improved.

[0315] As shown in Figure 9b, which is a schematic flowchart of another image decoding method provided by an embodiment of the present application, the method shown in Figure 9b includes the following steps:

[0316] At S401, the decoding side analyzes the code stream of the block to be decoded, and obtains the inverse quantization parameters of each pixel in the block to be decoded and the first residual block of the block to be decoded. Here, the code stream of the block to be decoded may be a code stream received by the decoding side from the encoding side, or a code stream obtained from another device, for example, a code stream obtained from a storage device, and the embodiments of the present application are not limited to this. Here, the inverse quantization parameter is used to indicate that the decoding side should perform inverse quantization processing on the residual values ​​in the first residual block using an inverse quantization method corresponding to the inverse quantization parameter. The inverse quantization parameter may include a quantization parameter QP.

[0317] Specifically, the decoding side analyzes the code stream of the block to be decoded using a decoding method corresponding to the encoding side, and obtains the inverse quantization parameters of each pixel in the block to be decoded and the first residual block of the block to be decoded.

[0318] For example, the residual scan order in which the decoding side decodes the code stream of the block to be decoded is the target prediction order for predicting pixels in the block to be decoded. Here, the target prediction order corresponds to the target prediction mode for predicting the block to be decoded. For the description of the target prediction mode and the target prediction order, please refer to the above description, and redundant description will be omitted here.

[0319] Preferably, the decoding side analyzes the code stream of the block to be decoded using a variable code length decoding method to obtain the coding code length CL for encoding each value in the residual block corresponding to the block to be decoded and the first residual block. Here, the decoding side can refer to the description of S601 below for the process of analyzing the code stream of the block to be decoded using a variable code length decoding method and obtaining CL for each value in the residual block corresponding to the block to be decoded. For the description of the decoding side determining the first residual block based on CL, refer to the description of S602, and redundant description will be omitted here.

[0320] Other possible implementations of step S401 will be described later, but redundant explanations will be omitted here.

[0321] At S402, the decoding side dequantizes the first residual block based on the QP indicated by the dequantization parameter of each pixel in the block to be decoded and the dequantization preset array, to obtain a second residual block.

[0322] In a first possible embodiment, when the decoding side determines, based on the inverse quantization parameters of each pixel in the block to be decoded, that the inverse quantization method of the first residual block and the quantization method described in the first possible embodiment at S302 above are mutually inverse, the description of the inverse quantization preset array can refer to the description of the inverse quantization preset array at S302, and redundant description will be omitted here.

[0323] In this case, the decoding side can determine the amplification parameter corresponding to each pixel from the inverse quantization preset array based on the QP of each pixel in the block to be decoded. Then, the decoding side can perform inverse quantization processing on the first residual block based on the amplification parameter corresponding to each pixel to obtain the second residual block.

[0324] For example, for any pixel in the block to be decoded, the decoding side can search the dequantization preset array based on the QP of the pixel and determine the QPth value in the dequantization preset array as the amplification parameter for the pixel.The decoding side then multiplies the residual value corresponding to the pixel in the first residual block by the amplification parameter corresponding to the pixel to obtain a dequantized residual value corresponding to the pixel.When the decoding side completes the dequantization process for all residual values ​​in the first residual block, it obtains a second residual block.

[0325] Preferably, the decoding side determines an amplification parameter corresponding to each pixel in the block to be decoded, and then performs a left shift operation on the residual value in the first residual block corresponding to each pixel, thereby realizing multiplication of the residual value by the amplification parameter corresponding to that residual value, but this is not limited to this in the embodiments of the present application.

[0326] In a second possible embodiment, when the decoding side determines based on the inverse quantization parameters of each pixel in the block to be decoded that the inverse quantization method of the first residual block and the quantization method described in the second possible embodiment at S302 above are mutually inverse, the decoding side can realize an inverse quantization process for each residual value in the first residual block based on the above equation (2) to obtain a second residual block.

[0327] In this case, the amplification parameter mult in equation (2) (to be distinguished from amp in the above quantization process) is calculated using dequant_scale[QP&0x07], which is the QP&0x07th value in the dequantization preset array. The displacement parameter shift in equation (2) is calculated using 7-(QP>>3). The offset parameter offset in equation (2) is calculated using (shift==0)?0:(1<(shift-1)).

[0328] In the embodiment of the present application, when the decoding side implements the inverse quantization process of the first residual block using equation (2), the inverse quantization preset array may be dequant_scal[8]={128, 117, 107, 99, 90, 83, 76, 70}.

[0329] In this way, the decoding side calculates the amplification parameter and displacement parameter corresponding to each pixel in the block to be decoded based on the QP of the pixel and the inverse quantization preset array. Then, the decoding side realizes the inverse quantization of the first residual block according to the formula (2) based on the calculated amplification parameter, displacement parameter, and offset parameter of each pixel in the block to be decoded, and obtains the second residual block.

[0330] As can be seen, according to this possible embodiment, the decoding side needs to perform up to eight kinds of multiplication operations when inversely quantizing the residual values ​​in the first residual block. Compared with the prior art, this method greatly reduces the amount of calculation on the encoding side, that is, this method greatly saves the computing resources on the encoding side.

[0331] In a third possible embodiment, when the decoding side determines based on the inverse quantization parameters of each pixel in the block to be decoded that the inverse quantization method of the first residual block and the quantization method described in the third possible embodiment at S302 above are mutually inverse, the decoding side can realize an inverse quantization process for each residual value in the first residual block based on equation (4) to obtain the first residual block.

number

[0332] Here, for the explanation of the offset parameter "offset" and the displacement parameter "shift", please refer to the explanation of the third possible mode in S302, and a duplicate explanation will be omitted here.

[0333] In this way, the decoding side can determine the displacement parameter of each pixel based on the QP of each pixel in the block to be decoded, and further determine the corresponding offset parameter. Then, the decoding side can realize the inverse quantization of the first residual block according to the equation (4) based on the determined displacement parameter and offset parameter of each pixel in the block to be decoded, and obtain the second residual block.

[0334] As can be seen, according to this possible embodiment, the decoding side does not need to perform multiplication operations when inversely quantizing the residual values ​​in the first residual block. Compared with the prior art, in coding scenarios where the requirements for quantization granularity are not high, this method can greatly reduce the computational complexity of the coding side, that is, this method can greatly save the computing resources of the coding side.

[0335] In addition, the inverse quantization method in some of the above possible forms can be applied to the process of encoding an image on the encoding side (e.g., obtaining a reconstruction block for predicting pixels in an image block), and can also be applied to the process of decoding image data on the decoding side, and the embodiments of the present application are not limited thereto.

[0336] S403: The decoding side reconstructs the block to be decoded based on the second residual block to obtain a reconstructed block.

[0337] Preferably, the decoding side can directly reconstruct the second residual block to obtain a reconstructed block of the block to be decoded. Specifically, the decoding side can directly reconstruct the block to be decoded based on the second residual block and the predicted block of the block to be decoded to obtain a reconstructed block of the block to be decoded. For example, the decoding side can obtain a reconstructed block of the block to be decoded by adding the second residual block and the predicted block of the block to be decoded.

[0338] Here, the prediction block of the block to be decoded can be obtained by the decoding side predicting the block to be decoded based on a prediction mode.Preferably, this prediction mode can be obtained by analyzing the code stream of the block to be decoded, for example, can be any prediction mode of the above-mentioned Example 1, or can be any prediction mode of the prior art, and the embodiment of the present application is not limited thereto.In addition, here, the process by which the decoding side predicts the prediction block of the block to be decoded will not be described in detail.

[0339] Preferably, the decoding side can predict each pixel in the block to be decoded in accordance with the target prediction mode in a target prediction order corresponding to the target prediction mode, and reconstruct the block to be decoded based on the predicted value of each pixel and the second residual block to obtain a reconstructed block.

[0340] Preferably, the decoding side can first inversely transform the second residual block to reconstruct the residual value block of the block to be decoded. In this case, the second residual block is actually a residual coefficient block. Then, the decoding side can reconstruct the block to be decoded based on the reconstructed residual value block and the predicted block of the block to be decoded, thereby obtaining a reconstructed block of the block to be decoded. For example, the decoding side can obtain a reconstructed block of the block to be decoded by adding the reconstructed residual value block and the predicted block of the block to be decoded.

[0341] Here, the description of the prediction block of the block to be decoded can refer to the above description, and the redundant description will be omitted here. In addition, in the embodiment of the present application, the process of the decoding side performing the inverse transform process on the second residual block will not be described in detail.

[0342] Note that the image decoding method shown in Figure 9b corresponds to the image encoding method shown in Figure 9a, and based on the image decoding method described above in S401 to S403, an inverse quantization processing method is used that can save computational resources on the decoding side during the image decoding process. In other words, the efficiency of the inverse quantization processing process in this image decoding method is greatly improved, and therefore this image decoding method greatly improves the image decoding efficiency.

[0343] Furthermore, in the embodiments of the present application, the specific mode for predicting the block to be decoded is not particularly limited, and for example, the block to be decoded can be predicted using the prediction mode described in Example 1 above, and of course, there is no limitation thereto.

[0344] Furthermore, in the embodiments of the present application, there is no particular limitation on the method by which the decoding side decodes the code stream of the block to be decoded; for example, decoding can be performed using a variable code length decoding method described in Example 3 below, and of course there is no limitation thereto.

[0345] Next, possible embodiments of step S401 will be described.

[0346] Preferably, the decoding side determines a target prediction mode for predicting pixels in the block to be decoded and an inverse quantization parameter for each pixel in the block to be decoded based on a code stream of the block to be decoded. The decoding side determines a residual scanning order corresponding to the target prediction mode based on the target prediction mode. The decoding side analyzes the code stream of the block to be decoded based on the residual scanning order to obtain a first residual block.

[0347] Here, when the target prediction mode is the first target prediction mode, the residual scanning order is the first scanning order, and when the target prediction mode is the second target prediction mode, the residual scanning order is the second scanning order, and the first scanning order and the second scanning order are different.

[0348] The first scanning order or the second scanning order is a type of residual scanning order, and the first scanning order or the second scanning order corresponds to the target prediction mode. For example, the first scanning order corresponds to a first target prediction mode, and the second scanning order corresponds to a second target prediction mode. Preferably, the residual scanning order may be the same as the target prediction order. The first scanning order and the second scanning order are used to represent two different scanning orders in different target prediction modes.

[0349] For example, when the current block to be decoded is a 16x2 image block, if the first target prediction mode is the prediction mode shown in Table 1 above, the first scanning order may be the order shown by the preset trajectory in Figure 7a. If the second target prediction mode is the prediction mode shown in Table 2 above, the second scanning order may be the order shown by the preset trajectory in Figure 7b.

[0350] Also, for example, when the first target prediction mode is a prediction mode shown in Table 3-1 above, the first scanning order may be the order shown by the preset trajectory shown in Figure 7c-1.When the second target prediction mode is a prediction mode shown in Table 4-1 above, the second scanning order may be the order shown by the preset trajectory shown in Figure 7d-1.

[0351] As can be seen, for different prediction modes, the residual scanning order corresponding to the target prediction mode is different.

[0352] Preferably, in addition to the possible implementation of step S401, when determining the target prediction mode, the decoding side can analyze the code stream of the block to be decoded using a third scanning order in the target prediction mode for the block to be decoded having a first size, and can analyze the code stream of the block to be decoded using a fourth scanning order in the target prediction mode for the block to be decoded having a second size.

[0353] Here, the third scanning order and the fourth scanning order are different from each other and are types of residual scanning orders.

[0354] Furthermore, the residual scan order indicated by the first scan order may be the same as or different from the residual scan order indicated by the third scan order or the fourth scan order. Similarly, the residual scan order indicated by the second scan order may be the same as or different from the residual scan order indicated by the third scan order or the fourth scan order. The embodiment of the present application is not limited thereto.

[0355] Next, the above alternative implementation will be described by taking an example where the first size is 8x1 and the second size is 8x2.

[0356] For example, when the target prediction mode is one of those shown in Table 3-2 or Table 5, if the block to be decoded has a first size, the residual scanning order may be a third scanning order such as the scanning order shown in Figure 7e, and if the block to be decoded has a second size, the residual scanning order may be a fourth scanning order such as the scanning order shown in Figure 7c-2. Here, the prediction modes shown in Table 3-2 and Table 5 can represent two prediction modes with different sizes but the same target prediction mode.

[0357] Also, for example, when the target prediction mode is the prediction mode shown in Table 4-2 or the prediction mode shown in Table 4-3, if the block to be decoded is a first size, the residual scanning order may be a third scanning order such as the scanning order shown in Figure 7d-3, and if the block to be decoded is a second size, the residual scanning order may be a fourth scanning order such as the scanning order shown in Figure 7d-2. Here, the prediction modes shown in Table 4-2 and Table 4-3 can represent two prediction modes with different sizes but the same target prediction mode.

[0358] Example 3 As shown in Figure 10a, which is a schematic flowchart of another image encoding method provided by an embodiment of the present application, the method shown in Figure 10a includes the following steps:

[0359] In step S501, the encoding side determines a residual block corresponding to the block to be encoded. Here, this residual block may be the original residual value block of the block to be coded, or may be a residual coefficient block obtained by converting this original residual value block, or may be a quantized residual block obtained by the coding side quantizing this residual coefficient block, and there is no limitation thereto.

[0360] Here, the original residual value block of the block to be coded is a residual block obtained by the coding side based on the original pixel values ​​of the block to be coded and the predicted block of the block to be coded.

[0361] The process by which the encoding side predicts pixels in the block to be encoded to obtain a predicted block can be realized based on the method described in Example 1, and of course, can be obtained based on any method for obtaining a predicted block of the block to be encoded in the prior art, and the embodiments of the present application are not limited thereto.

[0362] The residual coefficient block is obtained by performing a transform process on the original residual value block on the encoding side, and the embodiment of the present application does not specifically limit the process by which the encoding side performs the transform process on the original residual value block.

[0363] The process in which the encoding side quantizes the residual coefficient block to obtain a quantized residual block can be realized based on the method described in Example 2, and of course, can be realized based on any method for quantizing a residual block in the prior art, and the embodiments of the present application are not limited thereto.

[0364] For ease of explanation, the following embodiments of the present application will be described taking the residual coefficient block as an example, where the residual block is the block to be coded.

[0365] S502: The encoding side encodes the residual block of the encoding target block using a variable code length encoding method to obtain a code stream of the encoding target block.

[0366] Preferably, the variable code length coding scheme may include a variable-order exponential Columbus coding scheme. In this manner, the coding side may first determine the attribute type of each pixel in the block to be coded. For a first value corresponding to a third pixel in the residual block of the block to be coded, the coding side may determine a target order for coding the first value based on a preset policy and the attribute type of the third pixel. The coding side may then encode the first value in the residual block of the block to be coded using a target-order exponential Columbus coding algorithm. After the coding side encodes each value in the residual block of the block to be coded, a coded codestream for the block to be coded can be obtained. The coding side may preset the prediction policy to indicate the orders used to code residual values ​​corresponding to pixels of different attribute types. Here, the third pixel represents at least one pixel in the block to be coded.

[0367] It should be understood that the encoding rules for exponential Columbus coding of different orders are different. Referring to Table 6, Table 6 shows the encoding rules (including code word structures and corresponding encoding ranges) for exponential Columbus coding when the order k takes different values. As shown in Table 6, X in the code word structure shown in Table 6 can be 0 or 1.

[0368] [Table 6]

[0369] In this way, for a first value corresponding to a third pixel in the residual block of the block to be coded, the coding side determines a target order for coding the first value based on a preset policy and an attribute type of the third pixel. Then, the coding side determines a codeword structure for coding the first value based on the exponential Columbus coding algorithm of the target order and the magnitude of the first value, and can code the first value using this codeword structure. Similarly, when the coding side codes each value in the residual block of the block to be coded, a coded codestream of the block to be coded is obtained.

[0370] For example, the encoding side determines the target order for encoding the first value corresponding to the third pixel as 0 based on the preset policy and the attribute type of the third pixel. Assuming the first value is 2, if the first value belongs to the encoding range 1 to 2 as shown in Table 6, the encoding side can determine the codeword structure for encoding the first value as 011 (i.e., the codeword structure corresponding to the encoding range 1 to 2 is 01X) based on the 0th-order exponential Columbus encoding algorithm and the magnitude of the first value. This allows the encoding side to encode the first value as 011. Assuming the first value is 7, if the first value belongs to the encoding range 7 to 14 as shown in Table 6, the encoding side can determine the codeword structure for encoding the first value as 00010000 (i.e., the codeword structure corresponding to the coding range 7 to 14 is 0001XXXX) based on the 0th-order exponential Columbus encoding algorithm and the magnitude of the first value. This allows the encoding side to encode the first value as 00010000. When the encoding side encodes each value in the residual block of the block to be encoded, an encoded codestream of the block to be encoded is obtained.

[0371] Preferably, the variable code length coding method may include a preset order exponential Columbus coding method, where the preset order may be a value preset by the coding side, such as 0 or 1 (i.e., the value of K may be a preset 0 or 1), and the embodiment of the present application is not limited thereto.

[0372] As can be seen from Table 6, if the encoding side specifies the order value (i.e., the K value) of the exponential Columbus coding method in advance, it is also possible to realize variable code length encoding of the residual values ​​in the residual block (or the residual coefficient values ​​in the residual coefficient block).

[0373] It should be understood that after encoding the residual block of the block to be encoded, the encoding side can determine a syntax element corresponding to the residual block, and for example, the syntax element includes a coding code length (CL) for encoding each value in the residual block.

[0374] Preferably, the encoding side uses the above-mentioned variable-order exponential Columbus coding algorithm to encode the CL, so as to achieve the purpose of saving bits, and further to increase the compression rate of image coding while simultaneously achieving the purpose of improving coding efficiency.

[0375] For example, for any value in the residual block of the current block, the encoder can determine a target order for encoding the CL based on the CL of that value, then encode the CL using an exponential Columbus coding algorithm of the target order and add the encoded data to the encoded codestream of the current block.

[0376] As can be seen, when the encoding side uses the variable-order exponential Columbus coding algorithm to encode the residual block (or the CL of the residual value in the residual block) of the block to be encoded, it can adaptively encode smaller residual values ​​(or CL values) with fewer bits, thereby achieving the goal of saving bits. In other words, it is possible to increase the compression rate of image encoding and simultaneously achieve the goal of improving coding efficiency.

[0377] Preferably, the encoding side can also use fixed-length coding and truncated unary coding to encode the CL of each value in the residual block of the block to be encoded. For example, for any value in the residual block of the block to be encoded, the encoding side can encode the CL of that value using fixed-length coding or truncated unary coding.

[0378] Specifically, if any of the above CL values ​​is less than or equal to a threshold, the encoding side encodes the CL value using a predetermined number of bits with fixed-length coding and adds the encoded data to the codestream of the block to be encoded. If any of the above CL values ​​is greater than the threshold, the encoding side encodes the CL value using truncated unary coding and adds the encoded data to the codestream of the block to be encoded. Note that the embodiments of the present application do not limit the specific method of determining this threshold.

[0379] As an example, let us take the threshold value as 2. Table 7 shows the codewords obtained when the encoder uses 2-bit fixed-length coding for CL values ​​less than or equal to 2, while Table 7 shows the codewords obtained when the encoder uses truncated unary coding for CL values ​​greater than 2. Here, if the maximum CL value is represented by CLmax, for CL values ​​greater than 2, the codeword for CLmax contains CLmax-1 1s, the codeword for CLmax-1 contains CLmax-2 1s and 1 0, ..., the codeword for CLmax-j contains CLmax-j-1 1s and 1 0, where j is a positive integer.

[0380] [Table 7]

[0381] It should be understood that the encoding side can also use fixed-length coding and truncated unary coding to encode each value in the residual block of the block to be encoded, and specifically, refer to the description of CL in which the encoding side uses fixed-length coding or truncated unary coding to encode each value in the residual block of the block to be encoded, and redundant description will be omitted here.

[0382] When the coding side uses fixed-length coding and truncated unary coding to code CL (or residual values), it can adaptively code smaller CL values ​​(or residual values) with fewer bits, thereby saving bits. That is, it can achieve the goal of increasing the compression rate of image coding and improving coding efficiency at the same time.

[0383] As shown in Figure 10b, which is a schematic flowchart of another image decoding method provided by an embodiment of the present application, the method shown in Figure 10b includes the following steps:

[0384] In step S601, the decoding side analyzes the code stream of the block to be decoded using a variable code length decoding method, and obtains CL of each value in the residual block corresponding to the block to be decoded.

[0385] Preferably, the variable code length decoding method may be a variable-order exponential Columbus decoding method. The decoding side first analyzes the target order for decoding the code stream of the block to be decoded from the code stream, and then analyzes the code stream of the block to be decoded using the target order exponential Columbus decoding algorithm to obtain the CL of each value in the residual block of the block to be decoded.

[0386] Here, for the variable-order exponential Columbus decoding method, please refer to the description of the variable-order exponential Columbus coding method. Since the encoding process can be understood as the inverse operation of the decoding process, a redundant description will be omitted here.

[0387] Preferably, the variable code length decoding method may be a preset-order exponential Columbus decoding method, in which the decoding side analyzes the code stream of the block to be decoded using a preset-order exponential Columbus decoding algorithm to obtain the CL of each value in the residual block of the block to be decoded.

[0388] Preferably, when the number of bits of the CL for encoding any value in the residual block of the block to be decoded is a predetermined number, the decoding side can also analyze the code stream of the block to be decoded based on a fixed-length decoding policy to obtain the CL for encoding any value in the residual block of the block to be decoded. Furthermore, when the number of bits of the CL for encoding any value in the residual block of the block to be decoded is greater than a predetermined number, the decoding side can analyze the code stream of the block to be decoded based on the rules of truncated unary coding to obtain the CL for encoding any value. Here, for a specific description, please refer to the above-mentioned description of the encoding side encoding the CL based on fixed-length coding and truncated unary coding. The decoding process can be understood as the inverse operation of the encoding process, so redundant description will be omitted here.

[0389] In step S602, the decoding side determines the residual block of the block to be decoded based on the obtained CL.

[0390] After determining the CL of each value in the residual block of the block to be decoded, the encoding side determines the number of bits for encoding each value in the residual block. In this way, the decoding side can determine a bit group corresponding to each pixel in the block to be decoded in the code stream of the block to be decoded based on the CL for encoding each value, and determine a target order for analyzing each bit group.

[0391] In one possible case, the decoding side may first determine the attribute type of each pixel in the block to be decoded after analyzing the CL of each value in the residual block of the block to be decoded. Then, for a first bit group corresponding to a third pixel in the block to be decoded, the decoding side may determine a target order for analyzing the first bit group based on a preset policy and the attribute type of the third pixel. In another possible case, if the preset order of the bit group corresponding to each pixel in the block to be decoded is previously set in the decoding side, the decoding side determines the preset order of the bit group corresponding to each pixel in the block to be decoded as the target order of each bit group. For example, the attribute type of a pixel may include whether or not a pixel has a symbol, information about the number of bits of the pixel, information about the format of the pixel, etc.

[0392] Then, the decoding side can use the target order exponential Columbus decoding algorithm to analyze the bit groups corresponding to each pixel in the block to be decoded, obtain the residual value of each pixel, and obtain the residual block of the block to be decoded.

[0393] It is understood that the order in which the decoding side obtains the residual values ​​in the residual block based on analysis of the codestream of the block to be decoded is the same as the order in which the encoding side encodes the residual values ​​in the residual block.

[0394] S603: The decoding side reconstructs the block to be decoded based on the residual block of the block to be decoded to obtain a reconstructed block.

[0395] Preferably, when the residual block of the block to be decoded is a residual coefficient block, the decoding end can sequentially perform inverse quantization and inverse transform on the residual block of the block to be decoded to obtain a reconstructed residual value block of the block to be decoded. Then, the decoding side can reconstruct the block to be decoded based on the reconstructed residual value block to obtain a reconstructed block. For example, the decoding side can obtain a reconstructed block of the block to be decoded by adding the reconstructed residual value block and a prediction block of the block to be decoded.

[0396] Preferably, when the residual block of the block to be decoded is a residual value block, the decoding end can dequantize the residual block of the block to be decoded to obtain a reconstructed residual value block of the block to be decoded. Then, the decoding end can reconstruct the block to be decoded based on the reconstructed residual value block to obtain a reconstructed block. For example, the decoding end can obtain a reconstructed block of the block to be decoded by adding the reconstructed residual value block and a prediction block of the block to be decoded.

[0397] Preferably, the decoding side can also determine a target prediction mode for predicting pixels in the block to be decoded based on the code stream of the block to be decoded. The decoding side determines a target prediction order corresponding to the target prediction mode based on the target prediction mode. The decoding side predicts each pixel in the block to be decoded in the target prediction order according to the target prediction mode. The decoding side reconstructs the decoded block based on the predicted value of each pixel in the block to be decoded and the residual block to obtain a reconstructed block. Specifically, for details of any of the above-mentioned embodiments, the description of Example 1 can be referred to, and redundant description will be omitted here.

[0398] Here, the predicted block of the block to be decoded may be obtained by predicting the decoded block based on a prediction mode, where the prediction mode may be obtained by analyzing the code stream of the block to be decoded at the decoding end. Preferably, the prediction mode may be any of the prediction modes in Example 1, or may be any of the prediction modes in the prior art, and the embodiment of the present application is not limited thereto. Note that the process by which the decoding side predicts the predicted block of the block to be decoded will not be described in detail here.

[0399] Here, the process of the decoding end inversely quantizing the residual block of the decoding block can be performed based on the inverse quantization parameters of each pixel in the block to be decoded and the inverse quantization preset array, which are obtained by analyzing the code stream of the block to be decoded. Specifically, this can be achieved based on the method in Example 2, and of course, this can be achieved based on any method that can achieve inverse quantization of the residual block in the prior art, and the embodiment of the present application is not limited thereto.

[0400] In addition, since the image decoding method shown in Figure 10b corresponds to the image encoding method shown in Figure 10a, this method can achieve the purpose of increasing the compression rate of image encoding while also improving decoding efficiency.

[0401] In addition, the variable code length encoding / decoding method provided in Example 3 can also be applied to Example 1 and Example 2, or can be applied to any scene that requires image encoding / decoding, and the embodiments of the present application are not limited thereto.

[0402] It is understood that to realize the functions according to the above embodiments, the encoding side / decoding side is equipped with a hardware structure and / or software module for executing the respective functions. Those skilled in the art should easily recognize that the means and method steps combining each example described in the embodiments disclosed herein can be realized in the form of hardware or a combination of hardware and computer software in this application. Depending on the specific application scenario and design constraints of the technical means, the functions are executed by either hardware or computer software driving the hardware.

[0403] The decoding device and the encoding device provided by the embodiments of the present application will be described below.

[0404] In one example, any of the decoding devices provided by the embodiments of the present application may be the target device 12 or the decoder 122 in Fig. 1. In another example, any of the encoding devices provided below may be the source device 11 or the encoder 112 in Fig. 1. They will be described together here, and redundant description will be omitted below.

[0405] FIG. 11 is a schematic diagram of the structure of a decoding device 1100 provided by an embodiment of the present application, and all of the embodiments of the above-mentioned decoding method can be implemented by the decoding device 1100. The decoding device 1100 includes an analyzing means 1101, a determining means 1102, a predicting means 1103, and a reconstructing means 1104. Here, the analyzing means 1101 is used to analyze a code stream of a block to be decoded and determine a target prediction mode for predicting pixels in the block to be decoded. The determining means 1102 is used to determine a target prediction order corresponding to the target prediction mode based on the target prediction mode. The predicting means 1103 is used to predict each pixel in the block to be decoded in a target prediction order corresponding to the target prediction mode according to the determined target prediction mode. The reconstructing means 1104 is used to reconstruct each pixel based on a predicted value of each pixel in the block to be decoded, thereby obtaining a reconstructed block of the block to be decoded.

[0406] In one example, the analyzing means 1101 may be realized by the codestream analyzing means 301 in Fig. 5. The determining means 1102 and the predicting means 1103 are realized by the prediction processing means 304 in Fig. 5, and the reconstructing means 1104 is realized by the reconstructing means 305 in Fig. 5. The coded bitstream in Fig. 5 may be the codestream of the block to be decoded in an embodiment of the present application.

[0407] For more detailed explanations of the above analysis means 1101, decision means 1102, prediction means 1103, and reconstruction means 1104, as well as more detailed explanations of their respective technical features and explanations of beneficial effects, please refer to the corresponding method embodiments above, and redundant explanations will be omitted here.

[0408] In one possible design form, specifically, when predicting any pixel in the block to be decoded in the target prediction order, the prediction means 1103 predicts the pixel for predicting the pixel based on the pixel that has already been reconstructed.

[0409] In another possible design form, when the target prediction mode indicates that each pixel in the block to be decoded is predicted dot-by-dot in a target prediction order, the predicting means 1103 is used to predict each pixel in the block to be decoded dot-by-dot along a direction indicated by the target prediction order in accordance with the target prediction mode, where if the target prediction mode is a first target prediction mode, the target prediction order is the first prediction order, and if the target prediction mode is a second target prediction mode, the target prediction order is the second prediction order, and the first prediction order and the second prediction order are different.

[0410] In yet another possible design form, for a block to be decoded having a first size, the prediction means 1103 is specifically used to predict the decoded block in a third prediction order in a target prediction mode, and for a block to be decoded having a second size, the prediction means 1103 is specifically used to predict the decoded block in a fourth prediction order in a target prediction mode, where the third prediction order is different from the fourth prediction order.

[0411] In yet another possible design form, when the target prediction mode indicates that pixels of each sub-block in the block to be decoded are to be predicted sequentially as a sub-block unit having a preset size within the block to be decoded, the prediction means 1103 is specifically used to sequentially predict pixels within each sub-block in the block to be decoded along the direction indicated by the target prediction order according to the target prediction mode.

[0412] In yet another possible design form, the target prediction mode includes a prediction mode for each sub-block in the block to be decoded, and for a first sub-block in the block to be decoded, if the first sub-block includes a first pixel and a second pixel, the prediction mode of the first sub-block is used to predict the first pixel and the second pixel in parallel based on reconstructed pixels surrounding the first sub-block.

[0413] In yet another possible design form, the reconstruction means 1104 includes an inverse quantization subunit and a reconstruction subunit, where the inverse quantization subunit is used to inverse quantize a first residual block of a block to be decoded, which is obtained by analyzing the codestream of the block to be decoded, based on an inverse quantization parameter of each pixel in the block to be decoded and an inverse quantization preset array, and to obtain a second residual block. The reconstruction subunit is used to reconstruct each pixel based on a predicted value of each pixel and the second residual block, to obtain a reconstructed block.

[0414] In yet another possible design form, the inverse quantization subunit is specifically used to analyze the code stream of the block to be decoded using a variable code length decoding method to obtain a coding code length CL for encoding each value of the residual block corresponding to the block to be decoded and a first residual block.

[0415] For detailed explanations of the above other possible design forms, more detailed explanations of their respective technical features, and explanations of their beneficial effects, please refer to the corresponding method embodiments, and duplicate explanations will be omitted here.

[0416] 12 is a schematic diagram of the structure of an encoding device 1200 provided by an embodiment of the present application, and any of the embodiments of the encoding method described above can be implemented by this encoding device 1200. The encoding device 1200 includes a determining means 1201, a predicting means 1202, and an encoding means 1203. Here, the determining means 1201 is used to determine a target prediction mode of a block to be encoded and to determine a target prediction order corresponding to the target prediction mode. The predicting means 1202 is used to predict each pixel in the block to be encoded in a target prediction order according to the target prediction mode. The determining means 1201 is also used to determine a residual block of the block to be encoded based on the predicted value of each pixel. The encoding means 1203 is used to encode the residual block in the target prediction order to obtain a codestream of the block to be encoded.

[0417] In one example, the determining means 1201 and the predicting means 1202 can be realized by the prediction processing means 201 in Fig. 2. The determining means 1201 can be realized by the residual calculating means 202 in Fig. 2. The encoding means 1203 can be realized by the encoding means 205 in Fig. 2. The encoding target block in Fig. 2 may be the encoding target block in the embodiment of the present application.

[0418] For more detailed explanations of the above determination means 1201, prediction means 1202, and encoding means 1203, as well as more detailed explanations of their respective technical features and explanations of beneficial effects, please refer to the embodiments of the corresponding methods above, and redundant explanations will be omitted here.

[0419] 13 is a schematic diagram of the structure of a decoding device 1300 provided by an embodiment of the present application, and all of the embodiments of the above-mentioned decoding method can be implemented by the decoding device 1300. The decoding device 1300 includes an analyzing means 1301, an inverse quantizing means 1302, and a reconstructing means 1303. Here, the analyzing means 1301 is also used to analyze the code stream of a block to be decoded and obtain an inverse quantization parameter for each pixel in the block to be decoded and a first residual block of the block to be decoded. The inverse quantizing means 1302 is also used to inverse quantize the first residual block based on the QP indicated by the inverse quantization parameter for each pixel and the quantization preset array to obtain a second residual block. The reconstructing means 1303 is also used to reconstruct a decoded block based on the second residual block to obtain a reconstructed block.

[0420] In one example, the analyzing means 1301 can be realized by the codestream analyzing means 301 in Fig. 5. The inverse quantizing means 1302 can be realized by the inverse quantizing means 302 in Fig. 5. The reconstructing means 1303 can be realized by the reconstructing means 305 in Fig. 5. The coded bitstream in Fig. 5 may be the codestream of the block to be decoded in an embodiment of the present application.

[0421] For more detailed explanations of the above analysis means 1301, inverse quantization means 1302 and reconstruction means 1303, as well as more detailed explanations of their respective technical features and explanations of their beneficial effects, please refer to the embodiments of the corresponding methods above, and redundant explanations will be omitted here.

[0422] In one possible design form, the analyzing means 1301 is specifically used to determine, based on the code stream of the block to be decoded, a target prediction mode for predicting pixels in the block to be decoded and an inverse quantization parameter for each pixel in the block to be decoded, and to determine, based on the target prediction mode, a residual scanning order corresponding to the target prediction mode. Here, if the target prediction mode is a first target prediction mode, the residual scanning order is a first scanning order, and if the target prediction mode is a second target prediction mode, the residual scanning order is a second scanning order, which are different from the first scanning order and the second scanning order. The code stream of the block to be decoded is analyzed based on the residual scanning order to obtain a first residual block.

[0423] In another possible design form, for a block to be decoded that is a first size, the analysis means 1301 analyzes the code stream of the block to be decoded using a third scanning order in a target prediction mode, and for a block to be decoded that is a second size, the analysis means 1301 analyzes the code stream of the block to be decoded using a fourth scanning order in a target prediction mode, where the third scanning order is different from the fourth scanning order.

[0424] In another possible design form, in the inverse quantization preset sequence, the interval between two adjacent numbers in the 1st to nth numbers is 1, the interval between two adjacent numbers in the n+1st to n+mth numbers is 2, and the interval between two adjacent numbers in the n+k*m+1st to n+k*m+mth numbers is 2. k+1 where n and m are integers greater than 1, and k is a positive integer.

[0425] In yet another possible design form, the inverse quantization means 1302 is specifically used to determine an amplification parameter corresponding to each pixel in the inverse quantization preset array based on the QP of each pixel, and perform an inverse quantization operation on the first residual block based on the amplification parameter corresponding to each pixel to obtain a second residual block.

[0426] In yet another possible design form, the inverse quantization means 1302 is specifically used to determine an amplification parameter and a displacement parameter corresponding to each pixel based on the QP of each pixel and the inverse quantization preset array, where the value of the amplification parameter corresponding to each pixel is the value corresponding to the QP of each pixel and 7 in the inverse quantization preset array, and the value of the displacement parameter corresponding to each pixel is the value corresponding to 7 and the QP of each pixel multiplied by 2 3 and the quotient obtained by dividing the first residual block by the second residual block, and then performing an inverse quantization operation on the first residual block based on the amplification parameter and displacement parameter corresponding to each pixel to obtain a second residual block.

[0427] In yet another possible design form, the reconstruction means 1303 is specifically used to inverse transform the second residual block to reconstruct a residual value block of the block to be decoded, reconstruct the decoded block based on the residual value block, and obtain a reconstructed block.

[0428] In yet another possible design form, the reconstruction means 1303 is specifically used to predict each pixel in the block to be decoded in a target prediction order corresponding to the target prediction mode according to the target prediction mode, and to reconstruct the decoded block based on the predicted value of each pixel and the second residual block to obtain a reconstructed block.

[0429] In yet another possible design form, the analyzing means 1301 is specifically used to analyze the code stream of the block to be decoded using a variable code length decoding method, and obtain the coding code length CL and the first residual block for encoding each value in the residual block corresponding to the block to be encoded.

[0430] For detailed explanations of the above possible design forms, more detailed explanations of their respective technical features, and explanations of beneficial effects, please refer to the corresponding method embodiments, and duplicate explanations will be omitted here.

[0431] 14 is a schematic diagram of the structure of an encoding device 1400 provided by an embodiment of the present application, and all of the embodiments of the encoding method described above can be implemented by the encoding device 1400. The encoding device 1400 includes a determining means 1401, a quantizing means 1402, and an encoding means 1403. The determining means 1401 is used to determine a second residual block of a block to be encoded and a quantization parameter QP for each pixel in the block to be encoded. The quantizing means 1402 is used to quantize the second residual block based on the QP for each pixel and a quantization preset array to obtain a first residual block. The encoding means 1403 is used to encode the first residual block to obtain a codestream for the block to be encoded.

[0432] In one example, the determining means 1401 can be realized by the residual calculation means 202 in Fig. 2, or the determining means 1401 can be realized by a combination of the residual calculation means 202 and the residual conversion means 203 in Fig. 2. The quantizing means 1402 can be realized by the quantizing means 204 in Fig. 2. The encoding means 1403 can be realized by the encoding means 205 in Fig. 2. The encoding target block in Fig. 2 may be the encoding target block in the embodiment of the present application.

[0433] For more detailed explanations of the above-mentioned determining means 1401, quantizing means 1402, and encoding means 1403, as well as more detailed explanations of their respective technical features and explanations of their beneficial effects, please refer to the corresponding method embodiments above, and redundant explanations will be omitted here.

[0434] 15 is a structural schematic diagram of an encoding device 1500 provided by an embodiment of the present application, and all of the embodiments of the encoding method described above can be implemented by the encoding device 1500. The encoding device 1500 includes a determining means 1501 and an encoding means 1502. Here, the determining means 1501 is used to determine a residual block corresponding to a current block to be encoded. The encoding means 1502 is used to encode the residual block using a variable code length encoding method to obtain a codestream of the current block to be encoded.

[0435] In one example, the determining means 1501 can be realized by the residual calculation means 202 in Fig. 2, or the determining means 1501 can be realized by a combination of the residual calculation means 202 and the residual conversion means 203 in Fig. 2, or the determining means 1501 can be realized by a combination of the residual calculation means 202, the residual conversion means 203, and the quantization means 204 in Fig. 2. The encoding means 1502 can be realized by the encoding means 205 in Fig. 2. The encoding target block in Fig. 2 may be the encoding target block in an embodiment of the present application.

[0436] For a more detailed description of the above-mentioned determining means 1501 and encoding means 1502, a more detailed description of their respective technical features, and an explanation of their beneficial effects, please refer to the corresponding method embodiments, and redundant explanations will be omitted here.

[0437] 16 is a schematic diagram of the structure of a decoding device 1600 provided by an embodiment of the present application, and all of the embodiments of the above-mentioned decoding method can be implemented by the decoding device 1600. The decoding device 1600 includes an analyzing means 1601, a determining means 1602, and a reconstructing means 1603. Here, the analyzing means 1601 is used to analyze the code stream of the block to be decoded using a variable code length decoding method and obtain an encoding code length CL for encoding each value in the residual block corresponding to the block to be decoded. The determining means 1602 is used to determine the residual block of the block to be decoded based on the CL of each encoded value. The reconstructing means 1603 is used to reconstruct a decoded block based on the residual block of the block to be decoded, and obtain a reconstructed block.

[0438] In one example, the analyzing means 1601 can be realized by the codestream analyzing means 301 in Figure 5. The determining means 1602 can be realized by the inverse quantizing means 302 in Figure 5, or the determining means 1602 can be realized by a combination of the inverse quantizing means 302 and the residual inverse transform means 303 in Figure 5. The reconstructing means 1603 can be realized by the reconstructing means 305 in Figure 5. The coded bitstream in Figure 5 may be the codestream of the block to be decoded in an embodiment of the present application.

[0439] For more detailed explanations of the above analysis means 1601, determination means 1602, and reconstruction means 1603, as well as more detailed explanations of their respective technical features and explanations of beneficial effects, please refer to the embodiments of the corresponding methods above, and redundant explanations will be omitted here.

[0440] In one possible design form, when the variable code length decoding scheme includes a variable order or preset order exponential Columbus decoding scheme, the analyzing means 1601 is specifically used to determine a target order for analyzing a CL for encoding each value in the residual block, and analyze the code stream using the exponential Columbus decoding algorithm of the target order to obtain a CL for encoding each value in the residual block.

[0441] In another possible design form, the analyzing means 1601 is specifically used to analyze the codestream based on a fixed-length decoding policy to obtain a CL for encoding any value in the residual block if the number of bits of the CL for encoding any value in the residual block is a predetermined number, and to analyze the codestream based on a truncated unary coding rule to obtain a CL for encoding any value if the number of bits of the CL for encoding any value in the residual block is greater than the predetermined number.

[0442] In another possible design form, the determining means 1602 is specifically used to determine a group of bits corresponding to each pixel in the block to be decoded from the codestream based on a CL for encoding each value, determine an attribute type of each pixel in the block to be decoded, and for a first group of bits corresponding to a third pixel in the block to be decoded, determine a target order for analyzing the first group of bits based on a preset policy and the attribute type of the third pixel, and analyze the first group of bits using an exponential Columbus decoding algorithm of the target order to obtain the residual block.

[0443] In another possible design form, the determining means 1602 is specifically used to determine a group of bits corresponding to each pixel in the block to be decoded from the codestream based on a CL for encoding each of the values, and for a first group of bits corresponding to a third pixel in the block to be decoded, to analyze the first group of bits using an exponential Columbus decoding algorithm of a preset order to obtain the residual block.

[0444] In a further possible design form, the reconstruction means 1603 is specifically used to perform inverse quantization and inverse transformation on the residual block, or to inverse quantize the residual block, to reconstruct a residual value block of the block to be decoded, and to reconstruct the block to be decoded based on the residual value block, thereby obtaining the reconstructed block.

[0445] In a further possible design form, the reconstruction means 1603 is specifically used to determine a target prediction mode for predicting pixels in the block to be decoded based on the code stream of the block to be decoded, determine a target prediction order corresponding to the target prediction mode based on the target prediction mode, predict each pixel in the block to be decoded in the target prediction order according to the target prediction mode, and reconstruct the block to be decoded based on the predicted value of each pixel in the block to be decoded and the residual block, thereby obtaining a reconstructed block.

[0446] In a further possible design form, the reconstruction means 1603 is specifically used to inverse quantize the residual block based on the inverse quantization parameter of each pixel in the block to be decoded and the inverse quantization preset array obtained by analyzing the code stream of the block to be decoded.

[0447] For detailed explanations of the above possible design forms, more detailed explanations of their respective technical features, and explanations of beneficial effects, please refer to the corresponding method embodiments, and duplicate explanations will be omitted here.

[0448] The present application further provides an electronic device for executing any of the embodiments of the image encoding / decoding method described above. As shown in Fig. 17, Fig. 17 is a schematic diagram of the structure of an electronic device provided by an embodiment of the present application, the electronic device includes a processor 1701 and a communication interface 1702. The processor 1701 and the communication interface 1702 are coupled to each other. It is understood that the communication interface 1702 is a transceiver or an input / output interface.

[0449] In one example, the electronic device 1700 further includes a memory 1703, which is used to store instructions to be executed by the processor 1701, or input data required for the processor 1701 to execute the instructions, or data generated after the processor 1701 executes the instructions.

[0450] In the embodiment of the present application, the specific connection medium between the communication interface 1702, the processor 1701, and the memory 1703 is not limited. In the embodiment of the present application, the communication interface 1702, the processor 1701, and the memory 1703 are connected via a bus 1704 in FIG. 17 , and the bus is shown by a bold line in FIG. 17 . The connection between the other components is only a schematic illustration and is not limited. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For convenience of illustration, the bus is shown by a single bold line in the figure, but this does not mean that there is only one bus or only one type of bus.

[0451] The memory 1703 can be used to store software programs and modules, such as program instructions / modules corresponding to the image decoding or encoding methods provided by the embodiments of the present application. The processor 1701 executes the software programs and modules stored in the memory 1703 to perform various functional applications and data processing to realize any of the image decoding or encoding methods. The communication interface 1702 can be used to communicate signaling or data with other devices. In the present application, the electronic device 1700 may include multiple communication interfaces 1702.

[0452] The processor in the embodiments of the present application may be a central processing unit (CPU), a neural processor (NPU), or a graphic processing unit (GPU), or 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, transistor logic device, hardware, or a combination thereof. The general-purpose processor may be a microprocessor or a conventional processor.

[0453] The steps of the method in the embodiments of the present application may be implemented by hardware or by a processor executing software instructions. The software instructions are configured by corresponding software blocks, which may be stored in random access memory (RAM), flash memory, read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), registers, hard disk, mobile hard disk, CD-ROM, or any other form of storage medium known in the art. Exemplarily, the storage medium is coupled to the processor such that the processor can read information from and write information to the storage medium. Of course, the storage medium may be a component of the processor. The processor and the storage medium may reside in an ASIC. Furthermore, the ASIC may reside in a network device or a terminal device. Of course, the processor and the storage medium may reside as separate components in the network device or the terminal device.

[0454] The present application further provides a computer-readable storage medium having stored thereon a computer program or instructions which, when executed by a processor, implements any of the embodiments of the image encoding / decoding method described above.

[0455] The present application further provides an image encoding / decoding system, comprising an encoding side and a decoding side, the encoding side being used to perform any of the above image encoding methods, and the decoding side being used to perform a corresponding image encoding method.

[0456] The above embodiments may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, they may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present application are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or another programmable device. The computer instructions may be stored on a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from a website, computer, server, or data center to another website, computer, server, or data center via wired or wireless connections. The computer-readable storage medium may be any available medium accessible by a computer, or a data storage device such as a server or data center that aggregates one or more available media. The available media may be magnetic media such as floppy disks, hard disks, or magnetic tapes, optical media such as digital video discs (DVDs), or semiconductor media such as solid state drives (SSDs).

[0457] In each embodiment of the present application, unless there is a conflict of specific explanation and logic, the terms and / or descriptions between different embodiments are consistent and can be cross-referenced, and the technical features in different embodiments can be combined based on their inherent logical relationships to form a new embodiment.

[0458] It should be understood that the various numerals used in the embodiments of the present application are merely for the convenience of explanation and are not intended to limit the scope of the embodiments of the present application. The magnitude of the sequence number of each process does not indicate the order of execution, and the execution order of each process must be determined by its function and inherent logic. The above description is merely a preferred embodiment of the present application and is not intended to limit the present application. Any amendments, equivalent substitutions, modifications, etc. made within the spirit and principles of the present application are all intended to be included in the scope of protection of the present application.

Claims

1. An image decoding method, comprising: analyzing a codestream of a block to be decoded to determine a target prediction mode for predicting pixels in the block to be decoded; determining a target prediction order corresponding to the target prediction mode based on the target prediction mode; predicting each pixel in the current block to be decoded in the target prediction order according to the target prediction mode; reconstructing each pixel based on the predicted value of each pixel to obtain a reconstructed block of the block to be decoded; Reconstructing each pixel based on the predicted value of each pixel to obtain a reconstructed block of the block to be decoded includes: obtaining a second residual block by inverse quantizing a first residual block of the block to be decoded, which is obtained by analyzing the code stream of the block to be decoded, based on an inverse quantization parameter of each pixel in the block to be decoded and an inverse quantization preset array, which are obtained by analyzing the code stream of the block to be decoded; reconstructing each pixel based on the predicted value of each pixel and the second residual block to obtain the reconstructed block.

1. An image decoding method comprising:

2. When predicting any pixel in the block to be decoded in the target prediction order, a pixel for predicting the any pixel is already reconstructed.

2. The image decoding method according to claim 1, wherein:

3. When the target prediction mode indicates that each pixel in the block to be decoded is predicted dot by dot in the target prediction order, predicting each pixel in the current block to be decoded in the target prediction order according to the target prediction mode, predicting, dot by dot, each pixel in the block to be decoded along a direction indicated by the target prediction order in accordance with the target prediction mode, wherein when the target prediction mode is a first target prediction mode, the target prediction order is a first prediction order, and when the target prediction mode is a second target prediction mode, the target prediction order is a second prediction order, and the first prediction order and the second prediction order are different from each other; 3. The image decoding method according to claim 2, wherein:

4. For the block to be decoded having a first size, the target prediction mode predicts the block to be decoded in a third prediction order, and for the block to be decoded having a second size, the target prediction mode predicts the block to be decoded in a fourth prediction order, and the third prediction order and the fourth prediction order are different.

4. The image decoding method according to claim 3, wherein:

5. When the target prediction mode indicates that pixels in each sub-block in the block to be decoded are to be predicted sequentially in units of sub-blocks of a preset size in the block to be decoded, predicting each pixel in the block to be decoded in the target prediction order according to the target prediction mode includes: and sequentially predicting pixels in each sub-block of the current block to be decoded in accordance with the target prediction mode along a direction indicated by the target prediction order.

3. The image decoding method according to claim 2, wherein:

6. The target prediction mode includes a prediction mode for each sub-block in the block to be decoded, and for a first sub-block in the block to be decoded, if the first sub-block includes a first pixel and a second pixel, the prediction mode of the first sub-block is used to predict the first pixel and the second pixel in parallel based on reconstructed pixels around the first sub-block.

6. The image decoding method according to claim 5, wherein:

7. Analyzing the codestream of the block to be decoded includes: and analyzing the code stream of the block to be decoded using a variable code length decoding method to obtain a coding code length CL for encoding each value in a residual block corresponding to the block to be decoded and a first residual block.

2. The image decoding method according to claim 1, wherein:

8. 1. An image encoding method, comprising: determining a target prediction mode for a block to be coded and determining a target prediction order corresponding to the target prediction mode; predicting each pixel in the current block to be coded in the target prediction order according to the target prediction mode; determining a second residual block of the current block based on the predicted value of each pixel; quantizing the second residual block based on a quantization parameter for each pixel and a quantization preset array to obtain a first residual block; encoding the first residual block to obtain a codestream of the current block.

1. An image coding method comprising:

9. An image encoding device comprising a determining means, a predicting means, and an encoding means, the determining means is used to determine a target prediction mode of a current block to be coded and to determine a target prediction order corresponding to the target prediction mode; the prediction means is used to predict each pixel in the current block to be coded in the target prediction order according to the target prediction mode; the determining means is further configured to determine a second residual block of the block to be coded based on the predicted value of each pixel, and to quantize the second residual block based on the quantization parameter of each pixel and a quantization preset array to obtain a first residual block; The encoding means is used to encode the first residual block in the target prediction order to obtain a codestream of the block to be encoded. An image encoding device comprising:

10. An image decoding device comprising: an analyzing means, a determining means, a predicting means, and a reconstructing means, the analyzing means is used to analyze a code stream of a block to be decoded and determine a target prediction mode for predicting pixels in the block to be decoded; the determination means is used to determine a target prediction order corresponding to the target prediction mode based on the target prediction mode, the prediction means is used to predict each pixel in the current block to be decoded in the target prediction order according to the target prediction mode; the reconstruction means is used to reconstruct each pixel based on the predicted value of each pixel to obtain a reconstructed block of the block to be decoded; the determining means is further used to inverse quantize a first residual block of the block to be decoded, which is obtained by analyzing the code stream of the block to be decoded, based on an inverse quantization parameter of each pixel in the block to be decoded and an inverse quantization preset array, which are obtained by analyzing the code stream of the block to be decoded, to obtain a second residual block; The reconstruction means is further used to reconstruct each pixel based on the predicted value of each pixel and the second residual block to obtain the reconstructed block. An image decoding device comprising:

11. An electronic device comprising a processor and a memory, the memory being adapted to store computer instructions, and the processor being adapted to retrieve and execute the computer instructions from the memory so as to implement the method of any one of claims 1 to 8. An electronic device characterized by:

12. A computer-readable storage medium having stored thereon a computer program or instructions which, when executed by a processor, implements the method of any one of claims 1 to 8. A computer-readable storage medium comprising:

Citation Information

Patent Citations

  • Decoding system, decoder and decoding circuit

    JP1996130745A

  • Method and device for encoding video signal

    JP1997200777A

  • Image encoding apparatus and image encoding program

    JP2007300389A

  • Adaptive Coding of Prediction Errors in Hybrid Video Coding

    JP2009522968A

  • Improving intra-prediction in HEVC lossless coding

    JP2015515226A