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

By employing target prediction modes and sequences in image encoding and decoding, combined with variable code length encoding and inverse quantization processing, the image encoding and decoding process is optimized, solving the problem of redundant information removal in video encoding, improving encoding and decoding efficiency, and reducing cache and computing resources.

CN116095310BActive Publication Date: 2024-11-12HANGZHOU HIKVISION DIGITAL TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210320915.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-29
Publication Date
2024-11-12
Estimated Expiration
2042-03-29

AI Technical Summary

Technical Problem

Existing technologies struggle to effectively remove redundant information in video encoding, resulting in large data volumes and increased demands for storage space and transmission bandwidth.

Method used

By determining the target prediction mode and prediction order, pixels in image blocks are predicted point by point or sub-block by sub-block. Combined with variable code length encoding and inverse quantization processing, the image encoding and decoding process is optimized, reducing cache requirements and computing resources.

Benefits of technology

It improves the efficiency of image encoding and decoding, reduces the consumption of cache space and computing resources, and enhances the speed and efficiency of encoding and decoding.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116095310B_ABST
    Figure CN116095310B_ABST
Patent Text Reader

Abstract

The present application discloses an image coding and decoding method, device, electronic device and storage medium, and relates to the field of image coding and decoding technology. The image coding method comprises: parsing the code stream of the block to be decoded to determine the target prediction mode for predicting the pixels in the block to be decoded; based on the target prediction mode, determining the target prediction order corresponding to the target prediction mode; predicting each pixel in the 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. Through this method, the efficiency of image coding can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] A complete image in a video is usually called a "frame", and a video consisting of multiple frames in chronological order is called a video sequence. Video sequences contain a series of redundant information, such as spatial redundancy, temporal redundancy, visual redundancy, information entropy redundancy, structural redundancy, knowledge redundancy, and importance redundancy. In order to remove redundant information in video sequences as much as possible and reduce the amount of data representing the video, video coding technology is proposed to achieve the effect of reducing storage space and saving transmission bandwidth. Video coding technology is also called video compression technology.

[0003] With the continuous development of technology, it is becoming more and more convenient to collect video data, and the scale of collected video data is also getting larger and larger. Therefore, how to effectively encode and decode video data has become an urgent problem that needs to be solved. Summary of the invention

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

[0005] To achieve the above objectives, this application provides the following technical solutions:

[0006] In a first aspect, the present application provides an image decoding method, the method comprising: parsing a code stream of a block to be decoded to determine a target prediction mode for predicting pixels in the block to be decoded. Based on the target prediction mode, determining a target prediction order corresponding to the target prediction mode. According to the target prediction mode, predicting each pixel in the block to be decoded in the target prediction order. Reconstructing each pixel based on the predicted value of each pixel to obtain a reconstructed block of the block to be decoded.

[0007] Through the image decoding method provided by the present application, when the decoding end predicts the pixels in the block to be decoded in the target prediction mode, the pixels in the block to be decoded are predicted in the target prediction order corresponding to the target prediction mode. In this process, when the decoding end predicts any pixel in the block to be decoded, the pixels used to predict the pixel have been reconstructed. Therefore, the image decoding method provided by the present application improves the efficiency of predicting the pixels in the block to be decoded, and then when the decoding end obtains the reconstructed value based on the predicted value and the residual value, the decoding end does not need to cache the residual value. Therefore, the decoding method provided by this embodiment can not only save the cache space used to cache the residual value, but also improve the decoding efficiency.

[0008] In a possible design, when predicting any pixel in the to-be-decoded block in the above target prediction order, the pixels used to predict any pixel have been reconstructed.

[0009] In another possible design, if the target prediction mode indicates that each pixel in the block to be decoded is predicted point by point in the target prediction order, then the above-mentioned predicting each pixel in the block to be decoded in the target prediction order according to the target prediction mode includes: predicting each pixel in the block to be decoded point by point along the direction indicated by the target prediction order according to the target prediction mode. Wherein, when the target prediction mode is the first target prediction mode, the target prediction order is the first prediction order, and when the target prediction mode is the 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.

[0010] In other words, different prediction modes correspond to different prediction orders.

[0011] In another possible design, for a block to be decoded having a size of the first size, the block to be decoded is predicted using a third prediction order in the above target prediction mode. For a block to be decoded having a size of the second size, the block to be decoded is predicted using a fourth prediction order in the above target prediction mode. The third prediction order is different from the fourth prediction order.

[0012] In other words, when the sizes of the blocks to be decoded are different, if the same prediction mode is used to predict the pixels in the blocks to be decoded, the prediction orders may also be different.

[0013] In a possible design manner, if the above-mentioned target prediction mode indicates that the pixels of each sub-block in the block to be decoded are predicted sequentially in units of sub-blocks with a preset size in the block to be decoded, then the above-mentioned predicting each pixel in the block to be decoded in a target prediction order according to the target prediction mode includes: predicting the pixels in each sub-block in the block to be decoded sequentially along the direction indicated by the target prediction order according to the target prediction mode.

[0014] In another possible design, 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, when 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.

[0015] Through these two possible designs, when predicting a sub-block, the decoder can predict multiple pixels in the sub-block in parallel based on the reconstructed pixels around the sub-block, that is, this prediction mode can further improve the efficiency of the decoder in predicting the block to be decoded. Furthermore, when the decoder obtains the reconstructed value based on the predicted value and the residual value, the decoder does not need to cache the residual value, so the decoding method provided by the two possible designs further saves cache space and improves decoding efficiency.

[0016] In another possible design, the above-mentioned reconstructing each pixel based on the predicted value of each pixel to obtain the reconstructed block of the block to be decoded includes: based on the inverse quantization parameter of each pixel in the block to be decoded obtained by parsing the code stream of the block to be decoded and the inverse quantization preset array, dequantizing the first residual block of the block to be decoded obtained by parsing the code stream of the block to be decoded to obtain a second residual block. Reconstructing each pixel based on the predicted value of each pixel and the second residual block to obtain the reconstructed block.

[0017] Through this possible design, the inverse quantization of the first residual block of the block to be decoded can be achieved based on fewer multiplication operations, that is, the inverse quantization of the first residual block of the block to be decoded can be achieved efficiently. Therefore, the decoding method provided by this possible design can further improve the efficiency of image decoding.

[0018] In a possible design, the above-mentioned parsing of the code stream of the block to be decoded includes: parsing the code stream of the block to be decoded using a variable code length decoding method to obtain a coding code length CL and a first residual block for encoding each value in a residual block corresponding to the block to be decoded.

[0019] Through this possible design, the residual block and CL of the block to be decoded are encoded with fewer bits at the encoding side, so the decoding efficiency is improved at the corresponding decoding side. Therefore, the decoding method provided by this possible design can further improve the efficiency of image decoding.

[0020] In a second aspect, the present application provides an image coding method, the method comprising: determining a target prediction mode of a block to be coded, and determining a target prediction order corresponding to the target prediction mode. According to the target prediction mode, predict each pixel in the block to be coded in the target prediction order. Determine a residual block of the block to be coded based on the predicted value of each pixel. Encode the residual block in the target prediction order to obtain a code stream of the block to be coded.

[0021] In a possible design, when predicting any pixel in the to-be-encoded block in the above target prediction order, the pixels used to predict any pixel have been reconstructed.

[0022] In another possible design, if the above-mentioned target prediction mode indicates that each pixel in the coding block is predicted point by point in the target prediction order, then the above-mentioned prediction of each pixel in the block to be coded in the target prediction order according to the target prediction mode includes: predicting each pixel in the block to be coded point by point along the direction indicated by the target prediction order according to the target prediction mode. Wherein, when the target prediction mode is the first target prediction mode, the target prediction order is the first prediction order, and when the target prediction mode is the 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. In other words, different prediction modes correspond to different prediction orders.

[0023] In another possible design, for a block to be encoded having a size of the first size, the block to be encoded is predicted using a third prediction order in the above target prediction mode. For a block to be encoded having a size of the second size, the block to be encoded is predicted using a fourth prediction order in the above target prediction mode. The third prediction order is different from the fourth prediction order. In other words, when the sizes of the blocks to be encoded are different, if the same prediction mode is used to predict pixels in the blocks to be encoded, the prediction order may also be different.

[0024] In another possible design manner, if the above-mentioned target prediction mode indicates that the pixels of each sub-block in the block to be encoded are predicted in sequence in units of sub-blocks of a preset size in the block to be encoded, then the above-mentioned predicting each pixel in the block to be encoded in a target prediction order according to the target prediction mode includes: predicting the pixels in each sub-block in the block to be encoded in sequence along the direction indicated by the target prediction order according to the target prediction mode.

[0025] In another possible design, the above-mentioned target prediction mode includes a prediction mode of each sub-block in the block to be encoded. For the first sub-block in the block to be encoded, 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 the reconstructed pixels around the first sub-block.

[0026] In another possible design, before encoding the residual block in the target prediction order to obtain the code stream of the block to be encoded, the method includes: determining a quantization parameter QP for each pixel in the block to be encoded. Based on the QP of each pixel and the quantization preset array, the residual block to be encoded is quantized to obtain a first residual block. In this case, the encoding of the residual block in the target prediction order to obtain the code stream of the block to be encoded includes: encoding the first residual block in the target prediction order to obtain the code stream of the block to be encoded.

[0027] In another possible design, the above-mentioned encoding of the first residual block in the target prediction order to obtain the code stream of the block to be encoded includes: encoding the first residual block in the target prediction order and using a variable code length encoding method to obtain the code stream of the block to be encoded.

[0028] It can be understood that the image encoding method provided by the second aspect and any possible design thereof corresponds to the image decoding method provided by the first aspect and any possible design thereof. Therefore, the beneficial effects of the technical solution provided by the second aspect and any possible design thereof can refer to the description of the beneficial effects of the corresponding method in the first aspect and will not be repeated here.

[0029] In a third aspect, the present application provides an image decoding method, the method comprising: parsing a code stream of a block to be decoded, obtaining an inverse quantization parameter of each pixel in the block to be decoded and a first residual block of the block to be decoded. Based on the QP indicated by the inverse quantization parameter of each pixel and the inverse quantization preset array, the first residual block is inversely quantized to obtain a second residual block. The block to be decoded is reconstructed based on the second residual block to obtain a reconstructed block.

[0030] Through the image decoding method provided by the present application, during the image decoding process, the quantization processing method implemented based on the quantization prediction array provided by the present application greatly saves the computing resources on the decoding end, that is, the efficiency of the quantization processing process in the image decoding method is greatly improved compared with the existing technology, and thus the image decoding method greatly improves the image decoding efficiency.

[0031] In a possible design, the above-mentioned parsing of the code stream of the block to be decoded to obtain the inverse quantization parameter of each pixel in the block to be decoded and the first residual block of the block to be decoded includes: determining the target prediction mode for predicting the pixels in the block to be decoded and the inverse quantization parameter of each pixel in the block to be decoded based on the code stream of the block to be decoded; determining the residual scanning order corresponding to the target prediction mode based on the target prediction mode; parsing the code stream of the block to be decoded based on the residual scanning order to obtain the first residual block. Wherein, 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. In other words, different prediction modes correspond to different residual scanning orders.

[0032] In another possible design, for a block to be decoded of a first size, a third scanning order is used to parse the bitstream of the block to be decoded in the above target prediction mode. For a block to be decoded of a second size, a fourth scanning order is used to parse the bitstream of the block to be decoded in the above target prediction mode; wherein the third scanning order and the fourth scanning order are different. In other words, when the sizes of the blocks to be decoded are different, if the same prediction mode is used to predict the pixels in the blocks to be decoded, the residual scanning order when parsing the bitstream of the blocks to be decoded may also be different.

[0033] Based on the two possible design methods, when a residual block to be decoded is obtained based on the residual scanning order, if the prediction block of the block to be decoded is predicted in the target prediction order that is the same as the residual scanning order, the efficiency of reconstructing the block to be decoded based on the residual block and the prediction block can be improved, that is, the two possible design methods further improve the decoding efficiency of the image.

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

[0035] In another possible design, the above-mentioned dequantization of the first residual block based on the quantization parameter QP of each pixel and the dequantization preset array to obtain the second residual block includes: determining the magnification coefficient corresponding to each pixel in the dequantization preset array based on the QP of each pixel. Based on the magnification coefficient corresponding to each pixel, the first residual block is dequantized to obtain the second residual block.

[0036] In another possible design, the above-mentioned dequantization of the first residual block based on the quantization parameter QP of each pixel and the dequantization preset array to obtain the second residual block includes: determining the magnification parameter and displacement parameter corresponding to each pixel based on the QP of each pixel and the dequantization preset array. Dequantization operation is performed on the first residual block based on the magnification parameter and displacement parameter corresponding to each pixel to obtain the second residual block. The value of the magnification parameter corresponding to each pixel is the value corresponding to the bitwise AND value of the QP of each pixel and 7 in the dequantization preset array, and the value of the displacement parameter corresponding to each pixel is 7 and the QP of each pixel divided by 2. 3 The difference of the quotients.

[0037] Based on the above three possible implementation methods, the quantization processing method implemented by the quantization prediction array provided in the present application greatly saves the computing resources on the decoding end, that is, the efficiency of the quantization processing process in the image decoding method is greatly improved compared with the existing technology.

[0038] In another possible design, the above-mentioned reconstructing the block to be decoded based on the second residual block to obtain the reconstructed block includes: inversely transforming the second residual block to reconstruct the residual value block of the block to be decoded. Reconstructing the block to be decoded based on the residual value block to obtain the reconstructed block.

[0039] In another possible design, the above-mentioned reconstruction of 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 the target prediction mode. Reconstructing the block to be decoded based on the predicted value of each pixel and the second residual block to obtain a reconstructed block.

[0040] Through this possible design method, since the prediction efficiency can be improved when predicting the to-be-decoded block based on the target prediction mode provided in the present application, this possible design method further improves the decoding efficiency of the image.

[0041] In another possible design, the above-mentioned parsing of the code stream of the block to be decoded includes: parsing the code stream of the block to be decoded using a variable code length decoding method to obtain a coding code length CL and a first residual block for encoding each value in a residual block corresponding to the block to be decoded.

[0042] Through this possible design, the residual block and CL of the block to be decoded are encoded with fewer bits at the encoding side, so the decoding efficiency is improved at the corresponding decoding side. Therefore, the decoding method provided by this possible design can further improve the efficiency of image decoding.

[0043] In a fourth aspect, the present application provides an image encoding method, the method comprising: determining a second residual block of a block to be encoded and a quantization parameter QP of each pixel in the block to be encoded. Based on the QP of each pixel and a quantization preset array, quantizing the second residual block to obtain a first residual block. Encoding the first residual block to obtain a code stream of the block to be encoded.

[0044] In another possible design, the above-mentioned encoding of the first residual block to obtain the bitstream of the block to be encoded includes: determining the target prediction mode of the block to be encoded, and determining the residual scanning order corresponding to the target prediction mode. The residual block is encoded in the residual scanning order to obtain the bitstream of the block to be encoded. 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.

[0045] In another possible design, for a block to be encoded having a size of the first size, the block to be encoded is encoded using a third scanning order in the above target prediction mode. For a block to be encoded having a size of the second size, the block to be encoded is encoded using a fourth scanning order in the above target prediction mode. The third scanning order is different from the fourth scanning order.

[0046] In another possible design, the above-mentioned quantization preset array includes an amplification parameter array and a shift parameter array, the amplification parameter array and the shift parameter array include the same number of values, for the i-th value amp[i] in the amplification parameter array and the i-th value shift[i] in the shift parameter array, 2 shift[i] The dequantized array formed by the quotient of amp[i] has the following rules: the interval between two adjacent numbers from the 1st to the nth number is 1, the interval between two adjacent numbers from the n+1st to the n+mth number is 2, and the interval between two adjacent numbers from the n+k*m+1st to the n+k*m+mth number is 2 k+1 ; Wherein, n and m are integers greater than 1, and i and k are positive integers.

[0047] In another possible design, the above-mentioned quantization of the second residual block based on the QP of each pixel and the quantization preset array to obtain the first residual block includes: determining the magnification parameter of each pixel in the magnification parameter array based on the QP of each pixel, and determining the displacement parameter of each pixel in the displacement parameter array. Based on the magnification parameter and displacement parameter of each pixel, the second residual block is quantized to obtain the first residual block.

[0048] In another possible design, the above-mentioned quantization of the second residual block based on the QP of each pixel and the quantization preset array to obtain the first residual block includes: determining the magnification parameter and displacement parameter corresponding to each pixel based on the QP of each pixel and the quantization preset array. Based on the magnification parameter and displacement parameter corresponding to each pixel, the second residual block is quantized to obtain the second residual block. The value of the magnification parameter corresponding to each pixel is the value corresponding to the bitwise AND value of the QP of each pixel and 7 in the quantization preset array, and the value of the displacement parameter corresponding to each pixel is 7 and the QP of each pixel divided by 2. 3 The sum of the quotients of ;

[0049] In another possible design, the second residual block is an original residual value block of the block to be encoded, or the second residual block is a residual coefficient block obtained after the residual value block is transformed.

[0050] In another possible design, the above-mentioned 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 the target prediction mode, and determining the second residual block based on the predicted value of each pixel in the block to be encoded.

[0051] In another possible design, the encoding of the first residual block to obtain the code stream of the block to be encoded includes: encoding the first residual block in a variable code length encoding manner to obtain the code stream of the block to be encoded.

[0052] It can be understood that the image encoding method provided by the fourth aspect and any possible design thereof corresponds to the image decoding method provided by the third aspect and any possible design thereof. Therefore, the beneficial effects of the technical solution provided by the fourth aspect and any possible design thereof can refer to the description of the beneficial effects of the corresponding method in the third aspect and will not be repeated here.

[0053] In a fifth aspect, the present application provides an image encoding method, the method comprising: determining a residual block corresponding to a block to be encoded, and encoding the residual block using a variable code length encoding method to obtain a code stream of the block to be encoded.

[0054] By using the encoding method provided by the present application, when the encoding end encodes the residual block of the encoding block through the exponential Golomb coding algorithm with a variable order, a smaller residual value can be adaptively encoded with fewer bits, thereby achieving the purpose of saving bits. That is, while improving the compression rate of image coding, the encoding method provided by the present application also improves the coding efficiency.

[0055] In a possible design, the variable code length encoding method includes an exponential Golomb coding method with a variable order. Then, the variable code length encoding method is used to encode the residual block to obtain a code stream of the block to be encoded, including: determining the attribute type of each pixel in the block to be encoded. For a first value in the residual block corresponding to the first pixel of the block to be encoded, based on a preset strategy and the attribute type of the first pixel, determine the target order when encoding the first value. Encode the first value using an exponential Golomb coding algorithm of the target order to obtain a code stream.

[0056] In another possible design, the above-mentioned variable code length encoding method includes an exponential Golomb coding method of a preset order, and the residual block is encoded using the variable code length encoding method to obtain a code stream of the block to be encoded, including: for a first value in the residual block corresponding to the first pixel of the block to be encoded, the first value is encoded using an exponential Golomb coding algorithm of a preset order to obtain a code stream.

[0057] The two possible design methods realize variable-length coding of the residual value in the residual block through a variable or specified-order exponential Golomb coding method. This coding method can adaptively encode smaller residual values ​​with fewer bits, thereby achieving the purpose of saving bits.

[0058] In another possible design, the method further includes: determining a semantic element corresponding to the residual block, the semantic element including a coding code length CL for coding each value in the residual block, and encoding each value CL in a variable code length coding manner to obtain a code stream.

[0059] In another possible design, the variable code length encoding method includes an exponential Golomb coding method with a variable order, and for any value in the residual block, the variable code length encoding method is used to encode the CL of each value to obtain a code stream, including: determining a target order when encoding the CL of any value. Encoding the CL of any value using an exponential Golomb coding algorithm with a target order to obtain a code stream.

[0060] The two possible design methods realize variable-length coding of the CL of the residual value in the residual block through a variable or specified-order exponential Golomb coding method. This coding method can adaptively encode a smaller CL with fewer bits, thereby achieving the purpose of saving bits.

[0061] In another possible design, for any value in the residual block, the above-mentioned encoding method using a variable code length to encode the CL of each value to obtain a code stream includes: when the CL of any value is less than or equal to a threshold, a preset number of bits are used to encode the CL of any value to obtain a code stream. When the CL of any value is greater than the threshold, a truncated unary code is used to encode the CL of any value to obtain a code stream.

[0062] This possible design method implements variable-length coding of the CL of the residual value in the residual block through fixed-length coding and truncated unary code. This coding method can adaptively encode a smaller CL with fewer bits, thereby achieving the purpose of saving bits.

[0063] In another possible design, the above-mentioned residual block is the original residual value block of the block to be encoded; or, the above-mentioned residual block is the residual coefficient block obtained after the original residual value block is transformed; or, the above-mentioned residual block is the quantized coefficient block obtained after the residual coefficient block is quantized.

[0064] In another possible design, if the above-mentioned residual block is the original residual value block of the block to be encoded, then the above-mentioned determination of the residual block corresponding to the block to be encoded includes: determining a target prediction mode of the block to be encoded, and determining a target prediction order corresponding to the target prediction mode. According to the target prediction mode, predict each pixel in the block to be encoded in the target prediction order. Based on the predicted value of each pixel in the block to be encoded, determine the residual block.

[0065] Through this possible design method, since the prediction efficiency can be improved when predicting the coding block based on the target prediction mode provided in the present application, this possible design method further improves the coding efficiency of the image.

[0066] In another possible design, if the above-mentioned residual block is a quantized coefficient block obtained after quantization of the residual coefficient block, then before encoding the residual block in the above-mentioned encoding method using a variable code length to obtain a code stream of the block to be encoded, the above-mentioned method further includes: determining a quantization parameter QP for each pixel in the block to be encoded. Based on the QP of each pixel and the quantization preset array, the residual value block to be encoded is quantized to obtain a residual block.

[0067] Through this possible design, the quantization of the residual value block to be encoded can be achieved based on fewer multiplication operations, that is, the quantization of the residual value block to be encoded can be achieved efficiently. Therefore, the encoding method provided by this possible design can further improve the efficiency of image encoding.

[0068] In a sixth aspect, the present application provides an image decoding method, the method comprising: parsing a code stream of a block to be decoded using a variable code length decoding method to obtain a coding code length CL for each value in a residual block corresponding to the block to be decoded. Determine a residual block based on the CL of each coding value. Reconstruct the block to be decoded based on the residual block to obtain a reconstructed block.

[0069] In another possible design, the variable code length decoding method includes an exponential Golomb decoding method with a variable order or a preset order, and the variable code length decoding method is used to parse the code stream of the block to be decoded to obtain the encoding code length CL of each value in the residual block corresponding to the block to be decoded, including: determining the target order when parsing the CL of each value in the encoded residual block. The exponential Golomb decoding algorithm of the target order is used to parse the code stream to obtain the CL of each value in the encoded residual block.

[0070] In another possible design, the above-mentioned variable code length decoding method is used to parse the code stream of the block to be decoded to obtain the encoding code length CL of each value in the residual block corresponding to the block to be decoded, including: when the number of bits used to encode any value CL in the residual block is a preset number, the code stream is parsed based on the fixed-length decoding strategy to obtain the CL for encoding any value. When the number of bits used to encode any value CL in the residual block is greater than the preset number, the code stream is parsed based on the rule of truncated unary code to obtain the CL for encoding any value.

[0071] In another possible design, the above-mentioned determination of the residual block based on the CL of each encoded value includes: determining a bit group corresponding to each pixel in the block to be decoded in the code stream based on the CL of each encoded value. Determining the attribute type of each pixel in the block to be decoded. For a first bit group corresponding to a first pixel in the block to be decoded, determining a target order for parsing the first bit group based on a preset strategy and the attribute type of the first pixel. Parsing the first bit group using an exponential Golomb decoding algorithm of the target order to obtain a residual block.

[0072] In another possible design, the above-mentioned determining the residual block based on the CL of each encoding value includes: determining a bit group corresponding to each pixel in the to-be-decoded block in the bitstream based on the CL of each encoding value. For a first bit group corresponding to a first pixel in the to-be-decoded block, an exponential Golomb decoding algorithm of a preset order is used to parse the first bit group to obtain a residual block.

[0073] In another possible design, the above-mentioned reconstructing the block to be decoded based on the residual block to obtain the reconstructed block includes: inverse quantizing and inverse transforming the residual block, or inverse quantizing the residual block to reconstruct the residual value block of the block to be decoded. Reconstructing the block to be decoded based on the residual value block to obtain the reconstructed block.

[0074] In another possible design, the above-mentioned reconstruction of the block to be decoded based on the residual block to obtain the reconstructed block includes: determining a target prediction mode for predicting pixels in the block to be decoded based on the code stream of the block to be decoded. Based on the target prediction mode, determining a target prediction order corresponding to the target prediction mode. According to the target prediction mode, predicting each pixel in the block to be decoded in the target prediction order. 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.

[0075] In another possible design, the above-mentioned dequantization of the residual block includes: dequantizing the residual block based on the dequantization parameter of each pixel in the block to be decoded and the dequantization preset array obtained by parsing the code stream of the block to be decoded.

[0076] It can be understood that the image decoding method provided by the sixth aspect and any possible design thereof corresponds to the image encoding method provided by the fifth aspect and any possible design thereof. Therefore, the beneficial effects of the technical solution provided by the sixth aspect and any possible design thereof can refer to the description of the beneficial effects of the corresponding method in the fifth aspect and will not be repeated here.

[0077] In a seventh aspect, the present application provides an image decoding device. The decoding device may be a video decoder or a device including a video decoder. The decoding device includes modules for implementing the method in any possible implementation of the first aspect, the third aspect or the sixth aspect. The decoding device has the function of implementing the behavior in the above-mentioned related method instance. The function may be implemented by hardware, or by hardware executing corresponding software implementation. The hardware or software includes one or more modules corresponding to the above-mentioned functions. The beneficial effects thereof can be found in the description of the corresponding method, which will not be repeated here.

[0078] In an eighth aspect, the present application provides an image encoding device. The encoding device may be a video encoder or a device including a video encoder. The encoding device includes modules for implementing the method in any possible implementation of the second aspect, the fourth aspect, or the fifth aspect. The encoding device has the function of implementing the behavior in the above-mentioned related method instance. The function may be implemented by hardware, or by hardware executing corresponding software implementation. The hardware or software includes one or more modules corresponding to the above-mentioned functions. The beneficial effects thereof can be found in the description of the corresponding method, which will not be repeated here.

[0079] In a ninth aspect, the present application provides an electronic device comprising a processor and a memory, wherein the memory is used to store computer instructions, and the processor is used to call and execute the computer instructions from the memory to implement a method of any one of the implementation methods in the first to sixth aspects.

[0080] For example, the electronic device may refer to a video encoder, or a device including a video encoder.

[0081] For another example, the electronic device may refer to a video decoder, or a device including a video decoder.

[0082] In the tenth aspect, the present application provides a computer-readable storage medium, in which a computer program or instructions are stored. When the computer program or instructions are executed by a computing device or a storage system where the computing device is located, a method of implementing any one of the first to sixth aspects is implemented.

[0083] In the eleventh aspect, the present application provides a computer program product, which includes instructions. When the computer program product runs on a computing device or a processor, the computing device or the processor executes the instructions to implement a method of any one of the implementation methods of the first to sixth aspects.

[0084] In the twelfth aspect, the present application provides a chip including a memory and a processor, wherein the memory is used to store computer instructions, and the processor is used to call and execute the computer instructions from the memory to implement the method of any one of the implementation modes in the first to sixth aspects.

[0085] In a thirteenth aspect, the present application provides an image decoding system, which includes an encoding end and a decoding end, the decoding end is used to implement the corresponding decoding method provided in the first, third or sixth aspect, and the encoding end is used to implement the corresponding encoding method.

[0086] Based on the implementations provided in the above aspects, the present application can be further combined to provide more implementations. In other words, any possible implementation of any of the above aspects can be applied to other aspects without conflict, thereby obtaining a new embodiment. For example, any image decoding method provided in the first, third and sixth aspects can be combined in pairs or in three aspects without conflict, thereby obtaining a new image decoding method. BRIEF DESCRIPTION OF THE DRAWINGS

[0087] Figure 1 A schematic diagram of the architecture of a coding and decoding system 10 used in an embodiment of the present application;

[0088] Figure 2 is a schematic block diagram of an example of an encoder 112 for implementing the method according to an embodiment of the present application;

[0089] Figure 3 A schematic diagram of a corresponding relationship between an image, a parallel coding unit, an independent coding unit, and a coding unit provided in an embodiment of the present application;

[0090] Figure 4 A schematic diagram of a flow chart of an encoding process provided in an embodiment of the present application;

[0091] Figure 5 is a schematic block diagram of an example of a decoder 122 for implementing the method according to an embodiment of the present application;

[0092] Figure 6a A schematic diagram of a flow chart of an image encoding method provided in an embodiment of the present application;

[0093] Figure 6b A flowchart of an image decoding method provided in an embodiment of the present application;

[0094] Figure 6c A schematic diagram of a flow chart of another image encoding method provided in an embodiment of the present application;

[0095] Figure 7a A schematic diagram of a prediction sequence provided in an embodiment of the present application;

[0096] Figure 7b A schematic diagram of another prediction sequence provided in an embodiment of the present application;

[0097] Figure 7c-1 A schematic diagram of another prediction sequence provided in an embodiment of the present application;

[0098] Figure 7c-2 A schematic diagram of another prediction sequence provided in an embodiment of the present application;

[0099] Figure 7d-1 A schematic diagram of another prediction sequence provided in an embodiment of the present application;

[0100] Figure 7d-2 A schematic diagram of another prediction sequence provided in an embodiment of the present application;

[0101] Figure 7d-3 A schematic diagram of another prediction sequence provided in an embodiment of the present application;

[0102] Figure 7e A schematic diagram of another prediction sequence provided in an embodiment of the present application;

[0103] Figure 7f A schematic diagram of another prediction sequence provided in an embodiment of the present application;

[0104] Figure 7g A schematic diagram of another encoding sequence provided in an embodiment of the present application;

[0105] Figure 8 A schematic diagram of a flow chart of another image decoding method provided in an embodiment of the present application;

[0106] Figure 9a A flowchart of another image encoding method provided in an embodiment of the present application;

[0107] Figure 9b A flowchart of another image decoding method provided in an embodiment of the present application;

[0108] Fig.10a A flowchart of another image encoding method provided in an embodiment of the present application;

[0109] Fig.10b A flowchart of another image decoding method provided in an embodiment of the present application;

[0110] Fig.11 A schematic diagram of the structure of a decoding device 1100 provided in an embodiment of the present application;

[0111] Fig.12 A schematic diagram of the structure of an encoding device 1200 provided in an embodiment of the present application;

[0112] Fig.13 A schematic diagram of the structure of a decoding device 1300 provided in an embodiment of the present application;

[0113] Fig.14 A schematic diagram of the structure of an encoding device 1400 provided in an embodiment of the present application;

[0114] Fig.15 A schematic diagram of the structure of an encoding device 1500 provided in an embodiment of the present application;

[0115] Fig.16 A schematic diagram of the structure of a decoding device 1600 provided in an embodiment of the present application;

[0116] Fig.17 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0117] In order to more clearly understand the embodiments of the present application, some terms or technologies involved in the embodiments of the present application are explained below:

[0118] 1) Prediction model

[0119] The combination of prediction methods used to predict the predicted value of each pixel in the current image block (such as the image block to be encoded (hereinafter referred to as the block to be encoded) or the image block to be decoded (hereinafter referred to as the block to be decoded)) is called a prediction mode. Different prediction methods can be used to predict different pixels in the current image block, or the same prediction method can be used. The prediction methods used to predict all pixels in the current image block can be collectively referred to as the (or corresponding) prediction mode of the current image block.

[0120] Optionally, the prediction mode includes: a point-by-point prediction mode, an intra-frame prediction mode, a block copy mode, and an original value mode (ie, a reconstructed value mode of directly decoding a fixed bit width), etc.

[0121] For example, the point-by-point prediction mode refers to a prediction mode that uses the reconstructed values ​​of the neighboring pixels around the pixel to be predicted as the predicted value of the pixel to be predicted. The point-by-point prediction mode includes one or more combinations of prediction modes such as vertical prediction, horizontal prediction, vertical mean prediction, and horizontal mean prediction.

[0122] The vertical prediction is to obtain the predicted value (PointPredData) of the pixel to be predicted by using the reconstructed value of the pixel on the upper side of the pixel to be predicted (which can be the adjacent upper side or the non-adjacent upper side but close to the pixel). In the embodiment of the present application, the prediction method using vertical prediction is called T prediction method. One example is: the reconstructed value of the adjacent pixel on the upper side of the pixel to be predicted is used as the predicted value of the pixel to be predicted.

[0123] Horizontal prediction is to obtain the predicted value of the pixel to be predicted by using the reconstructed value of the pixel on the left side of the pixel to be predicted (either the adjacent left side or the non-adjacent but closer left side). In the embodiment of the present application, the prediction method using horizontal prediction is called L prediction method. One example is: the reconstructed value of the adjacent pixel on the left side of the pixel to be predicted is used as the predicted value of the pixel to be predicted.

[0124] Vertical mean prediction is to obtain the predicted value of the pixel to be predicted by using the reconstructed values ​​of the pixels above and below the pixel to be predicted. In the embodiment of the present application, the prediction method using vertical mean prediction is called TB prediction method. One example is: the average of the reconstructed values ​​of the adjacent pixels vertically above the pixel to be predicted and the reconstructed values ​​of the adjacent pixels vertically below the pixel to be predicted is used as the predicted value of the pixel to be predicted.

[0125] The horizontal average prediction is to obtain the predicted value of the pixel to be predicted by using the reconstructed values ​​of the pixels on the left and right sides of the pixel to be predicted. In the embodiment of the present application, the prediction method using the horizontal average prediction is called the RL prediction method. An example is: the average of the reconstructed values ​​of the horizontal left adjacent pixels and the horizontal right adjacent pixels of the pixel to be predicted is used as the predicted value of the pixel to be predicted.

[0126] For example, the intra prediction mode is a prediction mode that uses the reconstructed values ​​of pixels in neighboring blocks around the block to be predicted as prediction values.

[0127] For example, the block copy prediction mode is a prediction mode that uses the reconstructed values ​​of pixels in the surrounding encoded (decoded) blocks (not necessarily adjacent) as the prediction value.

[0128] For example, the original value mode is a reconstructed value mode of directly decoding a fixed bit width, that is, a non-reference prediction mode.

[0129] 2) Residual coding mode

[0130] The way of encoding the residual (i.e., residual block, which is composed of the residual value of each pixel in the current image block) of the current image block (such as the block to be encoded or the block to be decoded) is called residual coding mode. The residual coding mode can include skip residual coding mode and normal residual coding mode.

[0131] In the skip residual coding mode, there is no need to encode (decode) the residual coefficients. At this time, the residual values ​​of the pixels in the current image block are all 0, and the reconstructed value of each pixel is equal to the predicted value of the pixel.

[0132] In the normal residual coding mode, the residual coefficients need to be encoded (decoded). At this time, the residual values ​​of the pixels in the previous image block are not all 0, and the reconstructed value of each pixel can be obtained based on the predicted value and the residual value of the pixel.

[0133] In one example, the residual value of a pixel is equivalent to the residual coefficient of the pixel; in another example, the residual coefficient of a pixel may be obtained by subjecting the residual value of the pixel to certain processing.

[0134] 3) Quantization and dequantization

[0135] In the image encoding process, in order to achieve image compression, the residual block of the block to be encoded is usually quantized, or the residual coefficient block obtained after a certain processing of the residual block is quantized, so that the quantized residual block or residual coefficient block can be encoded with fewer bits. It can be understood that the residual block is a residual value block obtained based on the original pixel block and the prediction block of the block to be encoded, and the residual coefficient block is a coefficient block obtained after a certain processing and transformation of the residual block.

[0136] As an example, taking the case where the coding device quantizes the residual block, the coding device may divide each residual value in the residual block of the to-be-coded block by a quantization coefficient to reduce the residual value in the residual block. In this way, compared with the residual value that has not been quantized, the reduced residual value after quantization can be encoded with fewer bits, thus achieving compression coding of the image.

[0137] Correspondingly, in order to reconstruct the image block from the compressed and encoded bit stream, the decoding device can dequantize the residual block or residual coefficient block parsed from the bit stream, so as to reconstruct the unquantized residual block or residual coefficient block corresponding to the image block. Then, the decoding device reconstructs the image block according to the reconstructed residual block or residual coefficient block, so as to obtain a reconstructed block of the image.

[0138] As an example, taking the residual block after the quantization of the block to be decoded parsed from the code stream by the decoding device as an example, the encoding device can dequantize the residual block. Specifically, the encoding device can multiply each residual value in the parsed residual block by a quantization coefficient to reconstruct the residual value in the unquantized residual block corresponding to the block to be decoded, thereby obtaining a reconstructed residual block. Among them, the quantization coefficient is the quantization coefficient 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 realize the reconstruction of the block to be decoded based on the residual block reconstructed after dequantization, and obtain the reconstructed block of the block to be decoded.

[0139] 4) Other terms

[0140] The term "at least one (kind)" in the embodiments of the present application includes one (kind) or more (kinds). "More than one (kind)" refers to two (kinds) or more than two (kinds). For example, at least one of A, B and C includes: A exists alone, B exists alone, A and B exist at the same time, A and C exist at the same time, B and C exist at the same time, and A, B and C exist at the same time. In the description of the present application, unless otherwise specified, " / " means or, for example, A / B can represent A or B; "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. "More than one" refers to two or more than two. In addition, in order to facilitate the clear description of the technical solutions of the embodiments of the present application, in the embodiments of the present application, the words "first", "second" and so on are used to distinguish the same items or similar items with basically the same functions and effects. Those skilled in the art can understand that the words "first", "second", etc. do not limit the quantity and execution order, and the words "first", "second", etc. do not necessarily limit the differences.

[0141] The following describes the system architecture used in the embodiments of the present application.

[0142] See also Figure 1 , Figure 1 FIG. 1 is a schematic diagram showing the architecture of the encoding and decoding system 10 used in the embodiment of the present application. Figure 1 As shown, the coding and decoding system 10 may include a source device 11 and a destination device 12. The source device 11 is used to encode an image, so the source device 11 may be referred to as an image encoding device or a video encoding device. The destination device 12 is used to decode the encoded image data generated by the source device 11, so the destination device 12 may be referred to as an image decoding device or a video decoding device.

[0143] The specific forms of the source device 10 and the destination device 12 can be various devices, which are not limited in the embodiments of the present application. For example, the source device 10 and the destination device 12 can be a desktop computer, a mobile computing device, a notebook (e.g., a laptop) computer, a tablet computer, a set-top box, a telephone handset such as a so-called "smart" phone, a television, a camera, a display device, a digital media player, a video game console, a car computer, or other similar devices.

[0144] Optionally, Figure 1 The source device 11 and the destination device 12 in the example may be two separate devices. Alternatively, the source device 11 and the destination device 12 may be the same device, that is, the source device 11 or the corresponding function and the destination device 12 or the corresponding function may be integrated in the same device.

[0145] The source device 11 and the destination device 12 may communicate with each other. For example, the destination device 12 may receive the encoded image data from the source device 11. In one example, one or more communication media may be included between the source device 11 and the destination device 12, and the one or more communication media are used to transmit the encoded image data. 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 destination device 12, which is not limited in the embodiments of the present application.

[0146] like Figure 1 As shown, the source device 11 includes an encoder 112. Optionally, the source device 11 may also include 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 refurbishment, color format conversion (for example, from RGB format to YUV format), color adjustment or denoising, etc. The encoder 112 is used to receive the image preprocessed by the image preprocessor 111, and process the preprocessed image using a related prediction mode to provide encoded image data. In some embodiments, the encoder 112 can be used to perform the encoding process in each embodiment described below. The communication interface 113 can be used to transmit the encoded image data to the destination device 12 or any other device (such as a memory) for storage or direct reconstruction. The other device can be any device for decoding or storage. The communication interface 113 can also encapsulate the encoded image data into a suitable format before transmission.

[0147] Optionally, 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 , which is not limited in the embodiment of the present application.

[0148] The destination device 12 includes a decoder 122. Optionally, the destination device 12 may also include a communication interface 121 and an image post-processor 123. The communication interface 121 may be used to receive encoded image data from the source device 11 or any other source device, such as a storage device. The communication interface 121 may also decapsulate the data transmitted by the communication interface 113 to obtain the encoded image data. The decoder 122 is used to receive the encoded image data and output the decoded image data (also referred to as reconstructed image data or reconstructed image data). In some embodiments, the decoder 122 may be used to perform the decoding process described in the various embodiments described below. The image post-processor 123 is used to perform post-processing on the decoded image data to obtain the post-processed image data. The post-processing performed by the image post-processor 123 may include: color format conversion (for example, from YUV format to RGB format), color adjustment, repair or resampling, or any other processing. The image post-processor 123 may also be used to transmit the post-processed image data to a display device for display.

[0149] Optionally, the communication interface 121, the decoder 122 and the image post-processor 123 may be hardware components in the destination device 12, or may be software programs in the destination device 12, which is not limited in the embodiment of the present application.

[0150] Below Figure 1 The structures of the encoder 112 and decoder 122 are briefly introduced.

[0151] See also Figure 2 , Figure 2 1 is a schematic block diagram of an example of an encoder 112 for implementing the method of the embodiment of the present application. Figure 2 As shown, the encoder 112 includes a prediction processing unit 201, a residual calculation unit 202, a residual transformation unit 203, a quantization unit 204, a coding unit 205, an inverse quantization unit (also referred to as an inverse quantization unit) 206, a residual inverse transformation unit 207, a reconstruction unit (or referred to as a reconstruction unit) 208, and a filter unit 209. Optionally, the encoder 20 may further include a buffer and a decoded image buffer. The buffer is used to cache the reconstructed block (or reconstructed block) output by the reconstruction unit 208, and the decoded image buffer is used to cache the filtered image block output by the filter unit 209.

[0152] In one example, the input of the encoder 112 is an image block to be encoded (i.e., a block to be encoded or a coding unit). In another example, the input of the encoder 112 is an image to be encoded, and the encoder 20 may include a segmentation unit ( Figure 2The encoder 112 is used for encoding the image to be encoded block by block 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.

[0153] In an example, a method for dividing a to-be-encoded image into a plurality of image blocks may include:

[0154] Step 1: Divide a frame of image into one or more non-overlapping parallel coding units. There is no dependency between the parallel coding units and they can be encoded and decoded in parallel / independently.

[0155] Step 2: For each parallel coding unit, the encoding end may divide it into one or more independent coding units that do not overlap each other. The independent coding units may not depend on each other, but may share some header information of the parallel coding unit.

[0156] Step 3: For each independent coding unit, the encoding end may further divide it into one or more non-overlapping coding units. If the independent coding unit is divided into multiple non-overlapping coding units, the division method may be horizontal equal division, vertical equal division, or horizontal and vertical equal division. Of course, the specific implementation is not shown here. The coding units in the independent coding unit may be interdependent, that is, they may refer to each other during the prediction step.

[0157] The width of the coding unit is w_cu, and the height is h_cu. Optionally, the width is greater than the height (unless it is an edge area). Usually, the coding unit can be a fixed w_cu×h_cu, where w_cu and h_cu are both 2N powers (N is greater than or equal to 0), such as 16×4, 8×4, 16×2, 8×2, 4×2, 8×1, 4×1, etc.

[0158] The coding unit may include three components, namely, luminance Y, chrominance Cb, and chrominance Cr (or three components, namely, red R, green G, and blue B), or only one of them. If it includes three components, the sizes of the components may be exactly the same or different, depending on the image input format.

[0159] like Figure 3 , which is a schematic diagram of the correspondence between an image, a parallel coding unit, an independent coding unit, and a coding unit. Figure 3 In the description, an example is taken in which an image is divided into parallel coding unit 1 and parallel coding unit 2 according to 3:1, and an independent coding unit includes 4 coding units.

[0160] The prediction processing unit 201 is used to receive or obtain the real value of the block to be encoded and the reconstructed image data, and predict the block to be encoded based on the relevant data in the reconstructed image data to obtain a predicted block of the block to be encoded.

[0161] The residual calculation unit 202 is used to calculate the residual value between the real value of the block to be encoded and the predicted block of the block to be encoded to obtain the residual block. For example, by subtracting the pixel value of the predicted block from the real pixel value of the block to be encoded pixel by pixel.

[0162] In one example, the residual transform unit 203 is used to determine the residual coefficient based on the residual block. Optionally, in this process, it can include: transforming the residual block, such as discrete cosine transform (DCT) or discrete sine transform (DST), to obtain transform coefficients in the transform domain, and the transform coefficients can also be called 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 the step of residual transform in the process of encoding the block to be encoded.

[0163] The quantization unit 204 is used to quantize the transform coefficients or residual values ​​by applying scalar quantization or vector quantization 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, a p-bit transform coefficient can be rounded down to a q-bit transform coefficient 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, different scales can be applied to achieve finer or coarser quantization. A smaller quantization step size corresponds to finer quantization, while a larger quantization step size corresponds to coarser quantization. The appropriate quantization step size can be indicated by the QP.

[0164] The encoding unit 205 is used to encode the above-mentioned quantized residual coefficients (or quantized residual values), and output the encoded image data (i.e., the encoding result of the current block to be encoded) in the form of an encoded bit stream (or code stream), and then the encoded bit stream can be transmitted to the decoder, or stored and subsequently transmitted to the decoder or used for retrieval. The encoding unit 205 can also be used to encode the syntax elements of the block to be encoded, such as encoding the prediction mode adopted by the block to be encoded into the code stream, etc.

[0165] In one example, the coding unit 205 encodes the residual coefficient, and a feasible method is: semi-fixed length coding. First, the maximum value of the absolute value of the residual in a residual block (RB) is defined as modifiedmaximum(mm). Determine the number of coding bits for the residual coefficient in the RB (the number of coding bits for the residual coefficient in the same RB is consistent). For example, if the CL of the current RB is 2 and the current residual coefficient is 1, then 2 bits are required to encode the residual coefficient 1, which is expressed as 01. If the CL of the previous RB is 7, it means encoding an 8-bit residual coefficient and a 1-bit sign bit. The determination of CL is to find the minimum M value that satisfies that all residuals of the current sub-block are within the range of [-2^(M-1), 2^(M-1)]. If both -2^(M-1) and 2^(M-1) exist, M should be increased by 1, that is, M+1 bits are required to encode all residuals of the current RB; if only one of the two boundary values ​​​​of -2^(M-1) and 2^(M-1) exists, a Trailing bit needs to be encoded to determine whether the boundary value is -2^(M-1) or 2^(M-1); if all residuals do not exist in either -2^(M-1) or 2^(M-1), there is no need to encode the Trailing bit.

[0166] Of course, other residual coefficient encoding methods may also be used, such as an exponential Golomb encoding method, a Golomb-Rice encoding method, a truncated unary code encoding method, a run-length encoding method, directly encoding the original residual value, and the like.

[0167] In addition, for some special cases, the original value can be directly encoded instead of the residual value.

[0168] The inverse quantization unit 206 is used to inverse quantize the above-mentioned quantized residual coefficient (or quantized residual value) to obtain an inverse quantized residual coefficient (inverse quantized residual value). The inverse quantization is the reverse application of the above-mentioned quantization unit 204, for example, based on or using the same quantization step size as the quantization unit 204, applying an inverse quantization scheme of the quantization scheme applied by the quantization unit 204.

[0169] The residual inverse transform unit 207 is used to inverse transform (or inverse transform) the above-mentioned inverse quantized residual coefficients to obtain a reconstructed residual block. Optionally, the inverse transform may include an inverse discrete cosine transform (discrete cosine transform, DCT) or an inverse discrete sine transform (discrete sine transform, DST). In this way, the inverse transform value obtained after the inverse transform (or inverse transform) of the above-mentioned inverse quantized residual coefficients is the residual value reconstructed in the pixel domain (or sample domain). That is, after the inverse quantized residual coefficient block is inversely transformed by the residual inverse transform unit 207, the block obtained is the reconstructed residual block. Of course, when the above-mentioned residual change unit 203 is not included in the encoder 112, the encoder 112 may also not include the inverse transform step.

[0170] The reconstruction unit 208 is used to add the reconstructed residual block to the prediction block to obtain a reconstructed block in the sample domain. The reconstruction unit 208 can be a summer. For example, the reconstruction unit 208 adds the residual value in the reconstructed residual block to the prediction value of the corresponding pixel in the prediction block to obtain the reconstructed value of the corresponding pixel. The reconstructed block output by the reconstruction unit 208 can be subsequently used to predict other image blocks to be encoded.

[0171] The filter unit 209 (or simply “filter”) is used to filter the reconstructed block to obtain a filtered block, so as to smoothly perform pixel conversion or improve image quality.

[0172] In one example, an encoding process such as Figure 4 As shown. Specifically, the encoder determines whether to adopt the point-by-point prediction mode. If so, prediction is performed based on the point-by-point prediction mode, and inverse quantization and reconstruction steps are performed to realize the encoding process; if not, it is determined whether the original value mode is adopted. If yes, the original value mode is adopted for encoding; if not, it is determined to adopt other prediction modes such as intra-frame prediction or block copy mode for prediction. Subsequently, when it is determined to perform residual skipping, the reconstruction step is directly performed; when it is determined not to perform residual skipping, the inverse quantization step is first performed, and it is determined whether the block copy prediction mode is adopted. If it is determined to adopt the block copy prediction mode, in one case, when it is determined to perform transform skipping, the reconstruction step is directly performed, and in another case, when it is determined that transform skipping is not performed, the encoding process is realized by performing inverse transform and reconstruction steps. If it is determined not to adopt the block copy mode (in this case, one of the prediction modes adopted is the intra-frame prediction mode), the inverse transform step and the reconstruction step are performed to realize the encoding process.

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

[0174] In one example, an encoding process implemented by the encoder 112 may include the following steps:

[0175] Step 11: The prediction processing unit 201 determines a prediction mode, and predicts the block to be encoded based on the determined prediction mode and the reconstructed block of the encoded image block to obtain a prediction block of the block to be encoded.

[0176] The reconstructed block of the encoded image block is obtained after the inverse quantization unit 206, the residual inverse transformation unit 207 and the reconstruction unit 208 sequentially process the quantized residual coefficient block of the encoded image block.

[0177] Step 12: The residual calculation unit 202 obtains a residual block of the block to be encoded based on the original pixel values ​​of the prediction block and the block to be encoded;

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

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

[0180] Step 15: The encoding unit 205 encodes the quantized residual coefficient block and the related syntax elements (such as prediction mode, encoding mode) to obtain a code stream of the block to be encoded.

[0181] See also Figure 5 , Figure 5 A schematic block diagram of an example of a decoder 122 for implementing the method of an embodiment of the present application is shown. The decoder 122 is used to receive image data (i.e., an encoded bit stream, e.g., an encoded bit stream including an image block and associated syntax elements) encoded by, for example, the encoder 112 to obtain a decoded image block.

[0182] like Figure 5 As shown, the decoder 122 includes a code stream parsing unit 301, a dequantization unit 302, a residual inverse transform unit 303, a prediction processing unit 304, a reconstruction unit 305, and a filter unit 306. In some examples, the decoder 122 can perform substantially the same Figure 2 The decoding process is the inverse of the encoding process described by the encoder 112. Optionally, the decoder 122 may also include a buffer and a filtered image buffer, wherein the buffer is used to cache the reconstructed image block output by the reconstruction unit 305, and the filtered image buffer is used to cache the filtered image block output by the filter unit 306.

[0183] The code stream parsing unit 301 is used to decode the encoded bit stream to obtain quantized residual coefficients (or quantized residual values) and / or decoding parameters (for example, the decoding parameters may include any one or all of the inter-frame prediction parameters, intra-frame prediction parameters, filter parameters and / or other syntax elements performed by the encoding side). The code stream parsing unit 301 is also used to forward the above-mentioned decoding parameters to the prediction processing unit 304, so that the prediction processing unit 304 performs a prediction process according to the decoding parameters.

[0184] The function of the inverse quantization unit 302 may be the same as that of the inverse quantization unit 206 of the encoder 112 , and is used to inverse quantize (ie, inverse quantize) the quantized residual coefficients decoded and output by the bitstream parsing unit 301 .

[0185] The function of the residual inverse transform unit 303 may be the same as that of the residual inverse transform unit 207 of the encoder 112, and is used to perform an inverse transform (e.g., an inverse DCT, an inverse integer transform, or a conceptually similar inverse transform process) on the above-mentioned dequantized residual coefficients to obtain a reconstructed residual value. The block obtained by the inverse transform is the residual block of the reconstructed block to be decoded in the pixel domain.

[0186] The function of the reconstruction unit 305 (eg, a summer) may be the same as that of the reconstruction unit 208 of the encoder 112 .

[0187] The prediction processing unit 304 is used to receive or obtain the encoded image data (for example, the encoded bit stream of the current image block) and the reconstructed image data. The prediction processing unit 304 can also receive or obtain relevant parameters of the prediction mode and / or information about the selected prediction mode (that is, the above-mentioned decoding parameters) from, for example, the bit stream parsing unit 302, and predict the current image block based on the relevant data and decoding parameters in the reconstructed image data to obtain a prediction block of the current image block.

[0188] The reconstruction unit 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, adding the residual value in the reconstructed residual block to the prediction value in the prediction block.

[0189] The filter unit 306 is configured to filter the reconstructed block to obtain a filtered block, where the filtered block is a decoded image block.

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

[0191] It should be understood that in the encoder 112 and decoder 122 of the embodiment of the present application, the processing result of a certain link can also be output to the next link after further processing. For example, after the interpolation filtering, motion vector derivation or filtering and other links, the processing results of the corresponding link are further subjected to operations such as Clip or shift.

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

[0193] Step 21: The code stream parsing unit 301 parses the prediction mode and the residual coding mode;

[0194] Step 22: The code stream parsing unit 301 parses quantization related values ​​(such as near values ​​or QP values, etc.) based on the prediction mode and the residual coding mode;

[0195] Step 23: The inverse quantization unit 302 analyzes the residual coefficients based on the prediction mode and the quantization correlation value;

[0196] Step 24: The prediction processing unit 304 obtains the prediction value of each pixel of the current image block based on the prediction mode;

[0197] Step 25: The residual value decoding unit 303 inversely transforms the residual coefficients to reconstruct the residual values ​​of each pixel of the current image block;

[0198] Step 26: The reconstruction unit 305 obtains the reconstructed value of each pixel in the current coding unit based on the predicted value and residual value of each pixel.

[0199] Below, in conjunction with the accompanying drawings, the embodiment of the present application provides the following image encoding and decoding method for illustration.

[0200] It should be noted that the encoding end in any embodiment of the present application may be the above Figure 1 or Figure 2 The encoder 112 in the embodiment may also be the above Figure 1 The source device 11 in the present application. The decoding end in any embodiment of the present application can be as described above Figure 1 or Figure 5 The decoder 122 in may also be the above Figure 1 The destination device 12 is not limited in this embodiment of the present application.

[0201] refer to Figure 6a , Figure 6a A schematic diagram of a process of an image encoding method provided by an embodiment of the present application is shown, and the method may include the following steps:

[0202] S11. The encoding end determines a target prediction mode of a block to be encoded, and determines a target prediction order corresponding to the target prediction mode.

[0203] The detailed description of S11 can refer to the description of S101 below, which will not be repeated here.

[0204] S12. The encoding end predicts each pixel in the to-be-encoded block in the above target prediction order according to the above target prediction mode.

[0205] The detailed description of S12 can be referred to the description of S102 below, which will not be repeated here.

[0206] S13: The encoding end determines a residual block of the block to be encoded based on the prediction value of each pixel in the block to be encoded.

[0207] The detailed description of S13 may refer to the description of S103 below, which will not be repeated here.

[0208] S14 (optional): the encoding end transforms the residual block of the block to be encoded to obtain a transformed residual coefficient block.

[0209] S15. The encoding end performs quantization processing on the residual coefficient block to obtain a quantized residual coefficient block.

[0210] It can be understood that when the encoder does not execute S14, the encoder can directly perform quantization processing on the above residual block to obtain a quantized residual block.

[0211] For a detailed description of the quantization process performed on the residual block or residual coefficient block by the encoder, reference may be made to the detailed description of the quantization process on the residual block in S301-S302 below, which will not be described in detail.

[0212] S16. The encoding end encodes the quantized residual coefficient block to obtain a code stream of the block to be encoded.

[0213] It can be understood that when the encoder does not perform S14, the encoder encodes the quantized residual block to obtain a code stream of the block to be encoded.

[0214] The process of encoding the quantized residual coefficient block (or residual block) at the encoding end may refer to the detailed description of S502 below and will not be repeated here.

[0215] It should be noted that the residual scanning order of the residual coefficient block encoded by the encoder can be the same as the target prediction order in S11. In this way, on the decoding side, the decoder can predict the predicted values ​​of the pixels in the to-be-decoded block in the target prediction order, and decode the residual block of the to-be-decoded block in the residual scanning order that is the same as the target prediction order, thereby being able to efficiently obtain the reconstructed block of the to-be-decoded block.

[0216] In the image coding method described in S11-S16, the target prediction mode used by the coding end to predict the pixels in the block to be coded has a high prediction efficiency, and the quantization method used by the coding end to quantize the residual block or the residual coefficient block can reduce the multiplication operation of the coding end, that is, improve the quantization efficiency, and the coding method used by the coding end can reduce the number of bits used to encode the residual block or the residual coefficient block. Therefore, the method provided by the embodiment of the present application can greatly improve the coding efficiency of the coding end.

[0217] refer to Figure 6b , Figure 6b A schematic diagram of a process of an image decoding method provided by an embodiment of the present application is shown, and the method may include the following steps:

[0218] S21. The decoding end parses the code stream of the block to be decoded to determine a target prediction mode for predicting pixels in the block to be decoded.

[0219] Among them, the detailed description of S21 can refer to the description of S201 below, which will not be repeated here.

[0220] S22. The decoding end determines a target prediction order corresponding to the target prediction mode based on the target prediction mode.

[0221] The detailed description of S22 can be referred to the description of S202 below, which will not be repeated here.

[0222] S23. The decoding end predicts each pixel in the to-be-decoded block in a target prediction order according to the target prediction mode to obtain a prediction value of each pixel.

[0223] S24. The decoding end parses the code stream of the block to be decoded by 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 parses the code stream of the block to be decoded based on the CL and in accordance with the above-mentioned residual scanning order to obtain the first residual block of the block to be decoded.

[0224] The residual scanning order and the target prediction order can be the same. When they are the same, that is, when the decoding end predicts the pixels in the block to be decoded in the target prediction order, the decoding end also parses the bit stream of the block to be decoded according to the residual scanning order that is the same as the target prediction order to obtain the first residual block of the block to be decoded. This can improve the decoding efficiency of the decoding end.

[0225] The decoding end uses a variable code length decoding method to parse the code stream of the block to be decoded, and obtains the CL of each value in the residual block corresponding to the block to be decoded, which can be referred to the description of S601 below. The decoding end determines the first residual block based on CL, which can be referred to the description of S602, and will not be repeated here.

[0226] S25. The decoding end obtains the inverse quantization parameter of each pixel in the block to be decoded by parsing the code stream of the block to be decoded.

[0227] The detailed description of the inverse quantization parameter may refer to the description in S401 below, which will not be repeated here.

[0228] S26. The decoding end 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.

[0229] The detailed description of S26 can refer to the description of S402 below, which will not be repeated here.

[0230] It should be noted that the embodiment of the present application does not limit the execution order of S23 and S24-S26. For example, S23 and S24-S26 can be executed at the same time.

[0231] S27 (optional): the decoding end performs an inverse transformation on the second residual block to obtain an inversely transformed second residual block.

[0232] It should be understood that when the image encoding process includes the above-mentioned S14, the decoding end executes S27.

[0233] S28. The decoding end 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.

[0234] It can be understood that when the decoding end does not execute S27, the decoding end 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.

[0235] It should be noted that the image decoding method of S21-S27 corresponds to the image encoding method of S11-S16. In the image decoding method described in S21-S26, the target prediction mode used by the decoding end to predict the pixels in the block to be decoded has a high prediction efficiency, and the dequantization method used by the decoding end to dequantize the residual block or the residual coefficient block can reduce the multiplication operation of the decoding end, that is, improve the dequantization efficiency, and the decoding method used by the decoding end can reduce the number of bits used to encode the residual block or the residual coefficient block. Therefore, the method provided by the embodiment of the present application can greatly improve the decoding efficiency of the decoding end.

[0236] Embodiment 1

[0237] like Figure 6c As shown, it is a schematic diagram of the flow chart of another image encoding method provided by this embodiment. Figure 6c The method shown includes the following steps:

[0238] S101: The encoding end determines a target prediction mode of a block to be encoded, and determines a target prediction order corresponding to the target prediction mode.

[0239] Specifically, the encoding end may predict the blocks to be encoded respectively by adopting different prediction modes, and determine the target prediction mode based on the encoding performance of the blocks to be encoded after predicting the encoding performance of the blocks to be encoded by using different prediction modes.

[0240] For example, the encoder can predict the blocks to be encoded respectively by using different prediction modes, and after obtaining the prediction blocks based on the different prediction modes, the encoder performs steps 12 to 15 described above to obtain the bitstreams of the blocks to be encoded under the different prediction modes. The encoder determines the time to obtain the bitstreams of the blocks to be encoded under the different prediction modes, and determines the prediction mode with the shortest time as the target prediction mode. In other words, the encoder determines the prediction mode with the highest coding efficiency as the target prediction mode.

[0241] In addition to the existing prediction mode, the embodiment of the present application also provides a variety of prediction modes. In the prediction mode provided in the embodiment of the present application, the encoding end can predict the pixels in the block to be encoded in sequence according to a preset order. The encoding end predicts the pixels in the block to be encoded in sequence according to a preset order, which means that the encoding end predicts the pixels in the block to be encoded in sequence according to a preset trajectory. In this process, when the encoding end predicts any pixel in the block to be encoded, the pixels used to predict any pixel have been reconstructed. Among them, the detailed description of the prediction mode provided in the embodiment of the present application can be referred to below, which will not be repeated here.

[0242] When the encoding end predicts the encoding performance of the block to be encoded based on different prediction modes and determines the target prediction mode, it can determine the target prediction order when predicting pixels in the block to be encoded using the target prediction mode.

[0243] S102: The encoding end predicts each pixel in the to-be-encoded block in the target prediction order according to the target prediction mode.

[0244] Optionally, the target prediction mode may be used to indicate that each pixel in the coding block is predicted point by point in the target prediction order. For example, when the target prediction mode is the first to fifth prediction modes described below, the target prediction order is used to indicate that each pixel in the coding block is predicted point by point in the trajectory direction indicated by the target prediction order.

[0245] In this case, the encoder predicts each pixel in the to-be-encoded block point by point in the direction of the track indicated by the target prediction order, so as to obtain the predicted value of each pixel.

[0246] Optionally, the target prediction mode may also be used to indicate that the pixels of each sub-block in the block to be encoded are predicted in sequence in units of sub-blocks with a preset size in the block to be encoded. For example, when the target prediction mode is the sixth prediction mode described below, the target prediction mode is used to indicate that the pixels of each sub-block in the block to be encoded are predicted in sequence in units of sub-blocks with a preset size in the block to be encoded.

[0247] In this case, the target prediction mode includes the prediction mode of each sub-block in the block to be encoded. In this way, the encoder can predict the pixels of each sub-block in the block to be encoded in sequence along the direction indicated by the target prediction order according to the target prediction mode. In addition, when the encoder predicts a sub-block of the block to be encoded, the encoder can predict each pixel in the sub-block based on the reconstructed pixels around the sub-block in parallel.

[0248] S103: The encoding end determines a residual block of the block to be encoded based on the prediction value of each pixel in the block to be encoded.

[0249] The encoder may determine the residual block of the block to be encoded according to the predicted value of each pixel in the block to be encoded and the original pixel value of the block to be encoded.

[0250] For example, the encoder can Figure 2 The residual calculation unit 202 shown performs a difference operation on the predicted value of each pixel in the block to be encoded and the original pixel value of the block to be encoded, so as to obtain a residual block of the block to be encoded.

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

[0252] The residual scanning order corresponds to the above target prediction mode. Optionally, the residual scanning order may be the same as the above target prediction order.

[0253] For example, when the block to be encoded is an image block of size 16×2, if the target prediction mode is the prediction mode shown in Table 1 below, the residual scanning order can be Figure 7a If the target prediction mode is the prediction mode shown in Table 2 below, the residual scanning order can be Figure 7b If the target prediction mode is the prediction mode shown in Table 3-1 below, the residual scanning order can be Figure 7c-1 If the target prediction mode is the prediction mode shown in Table 4-1 below, the residual scanning order can be Figure 7d-1 Shows the order of preset trajectory instructions.

[0254] For another example, when the block to be encoded is an image block of size 8×2, if the target prediction mode is the prediction mode shown in Table 3-2 below, the residual scanning order can be Figure 7c-2 If the target prediction mode is the prediction mode shown in Table 4-2 below, the residual scanning order can be Figure 7d-2 The sequence of preset track instructions is shown.

[0255] For another example, when the block to be encoded is an image block of size 8×1, if the target prediction mode is the prediction mode shown in Table 4-3 below, the residual scanning order can be Figure 7d-3 If the target prediction mode is the prediction mode shown in Table 5 below, the residual scanning order can be Figure 7e The sequence of preset track instructions is shown.

[0256] For another example, when the block to be encoded is an image block of size 16×2, if the target prediction mode is Figure 7f The prediction mode shown, the residual scanning order can be Figure 7g The sequence of preset track instructions is shown.

[0257] Optionally, the encoder may first transform the residual block of the block to be encoded to obtain a residual coefficient block of the block to be encoded. The encoder may also quantize the residual coefficient block to obtain a quantized residual coefficient block. Then, the encoder encodes the quantized residual coefficient block in the above-mentioned target prediction order to obtain an encoded bitstream of the block to be encoded.

[0258] For example, the encoder can first pass Figure 2 The residual transform unit 203 shown in FIG. 1 transforms the residual block of the block to be coded to obtain a residual coefficient block of the block to be coded. Figure 2 The quantization unit 204 shown in FIG. 2 quantizes the residual coefficient block to obtain a quantized residual coefficient block. Figure 2 The encoding unit 205 shown encodes the quantized residual coefficient block in the above target prediction order, thereby obtaining an encoded code stream of the block to be encoded.

[0259] Optionally, the encoder may directly quantize the residual block of the block to be encoded to obtain a quantized residual block. Then, the encoder encodes the quantized residual block in the above target prediction order to obtain an encoded bitstream of the block to be encoded.

[0260] For example, the encoder can directly pass Figure 2 The quantization unit 204 shown in FIG. 2 quantizes the residual block of the coding block to obtain a quantized residual block. Figure 2The encoding unit 205 shown encodes the quantized residual block in the above target prediction order, thereby obtaining an encoded code stream of the block to be encoded.

[0261] Optionally, the encoding end further uses the above target prediction mode as a semantic element of the block to be encoded, or uses the above target prediction mode and the corresponding target prediction order as a semantic element of the block to be encoded, and encodes the semantic element. The encoding end may also add the encoded semantic element data to the encoded bitstream of the block to be encoded.

[0262] It should be noted that the present embodiment does not specifically limit the manner in which the residual block or residual coefficient block of the coding block is quantized. For example, the residual block or residual coefficient block of the coding block may be quantized using the quantization method described in the following embodiment 2, but is certainly not limited thereto.

[0263] It should also be noted that this embodiment does not specifically limit the specific encoding method of the residual block or residual coefficient after encoding and quantization at the encoding end, and the encoding-related semantic elements. For example, the variable-length encoding method described in the following embodiment three can be used for encoding, but of course it is not limited to this.

[0264] The prediction mode provided in this embodiment is described in detail below. It should be noted in advance that in the prediction mode for predicting a block to be encoded, at least one prediction mode of the T prediction mode, TB prediction mode, L prediction mode and RL prediction mode described above may be included. Among them, a pixel in the block to be encoded can be predicted by any prediction mode of the T prediction mode, TB prediction mode, L prediction mode or RL prediction mode.

[0265] It should be noted that any of the following prediction modes can be applied to the process of encoding an image at the encoding end, and can also be applied to the process of decoding image data at the decoding end, and the embodiments of the present application are not limited to this.

[0266] In the first prediction mode, the size of the block to be coded is 16×2 as an example, as shown in Table 1, Table 1 shows a prediction mode for predicting each pixel in the coding block of size 16×2. In this prediction mode, the coding end predicts the order of pixels in the block to be coded in the following order: Figure 7a That is, the encoding end is based on the sequence of preset track instructions shown in Figure 7a When the preset trajectory shown in Table 1 predicts the pixels in the block to be encoded one by one in sequence, each pixel in the block to be encoded will be predicted in a specific prediction manner in the prediction mode shown in Table 1.

[0267] Table 1

[0268] T RL T RL T RL T RL T RL T RL T RL T L T RL T RL T RL T RL T RL T RL T RL T L

[0269] It can be understood that each cell in Table 1 shows the prediction method used to predict Figure 7a The predicted value of the pixel at the corresponding position in the block to be encoded is shown. For example, the T prediction method shown in the first row and the first cell of Table 1 is used to predict Figure 7a The predicted value of pixel 1-1 located in the first row and the first grid in the block to be encoded is shown. For another example, the RL prediction method shown in the second grid of the first row in Table 1 is used to predict Figure 7a The predicted value of pixel 1-2 located in the 2nd grid of the 1st row in the block to be encoded is shown. For another example, the T prediction method shown in the 1st grid of the 2nd row in Table 1 is used to predict Figure 7a The predicted value of pixel 2-1 located in the 1st grid of the 2nd row in the block to be encoded is shown. For another example, the T prediction method shown in the 15th grid of the 2nd row in Table 1 is used to predict Figure 7a The predicted values ​​of pixels 1-15 located at the 15th grid in the 2nd row in the block to be encoded are shown.

[0270] It should also be understood that Figure 7a The two blocks of size 16×2 shown represent the same image block in the image to be encoded (eg, the block to be encoded). Figure 7a In the figure, two blocks are used to represent the block to be coded, only to clearly show the preset trajectory when the encoder predicts the pixels in the block to be coded one by one. The preset trajectory is Figure 7a The trajectory is shown by the black solid line with an arrow in the figure. The origin is the starting point of the preset trajectory, and the pixel points at both ends of the black dotted line are two adjacent pixel points on the preset trajectory.

[0271] Thus, for example, at the encoding end, Figure 7a When predicting the block to be coded, the encoder first Figure 7a The pixel 1-1 shown is predicted using the T prediction method shown in Table 1. That is, the predicted value of the pixel 1-1 = P T1-1 , P T1-1 It is the reconstructed value of the upper pixel of pixel 1-1 (for example, the pixel in the upper image block of the block to be encoded. It should be understood that the upper image block and the left image block of the block to be encoded are usually encoded earlier than the block to be encoded, so the pixel values ​​in the upper image block and the left image block of the block to be encoded have been reconstructed). It should be understood that after the encoding end obtains the predicted value of pixel 1-1, the reconstructed value of pixel 1-1 can be determined based on the predicted value of pixel 1-1 (for example, after the encoding end obtains the predicted value of pixel 1-1, by executing steps 12 to 14 described above, and reconstructing the residual value of the pixel by performing inverse quantization and inverse transformation, the reconstructed value of pixel 1-1 is obtained based on the predicted value and the reconstructed residual value).

[0272] Another example, according to Figure 7a The preset track shown in the figure, after the encoder completes the prediction of pixel 1-1, Figure 7aThe pixel 2-1 shown in the figure is predicted using the T prediction method shown in Table 1. That is, the predicted value of the pixel 2-1 = P T2-1 , P T2-1 is the reconstructed value of the pixel above the pixel 2-1 (eg, the pixel 1-1 that has completed reconstruction).

[0273] For example, according to Figure 7a The preset track shown in the figure, after the encoder completes the prediction of pixels 2-15, Figure 7a The pixel 1-2 shown in Table 1 is predicted 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, where (P R1-2 +P L1-2 +1)>>1 indicates that (P R1-2 +P L1-2 +1) is shifted right by 1 bit, which is equivalent to (P R1-2 +P L1-2 +1) divided by 2 1 The value of P R1-2 is the reconstructed value of the pixel to the right of pixel 1-2 (e.g., pixel 1-3 that has been reconstructed, because the prediction order of pixel 1-3 is before pixel 1-2), P L1-2 is the reconstructed value of the pixel to the left of pixel 1-2 (eg, pixel 1-1 that has completed reconstruction).

[0274] In the second prediction mode, taking the size of the block to be coded as 16×2 as an example, as shown in Table 2, Table 2 shows another prediction mode for predicting each pixel in the coding block of size 16×2. In this prediction mode, the coding end predicts the order of pixels in the block to be coded in the following order: Figure 7b That is, the encoding end is based on the sequence of preset track instructions shown in Figure 7b When the preset trajectory shown in Table 2 predicts the pixels in the block to be encoded one by one, each pixel in the block to be encoded will be predicted in the specific prediction mode in Table 2. The detailed description of predicting each pixel in the block to be encoded in the prediction mode shown in Table 2 can refer to the relevant description of predicting each pixel in the block to be encoded in the prediction mode shown in Table 1 above. Figure 7b The description of the preset tracks shown in can also be referred to Figure 7a The description of the preset trajectory is not repeated here.

[0275] Table 2

[0276] TB TB TB TB T TB TB TB T TB TB TB T TB TB TB L L L L T L L L T L L L T L L L

[0277] Thus, for example, at the encoding end, Figure 7bWhen predicting the block to be coded, the encoder first Figure 7b The pixel 2-1 shown is predicted using the L prediction method shown in Table 2. That is, the predicted value of the pixel 2-1 = P L2-1 , P L2-1 It is the reconstructed value of the pixel to the left of pixel 2-1 (for example, the pixel in the image block to the left of the block to be encoded).

[0278] For example, according to Figure 7a The preset track shown in the figure, after the encoder completes the prediction of pixels 2-16, Figure 7a The pixel 1-1 shown in Table 2 is predicted using the TB prediction method shown in Table 2. That is, the predicted value of the 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 (e.g., the pixel in the image block above the block to be encoded), P B1-1 It is the reconstructed value of the pixel below the pixel 1-1 (for example, the pixel 2-1 that has been reconstructed because the prediction order of the pixel 2-1 is before the pixel 1-1).

[0279] In the third prediction mode, taking the size of the block to be coded as 16×2 as an example, as shown in Table 3-1, Table 3-1 shows another prediction mode for predicting each pixel in the coding block of size 16×2. In this prediction mode, the encoder predicts the order of pixels in the block to be coded in the following order: Figure 7c-1 That is, the encoding end is based on the sequence of preset track instructions shown in Figure 7c-1 When the preset trajectory shown in the figure predicts the pixels in the block to be coded one by one, each pixel in the block to be coded will be predicted in the specific prediction mode in the prediction mode shown in Table 3-1. Among them, the detailed description of predicting each pixel in the block to be coded in the prediction mode shown in Table 3-1 can refer to the relevant description of predicting each pixel in the block to be coded in the prediction mode shown in Table 1 above. Figure 7c-1 The description of the preset tracks shown in can also be referred to Figure 7a The description of the preset trajectory is not repeated here.

[0280] Table 3-1

[0281] L L L L T L L L T L L L T L L L L L L L T L L L T L L L T L L L

[0282] In the third prediction mode, taking the size of the block to be coded as 8×2 as an example, as shown in Table 3-2, Table 3-2 shows a prediction mode for predicting each pixel in the coding block of size 8×2. In this prediction mode, the encoder predicts the order of pixels in the block to be coded in the following order: Figure 7c-2 That is, the encoding end is based on the sequence of preset track instructions shown in Figure 7c-2When the preset trajectory shown in Table 3-2 predicts the pixels in the block to be coded one by one, each pixel in the block to be coded will be predicted in the specific prediction mode shown in Table 3-2. The detailed description of predicting each pixel in the block to be coded in the prediction mode shown in Table 3-2 can refer to the relevant description of predicting each pixel in the block to be coded in the prediction mode shown in Table 1 above. Figure 7c-2 The description of the preset tracks shown in can also be referred to Figure 7a The description of the preset trajectory is not repeated here.

[0283] Table 3-2

[0284] L L L L T L L L L L L L T L L L

[0285] In the fourth prediction mode, taking the size of the block to be coded as 16×2 as an example, as shown in Table 4-1, Table 4-1 shows another prediction mode for predicting each pixel in the coding block of size 16×2. In this prediction mode, the encoder predicts the order of pixels in the block to be coded in the following order: Figure 7d-1 That is, the encoding end is based on the sequence of preset track instructions shown in Figure 7d-1 When the preset trajectory shown in the figure predicts the pixels in the block to be coded one by one, each pixel in the block to be coded will be predicted in the specific prediction mode in the prediction mode shown in Table 4-1. Among them, the detailed description of predicting each pixel in the block to be coded in the prediction mode shown in Table 4-1 can refer to the relevant description of predicting each pixel in the block to be coded in the prediction mode shown in Table 1 above. Figure 7d-1 The description of the preset tracks shown in can also be referred to Figure 7a The description of the preset trajectory is not repeated here.

[0286] Table 4-1

[0287] T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T

[0288] In the fourth prediction mode, the size of the block to be coded is 8×2 as an example, as shown in Table 4-2, Table 4-2 shows another prediction mode for predicting each pixel in the coding block of size 8×2. In this prediction mode, the encoder predicts the order of pixels in the block to be coded in the following order: Figure 7d-2 That is, the encoding end is based on the sequence of preset track instructions shown in Figure 7d-2 When the preset trajectory shown in the figure predicts the pixels in the block to be coded one by one, each pixel in the block to be coded will be predicted in the specific prediction mode in the prediction mode shown in Table 4-2. Among them, the detailed description of predicting each pixel in the block to be coded in the prediction mode shown in Table 4-2 can refer to the relevant description of predicting each pixel in the block to be coded in the prediction mode shown in Table 1 above. Figure 7d-2 The description of the preset tracks shown in can also be referred to Figure 7a The description of the preset trajectory is not repeated here.

[0289] Table 4-2

[0290] T T T T T T T T T T T T T T T T

[0291] In the fourth prediction mode, taking the size of the block to be coded as 8×1 as an example, as shown in Table 4-3, Table 4-3 shows another prediction mode for predicting each pixel in the coding block of size 8×2. In this prediction mode, the encoder predicts the order of pixels in the block to be coded in the following order: Figure 7d-3 That is, the encoding end is based on the sequence of preset track instructions shown in Figure 7d-3 When the preset trajectory shown in the figure predicts the pixels in the block to be coded one by one, each pixel in the block to be coded will be predicted in the specific prediction mode in the prediction mode shown in Table 4-3. Among them, the detailed description of predicting each pixel in the block to be coded in the prediction mode shown in Table 4-3 can refer to the relevant description of predicting each pixel in the block to be coded in the prediction mode shown in Table 1 above. Figure 7d-3 The description of the preset tracks shown in can also be referred to Figure 7a The description of the preset trajectory is not repeated here.

[0292] Table 4-3

[0293] T T T T T T T T

[0294] In the fifth prediction mode, the size of the block to be coded is 8×1 as an example, as shown in Table 5, Table 5 shows a prediction mode for predicting each pixel in the coding block of size 8×1. In this prediction mode, the coding end predicts the order of pixels in the block to be coded in the following order: Figure 7e That is, the encoding end is based on the sequence of preset track instructions shown in Figure 7e When the preset trajectory shown in Table 5 predicts the pixels in the block to be encoded one by one, each pixel in the block to be encoded will be predicted in the specific prediction mode in Table 5. The detailed description of predicting each pixel in the block to be encoded in the prediction mode shown in Table 5 can refer to the relevant description of predicting each pixel in the block to be encoded in the prediction mode shown in Table 1 above. Figure 7e The description of the preset tracks shown in can also be referred to Figure 7a The description of the preset trajectory is not repeated here.

[0295] Table 5

[0296] L L L T L L L L

[0297] It can be seen that each of the above prediction modes corresponds to a different prediction order. For example, when the prediction mode is the first prediction mode, the prediction order is the first prediction order, and when the prediction mode is the second prediction mode, the prediction order is the second prediction order, wherein the first prediction order and the second prediction order are different.

[0298] It can also be seen that in the same prediction mode, when the sizes of the blocks to be encoded are different, the corresponding prediction orders are also different. For example, for a block to be decoded with a size of the first size, the block to be decoded is predicted using the third prediction order in prediction mode 1, and for a block to be decoded with a size of the second size, the block to be decoded is predicted using the fourth prediction order in prediction mode 1, wherein the third prediction order is different from the fourth prediction order.

[0299] In the sixth prediction mode, the prediction mode is used to instruct the encoder to predict each sub-block to be encoded in sequence in the method indicated by the prediction order corresponding to the prediction mode, taking the sub-blocks with preset sizes in the block to be encoded as units. In addition, in this prediction mode, when the encoder predicts any sub-block of the block to be encoded, it can predict the pixels in any sub-block based on the reconstructed pixels around the sub-block in parallel.

[0300] In this prediction mode, the encoder may divide the block to be encoded into a plurality of non-overlapping sub-blocks of preset sizes, and use the arrangement direction of the sub-blocks obtained by the division as the direction indicated by the prediction order corresponding to the prediction mode.

[0301] As an example, refer to Figure 7f , Figure 7f A schematic diagram of a sub-block in a block to be encoded provided by an embodiment of the present application is shown.

[0302] like Figure 7f As shown in (a) of FIG. 1 , assuming that the sub-block with a preset size is a 2×2 sub-block, then for a 16×2 block to be encoded, the block to be encoded can be divided as follows: Figure 7f The 8 non-overlapping 2×2 sub-blocks are shown in the black thick line frame in (a). Moreover, the arrangement direction of these 8 sub-blocks, that is, the direction indicated by the prediction order corresponding to the prediction mode, is as follows: Figure 7f The direction indicated by the arrow in (a) is shown.

[0303] like Figure 7f As shown in (b) of FIG. 1 , assuming that the sub-block with a preset size is a 4×2 sub-block, then for a 16×2 block to be encoded, the block to be encoded can be divided as follows: Figure 7f The four non-overlapping 4×2 sub-blocks are shown in the black thick line frame in (a). Moreover, the arrangement direction of these four sub-blocks, that is, the direction indicated by the prediction order corresponding to the prediction mode, is, Figure 7f The direction indicated by the arrow in (b) is shown.

[0304] like Figure 7f As shown in (c) in FIG. 1 , assuming that the sub-block with a preset size is a sub-block of 8×2 size, then for a 16×2 block to be encoded, the block to be encoded can be divided as follows: Figure 7f The two non-overlapping 8×2 sub-blocks shown in the black thick line frame in (a) are arranged in the direction of the two sub-blocks, that is, the direction indicated by the prediction order corresponding to the prediction mode, for example Figure 7f The direction indicated by the arrow in (c) is shown.

[0305] Specifically, for any sub-block in the block to be encoded, the sixth prediction mode indicates that the pixels in any sub-block are predicted based on the reconstruction values ​​of the pixels on the upper side (adjacent or non-adjacent), left side (adjacent or non-adjacent) and oblique upper side (adjacent or non-adjacent) of any sub-block. It should be noted that in this prediction mode, a pixel in a sub-block will not rely on other pixels in the same sub-block for prediction. For simple description, the embodiment of the present application uses this prediction mode to indicate that the pixels in any sub-block are predicted based on the reconstruction values ​​of the pixels adjacent to the upper side, left side and oblique upper side of any sub-block.

[0306] The sixth prediction mode is used to indicate Figure 7f As an example, the sub-block shown in (a) in FIG. 1 is taken as a unit, and each sub-block in the coding is predicted in turn according to the method indicated by the prediction order corresponding to the prediction mode, such as Figure 7f As shown in (a) of FIG. 1 , it is assumed that any of the above sub-blocks is sub-block a, and Figure 7f The gray squares shown in (a) are the adjacent pixels on the upper side, left side and diagonally upper side of sub-block a. For example, the pixels in sub-block a are Y0, Y1, Y2 and Y3, the pixels on the upper side of sub-block a are T0 and T1, the pixels on the left side of sub-block a are L0 and L1, and the pixel on the diagonally upper side of sub-block a is LT:

[0307] Then in a possible implementation, the sixth prediction mode may specifically indicate: the prediction value of Y0 in sub-block a is obtained based on T0, L0 and LT, the prediction value of Y1 in sub-block a is obtained based on T1, L0 and LT, the prediction value of Y2 in sub-block a is obtained based on T0, L1 and LT, and the prediction value of Y3 in sub-block a is obtained based on T1, L1 and LT.

[0308] Optionally, the prediction method 1 specifically indicated by the sixth prediction mode may be: determining the prediction value of any pixel based on the horizontal gradient or vertical gradient of the upper pixel, the left pixel and the obliquely upper pixel of any pixel in any sub-block in the block to be encoded.

[0309] refer to Figure 7fIn (a), taking the pixel Y0 in sub-block a as an example, when the encoder determines that the reconstruction values ​​of the upper pixel T0, the left pixel L0, and the oblique upper pixel LT of Y0 meet condition 1, the reconstruction value of the left pixel L0 of Y0 is determined as the predicted value of Y0. Among them, condition 1 is used to indicate that the horizontal gradient of the pixels around Y0 is the smallest. Condition 1 is specifically: |T0 reconstruction value-LT reconstruction value|≤|L0 reconstruction value-LT reconstruction value|, and |T0 reconstruction value-LT reconstruction value|≤|L 0 reconstruction value+T 0 reconstruction value-2*LT reconstruction value|. When the encoder determines that the reconstruction values ​​of the upper pixel T0, the left pixel L0, and the oblique upper pixel LT of Y0 meet condition 2, the reconstruction value of the upper pixel T0 of Y0 is determined as the predicted value of Y0. Among them, condition 2 is used to indicate that the vertical gradient of the pixels around Y0 is the smallest. Condition 2 is specifically: |T0 reconstruction value-LT reconstruction value|≤|L 0 reconstruction value+T 0 reconstruction value-2*LT reconstruction value|. When the encoding end determines that the reconstructed values ​​of the upper pixel T0, the left pixel L0 and the upper oblique pixel LT of Y0 do not meet the above conditions 1 and 2, the reconstructed value of the upper oblique pixel LT of Y0 is determined as the predicted value of Y0.

[0310] Optionally, the prediction method 2 specifically indicated by the sixth prediction mode may be: determining the prediction value of any pixel based on the average of the reconstructed values ​​of the upper pixel, the left pixel and the diagonally upper pixel of any pixel in any sub-block in the block to be encoded.

[0311] Continue to refer Figure 7f In (a), taking pixel Y0 in sub-block a as an example, the predicted value of Y0 can be: (L0 reconstruction value + T0 reconstruction value + 2*LT reconstruction value)>>2. Among them, (L0 reconstruction value + T0 reconstruction value + 2*LT reconstruction value)>>2 represents the value obtained by right shifting the binary value of (L0 reconstruction value + T0 reconstruction value + 2*LT reconstruction value) by 2 bits.

[0312] In another possible implementation, the sixth prediction mode may specifically indicate: determining the reconstructed value of the upper pixel, the left pixel, or the obliquely upper pixel in the prediction direction of any pixel in any sub-block of the block to be encoded as the prediction value of the any pixel. The prediction direction may be a 45-degree oblique left direction or a 45-degree oblique right direction of the any pixel, which is not limited in the embodiment of the present application.

[0313] The sixth prediction mode is used to indicate Figure 7f As an example, the prediction order corresponding to the prediction mode is used to predict each sub-block in the encoding. Figure 7f (b) in , assuming that any of the above sub-blocks is sub-block b, and Figure 7fThe gray squares shown in (b) are the adjacent pixels on the upper side, left side and diagonally upper side of sub-block b. The pixels in sub-block b are Y0, Y1, Y2, Y3, Y4, Y5, Y6 and Y7, the pixels on the upper side of sub-block b include T0, T1, T2, T3, T4 and T5, the pixels on the left side of sub-block b include L0 and L1, and the pixel on the diagonally upper side of sub-block b is LT:

[0314] Then, when the prediction direction is the left oblique 45-degree direction of the pixel to be predicted, the sixth prediction mode can specifically indicate: the reconstructed value of LT located in the left oblique 45-degree direction of Y0 in sub-block b is determined as the prediction value of Y0, the reconstructed value of T0 located in the left oblique 45-degree direction of Y1 in sub-block b is determined as the prediction value of Y1, the reconstructed value of T1 located in the left oblique 45-degree direction of Y2 in sub-block b is determined as the prediction value of Y2, and the reconstructed value of T2 located in the left oblique 45-degree direction of Y3 in sub-block b is determined as the prediction value of Y4. The reconstructed value of T2 is determined as the predicted value of Y3, the reconstructed value of L0 located at 45 degrees to the left of Y4 in sub-block b is determined as the predicted value of Y4, the reconstructed value of LT located at 45 degrees to the left of Y5 in sub-block b is determined as the predicted value of Y5, the reconstructed value of T0 located at 45 degrees to the left of Y6 in sub-block b is determined as the predicted value of Y6, and the reconstructed value of T1 located at 45 degrees to the left of Y7 in sub-block b is determined as the predicted value of Y7.

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

[0316] It should be noted that when the encoder adopts the sixth prediction mode to predict the pixels in the coding block, when the encoder encodes the residual block or residual coefficient block corresponding to the coding block, the Figure 7g The tracks shown are encoded in the order indicated.

[0317] So far, based on the encoding method described in S101-S104 above, when the encoding end predicts the pixels in the block to be encoded in the target prediction mode, the pixels in the block to be encoded are predicted in the target prediction order corresponding to the target prediction mode. In this process, when the encoding end predicts any pixel in the block to be encoded, the pixels used to predict the pixel have been reconstructed. Therefore, the encoding method provided by this embodiment improves the efficiency of predicting pixels in the block to be encoded, and then when the encoding end obtains the reconstructed value based on the predicted value and the residual value, the encoding end does not need to cache the residual value. Therefore, the encoding method provided by this embodiment can not only save the cache space used to cache the residual value, but also improve the encoding efficiency.

[0318] In addition, when the target prediction mode indicates that each sub-block in the block to be coded is predicted in turn in units of sub-blocks, because in this prediction mode, when the encoder predicts a sub-block, it can predict multiple pixels in the sub-block in parallel based on the reconstructed pixels around the sub-block, that is, this prediction mode can further improve the efficiency of the encoder in predicting the block to be coded. Furthermore, when the encoder re-obtains the reconstructed value based on the predicted value and the residual value, the encoder does not need to cache the residual value, so the encoding method provided by this embodiment further saves cache space and improves encoding efficiency.

[0319] like Figure 8 As shown, it is a schematic diagram of the flow chart of another image decoding method provided by this embodiment. Figure 8 The method shown includes the following steps:

[0320] S201: A decoding end parses a code stream of a block to be decoded to determine a target prediction mode for predicting pixels in the block to be decoded.

[0321] Among them, the code stream of the block to be decoded can be a code stream received by the decoding end from the encoding end, or a code stream obtained from other devices, such as a code stream obtained from a storage device, which is not limited in this embodiment of the present application.

[0322] 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. It can be understood that the target prediction mode here is the prediction mode used by the encoder to predict pixels in the image block during encoding.

[0323] Specifically, the decoding end may parse the code stream of the block to be decoded by using a decoding method corresponding to the encoding end, so as to obtain the target prediction mode.

[0324] S202: The decoding end determines a target prediction order corresponding to the target prediction mode based on the target prediction mode.

[0325] Among them, the description of the prediction mode and the prediction order corresponding to the prediction mode can be referred to the description above and will not be repeated here.

[0326] Optionally, the decoding end may preset a correspondence between multiple prediction modes and their corresponding prediction orders. Thus, when the decoding end determines that the prediction mode is the target prediction mode, the target prediction order corresponding to the target prediction mode can be determined in the preset correspondence.

[0327] S203 . The decoding end predicts each pixel in the to-be-decoded block in a target prediction order according to the target prediction mode to obtain a prediction value of each pixel.

[0328] Here, for the description of predicting each pixel in the to-be-decoded block in a prediction order corresponding to the prediction mode based on the prediction mode, reference may be made to the detailed description of the prediction mode above, which will not be repeated here.

[0329] S204: The decoding end reconstructs each pixel in the to-be-decoded block based on the predicted value of the pixel, thereby obtaining a reconstructed block of the to-be-decoded block.

[0330] Optionally, the decoding end may first parse the bitstream to obtain a residual block of the block to be decoded. Then, the decoding end dequantizes the residual block to obtain a reconstructed residual block of the block to be decoded. In this way, the decoding end may obtain a reconstructed block of the block to be decoded 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.

[0331] For example, the decoder can first pass Figure 5 The code stream parsing unit 301 shown in FIG. 1 parses the code stream of the block to be decoded to obtain the residual block of the block to be decoded. Then, the decoding end can Figure 5 The dequantization unit 302 shown in FIG. 1 dequantizes the residual block to obtain a reconstructed residual block of the block to be decoded. In this way, the decoding end can obtain a reconstructed block of the block to be decoded through the reconstruction unit 306 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.

[0332] Optionally, the decoding end may first parse the bitstream to obtain a residual coefficient block of the block to be decoded. Then, the decoding end dequantizes the residual block to obtain a dequantized residual coefficient block. Next, the decoding end performs a de-transformation on the dequantized residual coefficient block to obtain a reconstructed residual block of the block to be decoded. In this way, the decoding end can obtain a reconstructed block of the block to be decoded 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.

[0333] For example, the decoder can first pass Figure 5The code stream parsing unit 301 shown in FIG. 1 parses the code stream of the block to be decoded to obtain the residual coefficient block of the block to be decoded. Then, the decoding end can Figure 5 The dequantization unit 302 shown in FIG. 1 dequantizes the residual coefficient block to obtain a dequantized residual coefficient block. Figure 5 The residual inverse transform unit 303 shown in FIG. 1 performs an inverse transform on the inverse quantized residual coefficient block to obtain a reconstructed residual block of the block to be decoded. In this way, the decoding end can obtain a reconstructed block of the block to be decoded through the reconstruction unit 306 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.

[0334] Among them, the decoding end can parse the code stream of the block to be decoded by a decoding method corresponding to the encoding end, so as to obtain the residual block or residual coefficient block of the block to be decoded. For example, the residual scanning order of the code stream of the block to be decoded decoded by the decoding end is the target prediction order of the pixels in the block to be decoded. Among them, the target prediction order corresponds to the target prediction mode of the block to be decoded. The relevant description of the residual scanning order can be referred to above, and will not be repeated here.

[0335] Need to explain, Figure 8 The image decoding method shown is similar to Figure 6c The image encoding method shown corresponds to this, therefore, the image decoding method helps to improve the efficiency of predicting the block to be decoded, and further, 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 can save the cache space used for caching the residual value and improve the decoding efficiency.

[0336] It should be noted that the present embodiment does not specifically limit the manner in which the residual block or residual coefficient block of the block to be decoded is dequantized. For example, the dequantization method described in the following embodiment 2 may be used to dequantize the residual block or residual coefficient block of the block to be decoded, but is certainly not limited thereto.

[0337] It should also be noted that this embodiment does not specifically limit the manner in which the decoding end decodes the code stream of the block to be decoded. For example, the variable-length decoding method described in the following embodiment 3 may be used for encoding, but it is certainly not limited thereto.

[0338] Embodiment 2

[0339] like Figure 9a As shown, it is a schematic diagram of the flow chart of another image encoding method provided by this embodiment. Figure 9a The method shown includes the following steps:

[0340] S301: The encoder determines a second residual block of a block to be encoded and a quantization parameter QP of each pixel in the block to be encoded.

[0341] Here, the second residual block may be an original residual value block of the to-be-encoded block, or the second residual block may be a residual coefficient block obtained after the original residual value block is transformed.

[0342] Among them, the original residual value block of the block to be encoded is the residual block obtained by the encoding end based on the original pixel values ​​of the block to be encoded and the prediction block of the block to be encoded. It can be understood that the process of the encoding end predicting the pixels in the block to be encoded to obtain the prediction block can be implemented based on the method described in Example 1, and of course, it can also be obtained based on any method in the prior art that can obtain the prediction block of the block to be encoded, and the embodiment of the present application does not limit this. The residual coefficient block is obtained after the encoding end transforms the original residual value block, and the embodiment of the present application does not specifically limit the process of the encoding end transforming the original residual value block.

[0343] For the sake of simplicity, this embodiment is described below by taking the second residual block being the original residual value block of the to-be-encoded block as an example.

[0344] In addition, before or after obtaining the second residual block of the block to be encoded, the encoder can also determine the quantization parameter QP of each pixel in the block to be encoded. Here, the embodiment of the present application does not limit the specific process of the encoder determining the quantization parameter QP of each pixel in the block to be encoded.

[0345] S302: The encoder quantizes the second residual block based on the QP of each pixel in the block to be encoded and the preset quantization array to obtain a first residual block.

[0346] The quantization preset array is used to perform quantization processing on the values ​​in the second residual block.

[0347] In a first possible implementation, 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 values. If amp represents the amplification parameter in the amplification parameter array, and shift represents the displacement parameter in the displacement parameter array, the encoder can perform quantization processing on each value in the second residual block based on formula (1):

[0348] Formula (1) Residual value after quantization = (residual value before quantization × amp[QP]) >> shift[QP]

[0349] Among them, amp[QP] represents the QP-th amplification parameter in the amplification parameter array, shift[QP] represents the QP-th displacement parameter in the displacement parameter array, and (residual value before quantization × amp[QP])>>shift[QP] represents shifting the binary value of (residual value before quantization × amp[QP]) right by shift[QP] bits.

[0350] In this embodiment, 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 shift parameter in the shift parameter array, 2 shift[i] The dequantization array formed by the quotient of amp[i] has the following rules: the interval between two adjacent numbers in the 1st to nth numbers in the dequantization array is 1, the interval between two adjacent numbers in the n+1st to n+mth numbers in the dequantization array is 2, and the numerical interval between two adjacent numbers in the n+k*m+1st to n+k*m+mth numbers in the dequantization array is 2 k+1 . Wherein, n and m are integers greater than 1, and i and k are both positive integers.

[0351] The inverse quantization array is used to implement inverse quantization processing on the first residual block obtained after quantization, that is, the inverse quantization array is used to implement the inverse operation with the quantization preset array. Therefore, based on the inverse quantization array with the above rules, the amplification parameter array and the displacement parameter array used to implement the quantization operation can be reversely determined.

[0352] As an example, assuming that mult represents the magnification parameter in the dequantization array, and the dequantization array includes 42 magnification parameters, and taking the above n value of 12 and m value of 6 as an example, the dequantization array based on the above rule can be:

[0353] mult(42)={1,2,3,4,5,6,7,8,9,10,11,12,14,16,18,20,22,24,28,32,36,40,44 ,48,56,64,72,80,88,96,112,128,144,160,176,192,224,256,288,320,352,384}

[0354] Then the enlarged parameter array can be:

[0355] amp

[42] ={1,2048,2731,2048,3277,2731,2341,2048,3641,3277,2979,2731,2341,2048,3641,3277,2979,2731,2341,2048,36 41,3277,2979,2731,2341,2048,3641,3277,2979,2731,2341,2048,3641,3277,2979,2731,2341,2048,3641,3277,2979,2731}

[0356] The displacement parameter array can be:

[0357] shift

[42] ={0,12,13,13,14,14,14,14,15,15,15,15,15,15,16,16,16,16,16,1 6,17,17,17,17,17,17,18,18,18,18,18,18,19,19,19,19,19,19,20,20,20,20}

[0358] In this way, the encoder can determine the amplification parameter of each pixel in the above-mentioned amplification parameter array based on the determined QP of each pixel in the block to be encoded, and determine the displacement parameter of each pixel in the above-mentioned displacement parameter array. Then, the encoder performs a quantization operation on the second residual block based on the amplification parameter and displacement parameter corresponding to each pixel in the block to be encoded, thereby obtaining a first residual block.

[0359] For example, for any pixel in the block to be encoded, the encoding end can search in the above-mentioned amplification parameter array based on the determined QP of the any pixel, and determine the QP-th value in the amplification parameter array as the amplification parameter of the any pixel, and search in the above-mentioned displacement parameter array, and determine the QP-th value in the displacement parameter array as the displacement parameter of the any pixel. Then, the encoding end performs a quantization operation on the residual value corresponding to the any pixel in the second residual block based on the amplification parameter and displacement parameter corresponding to the any pixel, and through the above-mentioned formula (1), thereby obtaining the quantized residual value corresponding to the any pixel. When the encoding end completes the quantization processing of all residual values ​​in the second residual block, the first residual block is obtained.

[0360] Through this possible implementation method, the encoder needs to perform at most 6 multiplication operations when quantizing the residual value in the second residual block. Compared with the prior art, this method greatly reduces the amount of calculation on the encoder, that is, this method greatly saves the computing resources of the encoder.

[0361] In a second possible implementation, compared with the first possible implementation, the quantization preset array in this implementation may include fewer values. In this implementation, the encoder may implement quantization processing on each residual value in the second residual block based on formula (2):

[0362] Formula (2) Residual value after quantization = (residual value before quantization × amp + offset) > > shift

[0363] Among them, amp is the amplification parameter corresponding to each pixel determined by the encoder based on the QP of each pixel in the block to be encoded and the quantization preset array, and shift is the displacement parameter corresponding to each pixel determined by the encoder based on the QP of each pixel in the block to be encoded and the quantization preset array. Offset is an offset parameter used to round off the residual value after quantization, and (residual value before quantization × amp + offset) >> shift means that the binary value of (residual value before quantization × amp + offset) is shifted right by shift bits.

[0364] Specifically, the value of the amplification parameter amp corresponding to each pixel in the block to be encoded determined by the encoder is the value corresponding to the bitwise AND value 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 encoded determined by the encoder is 7 and the QP of each pixel divided by 2. 3 The sum of the quotients of .

[0365] That is, assuming that quant_scal represents the value in the quantization preset array, the amplification parameter amp can be calculated by quant_scale[QP&0x07], and the displacement parameter shift can be calculated by 7+(QP>>3). Among them, [QP&0x07] represents the bitwise AND of the binary value of QP and 7 (equivalent to the mathematical effect of QP divided by 8 and taking the remainder), and quant_scale[QP&0x07] is the QP&0x07th value in the quantization preset array. QP>>3 means shifting the binary value of QP by 3 bits to the right.

[0366] In addition, offset can be calculated by 1<<(shift-1), where 1<<(shift-1) means shifting the binary value of 1 to the left by (shift-1) (the mathematical effect is 1 times 2 to the power of (shift-1)).

[0367] In the embodiment of the present application, when the encoder implements the quantization processing of the second residual block according to formula (2), the quantization preset array can be: quant_scal[8]={128, 140, 153, 166, 182, 197, 216, 234}.

[0368] In this way, the encoder calculates the magnification parameter and displacement parameter corresponding to each pixel based on the determined QP and quantization preset array of each pixel in the block to be encoded. Then, the encoder can quantize the second residual block based on the calculated magnification parameter, displacement parameter and offset parameter of each pixel in the block to be encoded and through formula (2), thereby obtaining the first residual block.

[0369] It can be seen that, through this possible implementation, the encoder needs to perform at most 8 multiplication operations when quantizing the residual value in the second residual block. Compared with the prior art, this method greatly reduces the amount of calculation at the encoder, that is, this method greatly saves the calculation resources of the encoder.

[0370] In a third possible implementation, the encoder may implement quantization processing on each residual value in the second residual block by using formula (3):

[0371] Formula (3) Residual value after quantization = (residual value before quantization + offset)>>shift

[0372] Among them, shift represents a displacement parameter, and the value of shift is a monotonically non-decreasing integer related to QP. Or it can be understood that when QP increases, shift corresponds to QP one-to-one, and the value of shift is a monotonically non-decreasing integer. The description of offset can be referred to above and will not be repeated here. In addition, offset can be determined by (shift == 0)? 0:(1<<(shift-1)), specifically: when the value of shift is 0, the value of offset is 0, and when the value of shift is not 0, the value of offset is (1<<(shift-1)) (that is, the value obtained by shifting the binary value of 1 left by (shift-1) bits).

[0373] In this way, the encoder can determine the displacement parameter of each pixel based on the determined QP of each pixel in the block to be encoded, and further determine the corresponding offset parameter. Then, the encoder can quantize the second residual block based on the determined displacement parameter and offset parameter of each pixel in the block to be encoded and through formula (3), thereby obtaining the first residual block.

[0374] It can be seen that, through this possible implementation, the encoder does not need to perform multiplication when quantizing the residual value in the second residual block. Compared with the prior art, in the encoding scenario where the quantization granularity requirement is not high, this method greatly reduces the amount of calculation of the encoder, that is, this method greatly saves the computing resources of the encoder.

[0375] S303: The encoding end encodes the first residual block to obtain a code stream of the block to be encoded.

[0376] After obtaining the first residual block, the encoder encodes it to obtain an encoded bit stream of the block to be encoded.

[0377] Optionally, the encoder uses the QP corresponding to each pixel when the second residual block is quantized, and the specific quantization method used as the semantic element of the block to be encoded, and encodes the semantic element. The encoder can also add the encoded semantic element data to the encoded bitstream of the block to be encoded.

[0378] Optionally, the encoding end encodes the residual scanning order of the first residual block to be encoded, which can be used to predict the target prediction order of pixels in the block to be encoded by the encoding end. The target prediction order corresponds to the target prediction mode for predicting the block to be decoded. The relevant description of the target prediction mode and the target prediction order can be referred to above, and will not be repeated here.

[0379] It should be noted that the specific mode for predicting the coding block in this embodiment is not specifically limited. For example, the prediction mode described in the above embodiment 1 can be used to predict the coding block, but it is certainly not limited to this.

[0380] It should also be noted that this embodiment does not specifically limit the specific encoding method of encoding the first residual block and related semantic elements at the encoding end. For example, the variable-length encoding method described in Embodiment 3 may be used for encoding.

[0381] Through the image coding method described in S301-S303 above, since a quantization processing method that can save computing resources on the coding end is adopted during the image coding process, that is, the efficiency of the quantization processing process in the image coding method is greatly improved, and thus the image coding method greatly improves the image coding efficiency.

[0382] like Figure 9b As shown, it is a flowchart of another image decoding method provided by this embodiment. Figure 9b The method shown includes the following steps:

[0383] S401: The decoding end parses the code stream of the block to be decoded to obtain the inverse quantization parameter of each pixel in the block to be decoded and the first residual block of the block to be decoded.

[0384] Among them, the code stream of the block to be decoded can be a code stream received by the decoding end from the encoding end, or a code stream obtained from other devices, such as a code stream obtained from a storage device, which is not limited in this embodiment of the present application.

[0385] The inverse quantization parameter is used to instruct the decoder to perform inverse quantization processing on the residual value 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.

[0386] Specifically, the decoding end may parse the code stream of the block to be decoded in a decoding manner corresponding to that of the encoding end, thereby obtaining the inverse quantization parameter of each pixel in the block to be decoded and the first residual block of the block to be decoded.

[0387] For example, the residual scanning order of the code stream of the block to be decoded by the decoder is the target prediction order of the pixels in the block to be decoded. The target prediction order corresponds to the target prediction mode of the block to be decoded. The relevant description of the target prediction mode and the target prediction order can be referred to above, and will not be repeated here.

[0388] S402: The decoding end 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.

[0389] A first possible implementation method is that when the decoding end determines that the inverse quantization method for the first residual block is inverse to the quantization method described in the first possible implementation method in S302 above based on the inverse quantization parameter of each pixel in the block to be decoded, the description of the inverse quantization preset array can be the relevant description of the inverse quantization array in S302 above, which will not be repeated here.

[0390] In this case, the decoding end can determine the magnification coefficient corresponding to each pixel in the inverse quantization preset array based on the QP of each pixel in the block to be decoded. Then, the decoding end can perform inverse quantization processing on the first residual block based on the magnification coefficient corresponding to each pixel, thereby obtaining a second residual block.

[0391] For example, for any pixel in the block to be decoded, the decoding end can search in the above-mentioned inverse quantization preset array based on the QP of the any pixel, and determine the QP-th value in the inverse quantization preset array as the magnification coefficient of the any pixel. Then, the decoding end performs a multiplication operation on the residual value corresponding to the any pixel in the first residual block based on the magnification coefficient corresponding to the any pixel, so as to obtain the inverse quantized residual value corresponding to the any pixel. When the decoding end completes the inverse quantization processing of all residual values ​​in the first residual block, the second residual block is obtained.

[0392] Optionally, after determining the amplification coefficient corresponding to each pixel in the block to be decoded, the decoding end may also shift the residual value in the first residual block corresponding to each pixel to the left to implement the multiplication operation of the residual value and the amplification coefficient corresponding to the residual value. The embodiment of the present application does not make any specific limitation in comparison.

[0393] In a second possible implementation, when the decoding end determines that the inverse quantization method for the first residual block is inverse to the quantization method described in the second possible implementation in S302 based on the inverse quantization parameter of each pixel in the block to be decoded, the decoding end can implement inverse quantization processing on each residual value in the first residual block based on the above formula (2) to obtain the first residual block.

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

[0395] In the embodiment of the present application, when the decoding end implements the dequantization processing of the first residual block according to formula (2), the dequantization preset array can be: dequant_scal[8]={128, 117, 107, 99, 90, 83, 76, 70}.

[0396] In this way, the decoding end calculates the magnification parameter and displacement parameter corresponding to each pixel based on the QP and the inverse quantization preset array of each pixel in the block to be decoded. Then, the decoding end can implement inverse quantization of the first residual block based on the calculated magnification parameter, displacement parameter and offset parameter of each pixel in the block to be decoded, and obtain the second residual block through formula (2).

[0397] It can be seen that, through this possible implementation, the decoder needs to perform at most 8 multiplication operations when performing inverse quantization processing on the residual value in the first residual block. Compared with the prior art, this method greatly reduces the amount of calculation at the decoder, that is, this method greatly saves the calculation resources of the decoder.

[0398] In a third possible implementation, when the decoding end determines that the dequantization method for the first residual block is inverse to the quantization method described in the third possible implementation in S302 based on the dequantization parameter of each pixel in the block to be decoded, the decoding end can implement dequantization processing on each residual value in the first residual block based on formula (4) to obtain the first residual block:

[0399] Formula (4) Residual value after dequantization = (residual value before dequantization + offset) < <shift

[0400] The description of the offset parameter offset and the displacement parameter shift may refer to the description of the third possible implementation manner in S302, which will not be repeated here.

[0401] In this way, the decoding end 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 end can implement the dequantization of the first residual block based on the determined displacement parameter and offset parameter of each pixel in the block to be decoded, and obtain the second residual block through formula (4).

[0402] It can be seen that, through this possible implementation, the decoder does not need to perform multiplication when performing inverse quantization processing on the residual value in the first residual block. Compared with the prior art, in the encoding scenario where the quantization granularity requirement is not high, this method greatly reduces the amount of calculation at the decoder, that is, this method greatly saves the computing resources of the decoder.

[0403] It should be noted that the inverse quantization method in the above-mentioned possible implementation methods can be applied to the process of encoding an image at the encoding end (for example, obtaining a reconstructed block for predicting pixels in an image block), and can also be applied to the process of decoding image data at the decoding end. The embodiments of the present application are not limited to this.

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

[0405] Optionally, the decoding end may directly reconstruct the second residual block to obtain a reconstructed block of the block to be decoded. Specifically, the decoding end may directly reconstruct the block to be decoded according to the second residual block and the prediction block of the block to be decoded to obtain a reconstructed block of the block to be decoded. For example, the decoding end may obtain the reconstructed block of the block to be decoded by summing the second residual block and the prediction block of the block to be decoded.

[0406] The prediction block of the block to be decoded may be obtained by predicting the block to be decoded based on the prediction mode obtained by parsing the code stream of the block to be decoded at the decoding end. Optionally, the prediction mode may be any prediction mode described in Embodiment 1, or the prediction mode may be any prediction mode in the prior art, which is not limited in the embodiments of the present application. In addition, the process of predicting the prediction block of the block to be decoded at the decoding end is not described in detail here.

[0407] Optionally, the decoding end may first perform an inverse transform on 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 end may reconstruct the block to be decoded according to the reconstructed residual value block and the prediction block of the block to be decoded to obtain a reconstructed block of the block to be decoded. For example, the decoding end may obtain a reconstructed block of the block to be decoded by summing the reconstructed residual value block and the prediction block of the block to be decoded.

[0408] The description of the prediction block of the to-be-decoded block can be referred to above and will not be repeated here. In addition, the embodiment of the present application does not describe in detail the process of the decoding end performing inverse transformation processing on the second residual block.

[0409] Need to explain, Figure 9b The image decoding method shown is similar to Figure 9a The image encoding method shown corresponds to the image decoding method based on the above S401-S403. Since an inverse quantization processing method that can save computing resources on the decoding end is adopted in the image decoding process, that is, the efficiency of the inverse quantization processing process in the image decoding method is greatly improved, and thus the image decoding method greatly improves the image decoding efficiency.

[0410] It should also be noted that the specific mode for predicting the block to be decoded in this embodiment is not specifically limited. For example, the prediction mode described in the above embodiment 1 can be used to predict the block to be decoded, but it is certainly not limited to this.

[0411] It should also be noted that this embodiment does not specifically limit the manner in which the decoding end decodes the code stream of the block to be decoded. For example, the variable-length decoding method described in the following embodiment 3 may be used for encoding, but it is certainly not limited thereto.

[0412] Embodiment 3

[0413] like Fig.10a As shown, it is a schematic diagram of the flow chart of another image encoding method provided by this embodiment. Fig.10a The method shown includes the following steps:

[0414] S501: The encoding end determines a residual block corresponding to a block to be encoded.

[0415] Here, the residual block may be the original residual value block of the block to be encoded, or the residual block may be the residual coefficient block obtained after the original residual value block is transformed, or the residual block may be the quantized residual block obtained after the encoding end quantizes the residual coefficient block, and there is no limitation on this.

[0416] The original residual value block of the block to be encoded is a residual block obtained by the encoding end based on the original pixel value of the block to be encoded and the prediction block of the block to be encoded.

[0417] It can be understood that the process of the encoding end predicting the pixels in the block to be encoded to obtain the prediction block can be implemented based on the method described in Example 1, and of course, it can also be obtained based on any method in the prior art that can obtain the prediction block of the block to be encoded. The embodiments of the present application are not limited to this.

[0418] The residual coefficient block is obtained after the encoder performs transformation processing on the original residual value block. The embodiment of the present application does not specifically limit the process of transforming the original residual value block on the encoder.

[0419] The process of obtaining a quantized residual block after the encoding end quantizes the residual coefficient block can be implemented based on the method described in Example 2, and of course can also be obtained based on any method in the prior art that can quantize the residual block, and the embodiments of the present application are not limited to this.

[0420] For the sake of simplicity, this embodiment is described below by taking the residual block being a residual coefficient block of a to-be-encoded block as an example.

[0421] S502: The encoding end encodes the residual block of the block to be encoded by using a variable code length encoding method to obtain a code stream of the block to be encoded.

[0422] Optionally, the above-mentioned variable code length encoding method may include an exponential Golomb coding method with a variable order. In this way, the encoding end can first determine the attribute type of each pixel in the block to be encoded. For the first value in the residual block of the block to be encoded corresponding to the first pixel in the block to be encoded, the encoding end can determine the target order when encoding the first value corresponding to the first pixel based on a preset strategy and the attribute type of the first pixel. Then, the encoding end can use an exponential Golomb coding algorithm of the target order to encode the first value in the residual block of the block to be encoded. When the encoding end encodes each value in the residual block of the block to be encoded, the encoded code stream of the block to be encoded is obtained. Among them, the encoding end can be preset with the above-mentioned prediction strategy, which is used to indicate the order used to encode the residual values ​​corresponding to pixels of different attribute types.

[0423] It should be understood that the coding rules of the exponential Golomb coding methods of different orders are different. Referring to Table 6, Table 6 shows the coding rules (including codeword structure and corresponding coding range) of the exponential Golomb coding method when the order k takes different values. As shown in Table 6, X in the codeword structure shown in Table 6 can be 0 or 1.

[0424] Table 6

[0425]

[0426] In this way, for the first value corresponding to the first pixel of the block to be encoded in the residual block of the block to be encoded, the encoding end determines the target order when encoding the first value corresponding to the first pixel based on the preset strategy and the attribute type of the first pixel. Then, the encoding end can determine the codeword structure for encoding the first value based on the exponential Golomb coding algorithm of the target order and the size of the first value, and encode the first value with the codeword structure. Similarly, when the encoding end encodes each value in the residual block of the block to be encoded, the encoded code stream of the block to be encoded is obtained.

[0427] For example, when the encoding end determines that the target order for encoding the first value corresponding to the first pixel is 0 based on the preset strategy and the attribute type of the first pixel. Assuming that the value of the first value is 2, as shown in Table 6, the first value belongs to the encoding range 1 to 2, the encoding end can determine that the codeword structure for encoding the first value is 011 (that is, the codeword structure 01X corresponding to the encoding range 1 to 2) based on the 0-order exponential Golomb coding algorithm and the size of the first value. In this way, the encoding end can encode the first value with 011. Assuming that the value of the first value is 7, as shown in Table 6, the first value belongs to the encoding range 7 to 14, the encoding end can determine that the codeword structure for encoding the first value is 00010000 (that is, the codeword structure 0001XXXX corresponding to the encoding range 7 to 14) based on the 0-order exponential Golomb coding algorithm and the size of the first value. In this way, the encoding end can encode the first value with 00010000. When the encoding end encodes each value in the residual block of the block to be encoded, the encoded code stream of the block to be encoded is obtained.

[0428] Optionally, the variable code length encoding method may also include an exponential Golomb encoding method of a preset order, wherein the preset order may be a value preset by the encoding end, such as 0 or 1 (i.e., the value of K may be a preset 0 or 1), which is not limited in the present embodiment of the application.

[0429] It can be seen from Table 6 that when the encoder pre-specifies the order value (ie, K value) of the exponential Golomb coding method, variable-length coding of the residual values ​​in the residual block (or the residual coefficient values ​​in the residual coefficient block) can also be achieved.

[0430] It should be understood that after encoding the residual block of the block to be encoded, the encoder can also determine the semantic element corresponding to the residual block. The semantic element, for example, includes a code length (CL) for encoding each value in the residual block.

[0431] Optionally, the encoding end may use the above-mentioned exponential Golomb coding algorithm with a transformable order to encode CL to achieve the purpose of saving bits, thereby achieving the purpose of improving the encoding efficiency while improving the compression rate of image encoding.

[0432] For example, for any value in the residual block of the block to be encoded, the encoder can determine the target order when encoding the CL based on the CL of the any value. Then, the encoder can encode the CL using the exponential Golomb coding algorithm of the target order, and add the encoded data to the encoded bitstream of the block to be encoded.

[0433] It can be seen that when the encoding end encodes the residual block (or the CL of the residual value in the residual block) of the coding block through the exponential Golomb coding algorithm with a variable order, it can adaptively encode the smaller residual value (or CL value) with fewer bits, thereby achieving the purpose of saving bits. That is, while improving the compression rate of image coding, the method of the embodiment of the present application also improves the coding efficiency.

[0434] Optionally, the encoder may 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 encoder may use fixed-length coding or truncated unary coding to encode the CL of the any value.

[0435] Specifically, when the CL of any of the above values ​​is less than or equal to the threshold, the encoding end uses a preset number of bits to perform fixed-length encoding on the CL of any value, and adds the encoded data to the code stream of the block to be encoded. When the CL of any of the above values ​​is greater than the aforementioned threshold, the encoding end uses a truncated unary code to encode the CL of any value, and adds the encoded data to the code stream of the block to be encoded. The specific value of the threshold is not limited in the embodiment of the present application.

[0436] As an example, taking the value of the threshold as 2, as shown in Table 7, Table 7 shows the codewords obtained by the encoder using 2 bits for fixed-length encoding for CL values ​​less than or equal to 2, and Table 7 also shows the codewords obtained by the encoder using truncated unary code encoding for CL values ​​greater than 2. Wherein, if CLmax represents the maximum CL value, for CL values ​​greater than 2, the codeword of CLmax includes CLmax-1 1s, the codeword of CLmax-1 includes CLmax-2 1s and 1 0, ..., the codeword of CLmax-j includes CLmax-j-1 1s and 1 0, where j is a positive integer.

[0437] Table 7

[0438] CL value Codeword 0 00 1 01 2 10 3 110 4 1110 5 11110 6 111110 … … CLmax-1 11…110 CLmax 11…111

[0439] It can be understood that the encoding end can also use fixed-length coding and truncated unary code to encode each value in the residual block of the block to be encoded. For details, please refer to the description of CL of each value in the residual block of the block to be encoded by the encoding end using fixed-length coding or truncated unary code, which will not be repeated here.

[0440] It can be seen that when the encoder uses fixed-length coding and truncated unary code to encode CL (or residual value), it can adaptively encode a smaller CL value (or residual value) with fewer bits, thereby achieving the purpose of saving bits. That is, while improving the compression rate of image coding, it also improves the coding efficiency.

[0441] like Fig.10bAs shown, it is a flowchart of another image decoding method provided by this embodiment. Fig.10b The method shown includes the following steps:

[0442] S601: The decoding end parses the code stream of the block to be decoded by 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.

[0443] Optionally, the variable code length decoding method may be an exponential Golomb decoding method with a variable order. The decoding end may first parse the target order of the code stream for decoding the block to be decoded from the code stream, and then use the exponential Golomb decoding algorithm of the target order to parse the code stream of the block to be decoded, thereby obtaining the CL of each value in the residual block of the block to be decoded.

[0444] The exponential Golomb decoding method of the transformable order can refer to the description of the exponential Golomb encoding method of the transformable order in the above text. It can be understood that decoding is the inverse operation of encoding, which will not be described in detail.

[0445] Optionally, the variable code length decoding method may be an exponential Golomb decoding method of a preset order. In this case, the decoding end may use the exponential Golomb decoding algorithm of the preset order to parse the code stream of the block to be decoded, thereby obtaining the CL of each value in the residual block of the block to be decoded.

[0446] Optionally, the decoding end may also determine that when the number of bits in the code stream used to encode any value CL in the residual block of the block to be decoded is a preset number, the code stream of the block to be decoded is parsed based on the fixed-length decoding strategy to obtain the CL encoding the arbitrary value. Also, the decoding end may determine that when the number of bits in the code stream used to encode any value CL in the residual block of the block to be decoded is greater than a preset number, the code stream of the block to be decoded is parsed based on the rule of truncated unary code to obtain the CL encoding the arbitrary value. For a specific description, reference may be made to the above description of the encoding end encoding CL with fixed-length coding and truncated unary code. It can be understood that decoding is the inverse operation of encoding and will not be repeated.

[0447] S602: The decoding end determines a residual block of the block to be decoded based on the CL obtained above.

[0448] After the encoder determines the CL of each value in the residual block of the block to be decoded, the number of bits used to encode each value in the residual block is determined. In this way, the decoder can determine the bit group corresponding to each pixel in the block to be decoded in the bit stream of the block to be decoded based on the CL of encoding each value, and determine the target order for parsing each bit group.

[0449] In one possible case, the decoding end may first determine the attribute type of each pixel in the block to be decoded after parsing the CL of each value in the residual block of the block to be decoded. Then, for the first bit group corresponding to the first pixel in the block to be decoded, the decoding end may determine the target order for parsing the first bit group based on the preset strategy and the attribute type of the first pixel. In another possible case, the decoding end is preset with a preset order of the bit group corresponding to each pixel in the block to be decoded, and the decoding end 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.

[0450] Then, the decoding end uses the exponential Golomb decoding algorithm of the target order to parse the bit group corresponding to each pixel in the block to be decoded, so as to obtain the residual value of each pixel, thereby obtaining the residual block of the block to be decoded.

[0451] It can be understood that the order in which the values ​​in the residual block are obtained by the decoding end according to the code stream analysis of the block to be decoded is the same as the order in which the values ​​in the residual block are encoded by the encoding end.

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

[0453] Optionally, when the residual block of the block to be decoded is a residual coefficient block, the decoding end may sequentially perform inverse quantization and inverse transformation 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 end may reconstruct the block to be decoded based on the reconstructed residual value block to obtain a reconstructed block. For example, the decoding end may obtain the reconstructed block of the block to be decoded by summing the reconstructed residual value block and the prediction block of the block to be decoded.

[0454] Optionally, when the residual block of the block to be decoded is a residual value block, the decoding end may inversely quantize 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 may reconstruct the block to be decoded based on the reconstructed residual value block to obtain a reconstructed block. For example, the decoding end may obtain the reconstructed block of the block to be decoded by summing the reconstructed residual value block and the prediction block of the block to be decoded.

[0455] The prediction block of the block to be decoded can be obtained by predicting the block to be decoded based on the prediction mode obtained by parsing the code stream of the block to be decoded at the decoding end. Optionally, the prediction mode can be any prediction mode described in Embodiment 1, or the prediction mode can be any prediction mode in the prior art, which is not limited in the embodiments of the present application. In addition, the process of predicting the prediction block of the block to be decoded at the decoding end is not described in detail here.

[0456] Among them, the process of dequantizing the residual block of the decoded block at the decoding end can be implemented based on the method described in Example 2, and of course can also be obtained based on any method in the prior art that can achieve dequantization of the residual block, and the embodiment of the present application is not limited to this.

[0457] Need to explain, Fig.10b The image decoding method shown is similar to Fig.10a The image encoding method shown corresponds to this, so this method can improve the decoding efficiency while improving the compression rate of image encoding.

[0458] It should also be noted that the variable-length encoding / decoding method provided in Example 3 can also be applied to Example 1 and Example 2, or to any scenario requiring image encoding / decoding, and the embodiments of the present application are not limited to this.

[0459] It is understandable that, in order to implement the functions in the above-mentioned embodiments, the encoding end / decoding end includes hardware structures and / or software modules corresponding to the execution of each function. It should be easily appreciated by those skilled in the art that, in combination with the units and method steps of each example described in the embodiments disclosed in this application, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application scenario and design constraints of the technical solution.

[0460] The following describes a decoding device and an encoding device provided in embodiments of the present application.

[0461] In one example, any decoding device provided in the embodiments of the present application may be Figure 1 In another example, any of the encoding devices provided below may be Figure 1 The source device 11 or the encoder 112 in the embodiment is described uniformly here and will not be described in detail below.

[0462] Fig.11A structural schematic diagram of a decoding device 1100 provided in the present application, any of the above decoding method embodiments can be executed by the decoding device 1100. The decoding device 1100 includes a parsing unit 1101, a determining unit 1102, a prediction unit 1103 and a reconstruction unit 1104. Among them, the parsing unit 1101 is used to parse the code stream of the block to be decoded to determine the target prediction mode for predicting the pixels in the block to be decoded. The determining unit 1102 is used to determine the target prediction order corresponding to the target prediction mode based on the target prediction mode. The prediction unit 1103 is used to predict each pixel in the block to be decoded in the target prediction order corresponding to the target prediction mode according to the determined target prediction mode. The reconstruction unit 1104 is used to reconstruct each pixel in the block to be decoded based on the predicted value of the pixel, so as to obtain a reconstructed block of the block to be decoded.

[0463] In one example, the parsing unit 1101 may Figure 5 The code stream parsing unit 301 in the embodiment of the present invention is implemented. The determination unit 1102 and the prediction unit 1103 can be Figure 5 The prediction processing unit 304 in the reconstruction unit 1104 can be realized by Figure 5 The reconstruction unit 305 in is implemented. Figure 5 The encoded bit stream in may be the code stream of the block to be decoded in this embodiment.

[0464] For a more detailed description of the above-mentioned analysis unit 1101, determination unit 1102, prediction unit 1103 and reconstruction unit 1104, as well as a more detailed description of each technical feature therein, and a description of the beneficial effects, etc., please refer to the above-mentioned corresponding method embodiment part, which will not be repeated here.

[0465] Fig.12 A structural schematic diagram of a coding device 1200 provided in the present application, any of the above-mentioned coding method embodiments can be executed by the coding device 1200. The coding device 1200 includes a determination unit 1201, a prediction unit 1202 and a coding unit 1203. Among them, the determination unit 1201 is used to determine the target prediction mode of the block to be encoded, and determine the target prediction order corresponding to the target prediction mode. The prediction unit 1202 is used to predict each image in the block to be encoded in the target prediction order according to the target prediction mode. The determination unit 1201 is also used to determine the residual block of the block to be encoded based on the prediction value of each pixel. The coding unit 1203 is used to encode the residual block in the target prediction order to obtain the code stream of the block to be encoded.

[0466] In one example, the determining unit 1201 and the predicting unit 1202 may be Figure 2 The prediction processing unit 201 in the embodiment is implemented. The determination unit 1201 can also be implemented by Figure 2The residual calculation unit 202 in is implemented. The encoding unit 1203 can be Figure 2 The encoding unit 205 in is implemented. Figure 2 The block to be encoded in may be the block to be encoded in this embodiment.

[0467] For a more detailed description of the above-mentioned determination unit 1201, prediction unit 1202 and encoding unit 1203, as well as a more detailed description of each technical feature therein, and a description of the beneficial effects, etc., please refer to the above-mentioned corresponding method embodiment part, which will not be repeated here.

[0468] Fig.13 The present application provides a structural schematic diagram of a decoding device 1300, and any of the above decoding method embodiments can be executed by the decoding device 1300. The decoding device 1300 includes a parsing unit 1301, a dequantization unit 1302, and a reconstruction unit 1303. Among them, the parsing unit 1301 is used to parse the code stream of the block to be decoded to obtain the dequantization parameter of each pixel in the block to be decoded and the first residual block of the block to be decoded. The dequantization unit 1302 is used to dequantize the first residual block based on the QP indicated by the dequantization parameter of each pixel and the dequantization preset array to obtain a second residual block. The reconstruction unit 1303 is used to reconstruct the block to be decoded based on the second residual block to obtain a reconstructed block.

[0469] In one example, the parsing unit 1301 may Figure 5 The code stream parsing unit 301 in the embodiment of the present invention is implemented. The inverse quantization unit 1302 can be Figure 5 The inverse quantization unit 302 in the reconstruction unit 1303 can be realized by Figure 5 The reconstruction unit 305 in is implemented. Figure 5 The encoded bit stream in may be the code stream of the block to be decoded in this embodiment.

[0470] For a more detailed description of the above-mentioned analysis unit 1301, inverse quantization unit 1302 and reconstruction unit 1303, as well as a more detailed description of each technical feature therein, and a description of the beneficial effects, etc., please refer to the above-mentioned corresponding method embodiment part, which will not be repeated here.

[0471] Fig.14The present application provides a schematic diagram of the structure of a coding device 1400, and any of the above coding method embodiments can be executed by the coding device 1400. The coding device 1400 includes a determination unit 1401, a quantization unit 1402, and a coding unit 1403. The determination unit 1401 is used to determine the second residual block of the block to be encoded and the quantization parameter QP of each pixel in the block to be encoded. The quantization unit 1402 is used to quantize the second residual block based on the QP of each pixel and the quantization preset array to obtain a first residual block. The coding unit 1403 is used to encode the first residual block to obtain a code stream of the block to be encoded.

[0472] In one example, the determining unit 1401 may Figure 2 Alternatively, the determination unit 1401 may be implemented by Figure 2 The residual calculation unit 202 and the residual transformation unit 203 in the embodiment are combined to realize the quantization unit 1402. Figure 2 The encoding unit 1403 can be implemented by the quantization unit 204 in Figure 2 The encoding unit 205 in is implemented. Figure 2 The block to be encoded in may be the block to be encoded in this embodiment.

[0473] For a more detailed description of the above-mentioned determination unit 1401, quantization unit 1402 and encoding unit 1403, as well as a more detailed description of each technical feature therein, and a description of the beneficial effects, etc., please refer to the above-mentioned corresponding method embodiment part, which will not be repeated here.

[0474] Fig.15 The present application provides a schematic diagram of the structure of a coding device 1500, and any of the above coding method embodiments can be performed by the coding device 1500. The coding device 1500 includes a determination unit 1501 and a coding unit 1502. The determination unit 1501 is used to determine the residual block corresponding to the block to be coded. The coding unit 1502 is used to encode the residual block in a variable code length coding method to obtain a code stream of the block to be coded.

[0475] In one example, the determining unit 1501 may Figure 2 Alternatively, the determination unit 1501 may be implemented by Figure 2 The residual calculation unit 202 and the residual transformation unit 203 in the embodiment are combined to realize, or the determination unit 1501 can be realized by Figure 2 The residual calculation unit 202, the residual transformation unit 203 and the quantization unit 204 in the embodiment are combined to realize the coding unit 1502. Figure 2 The encoding unit 205 in is implemented. Figure 2The block to be encoded in may be the block to be encoded in this embodiment.

[0476] For a more detailed description of the above-mentioned determination unit 1501 and encoding unit 1502, a more detailed description of each technical feature therein, and a description of the beneficial effects, etc., please refer to the above-mentioned corresponding method embodiment part, which will not be repeated here.

[0477] Fig.16 The present application provides a structural schematic diagram of a decoding device 1600, and any of the above decoding method embodiments can be executed by the decoding device 1600. The decoding device 1600 includes a parsing unit 1601, a determining unit 1602, and a reconstruction unit 1603. The parsing unit 1601 is used to parse the code stream of the block to be decoded by using a variable code length decoding method to obtain the encoding code length CL of each value in the residual block corresponding to the block to be decoded. The determining unit 1602 is used to determine the residual block of the block to be decoded based on the CL of each encoding value. The reconstruction unit 1603 is used to reconstruct the block to be decoded based on the residual block of the block to be decoded to obtain a reconstructed block.

[0478] In one example, the parsing unit 1601 may Figure 5 The code stream parsing unit 301 in the embodiment of the present invention is implemented. The determination unit 1602 can be Figure 5 Alternatively, the determination unit 1602 may be implemented by Figure 5 The inverse quantization unit 302 and the residual inverse transform unit 303 in the reconstruction unit 1603 can be realized by combining Figure 5 The reconstruction unit 305 in is implemented. Figure 5 The encoded bit stream in may be the code stream of the block to be decoded in this embodiment.

[0479] For a more detailed description of the above-mentioned analysis unit 1601, determination unit 1602 and reconstruction unit 1603, as well as a more detailed description of each technical feature therein, and a description of the beneficial effects, etc., please refer to the above-mentioned corresponding method embodiment part, which will not be repeated here.

[0480] The present application also provides an electronic device for executing any of the above-mentioned image encoding / decoding methods. Fig.17 As shown, Fig.17 This is a schematic diagram of the structure of an electronic device provided by the present application, where the electronic device 1700 includes a processor 1701 and a communication interface 1702. The processor 1701 and the communication interface 1702 are coupled to each other. It can be understood that the communication interface 1702 can be a transceiver or an input-output interface.

[0481] In one example, the electronic device 1700 may further include a memory 1703 for storing instructions executed by the processor 1701 or storing input data required for the processor 1701 to run instructions or storing data generated after the processor 1701 runs instructions.

[0482] 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. Fig.17 The communication interface 1702, the processor 1701 and the memory 1703 are connected via a bus 1704. Fig.17 The connections between the other components are shown in bold lines, which are only for illustration and are not intended to be limiting. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig.17 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0483] The memory 1703 may be used to store software programs and modules, such as program instructions / modules corresponding to the image decoding method or image encoding method provided in the embodiment 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 implement any of the image decoding methods or image encoding methods provided above. The communication interface 1702 may be used to communicate signaling or data with other devices. In the present application, the electronic device 1700 may have multiple communication interfaces 1702.

[0484] It is understandable that the processor in the embodiments of the present application may be a central processing unit (CPU), a neural processing unit (NPU) or a graphic processing unit (GPU), or may be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. A general-purpose processor may be a microprocessor or any conventional processor.

[0485] The method steps in the embodiments of the present application can be implemented by hardware or by a processor executing software instructions. The software instructions can be composed of corresponding software modules, which can be stored in random access memory (RAM), flash memory, read-only memory (ROM), programmable ROM (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), registers, hard disks, mobile hard disks, CD-ROMs or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an ASIC. In addition, the ASIC can be located in a network device or a terminal device. Of course, the processor and the storage medium can also be present in a network device or a terminal device as discrete components.

[0486] An embodiment of the present application also provides a coding and decoding system, including a coding end and a decoding end, wherein the coding end can be used to execute any one of the image coding methods provided above, and the decoding end is used to execute the corresponding image decoding method.

[0487] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer programs or instructions. When the computer program or instruction is loaded and executed on a computer, the process or function described in the embodiment of the present application is executed in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, a network device, a user device or other programmable device. The computer program or instruction may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer program or instruction may be transmitted from one website site, computer, server or data center to another website site, computer, server or data center by wired or wireless means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium may be a magnetic medium, for example, a floppy disk, a hard disk, a tape; it may also be an optical medium, for example, a digital video disc (DVD); it may also be a semiconductor medium, for example, a solid state drive (SSD).

[0488] In the various embodiments of the present application, unless otherwise specified or provided for in any logical conflict, the terms and / or descriptions between the different embodiments are consistent and may be referenced to each other, and the technical features in the different embodiments may be combined to form new embodiments according to their inherent logical relationships.

[0489] It is understood that the various numbers involved in the embodiments of the present application are only for the convenience of description and are not used to limit the scope of the embodiments of the present application. The size of the sequence number of the above-mentioned processes does not mean the order of execution, and the execution order of each process should be determined by its function and internal logic.

Claims

1. An image decoding method, characterized in that: include: Parsing a bitstream of a block to be decoded to determine a target prediction mode for predicting pixels in the block to be decoded; Based on the target prediction mode, determining a target prediction order corresponding to the target prediction mode; Predicting each pixel in the to-be-decoded block in the target prediction order according to the target prediction mode; Each pixel is reconstructed based on the predicted value of each pixel to obtain a reconstructed block of the block to be decoded.

2. The method according to claim 1, characterized in that When predicting any pixel in the to-be-decoded block in the target prediction order, the pixels used to predict the any pixel have been reconstructed.

3. The method according to claim 2, characterized in that If the target prediction mode indicates predicting each pixel in the to-be-decoded block point by point in the target prediction order, then predicting each pixel in the to-be-decoded block in the target prediction order according to the target prediction mode includes: According to the target prediction mode, each pixel in the block to be decoded is predicted point by point along the direction indicated by the target prediction order; 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.

4. The method according to claim 3, characterized in that For the block to be decoded having a first size, the block to be decoded is predicted using a third prediction order in the target prediction mode; for the block to be decoded having a second size, the block to be decoded is predicted using a fourth prediction order in the target prediction mode; wherein the third prediction order is different from the fourth prediction order.

5. The method according to claim 2, characterized in that: If the target prediction mode indicates that pixels of each sub-block in the block to be decoded are predicted in sequence in units of sub-blocks having a preset size in the block to be decoded, then predicting each pixel in the block to be decoded in the target prediction order according to the target prediction mode includes: According to the target prediction mode, pixels in each sub-block in the to-be-decoded block are predicted sequentially along the direction indicated by the target prediction order.

6. The method according to claim 5, characterized in that The target prediction mode includes a prediction mode of each sub-block in the block to be decoded. For a first sub-block in the block to be decoded, the first sub-block includes a first pixel and a second pixel, and the prediction mode of the first sub-block is used to predict the first pixel and the second pixel in parallel according to reconstructed pixels around the first sub-block.

7. The method according to any one of claims 1 to 6, characterized in that The reconstructing each pixel based on the predicted value of each pixel to obtain the reconstructed block of the block to be decoded comprises: Based on the inverse quantization parameter of each pixel in the block to be decoded obtained by parsing the bitstream of the block to be decoded and the inverse quantization preset array, inverse quantize the first residual block of the block to be decoded obtained by parsing the bitstream of the block to be decoded to obtain a second residual block; Reconstruct each pixel based on the prediction value of each pixel and the second residual block to obtain the reconstructed block.

8. The method according to claim 7, characterized in that The parsing of the code stream of the block to be decoded comprises: The code stream of the block to be decoded is parsed in a variable code length decoding manner to obtain a coding code length CL for encoding each value in a residual block corresponding to the block to be decoded and the first residual block.

9. The method according to claim 8, characterized in that Before obtaining the second residual block, the method further includes: Parse the code stream of the block to be decoded to obtain an inverse quantization parameter of each pixel in the block to be decoded and a first residual block of the block to be decoded.

10. The method according to claim 9, characterized in that The step of parsing the code stream of the block to be decoded to obtain the inverse quantization parameter of each pixel in the block to be decoded and the first residual block of the block to be decoded comprises: Determining, based on the bitstream 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; Based on the target prediction mode, determining a residual scanning order corresponding to the target prediction mode; wherein when the target prediction mode is a first target prediction mode, the residual scanning order is a first scanning order, and when the target prediction mode is a second target prediction mode, the residual scanning order is a second scanning order, and the first scanning order and the second scanning order are different; The code stream of the to-be-decoded block is parsed based on the residual scanning order to obtain the first residual block.

11. The method according to claim 10, characterized in that For the block to be decoded having a first size, a third scanning order is used in the target prediction mode to parse the code stream of the block to be decoded; for the block to be decoded having a second size, a fourth scanning order is used in the target prediction mode to parse the code stream of the block to be decoded; wherein the third scanning order is different from the fourth scanning order.

12. An image encoding method, characterized in that: include: 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; Determine a residual block of the to-be-encoded block based on the predicted value of each pixel; The residual block is encoded in the target prediction order to obtain a code stream of the block to be encoded.

13. An image decoding device, characterized in that: include: A parsing unit, used for parsing a code stream of a block to be decoded to determine a target prediction mode for predicting pixels in the block to be decoded; A determination unit, configured to determine, based on the target prediction mode, a target prediction order corresponding to the target prediction mode; A prediction unit, configured to predict each pixel in the to-be-decoded block in the target prediction order according to the target prediction mode; A reconstruction unit is used to reconstruct each pixel based on the prediction value of each pixel to obtain a reconstructed block of the block to be decoded.

14. An image encoding device, characterized in that: include: A determination unit, configured 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; A prediction unit, configured to predict each pixel in the to-be-encoded block in the target prediction order according to the target prediction mode; The determining unit is further configured to determine a residual block of the to-be-encoded block based on the predicted value of each pixel; The encoding unit is used to encode the residual block in the target prediction order to obtain a code stream of the block to be encoded.

15. An electronic device, characterized in that: The system comprises a processor and a memory, wherein the memory is used to store computer instructions, and the processor is used to call and execute the computer instructions from the memory to implement the method according to any one of claims 1 to 12.

16. A computer-readable storage medium, characterized in that: The storage medium stores a computer program or instruction. When the computer program or instruction is executed by an electronic device, the method according to any one of claims 1 to 12 is implemented.