Image encoding decoding method, apparatus, electronic device, and storage medium
The image encoding and decoding method addresses inefficiencies in video coding by predicting pixels in a target order, enabling parallel processing and reducing resource usage, thereby enhancing decoding efficiency and accuracy.
Patent Information
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- HANGZHOU HIKVISION DIGITAL TECHNOLOGY CO LTD
- Filing Date
- 2026-01-22
- Publication Date
- 2026-04-21
AI Technical Summary
Existing video coding techniques face challenges in efficiently encoding and decoding video data due to redundant information, leading to inefficiencies in storage and transmission.
An image encoding and decoding method that predicts pixels within a block in a target prediction order, allowing parallel prediction and reducing the need for caching residual values, thereby improving efficiency and reducing the number of bits required for decoding.
The method enhances decoding efficiency by minimizing cache space and computational resources, while reducing the number of bits needed for encoding and decoding, thus improving overall image processing speed and accuracy.
Smart Images

Figure 2026067941000001_ABST
Abstract
Description
[Technical Field]
[0001] This application claims priority to Chinese Patent Application No. 202210320915.5, filed with the China National Patent Office on March 29, 2022, with the invention title "Image encoding and decoding method, apparatus, electronic device, and storage medium," and all of its contents are incorporated into this application by reference.
[0002] This application relates to the field of image coding and decoding, and more particularly to image coding and decoding methods, apparatus, electronic devices, and storage media. [Background technology]
[0003] A complete image within a video is typically called a "frame," and a video composed of multiple frames in chronological order is called a video sequence. Video sequences contain a range of redundant information, including spatial redundancy, temporal redundancy, visual redundancy, information entropy redundancy, structural redundancy, knowledge redundancy, and importance redundancy. To remove as much redundant information as possible from a video sequence and reduce the amount of data representing the video, video coding techniques have been proposed to achieve the effects of reducing storage space and saving transmission bandwidth. Video coding techniques are also called video compression techniques.
[0004] With technological advancements, collecting video data has become increasingly convenient, and the volume of collected video data is also growing larger. Therefore, how to effectively encode and decode video data has become a problem that needs to be solved. [Overview of the project]
[0005] This application provides an image encoding and decoding method, apparatus, electronic device, and storage medium, and the image encoding and decoding method can improve the efficiency of image encoding and decoding.
[0006] To achieve the above objective, this application provides the following technical means. In a first aspect, the present invention provides an image decoding method which includes: analyzing a code stream of a block to be decoded to determine a target prediction mode for predicting pixels within the block to be decoded; determining a target prediction order corresponding to the target prediction mode based on the target prediction mode; predicting each pixel within the block to be decoded in the target prediction order according to the target prediction mode; and reconstructing each pixel based on the predicted value of each pixel to obtain a reconstructed block of the block to be decoded.
[0007] According to the image decoding method provided in this application, when the decoding side predicts pixels within a block to be decoded using a target prediction mode, it predicts the pixels within the block to be decoded in a target prediction order corresponding to the target prediction mode. In this process, when the decoding side predicts any pixel in the block to be decoded, the pixels for predicting that pixel have already been reconstructed. Therefore, the image decoding method provided in this application predicts each pixel within the block to be decoded in a target prediction order according to the target prediction mode, and can predict some pixels within the block to be decoded in parallel, thereby improving the prediction efficiency for pixels within the block to be decoded. When the decoding side reacquires the reconstructed value based on the predicted value and the residual value, there is no need to cache the residual value. Therefore, the decoding method provided by the embodiment of this application not only saves cache space for caching residual values but can also improve decoding efficiency.
[0008] In one possible design configuration, when predicting any pixel within the decoded block in the target prediction order described above, the pixels needed to predict any of those pixels have already been reconstructed. By using the reconstructed pixels to predict the pixels, the pixels used for prediction during the decoding process can be matched with the pixels used for prediction during the encoding process, thereby reducing decoding errors, making the predicted values of pixels during the decoding process more accurate, and improving the accuracy of decoding.
[0009] In another possible design configuration, if the target prediction mode instructs to predict each pixel in the decoded block dot by dot in the target prediction order, then predicting each pixel in the decoded block in the target prediction order according to the target prediction mode includes predicting each pixel in the decoded block dot by dot along the direction indicated by the target prediction order, according to the target prediction mode. Here, if the target prediction mode is a first target prediction mode, the target prediction order is a first prediction order, and if the target prediction mode is a second target prediction mode, the target prediction order is a second prediction order, and the first and second prediction orders are different.
[0010] In other words, different prediction modes correspond to different prediction orders. Thus, by selecting an appropriate prediction order for different prediction modes during encoding on the encoding side, the difference between the pixels in the target block and the predicted values can be reduced, thereby allowing the target block to be encoded with fewer bits. Consequently, the number of bits to be decoded on the decoding side is reduced, improving decoding efficiency. Therefore, the decoding method provided by this possible design can further improve the decoding efficiency of images.
[0011] In another possible design configuration, for a decryption target block of a first size, the target prediction mode predicts the decryption target block in a third prediction order. For a decryption target block of a second size, the target prediction mode predicts the decryption target block in a fourth prediction order. Here, the third and fourth prediction orders are different.
[0012] In other words, if the size of the blocks to be decoded is different, the prediction order may differ when predicting pixels within the blocks using the same prediction mode. Thus, by selecting an appropriate prediction order according to the size of the blocks to be encoded during encoding on the encoding side, the difference between the pixels within the blocks and the predicted values can be reduced, thereby allowing the blocks to be encoded with fewer bits. Consequently, the number of bits to be decoded on the decoding side is reduced, improving decoding efficiency. Therefore, the decoding method provided by this possible design can further improve the decoding efficiency of images.
[0013] In one possible design configuration, if the target prediction mode instructs to sequentially predict the pixels within each subblock in the target block, using preset-sized subblocks within the target block as units, then predicting each pixel in the target block in the target prediction order according to the target prediction mode includes sequentially predicting the pixels within each subblock in the target block in the direction indicated by the target prediction order, according to the target prediction mode.
[0014] In another possible design configuration, the target prediction mode includes a prediction mode for each subblock in the block to be decoded, wherein for a first subblock in the block to be decoded, if the first subblock contains a first pixel and a second pixel, the prediction mode for the first subblock is used to predict the first pixel and the second pixel in parallel based on the reconstructed pixels surrounding the first subblock.
[0015] With these two possible design forms, when the decoder predicts one sub-block, it can predict multiple pixels within the sub-block in parallel based on the reconstructed pixels around the sub-block. That is, such a prediction mode can further improve the prediction efficiency for the decoding target block on the decoder side. When the decoder obtains the reconstructed value based on the predicted value and the residual value, there is no need to cache the residual value. Therefore, the decoding method provided by these two possible design forms further saves cache space and improves the decoding efficiency.
[0016] In another possible design form, reconstructing each pixel based on the predicted value of each pixel to obtain the reconstructed block of the decoding target block includes: based on the inverse quantization parameter and the inverse quantization preset array of each pixel in the decoding target block obtained by analyzing the code stream of the decoding target block, inverse quantizing the first residual block of the decoding target block obtained by analyzing the code stream of the decoding target block to obtain a second residual block; and reconstructing each pixel based on the predicted value of each pixel and the second residual block to obtain a reconstructed block.
[0017] With this possible design form, inverse quantization can be performed based on a preset inverse quantization preset array, reducing the multiplication during the inverse quantization process. Since multiplication operations take time, reducing multiplication operations can improve the calculation efficiency of the inverse quantization process. That is, the inverse quantization of the first residual block of the decoding target block can be efficiently realized. Therefore, the decoding method provided by this possible design form can further improve the decoding efficiency of the image.
[0018] In one possible design form, analyzing the code stream of the decoding target block includes: using a variable code length decoding method to analyze the code stream of the decoding target block to obtain the code length (CL) for encoding each value in the residual block corresponding to the decoding target block and the first residual block.
[0019] With this possible design form, since the residual block of the decoding target block and the CL are encoded with fewer bits on the encoding side, the number of bits to be decoded on the corresponding decoding side is reduced, improving the decoding efficiency. Therefore, the decoding method provided by this possible design form can further improve the decoding efficiency of the image.
[0020] As a second aspect, the present application provides an image encoding method, which includes determining a target prediction mode of an encoding target block, determining a target prediction order corresponding to the target prediction mode, predicting each pixel in the encoding target block in the target prediction order according to the target prediction mode, determining a residual block of the encoding target block based on the predicted value of each pixel, and encoding the residual block in the target prediction order to obtain a code stream of the encoding target block.
[0021] According to the image encoding method provided by the present application, when the encoding side predicts the pixels in the encoding target block in the target prediction mode, the pixels in the encoding target block are predicted in the target prediction order corresponding to the target prediction mode. In this process, when the encoding side predicts any pixel in the encoding target block, the pixel for predicting the pixel has already been reconstructed. Therefore, the image encoding method provided by the present application can predict each pixel in the encoding target block in the target prediction order according to the target prediction mode, and can predict some pixels in the encoding target block in parallel, improving the prediction efficiency for the pixels in the encoding target block. When the encoding side re-obtains the reconstructed value based on the predicted value and the residual value, there is no need to cache the residual value. Therefore, the encoding method provided by the embodiments of the present application not only saves the cache space for caching the residual value, but can also improve the encoding efficiency.
[0022] In one possible design form, when predicting any pixel in the encoding target block in the above target prediction order, the pixel for predicting the pixel has already been reconstructed.
[0023] In another possible design configuration, if the target prediction mode instructs that each pixel in the block to be encoded be predicted dot by dot in the target prediction order, then predicting each pixel in the block to be encoded in the target prediction order according to the target prediction mode includes predicting each pixel in the block to be encoded dot by dot along the direction indicated by the target prediction order, according to the target prediction mode. Here, if the target prediction mode is a first target prediction mode, the target prediction order is the first prediction order; if the target prediction mode is a second target prediction mode, the target prediction order is the second prediction order, and the first and second prediction orders are different. In other words, different prediction modes correspond to different prediction orders.
[0024] In another possible design configuration, for a block to be encoded of a first size, the target prediction mode predicts the block in a third prediction order. For a block to be encoded of a second size, the target prediction mode predicts the block in a fourth prediction order. Here, the third and fourth prediction orders are different. In other words, if the size of the block to be encoded is different, the prediction order may be different when predicting pixels within the block using the same prediction mode.
[0025] In another possible design configuration, if the target prediction mode instructs sequential prediction for each pixel in a pre-sized subblock within the target block, then predicting each pixel in the target block in the target prediction order according to the target prediction mode includes sequentially predicting for each pixel in a subblock within the target block in the direction indicated by the target prediction order, according to the target prediction mode.
[0026] In another possible design configuration, the target prediction mode includes a prediction mode for each subblock within the block to be encoded, wherein for a first subblock in the block to be encoded, if the first subblock contains a first pixel and a second pixel, the prediction mode for the first subblock is used to predict the first pixel and the second pixel in parallel based on the reconstructed pixels surrounding the first subblock.
[0027] In another possible design configuration, before encoding the residual blocks in the target predicted order to obtain the code stream of the blocks to be encoded, the method includes determining the quantization parameter QP of each pixel in the blocks to be encoded. Based on the QP of each pixel and the quantization preset array, the residual blocks to be encoded are quantized to obtain a first residual block. Thus, encoding the residual blocks in the target predicted order to obtain the code stream of the blocks to be encoded includes encoding the first residual block in the target predicted order to obtain the code stream of the blocks to be encoded.
[0028] In another possible design configuration, obtaining a code stream of the blocks to be encoded by encoding the first residual blocks in the target prediction order includes obtaining a code stream of the blocks to be encoded by encoding the first residual blocks in the target prediction order and using a variable code length encoding scheme.
[0029] Since the image encoding method provided by the second embodiment and any possible design configuration corresponds to the image decoding method provided by the first embodiment and any possible design configuration, it is understood that the beneficial effects of the technical means provided by the second embodiment and any possible design configuration refer to the explanation of the beneficial effects of the corresponding method in the first embodiment, but redundant explanations are omitted here.
[0030] In a third aspect, the present invention provides an image decoding method comprising: analyzing a code stream of a block to be decoded to obtain an inverse quantization parameter for each pixel in the block to be decoded and a first residual block of the block to be decoded; inverse quantizing the first residual block based on the QP indicated by the inverse quantization parameter of each pixel and an inverse quantization preset array to obtain a second residual block; and reconstructing the block to be decoded based on the second residual block to obtain a reconstructed block.
[0031] The image decoding method provided in this application reduces the number of multiplication operations in the quantization process, as the quantization processing method implemented based on the quantization preset array provided in this application reduces the number of multiplication operations in the quantization process. Since multiplication operations occupy a large amount of computational resources, reducing the number of multiplication operations reduces the number of computational resources occupied in the quantization process, thereby significantly saving computational resources on the encoding side. Furthermore, because the calculation speed of multiplication operations is slow, the quantization processing process in this image decoding method is significantly more efficient than that of conventional technology, and this image decoding method further significantly improves the image decoding efficiency.
[0032] In one possible design configuration, analyzing the code stream of the target block to be decoded and obtaining the inverse quantization parameter of each pixel in the target block and the first residual block of the target block includes determining a target prediction mode and the inverse quantization parameter of each pixel in the target block based on the code stream of the target block; determining a residual scan order corresponding to the target prediction mode based on the target prediction mode; and analyzing the code stream of the target block to be decoded based on the residual scan order to obtain the first residual block. Here, if the target prediction mode is the first target prediction mode, the residual scan order is the first scan order; if the target prediction mode is the second target prediction mode, the residual scan order is the second scan order, and the first and second scan orders are different. In other words, different prediction modes correspond to different residual scan orders.
[0033] In another possible design configuration, for a first-size decryption target block, the code stream of the decryption target block is analyzed using the third scan order in the target prediction mode described above. For a second-size decryption target block, the code stream of the decryption target block is analyzed using the fourth scan order in the target prediction mode described above. Here, the third scan order and the fourth scan order are different. In other words, if the sizes of the decryption target blocks are different, the residual scan order when analyzing the code stream of the decryption target block may be different if the pixels within the decryption target block are predicted using the same prediction mode.
[0034] Based on these two possible design configurations, when analyzing based on the residual scan order to obtain residual blocks to be decoded, if the predicted blocks of the decoded blocks are predicted using the same target prediction order as the residual scan order, the efficiency of reconstructing the reconstructed blocks of the decoded blocks based on the residual blocks and predicted blocks can be improved. In other words, these two possible design configurations can further improve the image decoding efficiency. Furthermore, when encoding, the encoding side can select a scan order suitable for the target prediction mode, allowing the residual blocks to be encoded with fewer bits. That is, the blocks to be encoded are encoded with fewer bits, and consequently, the number of bits to be decoded on the decoding side is reduced, improving the decoding efficiency. Therefore, the decoding methods provided by these possible design configurations can further improve the image decoding efficiency.
[0035] In another possible design configuration, in the above inverse quantization preset array, the interval between adjacent numbers is 1 for numbers 1 through n, the interval between adjacent numbers is 2 for numbers n+1 through n+m, and the numerical interval between adjacent numbers is 2 for numbers n+k*m+1 through n+k*m+m. k+1 The equation is given, where n and m are integers greater than 1, and k is a positive integer.
[0036] In another possible design configuration, obtaining a second residual block by dequantizing a first residual block based on the QP of each pixel and a quantization preset array includes determining the amplification parameter corresponding to each pixel in the dequantization preset array based on the QP of each pixel, and performing a dequantization operation on the first residual block based on the amplification parameter corresponding to each pixel to obtain a second residual block.
[0037] In another possible design configuration, obtaining a second residual block by dequantizing a first residual block based on the QP of each pixel and the quantization preset array includes determining the amplification parameter and displacement parameter corresponding to each pixel based on the QP of each pixel and the quantization preset array, and performing a dequantization operation on the first residual block based on the amplification parameter and displacement parameter corresponding to each pixel to obtain a second residual block. Here, the value of the amplification parameter corresponding to each pixel is the value corresponding in the dequantization preset array to the logical AND of the QP of each pixel and 7, and the value of the displacement parameter corresponding to each pixel is the value obtained by multiplying 7 and the QP of each pixel by 2. 3 It is the difference between the quotient obtained by dividing by [the specified number].
[0038] According to the three possible design configurations described above, the number of multiplication operations in the inverse quantization process can be further reduced based on a pre-set inverse quantization preset array. Since multiplication operations occupy a large amount of computational resources, reducing multiplication operations reduces the computational resources occupied by the inverse quantization process. In other words, the inverse quantization processing method implemented based on the quantization preset array provided in this application can significantly save computational resources on the decoding side. Furthermore, because the calculation speed of multiplication operations is slow, the inverse quantization processing process in this image decoding method is significantly more efficient than that of conventional technology. Therefore, the decoding method provided by these possible design configurations can further improve the image decoding efficiency.
[0039] In another possible design configuration, reconstructing the decryption target block based on the second residual block and obtaining a reconstructed block includes inversely transforming the second residual block to reconstruct the residual value block of the decryption target block, and reconstructing the decryption target block based on the residual value block and obtaining a reconstructed block.
[0040] In another possible design configuration, reconstructing the decoded block based on the second residual block includes predicting each pixel in the decoded block in a target prediction order corresponding to the target prediction mode, and reconstructing the decoded block based on the predicted values of each pixel and the second residual block to obtain a reconstructed block.
[0041] As can be seen above, predicting the blocks to be decoded based on the target prediction mode provided by this application can improve prediction efficiency, and therefore, the image decoding efficiency can be further improved by this possible design configuration.
[0042] In another possible design configuration, analyzing the code stream of the block to be decoded includes analyzing the code stream of the block to be decoded using a variable code length decoding scheme to obtain an encoded code length CL and a first residual block for encoding each value in the residual block corresponding to the block to be decoded.
[0043] With this possible design, the residual block and CL of the block to be decoded are encoded with fewer bits on the encoding side, thus reducing the number of bits to be decoded on the corresponding decoding side and improving decoding efficiency. Therefore, the decoding method provided by this possible design can further improve the decoding efficiency of images.
[0044] In a fourth aspect, the present invention provides an image coding method comprising: determining a second residual block of a block to be coded and a quantization parameter QP for each pixel in the block to be coded; quantizing the second residual block based on the QP of each pixel and a quantization preset array to obtain a first residual block; and coding the first residual block to obtain a code stream of the block to be coded.
[0045] The image encoding method provided in this application reduces the number of multiplication operations in the quantization process, specifically in the quantization preset array provided in this application. Because multiplication operations occupy a large amount of computational resources, reducing them reduces the computational resources occupied in the quantization process, thereby significantly saving computational resources on the encoding side. Furthermore, since multiplication operations are time-consuming, the computational efficiency of the quantization process can be improved, and this image encoding method further significantly improves the image encoding efficiency.
[0046] In another possible design configuration, encoding the first residual block and obtaining a code stream of the block to be encoded includes determining the target prediction mode of the block to be encoded, determining the residual scan order corresponding to the target prediction mode, and encoding the residual block in the residual scan order to obtain a code stream of the block to be encoded. Here, if the target prediction mode is the first target prediction mode, the residual scan order is the first scan order; if the target prediction mode is the second target prediction mode, the residual scan order is the second scan order, and the first scan order and the second scan order are different.
[0047] In another possible design configuration, for a block to be encoded of a first size, the block is encoded using the third scan order in the target prediction mode described above. For a block to be encoded of a second size, the block is encoded using the fourth scan order in the target prediction mode described above. Here, the third scan order and the fourth scan order are different.
[0048] In another possible design configuration, the above quantization preset array includes an amplification parameter array and a displacement parameter array, the amplification parameter array and the displacement parameter array contain the same number of numerical values, and for the i-th value of the amplification parameter array amp[i] and the i-th value of the displacement parameter array shift[i], 2 shift[i] The inverse quantization preset array consisting of the quotient of and amp[i] has the following characteristics: for the 1st to nth digits, the interval between two adjacent digits is 1; for the n+1 to n+m digits, the interval between two adjacent digits is 2; and for the n+k*m+1 to n+k*m+m digits, the numerical interval between two adjacent digits is 2. k+1 The equation is such that n and m are integers greater than 1, and i and k are both positive integers.
[0049] In another possible design configuration, obtaining a first residual block by quantizing a second residual block based on the QP of each pixel and a quantization preset array includes determining the amplification parameter of each pixel in an amplification parameter array and the displacement parameter of each pixel in a displacement parameter array based on the QP of each pixel, and then quantizing the second residual block based on the amplification parameter and displacement parameter of each pixel to obtain a first residual block.
[0050] In another possible design configuration, obtaining a first residual block by quantizing a second residual block based on the QP of each pixel and the quantization preset array includes determining the amplification parameter and displacement parameter corresponding to each pixel based on the QP of each pixel and the quantization preset array, and performing a quantization operation on the second residual block based on the amplification parameter and displacement parameter corresponding to each pixel to obtain the second residual block. Here, the value of the amplification parameter corresponding to each pixel is the value corresponding in the inverse quantization preset array to the logical AND of the QP of each pixel and 7, and the value of the displacement parameter corresponding to each pixel is the value obtained by multiplying 7 and the QP of each pixel by 2. 3 It is the sum of the quotient obtained by dividing by [the specified value].
[0051] In another possible design configuration, the second residual block is the original residual value block of the block to be encoded, or the second residual block is a residual coefficient block obtained by transforming the residual value block.
[0052] In another possible design configuration, determining the second residual block of the above-mentioned block to be coded includes predicting each pixel in the block to be coded in a target prediction order according to a target prediction mode, and determining the second residual block based on the predicted values of each pixel in the block to be coded.
[0053] In another possible design configuration, encoding the first residual block to obtain a code stream of the block to be encoded includes encoding the first residual block using a variable code length encoding scheme to obtain a code stream of the block to be encoded.
[0054] Since the image encoding method provided by the fourth aspect and any possible design configuration corresponds to the image decoding method provided by the third aspect and any possible design configuration, it is understood that the beneficial effects of the technical means provided by the fourth aspect and any possible design configuration refer to the explanation of the beneficial effects of the corresponding method in the third aspect, but redundant explanations are omitted here.
[0055] In a fifth aspect, the present invention provides an image coding method, which includes determining a residual block corresponding to a block to be coded, and coding the residual block using a variable-length coding scheme to obtain a code stream of the block to be coded.
[0056] According to the encoding method provided in this application, when the encoding side encodes the residual block of the target block using a variable code length encoding scheme such as an exponential Columbus coding algorithm with convertible order, it can adaptively encode a smaller residual value with fewer bits. This saves bits, further increases the compression ratio of the image encoding, and also improves the encoding efficiency with the encoding method provided in this application.
[0057] In one possible design configuration, the variable code length coding scheme includes an exponential Columbus coding scheme that can be converted to a different order, and encoding a residual block using the variable code length coding scheme to obtain a code stream of the block to be coded includes determining the attribute type of each pixel in the block to be coded, determining the target order for coding a first value corresponding to a third pixel of the block to be coded in the residual block, based on a preset policy and the attribute type of the third pixel, and coding the first value using an exponential Columbus coding algorithm of the target order to obtain a code stream.
[0058] In another possible design, the variable code length coding scheme includes a preset-order exponential Columbus coding scheme, and encoding a residual block using the variable code length coding scheme to obtain a code stream of the block to be coded includes encoding a first value corresponding to a third pixel of the block to be coded in the residual block using a preset-order exponential Columbus coding algorithm to obtain a code stream.
[0059] The two possible design configurations achieve variable-length coding of residual values within residual blocks by exponential Columbus coding schemes of either convertible or preset order. These coding schemes can adaptively encode smaller residual values with fewer bits, thereby saving bits.
[0060] In another possible design form, the method includes determining a syntactic element corresponding to a residual block, wherein the syntactic element includes an encoded code length CL for encoding each value in the residual block, and encoding the CL of each value using a variable code length encoding scheme to obtain a code stream.
[0061] In another possible design, the variable code length coding scheme includes an exponential Columbus coding scheme that can be converted to a different order, and obtaining a code stream by coding the CL of any value in a residual block using the variable code length coding scheme includes determining the target order when coding the CL of any value, and obtaining a code stream by coding the CL of any value using the target order exponential Columbus coding algorithm.
[0062] The two possible design configurations achieved variable-length coding of CL within residual blocks by an exponential Columbus coding scheme with convertible or preset order. This coding scheme can adaptively encode smaller CL with fewer bits, thereby saving bits.
[0063] In another possible design configuration, obtaining a code stream by encoding the CL of any value within a residual block using the above variable-length coding scheme includes, if the CL of any value is less than or equal to a threshold, encoding the CL of any value using a predetermined number of bits, and if the CL of any value is greater than a threshold, encoding the CL of any value using truncated unary coding to obtain a code stream.
[0064] The possible design configuration achieves variable-length coding of the residual value CL within the residual block by fixed-length coding and truncated unary coding. This coding scheme can adaptively encode smaller CLs with fewer bits, thereby saving bits.
[0065] In another possible design configuration, the residual block is the original residual value block of the block to be encoded, or the residual block is a residual coefficient block obtained by transforming the original residual value block, or the residual block is a quantized coefficient block obtained by quantizing the residual coefficient block.
[0066] In another possible design configuration, if the residual block is the original residual value block of the block to be coded, determining the residual block corresponding to the block to be coded includes determining the target prediction mode of the block to be coded, determining the residual scan order corresponding to the target prediction mode, predicting each pixel in the block to be coded in the target prediction order according to the target prediction mode, and determining the residual block based on the predicted value of each pixel in the block to be coded.
[0067] With this possible design configuration, predicting the blocks to be encoded based on the target prediction mode provided by the present application can improve prediction efficiency, and therefore, this possible design configuration can further improve the image encoding efficiency.
[0068] In another possible design configuration, if the residual block is a quantized coefficient block obtained by quantizing the residual coefficient block, the method further includes determining the quantization parameter QP of each pixel in the block to be encoded, and quantizing the residual value block to be encoded based on the QP of each pixel and the quantization preset array to obtain the residual block.
[0069] This possible design configuration enables quantization of residual value blocks to be encoded with fewer multiplication operations, and efficiently achieves quantization of residual value blocks to be encoded. Therefore, the encoding method provided by this possible design configuration can further improve the encoding efficiency of images.
[0070] In a sixth aspect, the present invention provides an image decoding method which includes analyzing a code stream of a block to be decoded using a variable code length decoding scheme to obtain an encoded code length CL for encoding each value in a residual block corresponding to the block to be decoded, determining a residual block based on the CL for encoding each value, and reconstructing the block to be decoded based on the residual block to obtain a reconstructed block.
[0071] In another possible design, the variable code length decoding scheme includes an exponential Columbus decoding scheme of order convertible or preset order, and analyzing the code stream of the block to be decoded using the variable code length decoding scheme to obtain an encoded code length CL for encoding each value in the residual block corresponding to the block to be decoded includes determining the target order when analyzing the CL for encoding each value in the residual block, and analyzing the code stream using the target order exponential Columbus decoding algorithm to obtain an CL for encoding each value in the residual block.
[0072] In another possible design configuration, analyzing the code stream of the block to be decoded using the above variable code length decoding scheme and obtaining the coded code length CL for encoding each value in the residual block corresponding to the block to be decoded includes, if the number of bits in the CL for encoding any of the values in the residual block is a predetermined number, analyzing the code stream based on a fixed-length decoding policy to obtain the CL for encoding any of the values, and if the number of bits in the CL for encoding any of the values in the residual block is greater than a predetermined number, analyzing the code stream based on a truncated unary coding rule to obtain the CL for encoding any of the values.
[0073] In another possible design configuration, determining a residual block based on a CL for encoding each of the above values includes determining a set of bits corresponding to each pixel in the decoded block in the code stream based on the CL for encoding each value; determining the attribute type of each pixel in the decoded block; determining the target order for analyzing the first set of bits corresponding to a third pixel in the decoded block, based on a preset policy and the attribute type of the third pixel; and analyzing the first set of bits using an exponential Columbus decoding algorithm of the target order to obtain a residual block.
[0074] In another possible design configuration, determining the residual block based on the CL for encoding each of the above values includes determining the set of bits corresponding to each pixel in the decoded block in the code stream based on the CL for encoding each value, and obtaining the residual block by analyzing the first set of bits corresponding to the third pixel in the decoded block using a preset-order exponential Columbus decoding algorithm.
[0075] In another possible design configuration, reconstructing the decoded block based on the residual block and obtaining a reconstructed block includes reconstructing the residual value block of the decoded block by performing inverse quantization and inverse transformation on the residual block, or by inverse quantization of the residual block, and reconstructing the decoded block based on the residual value block and obtaining a reconstructed block.
[0076] In another possible design configuration, reconstructing the decoded block based on the residual block and obtaining a reconstructed block includes: determining a target prediction mode for predicting pixels within the decoded block based on the code stream of the decoded block; determining a target prediction order corresponding to the target prediction mode based on the target prediction mode; predicting each pixel within the decoded block in the target prediction order according to the target prediction mode; and reconstructing the decoded block based on the predicted values of each pixel within the decoded block and the residual block to obtain a reconstructed block.
[0077] In another possible design configuration, dequantizing the residual block involves dequantizing the residual block based on the dequantization parameters and dequantization preset array of each pixel in the decoded block obtained by analyzing the code stream of the decoded block.
[0078] Since the image decoding method provided by the sixth aspect and any possible design configuration corresponds to the image encoding method provided by the fifth aspect and any possible design configuration, it is understood that the beneficial effects of the technical means provided by the sixth aspect and any possible design configuration refer to the explanation of the beneficial effects of the corresponding method in the fifth aspect, but redundant explanations are omitted here.
[0079] In a seventh aspect, the present invention provides an image decoding device. The decoding device may be a video decoder or a device equipped with a video decoder. The decoding device comprises modules for implementing the methods in any feasible mode of the first, third, or sixth aspect. The decoding device has functions for implementing the operations in the examples of the related methods described above. These functions may be implemented by hardware, or by having the hardware run corresponding software. The hardware or software includes one or more modules corresponding to these functions. Their beneficial effects should be described in the corresponding methods, and redundant explanations are omitted here.
[0080] In an eighth aspect, the present invention provides an image encoding device, which may be a video encoder or a device equipped with a video encoder. The encoding device comprises modules for implementing the methods in any feasible mode of the second, fourth, or fifth aspect. The encoding device has functions for implementing the operations in the examples of the related methods described above. These functions may be implemented by hardware, or by having the hardware run corresponding software. The hardware or software includes one or more modules corresponding to these functions. Their beneficial effects should be described in the corresponding methods, and redundant explanations are omitted here.
[0081] In a ninth aspect, the present invention provides an electronic device comprising a processor and a memory, the memory being used to store computer instructions, and the processor being used to call and execute the computer instructions from the memory to implement a method in any feasible aspect of the first to sixth aspects. For example, the electronic device may be a video encoder, or a device equipped with a video encoder. For example, the electronic device may be a video decoder, or it may be a device equipped with a video decoder.
[0082] In a tenth aspect, the present invention provides a computer-readable storage medium in which a computer program or instruction is stored, and when the computer program or instruction is executed by a processor, a method in any feasible aspect of the first to sixth aspects is realized.
[0083] In an eleventh aspect, the present invention provides a computer program product which includes instructions, and when the computer program product is executed on a computing device or processor, it causes the computing device or processor to execute the instructions, thereby realizing a method in any feasible aspect of the first through sixth aspects.
[0084] In a twelfth aspect, the present invention provides a chip comprising memory and a processor, wherein the memory is used to store computer instructions, and the processor is used to call and execute computer instructions from the memory to implement a method in any feasible aspect of the first to sixth aspects.
[0085] In a thirteenth aspect, the present invention provides an image coding and decoding system comprising an encoding side and a decoding side, wherein the decoding side is used to implement a corresponding decoding method provided in the first, second, or sixth aspect, and the encoding side is used to implement a corresponding encoding method.
[0086] The present invention may be further combined to provide more embodiments in addition to those provided by each of the above embodiments. Alternatively, any possible implementation of any of the above embodiments may be applied to other embodiments, insofar as they do not conflict, to obtain new embodiments. For example, any of the image decoding methods provided by the first, third, and sixth embodiments may be combined in any way that does not conflict with two embodiments, or in any way that combines three embodiments, to obtain new image decoding methods. [Brief explanation of the drawing]
[0087] The drawings described herein constitute part of the Application, so as to allow for a further understanding of the Application. The exemplary embodiments and descriptions thereof are for interpretive purposes only and do not constitute an unreasonable limitation of the Application.
[0088] [Figure 1]Figure 1 is a schematic diagram of the architecture of an encoding / decoding system 10 applied to an embodiment of the present invention. [Figure 2] Figure 2 is a schematic block diagram of an example of an encoder 112 for realizing the method of the embodiment of the present invention. [Figure 3] Figure 3 is a schematic diagram showing the correspondence between the image provided by the embodiment of the present invention and the parallel encoding means, independent encoding means, and encoding means. [Figure 4] Figure 4 is a schematic flowchart of the encoding process provided by the embodiment of the present invention. [Figure 5] Figure 5 is a schematic block diagram of an example of a decoder 122 for realizing the method of the embodiment of the present invention. [Figure 6a] Figure 6a is a schematic flowchart of the image coding method provided by the embodiment of the present invention. [Figure 6b] Figure 6b is a schematic flowchart of the image decoding method provided by the embodiment of the present invention. [Figure 6c] Figure 6c is a schematic flowchart of another image coding method provided by an embodiment of the present invention. [Figure 7a] Figure 7a is a schematic diagram of the predicted sequence provided by the embodiment of the present application. [Figure 7b] Figure 7b is a schematic diagram of another predicted sequence provided by an embodiment of the present application. [Figure 7c-1] Figure 7c-1 is a schematic diagram of yet another predicted sequence provided by an embodiment of the present application. [Figure 7c-2] Figure 7c-2 is a schematic diagram of yet another predicted sequence provided by an embodiment of the present application. [Figure 7d-1] Figure 7d-1 is a schematic diagram of yet another predicted sequence provided by an embodiment of the present application. [Figure 7d-2] Figure 7d-2 is a schematic diagram of yet another predicted sequence provided by an embodiment of the present application. [Figure 7d-3] Figure 7d-3 is a schematic diagram of yet another predicted sequence provided by an embodiment of the present application. [Figure 7e] Figure 7e is a schematic diagram of yet another predicted sequence provided by an embodiment of the present application. [Figure 7f] Figure 7f is a schematic diagram of yet another predicted sequence provided by an embodiment of the present application. [Figure 7g] Figure 7g is a schematic diagram of yet another sequence provided by the embodiments of the present application. [Figure 8] Figure 8 is a schematic flowchart of another image decoding method provided by an embodiment of the present invention. [Figure 9a] Figure 9a is a schematic flowchart of yet another image coding method provided by an embodiment of the present invention. [Figure 9b] Figure 9b is a schematic flowchart of yet another image decoding method provided by an embodiment of the present invention. [Figure 10a] Figure 10a is a schematic flowchart of yet another image coding method provided by an embodiment of the present invention. [Figure 10b] Figure 10b is a schematic flowchart of yet another image decoding method provided by an embodiment of the present invention. [Figure 11] Figure 11 is a schematic diagram of the structure of the decoding device 1100 provided by an embodiment of the present invention. [Figure 12] Figure 12 is a schematic diagram of the structure of the encoding device 1200 provided by an embodiment of the present invention. [Figure 13] Figure 13 is a schematic diagram of the structure of the decoding device 1300 provided by an embodiment of the present invention. [Figure 14] Figure 14 is a schematic diagram of the structure of the encoding device 1400 provided by an embodiment of the present invention. [Figure 15] Figure 15 is a schematic diagram of the structure of the encoding device 1500 provided by an embodiment of the present invention. [Figure 16] Figure 16 is a schematic diagram of the structure of the decoding device 1600 provided by an embodiment of the present application. [Figure 17] Figure 17 is a schematic diagram of the structure of an electronic device provided by an embodiment of the present application. [Modes for carrying out the invention]
[0089] To further clarify the understanding of the embodiments of this application, some terms or technologies relating to the embodiments of this application will be explained below.
[0090] 1) Prediction mode The combination of prediction schemes used to predict the predicted value of each pixel in the current image block (for example, the image block to be encoded (hereinafter simply referred to as the image block to be encoded) or the image block to be decoded (hereinafter simply referred to as the image block to be decoded)) is called the prediction mode. Here, different prediction schemes may be used to predict different pixels in the current image block, or the same prediction scheme may be used, and the prediction schemes used to predict all pixels in the current image block may together be called the prediction mode of the current image block (or the corresponding prediction mode).
[0091] Preferably, the prediction mode includes a dot-by-dot prediction mode, an intra-prediction mode, a block copy mode, and an original value mode (i.e., a mode that decodes the reconstructed value with a fixed bit width as is).
[0092] For example, a dot-by-dot prediction mode refers to a prediction mode where the reconstructed values of neighboring pixels surrounding the target pixel are used as the predicted value for that pixel. A dot-by-dot prediction mode includes one or more combinations of prediction methods such as vertical prediction, horizontal prediction, vertical average prediction, and horizontal average prediction.
[0093] Here, vertical prediction involves obtaining the predicted value (PointPredData) of the target pixel using the reconstructed value of a pixel above the target pixel (which may be an adjacent upper pixel or a non-adjacent but close upper pixel). In the embodiments of this application, the prediction method using vertical prediction is called the T-prediction method. As an example, the reconstructed value of an upper adjacent pixel of the target pixel is used as the predicted value of the target pixel.
[0094] Horizontal prediction obtains the predicted value of the target pixel using the reconstructed value of a pixel to the left of the target pixel (which may be an adjacent pixel to the left, or a non-adjacent but close pixel to the left). In the embodiments of this application, the prediction method using horizontal prediction is called the L prediction method. As an example, the reconstructed value of the left adjacent pixel of the target pixel is used as the predicted value of the target pixel.
[0095] Vertical mean prediction obtains the predicted value of a target pixel using the reconstructed values of the pixels above and below the target pixel. In the embodiments of this application, the prediction method using vertical mean prediction is called the TB prediction method. As an example, the predicted value of the target pixel is the average of the reconstructed values of the vertically upper adjacent pixel and the vertically lower adjacent pixel.
[0096] Horizontal mean prediction obtains the predicted value of a target pixel using the reconstructed values of the pixels to its left and right. In the embodiments of this application, the prediction method using horizontal mean prediction is called the RL prediction method. As an example, the predicted value of a target pixel is the average of the reconstructed values of the horizontally adjacent pixel to the left and the horizontally adjacent pixel to the right.
[0097] For example, the intra-prediction mode is a prediction mode in which the reconstructed pixel values in the adjacent blocks surrounding the block to be predicted are used as the predicted values.
[0098] For example, block copy mode is a prediction mode in which the reconstructed values of (decoded) blocks (not necessarily adjacent) pixels are used as the predicted values.
[0099] For example, the original value mode is a mode that decodes the reconstructed value with a fixed bit width directly, i.e., a no-reference prediction mode.
[0100] 2) Residual coding mode The method for encoding the residuals of the current image block (e.g., the block to be encoded or decoded) (i.e., the residual block, which is a block consisting of the residual values of each pixel in the current image block) is called the residual coding mode. The residual coding mode may include residual skip coding modes and normal residual coding modes.
[0101] In residual skip encoding mode, there is no need to encode (decode) the residual coefficients. In this case, the residual values of pixels in the current image block are all 0, and the reconstructed value of each pixel is equal to the predicted value of that pixel.
[0102] Normally, residual coefficients need to be encoded (decoded) in residual encoding mode. In this case, the residual values of pixels in the current image block are not all zero, and the reconstructed value of each pixel can be obtained based on the predicted value and residual value of that pixel.
[0103] In one example, the residual coefficient of a pixel may be equivalent to the residual value of that pixel. In another example, the residual coefficient of a pixel may be obtained by processing the residual value of that pixel.
[0104] 3) Quantization and dequantization In the process of image encoding, to compress an image, the residual block of the block to be encoded is usually quantized, or the residual coefficient block obtained by processing this residual block is quantized, so that the quantized residual block or residual coefficient block can be encoded with fewer bits. The residual block is understood to be a residual value block obtained based on the original pixel block and prediction block of the block to be encoded, and the residual coefficient block is a coefficient block obtained by transforming the residual block.
[0105] As an example, if the encoding device quantizes the residual block, the encoding device can reduce the residual values within the residual block by dividing each residual value in the residual block of the block to be encoded by a quantization coefficient. In this way, the quantized and reduced residual values can be encoded with fewer bits than the unquantized residual values, thereby enabling compressed encoding of images.
[0106] To reconstruct image blocks from a reasonably compressed coded code stream, the decoder can dequantize the residual blocks or residual coefficient blocks analyzed from the code stream, thereby reconstructing the unquantized residual blocks or residual coefficient blocks corresponding to the image blocks. The decoder then reconstructs the image blocks based on the reconstructed residual blocks or residual coefficient blocks to obtain the reconstructed image blocks.
[0107] For example, if the decoding device analyzes the quantized residual block of the block to be decoded from the code stream, the encoding device can dequantize this residual block. Specifically, the encoding device multiplies each residual value in the analyzed residual block by a quantization coefficient to reconstruct the residual value of the unquantized residual block corresponding to the block to be decoded, and obtains the reconstructed residual block. However, the quantization coefficient is the quantization coefficient used when the encoding device quantizes the residual block of the block to be decoded when encoding the block to be decoded. In this way, the decoding device can reconstruct the block to be decoded based on the residual block reconstructed after dequantization, and obtain the reconstructed block of the block to be decoded.
[0108] 4) Other terms In the embodiments of this application, the term “at least one (kind)” includes one (kind) or more (kinds). “More (kinds)” means two (kinds) or two or more (kinds). For example, at least one of A, B, and C includes A existing alone, B existing alone, A and B existing together, A and C existing together, B and C existing together, and A, B, and C existing together. In the description of this application, unless otherwise specified, “ / ” means “or,” for example A / B means A or B. The term “and / or” in this application is solely for the purpose of describing the relationship between the associated objects, indicating that three kinds of relationships can exist, for example A and / or B can indicate three situations: A existing alone, A and B existing together, and B existing alone. “More” means two or more. Furthermore, in order to clearly explain the technical means relating to the embodiments of this application, the embodiments of this application use words such as "first," "second," etc. to distinguish identical or similar items that have substantially the same function and operation. Those skilled in the art will understand that words such as "first," "second," etc. do not limit the quantity or order of execution, and that words such as "first," "second," etc. do not necessarily limit that they are "different."
[0109] The system architecture applicable to the embodiments of this application will be described below.
[0110] Referring to Figure 1, Figure 1 shows a schematic architecture of an encoding / decoding system 10 applied to an embodiment of the present invention. As shown in Figure 1, the encoding / decoding system 10 may comprise a source device 11 and a target device 12. Here, the source device 11 is used to encode an image, and therefore can be called an image encoder or video encoder. The target device 12 is used to decode the encoded image data generated by the source device 11, and therefore can be called an image decoder or video decoder.
[0111] The specific forms of the source device 11 and target device 12 may be various devices and are not limited to the embodiments of this application. For example, the source device 11 and target device 12 may be a desktop computer, a mobile computing device, a notebook (e.g., laptop) PC, a tablet computer, a set-top box, a mobile phone such as a so-called "smartphone", a television, a camera, a display device, a digital media player, a video game console, an in-car computer, or other similar devices.
[0112] Preferably, the source device 11 and target device 12 in Figure 1 may be two separate devices. Alternatively, the source device 11 and target device 12 may be the same device, that is, the source device 11 or its corresponding function and the target device 12 or its corresponding function may be integrated into the same device.
[0113] Communication is possible between the source device 11 and the target device 12. For example, the target device 12 can receive encoded image data from the source device 11. As an example, one or more communication media for transmitting encoded image data may be included between the source device 11 and the target device 12. The one or more communication media may include, and are not limited to, a router, a switch, a base station, or other device that facilitates communication between the source device 11 and the target device 12.
[0114] As shown in Figure 1, the source device 11 includes an encoder 112. Preferably, the source device 11 may also include an image preprocessor 111 and a communication interface 113. Here, the image preprocessor 111 is used to perform preprocessing on the received image to be encoded, and the preprocessing performed by the image preprocessor 111 may include, for example, cropping, color format conversion (e.g., conversion from RGB format to YUV format), color correction, or noise reduction. The encoder 112 is used to receive the image preprocessed by the image preprocessor 111, process the preprocessed image using the relevant prediction mode, and provide encoded image data. In some embodiments, the encoder 112 is used to perform the encoding process in the various embodiments described below. The communication interface 113 may be used to transmit the encoded image data to the target device 12 or other device (e.g., memory) for storage or direct reconstruction, and the other device may be either a device for decoding or storage. The communication interface 113 can encapsulate the encoded image data in an appropriate format before transmission.
[0115] Preferably, the image preprocessor 111, encoder 112, and communication interface 113 may be hardware components within the source device 11 or software programs within the source device 11, and are not limited to the embodiments of this application.
[0116] The target device 12 includes a decoder 122. Preferably, the target device 12 may also include a communication interface 121 and an image post-processor 123. Here, the communication interface 121 is used to receive encoded image data from source device 11 or other source devices, the other source devices being, for example, storage devices. The communication interface 121 may also decapsulate data transmitted by communication interface 113 to obtain encoded image data. The decoder 122 is used to receive the encoded image data and output decoded image data (also called reconstructed image data or reconstructed image data). In some embodiments, the decoder 122 is used to perform the decoding process in the various embodiments described below. The image post-processor 123 is used to perform post-processing on the decoded image data to obtain post-processed image data. The post-processing performed by the image post-processor 123 may include color format conversion (e.g., conversion from YUV format to RGB format), color correction, finishing or resampling, or any other processing, and the image post-processor 123 is used to transfer the post-processed image data to a display device for display.
[0117] Preferably, the communication interface 121, decoder 122, and image post-processor 123 may be hardware components within the target device 12, or software programs within the target device 12, and are not limited to the embodiments of this application.
[0118] Next, we will briefly explain the configuration of the encoder 112 and decoder 122 shown in Figure 1.
[0119] Referring to Figure 2, Figure 2 shows a schematic block diagram of an example encoder 112 for realizing the method of the embodiment of the present invention. As shown in Figure 2, the encoder 112 comprises a prediction processing means 201, a residual calculation means 202, a residual conversion means 203, a quantization means 204, an encoding means 205, an inverse quantization means (also called an anti-quantization means) 206, an inverse residual conversion means 207, a reconstruction means (or reconstruction means) 208, and a filter means 209. Preferably, the encoder 112 may also comprise a buffer and a decoded image buffer. Here, the buffer is used to buffer the reconstructed block (or what will become a reconstructed block) output from the reconstruction means 208, and the decoded image buffer is used to buffer the filtered image block output from the filter means 209.
[0120] In one example, the input to encoder 112 is an image block of the image to be encoded (i.e., the block to be encoded or the encoding means). In another example, the input to encoder 112 is the image to be encoded, and encoder 112 may include a division means (not shown in Figure 2) for dividing the image to be encoded into multiple image blocks. Encoder 112 is used to encode each block to complete the encoding of the image to be encoded. For example, encoder 112 performs the encoding process for each image block to complete the encoding of the image to be encoded.
[0121] One example of a method for dividing an image to be encoded into multiple image blocks includes the following steps:
[0122] Step 1: Divide a single frame image into one or more parallel encoding means that do not overlap with each other, and that there are no dependencies between the parallel encoding means, and that they can be encoded and decoded in parallel / independently.
[0123] Step 2: For each parallel coding means, the coding side can be divided into one or more independent coding means that do not overlap with each other, and the independent coding means do not have to be dependent on each other, but they can share some of the header information of these parallel coding means.
[0124] Step 3: The encoding side can divide each independent encoding means into one or more non-overlapping encoding means. Here, when an independent encoding means is divided into multiple non-overlapping encoding means, the division method can be horizontal division, vertical division, or horizontal-vertical division. Of course, this is not the only way to implement it in practice. Each encoding means within an independent encoding means can be interdependent, that is, they can refer to each other during the process of performing the prediction step.
[0125] The width of the encoding means is w_cu, and its height is h_cu, preferably the width is greater than the height (unless it is an edge region). Generally, the encoding means is a fixed w_cu × h_cu, where both w_cu and h_cu may be 2 to the power of N (where N is greater than or equal to 0), such as 16 × 4, 8 × 4, 16 × 2, 8 × 2, 8 × 2, 4 × 2, 8 × 1, 4 × 1, etc.
[0126] The encoding means may include three components: luminance Y, chromaticity Cb, and chromaticity Cr (or three components: red R, green G, and blue B), or it may include only one of these components. If it includes three components, the sizes of some of the components may be exactly the same or different, depending on the image input format.
[0127] As shown in Figure 3, Figure 3 is a schematic diagram of the correspondence between an image, parallel encoding means, independent encoding means, and encoding means. For example, in Figure 3, parallel encoding means 1 and parallel encoding means 2 divide one image according to an image area ratio of 3:1, where parallel encoding means 1 comprises one independent encoding means divided into four encoding means.
[0128] The prediction processing means 201 receives or acquires the true value of the block to be encoded and the data of the reconstructed image, predicts the block to be encoded based on the correlation data in the data of the reconstructed image, and obtains the predicted block of the block to be encoded.
[0129] The residual calculation means 202 calculates the residual value between the true value of the block to be encoded and the predicted block of the block to be encoded, and obtains a residual block. For example, the residual block is obtained by subtracting the pixel value of the predicted block from the true pixel value of the block to be encoded using pixel-by-pixel.
[0130] In one example, the residual transformation means 203 is used to determine residual coefficients based on the residual block. Preferably, this process includes performing a transformation on the residual block, such as a discrete cosine transform (DCT) or a discrete sine transform (DST), in order to obtain transformation coefficients in the transformation domain, and the transformation coefficients may also be called transformation residual coefficients or residual coefficients, and these residual coefficients can represent the residual block in the transformation domain. Of course, the encoder 112 does not have to include a residual transformation step in the process of encoding the block to be encoded.
[0131] The quantization means 204 applies scalar quantization or vector quantization to quantize the transformation coefficients or residual values and obtains quantized residual coefficients (or quantized residual values). The quantization process can reduce the bit depth associated with partial or all residual coefficients. For example, p-bit transformation coefficients may be truncated to q-bit transformation coefficients during quantization, where p is greater than q. The degree of quantization can be modified by adjusting the quantization parameter (QP). For example, for scalar quantization, finer or coarser quantization can be achieved by applying different scales. Smaller quantization step sizes correspond to finer quantization, and larger quantization step sizes correspond to coarser quantization. An appropriate quantization step size can be indicated by QP.
[0132] The encoding means 205 can encode the 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) as an encoded bitstream (or code stream), and transfer the encoded bitstream to the decoder, or it can be stored and then transferred to the decoder or used for retrieval. The encoding means 205 can also be used to encode syntactic elements of the block to be encoded, for example, by encoding the prediction mode used in the block to be encoded into the code stream.
[0133] In one example, the encoding means 205 encodes the residual coefficients using a semi-fixed-length encoding method as a feasible method. First, the maximum value of the absolute residual value within a residual block (RB) is defined as the modified maximum (mm). The number of encoding bits for the residual coefficients within this RB (the number of encoding bits for residual coefficients within the same RB must be the same), i.e., the encoded code length CL, is determined from the above mm. For example, if the CL of the current RB is 2 and the current residual coefficient is 1, then the encoded residual coefficient of 1 requires 2 bits, as shown in 01. In one particular case, if the CL of the current RB is 7, it means that an 8-bit residual coefficient and a 1-bit sign bit are encoded. Here, the method for determining CL is to find the smallest M value that satisfies the condition that all residuals within the current RB are in the range [-2^(M-1), 2^(M-1)], and the found M is taken as the CL of the current RB. If the current RB contains both boundary values 2^(M-1) and 2^(M-1), then M must be increased by 1, meaning that all residuals of the current RB must be encoded with M+1 bits. If the current RB contains only one of the two boundary values 2^(M-1) and 2^(M-1), then the trailing bit (least significant bit) must be encoded to determine whether it is 2^(M-1) or 2^(M-1). If none of the residuals in the current RB are 2^(M-1) or 2^(M-1), then the trailing bit does not need to be encoded.
[0134] Of course, other residual coefficient coding methods can also be used, such as exponential Golomb coding, Golomb-Rice coding (a variant of the Columbus coding algorithm), truncated unary coding, run-length coding, and direct coding of the original residual values.
[0135] Furthermore, in certain cases, the encoding means 205 can encode the original value directly, rather than the residual value.
[0136] The inverse quantization means 206 is used to inverse quantize the quantized residual coefficient (or quantized residual value) to obtain the inverse quantized residual coefficient (inverse quantized residual value). This inverse quantization is an inverse application of the quantization means 204, and involves applying an inverse quantization method of the quantization method applied by the quantization means 204, for example, based on or using the same quantization step length as the quantization means 204.
[0137] The residual inverse transform means 207 is used to inversely transform (or reverse transform) the inverse quantization residual coefficients to obtain a reconstructed residual block. Preferably, the inverse transform may include an inverse discrete cosine transform (DCT) or an inverse discrete sine transform (DST). In this way, the inverse transformed value obtained by inversely transforming (or reverse transforming) the inverse quantization residual coefficients is a reconstructed residual value in the pixel region (or sample region). That is, the block obtained by inversely transforming the inverse quantized residual coefficient block by the residual inverse transform means 207 is a reconstructed residual block. Of course, if the encoder 112 does not include the residual transform means 203, the encoder 112 does not have to include the inverse transform step.
[0138] The reconstruction means 208 is used to obtain a reconstructed block within the sample region by adding the reconstructed residual block to the prediction block, and the reconstruction means 208 may be an adder. For example, the reconstruction means 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 from the reconstruction means 208 may then be used to predict other image blocks to be encoded.
[0139] The filtering means 209 (or simply called the "filter") is used to filter the reconstructed blocks to obtain filtered blocks, thereby smoothing pixel transitions and improving image quality.
[0140] In one example, the encoding process is shown in Figure 4. Specifically, the encoder determines whether or not to use a dot-by-dot prediction mode. If the dot-by-dot prediction mode is used, the encoder predicts the pixels in the block to be encoded based on the dot-by-dot prediction mode, encodes the block, and then performs inverse quantization and reconstruction steps on the encoded result to realize the encoding process. If the dot-by-dot prediction mode is not used, the encoder determines whether or not to use the original value mode. If the original value mode is used, it encodes in the original value mode. If the original value mode is not used, the encoder decides to predict and encode using another prediction mode, such as intra-prediction mode or block copy mode. Subsequently, if it is determined that residual skipping should be performed, the reconstruction step is performed directly on the encoded result. If it is determined that residual skipping should not be performed, the inverse quantization step is performed on the encoded result to obtain the inversely quantized residual block, and it is determined whether or not to use block copy prediction mode. If it is determined that block copy prediction mode is to be used, in one case, if it is determined that a transformation skip is to be performed, the reconstruction step is directly executed on the inversely quantized residual block. In another case, if it is determined that a transformation skip is not to be performed, the encoding process is realized by performing the inverse transformation and reconstruction steps on the inversely quantized residual block. If it is determined that block copy mode is not being used (in this case, the prediction mode used is intra prediction mode), the encoding process is realized by performing the inverse transformation step and reconstruction step on the inversely quantized residual block.
[0141] Specifically, in the embodiments of the present application, the encoder 112 is used to implement the encoding method described in the embodiments described later.
[0142] For example, the encoding process implemented by encoder 112 may include the following steps:
[0143] Step 11: The prediction processing means 201 determines a prediction mode, predicts the block to be encoded based on the determined prediction mode and the reconstructed block of the encoded image block, and obtains a predicted block of the block to be encoded. Here, the reconstructed block of the encoded image block is obtained by sequentially processing the quantized residual coefficient block of the encoded image block using the inverse quantization means 206, the residual inverse transform means 207, and the reconstruction means 208.
[0144] Step 12: The residual calculation means 202 obtains the residual block of the block to be encoded based on the prediction block and the original pixel values of the block to be encoded.
[0145] Step 13: The residual conversion means 203 converts the residual block to obtain a residual coefficient block.
[0146] Step 14: The quantization means 204 quantizes the residual coefficient block to obtain the quantized residual coefficient block.
[0147] Step 15: The encoding means 205 encodes the quantized residual coefficient block, encodes the associated syntactic elements (e.g., prediction mode, encoding mode), and obtains a code stream of the block to be encoded. Referring to Figure 5, which shows a schematic block diagram of an example of a decoder 122 for implementing the method of an embodiment of the present invention. The decoder 122 receives, for example, image data encoded by the encoder 112 (i.e., an encoded bitstream, including, for example, an encoded bitstream of an image block and associated syntactic elements) and obtains a decoded image block.
[0148] As shown in Figure 5, the decoder 122 comprises a code stream analysis means 301, an inverse quantization means 302, an inverse residual transform means 303, a prediction processing means 304, a reconstruction means 305, and a filter means 306. In some examples, the decoder 122 can perform a decoding process that is substantially the reverse of the encoding process described by the encoder 112 in Figure 2. Preferably, the decoder 122 comprises a buffer and a filtered image buffer, where the buffer is used to buffer the reconstructed image blocks output by the reconstruction means 305, and the filtered image buffer is used to buffer the filtered image blocks output by the filter means 306.
[0149] The code stream analysis means 301 decodes the encoded bitstream to obtain quantized residual coefficients (or quantized residual values) and / or decoding parameters (for example, the decoding parameters include one or all of the inter-prediction parameters, intra-prediction parameters, filter parameters, and / or other syntactic elements performed on the encoding side). The code stream analysis means 301 is also used to transfer the decoding parameters to the prediction processing means 304 so that the prediction processing means 304 performs a prediction process based on the decoding parameters.
[0150] The function of the inverse quantization means 302 may be the same as that of the inverse quantization means 206 of the encoder 112, and is used to inverse quantize the quantized residual coefficients that have been decoded and output by the code stream analysis means 301.
[0151] The function of the residual inverse transform means 303 may be the same as that of the residual inverse transform means 207 of the encoder 112, and is used to inversely transform the inversely quantized residual coefficients (for example, inverse DCT, inverse integer transformation, or a conceptually similar inverse transformation process) to obtain the reconstructed residual value. The block obtained by the inverse transformation is the residual block of the decoded target block reconstructed in the pixel region.
[0152] The function of the reconstruction means 305 (e.g., an adder) may be the same as the function of the reconstruction means 208 of the encoder 112.
[0153] The prediction processing means 304 is used to receive or acquire encoded image data (e.g., the encoded bitstream of the current image block) and reconstructed image data, and the prediction processing means 304 can, for example, receive or acquire relevant parameters of the prediction mode and / or information about the selected prediction mode (i.e., the decoding parameters) from the code stream analysis means 301, and also predict the current image block based on the relevant data and decoding parameters in the reconstructed image data, thereby obtaining a predicted block of the current image block.
[0154] The reconstruction means 305 is used to obtain a reconstructed block of the image to be decoded within the sample region by adding the reconstructed residual block to the prediction block, for example, by adding the residual value in the reconstructed residual block to the predicted value in the prediction block.
[0155] The filtering means 306 is used to filter the reconstructed blocks and obtain filtered blocks. These filtered blocks are the decoded image blocks.
[0156] Specifically, in the embodiments of the present application, the decoder 122 is used to implement the decoding method described in the embodiments described later.
[0157] In the encoder 112 and decoder 122 according to the embodiment of the present application, the processing result of a certain step may be further processed and output to the next step. For example, after steps such as interpolation filtering, motion vector derivation, or filtering, operations such as clipping or shifting may be performed on the processing result of the corresponding step.
[0158] For example, the decoding process implemented by decoder 122 may include the following steps:
[0159] Step 21: The code stream analysis means 301 analyzes the prediction mode and the residual coding mode.
[0160] Step 22: The code stream analysis means 301 analyzes quantization-related values (e.g., near values (values indicating the quantization step size), or QP values, etc.) based on the prediction mode and the residual coding mode.
[0161] Step 23: The inverse quantization means 302 analyzes the residual coefficients based on the prediction mode and the quantization-related values.
[0162] Step 24: The prediction processing means 304 obtains the predicted value of each pixel in the current image block based on the prediction mode.
[0163] Step 25: The residual inverse transform means 303 inverse transforms the residual coefficients to reconstruct the residual value of each pixel in the current image block.
[0164] Step 26: The reconstruction means 305 obtains the reconstructed value based on the predicted value and residual value of each pixel of the current encoding means.
[0165] The following embodiment of the present invention will be described below with reference to the drawings, illustrating the image coding and decoding method.
[0166] In any embodiment of this application, the encoding side may be the encoder 112 shown in Figure 1 or Figure 2, or the source device 11 shown in Figure 1. In any embodiment of this application, the decoding side may be the decoder 122 shown in Figure 1 or Figure 5, or the target device 12 shown in Figure 1, and the embodiments of this application are not limited.
[0167] Referring to Figure 6a, which shows a schematic flowchart of an image encoding method provided by an embodiment of the present invention, the method may include the following steps:
[0168] S11. The encoding side determines the target prediction mode for the block to be encoded, and also determines the target prediction order corresponding to the target prediction mode. Here, a detailed explanation of S11 may be found in the explanation of S101, which will be discussed later, and therefore, a redundant explanation will be omitted here.
[0169] S12. The encoding side predicts each pixel in the block to be encoded in the target prediction order according to the target prediction mode described above. Here, a detailed explanation of S12 may be found in the explanation of S102, which will be discussed later, and therefore, a redundant explanation will be omitted here.
[0170] S13, the encoding side determines the residual block of the block to be encoded based on the predicted value of each pixel in the block to be encoded. Here, a detailed explanation of S13 may be found in the explanation of S103, which will be discussed later, and therefore, a redundant explanation will be omitted here.
[0171] S14 (selectable): The encoding side performs a transformation on the residual block of the block to be encoded and obtains the transformed residual coefficient block.
[0172] In S15, the encoding side performs quantization on the residual coefficient block to obtain a quantized residual coefficient block. If the encoding side does not perform S14, it is understood that the encoding side can quantize the above residual block as is to obtain a quantized residual block. Here, a detailed explanation of the quantization process of residual blocks or residual coefficient blocks by the encoding side may be found in the explanation of residual block quantization in S301-S302 described later, and redundant explanations are omitted here.
[0173] S16. The encoding side encodes the quantized residual coefficient block and obtains a code stream of the block to be encoded. If the encoding side has not performed S14, it is understood that the encoding side encodes the quantized residual block to obtain the code stream of the block to be encoded. Here, the process by which the encoding side encodes the quantized residual coefficient block (or residual block) can be described in S502 below, and a redundant explanation is omitted here.
[0174] Furthermore, the residual scan order in which the encoding side encodes the residual coefficient blocks may be the same as the target prediction order in S11. In this way, the decoding side can predict the predicted values of pixels within the block to be decoded in the target prediction order, and decode the residual blocks of the block to be decoded in the same residual scan order as the target prediction order, and furthermore, efficiently obtain the reconstructed blocks of the block to be decoded.
[0175] In the image coding method described in S11 to S16, the target prediction mode used on the coding side to predict pixels within the target block has high prediction efficiency, and the quantization method used on the coding side to quantize the residual block or residual coefficient block can reduce the multiplication operations on the coding side, that is, it can improve the quantization efficiency. Furthermore, since the coding method used on the coding side can reduce the number of bits used to encode the residual block or residual coefficient block, the coding efficiency on the coding side can be significantly improved according to the method provided by the embodiment of the present invention.
[0176] Referring to Figure 6b, which shows a schematic flowchart of an image decoding method provided by an embodiment of the present invention, the method may include the following steps:
[0177] In S21, the decoding side analyzes the code stream of the block to be decoded and determines the target prediction mode to predict the pixels within the block to be decoded. Here, a detailed explanation of S21 can be found in the explanation of S201, which will be discussed later, and therefore, a redundant explanation will be omitted here.
[0178] S22, the decoding side determines the target prediction order corresponding to the target prediction mode based on the target prediction mode. Here, a detailed explanation of S22 may be found in the explanation of S202, which will be discussed later, and therefore, a redundant explanation will be omitted here.
[0179] S23. The decoding side predicts each pixel in the block to be decoded in the target prediction order according to the target prediction mode and obtains the predicted value for each pixel.
[0180] In S24, the decoding side analyzes the code stream of the block to be decoded using a variable code length decoding method, obtains the CL of each value in the residual block corresponding to the block to be decoded, and, based on the CL, analyzes the code stream of the block to be decoded according to the target prediction order to obtain the first residual block of the block to be decoded. Here, the residual scan order may be the same as the target prediction order described above. When the residual scan order is the same as the target prediction order, that is, when the decoding side predicts the pixels in the block to be decoded in the target prediction order, the decoding side further analyzes the first residual block of the block to be decoded from the code stream of the block to be decoded according to the same residual scan order as the target prediction order. This improves the decoding efficiency of the decoding side. Here, the decoding side analyzes the code stream of the block to be decoded using a variable code length decoding method, and the process of obtaining the CL of each value in the residual block corresponding to the block to be decoded can be found in the explanation of S601 below. The explanation of how the decoding side determines the first residual block based on the CL is the same as the method for obtaining the residual block of the block to be decoded explained in S602, so a redundant explanation is omitted here.
[0181] In S25, the decoding side obtains the inverse quantization parameter for each pixel within the block to be decoded by analyzing the code stream of the block to be decoded. Here, a detailed explanation of the inverse quantization parameters can be found in the explanation in S401, which will be discussed later, and therefore, a redundant explanation will be omitted here.
[0182] S26. The decoding side dequantizes the first residual block based on the QP indicated by the dequantization parameter of each pixel in the block to be decoded and the dequantization preset array, and obtains the second residual block. Here, a detailed explanation of S26 may be found in the explanation of S402, which will be discussed later, and therefore, a redundant explanation will be omitted here. Furthermore, the embodiments of this application do not limit the execution order of S23 and S24-S26; for example, S23 and S24-S26 can be executed simultaneously.
[0183] S27 (selectable): The decoding side performs an inverse transformation on the second residual block to obtain the inversely transformed second residual block. If the image encoding process includes S14, it is understood that the decoding side will perform S27.
[0184] S28. The decoding side reconstructs the target block based on the inversely transformed second residual block and the predicted values of each pixel in the target block, and obtains the reconstructed block. If the decoding side does not perform S27, it is understood that the decoding side reconstructs the target block as is, based on the second residual block and the predicted values of each pixel in the target block, and obtains the reconstructed block.
[0185] The image decoding methods in S21 to S28 correspond to the image encoding methods in S11 to S16. In the image decoding methods described in S21 to S28, the target prediction mode used on the decoding side to predict pixels within the target block has high prediction efficiency, and the inverse quantization method used on the decoding side to inverse quantize the residual block or residual coefficient block can reduce the multiplication operations on the decoding side, that is, it can improve the inverse quantization efficiency. Furthermore, the decoding method used on the decoding side can reduce the number of bits required to decode the residual block or residual coefficient block, so the decoding efficiency on the decoding side can be significantly improved according to the method provided by the embodiment of the present invention.
[0186] Example 1 As shown in Figure 6c, Figure 6c is a schematic flowchart of another image coding method provided by an embodiment of the present invention. The method shown in Figure 6c includes the following steps:
[0187] S101, The encoding side determines the target prediction mode for the block to be encoded, and also determines the target prediction order corresponding to the target prediction mode.
[0188] Specifically, the encoding side can predict each block to be encoded using different prediction modes, predict the encoding performance of the block based on the predicted values in the different prediction modes, and determine the target prediction mode.
[0189] For example, the encoding side predicts the target block using different prediction modes, and after obtaining the predicted block based on the predictions of the different prediction modes, the encoding side can perform steps 13 to 16 described above to obtain the code stream of the target block in the different prediction modes. The encoding side determines the time it takes to obtain the code stream of the target block in the different prediction modes and determines the prediction mode that takes the shortest time as the target prediction mode. In other words, the encoding side determines the prediction mode with the highest encoding efficiency as the target prediction mode.
[0190] Embodiments of the present invention provide multiple prediction modes in addition to the conventional prediction mode. In the prediction modes provided by embodiments of the present invention, the encoding side can sequentially predict pixels within a block to be encoded in a predetermined order. For the encoding side to sequentially predict pixels within a block to be encoded in a predetermined order means that the encoding side sequentially predicts pixels within a block to be encoded along a predetermined trajectory. In this process, when the encoding side predicts any pixel within a block to be encoded, the pixels for predicting that pixel have already been reconstructed. A detailed explanation of the prediction modes provided by embodiments of the present invention can be found below, and redundant explanations are omitted here.
[0191] The encoding side can predict the encoding performance of the block to be encoded based on different prediction modes, determine the target prediction mode, and then determine the target prediction order when predicting pixels within the block to be encoded using the target prediction mode.
[0192] Here, the target prediction order may be the prediction order for pixels within the block to be encoded, or it may be the prediction order for subblocks within the block to be encoded.
[0193] S102. The encoding side predicts each pixel in the block to be encoded in the target prediction order according to the target prediction mode described above.
[0194] Preferably, the target prediction mode can indicate that each pixel in the block to be encoded is predicted dot by dot in the target prediction order. For example, if the target prediction mode is one of the first to fifth prediction modes described later, the target prediction order is used to predict each pixel in the block to be encoded dot by dot along the trajectory direction indicated by the target prediction order.
[0195] In this case, the encoding side predicts each pixel within the block to be encoded sequentially, dot by dot, along the trajectory direction indicated by the target prediction order, and obtains the predicted value for each pixel.
[0196] Preferably, the target prediction mode can instruct the system to sequentially predict pixels within each subblock in the target block, using subblock units having a preset size within the target block. For example, if the target prediction mode is the sixth prediction mode described later, the target prediction mode is used to indicate that pixels within each subblock in the target block are to be sequentially predicted, using subblock units having a preset size within the target block.
[0197] In this case, the target prediction mode includes the prediction mode within each subblock in the block to be encoded. Thus, the encoding side can sequentially predict the pixels within each subblock in the block to be encoded in the direction indicated by the target prediction order, according to the target prediction mode. Furthermore, when the encoding side predicts one subblock in the block to be encoded, it can predict each pixel within that subblock in parallel based on the reconstructed pixels surrounding that subblock.
[0198] S103, the encoding side determines the residual block of the block to be encoded based on the predicted value of each pixel in the block to be encoded.
[0199] The encoding side can determine the residual block of the block to be encoded based on the predicted value of each pixel in the block to be encoded and the original pixel value in the block to be encoded.
[0200] For example, the encoding side can obtain the residual block of the encoding target block by performing a difference calculation between the predicted value of each pixel in the encoding target block and the original pixel value in the encoding target block, using the residual calculation means 202 shown in Figure 2.
[0201] S104, The encoding side encodes the residual blocks in the residual scan order to obtain the code stream of the blocks to be encoded.
[0202] Here, the residual scanning order corresponds to the target prediction mode described above. Preferably, the residual scanning order may be the same as the target prediction order described above.
[0203] For example, if the image block to be encoded is a 16x2 size image block, and the target prediction mode is one of the prediction modes shown in Table 1 below, the residual scan order may be the order shown by the pre-set trajectory in Figure 7a. If the target prediction mode is one of the prediction modes shown in Table 2 below, the residual scan order may be the order shown by the pre-set trajectory in Figure 7b. If the target prediction mode is one of the prediction modes shown in Table 3-1 below, the residual scan order may be the order shown by the pre-set trajectory in Figure 7c-1. If the target prediction mode is one of the prediction modes shown in Table 4-1 below, the residual scan order may be the order shown by the pre-set trajectory in Figure 7d-1.
[0204] For example, if the image block to be encoded is an 8x2 size image block, and the target prediction mode is one of the prediction modes shown in Table 3-2 described later, the residual scan order may be the order shown by the pre-set trajectory in Figure 7c-2. If the target prediction mode is one of the prediction modes shown in Table 4-2 described later, the residual scan order may be the order shown by the pre-set trajectory in Figure 7d-2.
[0205] Furthermore, for example, if the image block to be encoded is an 8x1 size image block, and the target prediction mode is one of the prediction modes shown in Table 4-3 later, the residual scan order may be the order shown by the pre-set trajectory in Figure 7d-3. If the target prediction mode is one of the prediction modes shown in Table 5 later, the residual scan order may be the order shown by the pre-set trajectory in Figure 7e.
[0206] Furthermore, for example, if the image block to be encoded is a 16x2 size image block, and the target prediction mode is the prediction mode shown in Figure 7f described later, the residual scanning order may be the order shown by the pre-set trajectory in Figure 7g.
[0207] Preferably, the encoding side performs a transformation on the residual block of the block to be encoded to obtain the residual coefficient block of the block to be encoded. The encoding side also quantizes this residual coefficient block to obtain the quantized residual coefficient block. Then, the encoding side encodes the quantized residual coefficient block in the target prediction order to obtain the encoded code stream of the block to be encoded.
[0208] For example, the encoding side first performs a transformation process on the residual block of the block to be encoded using the residual transformation means 203 shown in Figure 2 to obtain the residual coefficient block of the block to be encoded. The encoding side then quantizes this residual coefficient block using the quantization means 204 shown in Figure 2 to obtain the quantized residual coefficient block. Then, the encoding side encodes the quantized residual coefficient block in the target prediction order using the encoding means 205 shown in Figure 2 to obtain the encoded code stream of the block to be encoded.
[0209] Preferably, the encoding side can directly perform quantization on the residual block of the block to be encoded to obtain a quantized residual block. Then, the encoding side encodes the quantized residual block in the target prediction order to obtain the encoded code stream of the block to be encoded.
[0210] For example, the encoding side can perform quantization on the residual block of the block to be encoded using the quantization means 204 shown in Figure 2 to obtain a quantized residual block. Then, the encoding side can encode the quantized residual block in the target prediction order using the encoding means 205 shown in Figure 2 to obtain an encoded code stream of the block to be encoded.
[0211] Preferably, the encoding side uses the target prediction mode as a syntactic element of the block to be encoded, or uses the target prediction mode and the corresponding target prediction order as a syntactic element of the block to be encoded, and encodes the syntactic element. The encoding side may also add the encoded syntactic element data to the encoded code stream of the block to be encoded.
[0212] In the embodiments of this application, the method for quantizing the residual block or residual coefficient block of the block to be encoded is not particularly limited. For example, the residual block or residual coefficient block of the block to be encoded can be quantized using the quantization method described in Example 2 below, and of course, this does not limit the method.
[0213] In the embodiments of this application, the specific encoding scheme used by the encoding side to encode the quantized residual blocks or residual coefficients and associated syntactic elements is not particularly limited. For example, it can be encoded using a variable code length encoding scheme as described in Example 3 below, and is not limited to this.
[0214] The prediction modes provided by embodiments of the present invention are described in detail below. A prediction mode for predicting a single block to be encoded may include at least one of the prediction methods described above: the T prediction method, the TB prediction method, the L prediction method, and the RL prediction method. Here, a single pixel within the block to be encoded can be predicted by any of the T prediction method, the TB prediction method, the L prediction method, or the RL prediction method.
[0215] Furthermore, any of the following prediction modes can be applied to flows where the encoding side encodes an image, and also to flows where the decoding side decodes image data, and the embodiments of this application are not limited to these.
[0216] In the first prediction mode, as shown in Table 1, using the example of a 16x2 block size, Table 1 shows prediction modes for predicting each pixel within a 16x2 block. In this prediction mode, the prediction order in which the encoding side predicts pixels within the block may be the order shown by a pre-set trajectory as shown in Figure 7a. In other words, when the encoding side sequentially predicts pixels within the block using the pre-set trajectory shown in Figure 7a, each pixel within the block is predicted using the specific prediction method in the prediction mode shown in Table 1.
[0217] [Table 1]
[0218] It should be understood that the prediction methods shown for each grid in Table 1 are used to predict the predicted values of the corresponding positional pixels within the encoding block shown in Figure 7a. For example, the T prediction method shown for the first grid in the first row of Table 1 is used to predict the predicted value of pixel 1-1 located in the first grid in the first row of the encoding block shown in Figure 7a. Also, for example, the RL prediction method shown for the second grid in the first row of Table 1 is used to predict the predicted value of pixel 1-2 located in the second grid in the first row of the encoding block shown in Figure 7a. Furthermore, for example, the T prediction method shown for the first grid in the second row of Table 1 is used to predict the predicted value of pixel 2-1 located in the first grid in the second row of the encoding block shown in Figure 7a. Furthermore, for example, the T prediction method shown for the fifteenth grid in the second row of Table 1 is used to predict the predicted values of pixels 1-15 located in the fifteenth grid in the second row of the encoding block shown in Figure 7a.
[0219] Also, it should be understood that the two 16×2 blocks shown in FIG. 7a represent the same image block (e.g., the block to be encoded) within the image to be encoded. In FIG. 7a, representing the block to be encoded by two blocks is only for clearly showing a preset trajectory when the encoding side sequentially predicts pixels within the block to be encoded, and the preset trajectory is the trajectory shown by the thick black solid line with arrows in FIG. 7a. Here, the origin is the starting point of the preset trajectory, and the pixel points at both ends of the black dashed line are two adjacent pixel points on the preset trajectory.
[0220] Thus, exemplarily, when the encoding side predicts the block to be encoded according to the preset trajectory shown in FIG. 7a, the encoding side first predicts the pixel 1-1 shown in FIG. 7a using the T prediction method shown in Table 1. That is, the predicted value of pixel 1-1 = P T1-1 where P T1-1 is the pixel above pixel 1-1 (e.g., a pixel within the upper image block of the block to be encoded). It should be understood that since 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, the pixel values within the upper image block and the left image block of the block to be encoded have already been reconstructed. After the encoding side obtains the predicted value of pixel 1-1, it can determine the reconstructed value of pixel 1-1 based on the predicted value of pixel 1-1 (e.g., after the encoding side obtains the predicted value of pixel 1-1, it executes steps 13 to 16 described above, performs inverse quantization and inverse transformation to reconstruct the residual value of the pixel, and further obtains the reconstructed value of pixel 1-1 based on the predicted value and the reconstructed residual value).
[0221] Also exemplarily, after the encoding side predicts pixel 1-1 according to the preset trajectory shown in FIG. 7a, for pixel 2-1 shown in FIG. 7a, it predicts using the T prediction method shown in Table 1. That is, the predicted value of pixel 2-1 = P T2-1 where P T2-1 is the reconstructed value of the pixel above pixel 2-1 (e.g., the reconstructed pixel 1-1).
[0222] As a further example, the encoding side predicts pixels 2-15 according to a pre-set trajectory shown in Figure 7a, and then predicts pixels 1-2 shown in Figure 7a using the RL prediction method shown in Table 1. That is, the predicted value of pixel 1-2 = (P R1-2 +P L1-2 (P)>>1, R1-2 +P L1-2 +1)>>1 is (P R1-2 +P L1-2 This represents the value obtained by shifting the binary value of (+1) one bit to the right, and the mathematical result is (P R1-2 +P L1-2 This corresponds to the value obtained by dividing (+1) by 21. R1-2 This is the reconstructed value of the rightmost pixel of pixels 1-2 (for example, the reconstructed pixels 1-3, since the predicted order of pixels 1-3 is before pixels 1-2), and P L1-2 This is the reconstructed value of the leftmost pixel of pixel 1-2 (for example, the reconstructed pixel 1-1).
[0223] In the second prediction mode, as shown in Table 2, using the example of a 16x2 block size, Table 2 shows another prediction mode for predicting each pixel within a 16x2 block. In this prediction mode, the prediction order in which the encoding side predicts pixels within the block may be the order shown by the pre-set trajectory in Figure 7b. That is, when the encoding side sequentially predicts pixels within the block using the pre-set trajectory shown in Figure 7b, each pixel within the block is predicted using the specific prediction method in the prediction mode shown in Table 2. Here, a detailed explanation of predicting each pixel within the block using the prediction method shown in Table 2 can be found in the explanation of predicting each pixel within the block using the prediction method shown in Table 1 above, and an explanation of the pre-set trajectory shown in Figure 7b can be found in the explanation of the pre-set trajectory in Figure 7a, so redundant explanations are omitted here.
[0224] [Table 2]
[0225] Thus, as an example, when the encoding side predicts the block to be encoded according to a pre-set trajectory shown in Figure 7b, the encoding side first predicts pixel 2-1 shown in Figure 7b using the L prediction method shown in Table 2. That is, the predicted value of pixel 2-1 = P L2-1 P L2-1 This is the reconstructed value of the leftmost pixel of pixel 2-1 (for example, a pixel in the leftmost image block of the block to be encoded).
[0226] As a further example, the encoding side predicts pixels 2-16 according to a pre-set trajectory shown in Figure 7b, and then predicts pixel 1-1 shown in Figure 7b using the TB prediction method shown in Table 2. That is, the predicted value of pixel 1-1 = (P T1-1 +P B1-1 +1)>>1 is true. T1-1 P is the reconstructed value of the upper pixel of pixel 1-1 (for example, a pixel in the upper image block of the block to be encoded), and B1-1 This is the reconstructed value of the lower pixel of pixel 1-1 (for example, the reconstructed pixel 2-1, since the predicted order of pixel 2-1 is before pixel 1-1).
[0227] In the third prediction mode, as shown in Table 3-1, using the example of a 16x2 block size, Table 3-1 shows another prediction mode for predicting each pixel within a 16x2 block. In this prediction mode, the prediction order in which the encoding side predicts pixels within the block may be the order shown by the pre-set trajectory in Figure 7c-1. In other words, when the encoding side sequentially predicts pixels within the block using the pre-set trajectory shown in Figure 7c-1, each pixel within the block is predicted using the specific prediction method in the prediction mode shown in Table 3-1. For a detailed explanation of predicting each pixel within the block using the prediction method shown in Table 3-1, refer to the explanation of predicting each pixel within the block using the prediction method shown in Table 1 above, and for an explanation of the pre-set trajectory shown in Figure 7c-1, refer to the explanation of the pre-set trajectory in Figure 7a. Therefore, redundant explanations are omitted here.
[0228] [Table 3-1]
[0229] In the third prediction mode, as shown in Table 3-2, taking the example of a block size of 8 × 2, Table 3-2 shows a prediction mode for predicting each pixel within an 8 × 2 block of code. In this prediction mode, the prediction order in which the encoding side predicts pixels within the block of code may be the order shown by the pre-set trajectory in Figure 7c-2. In other words, when the encoding side sequentially predicts pixels within the block of code using the pre-set trajectory shown in Figure 7c-2, each pixel within the block of code is predicted using the specific prediction method in the prediction mode shown in Table 3-2. Here, a detailed explanation of predicting each pixel within the block of code using the prediction method shown in Table 3-2 can be found in the explanation of predicting each pixel within the block of code using the prediction method shown in Table 1 above, and an explanation of the pre-set trajectory shown in Figure 7c-2 can be found in the explanation of the pre-set trajectory in Figure 7a, so redundant explanations are omitted here.
[0230] [Table 3-2]
[0231] In the fourth prediction mode, as shown in Table 4-1, taking the size of the block to be encoded as 16 × 2 as an example, Table 4-1 shows another prediction mode in which each pixel within the 16 × 2 block to be encoded is predicted. In this prediction mode, the prediction order in which the encoding side predicts the pixels within the block to be encoded may be the order shown by the pre-set trajectory in Figure 7d-1. In other words, when the encoding side sequentially predicts the pixels within the block to be encoded using the pre-set trajectory shown in Figure 7d-1, each pixel within the block to be encoded is predicted using the specific prediction method in the prediction mode shown in Table 4-1. Here, a detailed explanation of predicting each pixel within the block to be encoded using the prediction method shown in Table 4-1 can be found in the explanation of predicting each pixel within the block to be encoded using the prediction method shown in Table 1 above, and an explanation of the pre-set trajectory shown in Figure 7d-1 can be found in the explanation of the pre-set trajectory in Figure 7a, so redundant explanations are omitted here.
[0232] [Table 4-1]
[0233] In the fourth prediction mode, as shown in Table 4-2, taking the size of the block to be encoded as 8 × 2 as an example, Table 4-2 shows another prediction mode in which each pixel within the 8 × 2 block to be encoded is predicted. In this prediction mode, the prediction order in which the encoding side predicts the pixels within the block to be encoded may be the order shown by the pre-set trajectory in Figure 7d-2. In other words, when the encoding side sequentially predicts the pixels within the block to be encoded using the pre-set trajectory shown in Figure 7d-2, each pixel within the block to be encoded is predicted using the specific prediction method in the prediction mode shown in Table 4-2. Here, a detailed explanation of predicting each pixel within the block to be encoded using the prediction method shown in Table 4-2 can be found in the explanation of predicting each pixel within the block to be encoded using the prediction method shown in Table 1 above, and an explanation of the pre-set trajectory shown in Figure 7d-2 can be found in the explanation of the pre-set trajectory in Figure 7a, so redundant explanations are omitted here.
[0234] [Table 4-2]
[0235] In the fourth prediction mode, as shown in Table 4-3, taking the size of the block to be encoded as 8 × 1 as an example, Table 4-3 shows another prediction mode in which each pixel within the 8 × 1 block to be encoded is predicted. In this prediction mode, the prediction order in which the encoding side predicts the pixels within the block to be encoded may be the order shown by the pre-set trajectory in Figure 7d-3. In other words, when the encoding side sequentially predicts the pixels within the block to be encoded using the pre-set trajectory shown in Figure 7d-3, each pixel within the block to be encoded is predicted using the specific prediction method in the prediction mode shown in Table 4-3. Here, a detailed explanation of predicting each pixel within the block to be encoded using the prediction method shown in Table 4-3 can be found in the explanation of predicting each pixel within the block to be encoded using the prediction method shown in Table 1 above, and an explanation of the pre-set trajectory shown in Figure 7d-3 can be found in the explanation of the pre-set trajectory in Figure 7a, so redundant explanations are omitted here.
[0236] [Table 4-3]
[0237] In the fifth prediction mode, as shown in Table 5, taking the size of the block to be encoded as 8 × 1 as an example, Table 5 shows a prediction mode for predicting each pixel within an 8 × 1 block to be encoded. In this prediction mode, the prediction order in which the encoding side predicts pixels in the block to be encoded may be the order shown by the pre-set trajectory in Figure 7e. In other words, when the encoding side sequentially predicts pixels within the block to be encoded using the pre-set trajectory shown in Figure 7e, each pixel within the block to be encoded is predicted using the specific prediction method in the prediction mode shown in Table 5. Here, a detailed explanation of predicting each pixel within the block to be encoded using the prediction method shown in Table 5 can be found in the explanation of predicting each pixel within the block to be encoded using the prediction method shown in Table 1 above, and an explanation of the pre-set trajectory shown in Figure 7e can be found in the explanation of the pre-set trajectory in Figure 7a, so redundant explanations are omitted here.
[0238] [Table 5]
[0239] As can be seen from the above, each of the above prediction modes corresponds to a different prediction order. For example, if the prediction mode is the first prediction mode, the prediction order is the first prediction order, and if the prediction mode is the second prediction mode, the prediction order is the second prediction order, and the first and second prediction orders are different. The first and second prediction orders may be one of the prediction orders corresponding to the first to sixth prediction modes in the example above.
[0240] As can also be seen, in the same prediction mode, if the size of the block to be encoded is different, the corresponding prediction order will also be different. For example, for a block to be decoded of a first size, the first prediction mode predicts the block to be decoded in the third prediction order, and for a block to be decoded of a second size, where the third and fourth prediction orders are different, the first prediction mode predicts the block to be decoded in the fourth prediction order. For example, for three different sizes of blocks to be decoded—16×2, 8×2, and 8×1—three different prediction orders can be used in the fourth prediction mode, as shown in Figures 7d-1, 7d-2, and 7d-3, respectively.
[0241] Here, the first prediction order, the second prediction order, the third prediction order, and the fourth prediction order can all represent prediction trajectories for pixels within the block to be encoded, and can also represent prediction trajectories for subblocks within the block to be encoded.
[0242] In the sixth prediction mode, the prediction mode is used to indicate that the encoding side predicts each subblock in the target block sequentially in the direction indicated by the prediction order corresponding to the prediction mode, using subblocks with preset sizes in the target block as units. In this prediction mode, when the encoding side predicts any subblock in the target block, it can simultaneously predict pixels within any subblock based on the reconstructed pixels surrounding that subblock.
[0243] In such prediction modes, the encoding side can divide the block to be encoded into multiple non-overlapping subblocks of a preset size, and the arrangement direction of the divided subblocks can be set to the direction indicated by the prediction order corresponding to that prediction mode.
[0244] As an example, referring to Figure 7f, Figure 7f shows a schematic diagram of one subblock of the encoding target block provided by the embodiment of the present invention.
[0245] As shown in Figure 7f(a), assuming that a subblock with a preset size is a 2x2 subblock, a 16x2 block to be encoded can be divided into eight non-overlapping 2x2 subblocks, as shown by the thick black border in Figure 7f(a). The direction of arrangement of these eight subblocks, that is, the direction shown as the prediction order corresponding to the prediction mode, is, for example, the direction pointed to by the arrow shown in Figure 7f(a).
[0246] Assuming that the sub-block having the preset size is a 4×2 sub-block as shown in (b) of FIG. 7f, for a 16×2 encoding target block, the encoding target block can be divided into four non-overlapping 4×2 sub-blocks as shown by the thick black frames in (b) of FIG. 7f. And the arrangement direction of these four sub-blocks, that is, the direction shown as the prediction order corresponding to the prediction mode, is, for example, the direction pointed by the arrow shown in (b) of FIG. 7f.
[0247] Assuming that the sub-block having the preset size is an 8×2 sub-block as shown in (c) of FIG. 7f, for a 16×2 encoding target block, the encoding target block can be divided into two non-overlapping 8×2 sub-blocks as shown by the thick black frames in (c) of FIG. 7f. And the arrangement direction of these two sub-blocks, that is, the direction shown as the prediction order corresponding to the prediction mode, is, for example, the direction pointed by the arrow shown in (c) of FIG. 7f.
[0248] Specifically, for any sub-block in the encoding target block, the sixth prediction mode indicates that pixels in any such sub-block are predicted based on the reconstructed values of pixels above (adjacent or non-adjacent), to the left (adjacent or non-adjacent), and diagonally above (adjacent or non-adjacent) of any such sub-block. Note that in this prediction mode, one pixel in one sub-block is not predicted depending on other pixels in the same sub-block. For the sake of brief explanation, in the embodiments of the present application, this prediction mode indicates that pixels in any such sub-block are predicted based on the reconstructed values of pixels adjacent above, to the left, and diagonally above in any such sub-block.
[0249] The sixth prediction mode is for indicating that, with the sub-block shown in (a) of FIG. 7f as a unit, each sub-block in the block to be coded is sequentially predicted along the direction indicated by the prediction order corresponding to the prediction mode. As shown in (a) of FIG. 7f, assume that any one of the above sub-blocks is sub-block a, and the gray grid shown in (a) of FIG. 7f is the pixels adjacent to the upper side, left side, and upper diagonal side of sub-block a. The pixels in sub-block a are Y0, Y1, Y2, and Y3 respectively, the upper pixels in sub-block a include T0 and T1, the left pixels in sub-block a include L0 and L1, and the upper diagonal pixels in sub-block a are LT as an example.
[0250] In one possible implementation, specifically, for the sixth prediction mode, the predicted value of Y0 in sub-block a is obtained based on T0, L0, and LT, the predicted value of Y1 in sub-block a is obtained based on T1, L0, and LT, the predicted value of Y2 in sub-block a is obtained based on T0, L1, and LT, and the predicted value of Y3 in sub-block a is obtained based on T1, L1, and LT.
[0251] Preferably, the first prediction method specifically indicated by the sixth prediction mode may be to determine the predicted value of any pixel in any sub-block in the block to be coded based on the horizontal gradient or vertical gradient of the upper pixel, left pixel, and upper diagonal pixel of the any pixel.
[0252] Referring to Figure 7f(a), taking pixel Y0 of subblock a as an example, if the encoding side determines that the reconstructed values of the upper pixel T0, left pixel L0, and diagonally upper pixel LT of Y0 satisfy condition 1, then the reconstructed value of the left pixel L0 of Y0 is determined as the predicted value of Y0. Here, condition 1 is used to indicate that the horizontal gradient of the pixels surrounding Y0 is minimized. Specifically, condition 1 is |reconstructed value of T0 - reconstructed value of LT| ≤ |reconstructed value of L0 - reconstructed value of LT| and |reconstructed value of T0 - reconstructed value of LT| ≤ |reconstructed value of L0 + reconstructed value of T0 - reconstructed value of 2*LT|. If the encoding side determines that the reconstructed values of the upper pixel T0, left pixel L0, and diagonally upper pixel LT of Y0 satisfy condition 2, then the reconstructed value of the upper pixel T0 of Y0 is determined as the predicted value of Y0. Here, condition 2 is used to indicate that the vertical gradient of the pixels surrounding Y0 is minimized. Condition 2 is specifically |Reconstructed value of T0 - Reconstructed value of LT| ≤ |Reconstructed value of L0 + Reconstructed value of T0 - 2 * Reconstructed value of LT|. If the encoding side determines that the reconstructed values of the upper pixel T0, left pixel L0, and diagonally upper pixel LT of Y0 do not satisfy conditions 1 and 2 above, it determines the reconstructed value of the diagonally upper pixel LT of Y0 as the predicted value of Y0.
[0253] Preferably, the prediction method 2 specifically represented by the sixth prediction mode may determine the predicted value of any pixel based on the average of the reconstruction values of the upper pixel, left pixel, and diagonally upper pixel of any pixel in any subblock of the block to be encoded.
[0254] Continuing to refer to Figure 7f(a), taking pixel Y0 in subblock a as an example, the predicted value of Y0 may be (reconstructed value of L0 + reconstructed value of T0 + reconstructed value of 2*LT)>>2. Here, (reconstructed value of L0 + reconstructed value of T0 + reconstructed value of 2*LT)>>2 represents the value obtained by shifting the binary value of (reconstructed value of L0 + reconstructed value of T0 + reconstructed value of 2*LT) 2 bits to the right.
[0255] In another feasible form, the sixth prediction mode specifically indicates determining the reconstructed value of an upper, left, or diagonally upper pixel located in the prediction direction of any pixel within any subblock in the block to be encoded as the prediction value of that pixel. Here, the prediction direction may be a 45-degree diagonal direction to the left or a 45-degree diagonal direction to the right of the pixel, and is not limited thereto in the embodiments of the present application.
[0256] As an example, the sixth prediction mode is used to indicate that each subblock in the target block to be encoded is predicted sequentially according to the prediction order corresponding to the prediction mode, using the subblock shown in Figure 7f(b) as the unit. Referring to Figure 7f(b), we assume that any of the above subblocks is subblock b, and that the gray grid shown in Figure 7f(b) represents the pixels adjacent to the upper, left, and diagonally upper sides of subblock b. The pixels within subblock b are Y0, Y1, Y2, Y3, Y4, Y5, Y6, and Y7, respectively. The upper pixels within subblock b include T0, T1, T2, T3, T4, and T5, the left pixels within subblock b include L0 and L1, and the diagonally upper pixel within subblock b is LT.
[0257] When the prediction direction is 45 degrees to the left of the pixel to be predicted, the sixth prediction mode specifically determines the reconstructed value of LT at 45 degrees to the left of Y0 in subblock b as the predicted value of Y0, determines the reconstructed value of T0 at 45 degrees to the left of Y1 in subblock b as the predicted value of Y1, determines the reconstructed value of T1 at 45 degrees to the left of Y2 in subblock b as the predicted value of Y2, and determines the reconstructed value of T2 at 45 degrees to the left of Y3 in subblock b as the predicted value of Y2 This shows that the reconstructed value is determined as the predicted value for Y3, the reconstructed value of L0 at a 45-degree angle to the left of Y4 in subblock b is determined as the predicted value for Y4, the reconstructed value of LT at a 45-degree angle to the left of Y5 in subblock b is determined as the predicted value for Y5, the reconstructed value of T0 at a 45-degree angle to the left of Y6 in subblock b is determined as the predicted value for Y6, and the reconstructed value of T1 at a 45-degree angle to the left of Y7 in subblock b is determined as the predicted value for Y7.
[0258] When the prediction direction is 45 degrees to the right of the pixel to be predicted, the sixth prediction mode specifically determines the reconstructed value of T1 at 45 degrees to the right of Y0 in subblock b as the predicted value of Y0, the reconstructed value of T2 at 45 degrees to the right of Y1 in subblock b as the predicted value of Y1, the reconstructed value of T3 at 45 degrees to the right of Y2 in subblock b as the predicted value of Y2, and the reconstructed value of T4 at 45 degrees to the right of Y3 in subblock b as the predicted value of Y2 This shows that the reconstructed value is determined as the predicted value for Y3, the reconstructed value of T2 at a 45-degree angle to the right of Y4 in subblock b is determined as the predicted value for Y4, the reconstructed value of T3 at a 45-degree angle to the right of Y5 in subblock b is determined as the predicted value for Y5, the reconstructed value of T4 at a 45-degree angle to the right of Y6 in subblock b is determined as the predicted value for Y6, and the reconstructed value of T5 at a 45-degree angle to the right of Y7 in subblock b is determined as the predicted value for Y7.
[0259] Preferably, if the target prediction mode includes a prediction mode for each subblock in the decoded block, and for a first subblock in the decoded block, if the first subblock includes a first pixel and a second pixel, the prediction mode for the first subblock is used to predict the first pixel and the second pixel in parallel based on the reconstructed pixels surrounding the first subblock.
[0260] Here, the first subblock is a subblock in the currently predicted decoded block. For example, as shown in Figure 7f(a), if the size of each subblock in the decoded block is 2x2, the decoded block can be divided into eight subblocks. When prediction of the coded block shown in Figure 7f(a) begins, the first subblock is the first subblock from left to right. Once the reconstruction of the pixels in the first subblock is complete, the reconstruction of the pixels in the second subblock from left to right can begin, and at this time, the first subblock is the second subblock. The first and second pixels included in the first subblock may be two pairs of non-overlapping pixels in the first subblock, and the first or second pixel may contain one or more pixels in the first subblock. For example, taking subblock a in Figure 7f(a) as an example, if there is one, the first pixel in subblock a may contain Y0, and the second pixels in subblock a may contain Y1, Y2, and Y3. In another case, the first pixel in subblock a may include Y0 and Y1, and the second pixel in subblock a may include Y2 and Y3. In yet another case, the first pixel in subblock a may include Y1, and the second pixel in subblock a may include Y2.
[0261] Furthermore, when the encoding side predicts pixels within the block to be encoded using the sixth prediction mode, and when the encoding side encodes the residual block or residual coefficient block corresponding to the block to be encoded, the encoding can be performed in the order shown by the trajectory in Figure 7g.
[0262] Up to this point, according to the encoding method described in S101 to S104 above, when the encoding side predicts pixels in the block to be encoded using the target prediction mode, it predicts the pixels in the block to be encoded in the target prediction order corresponding to that target prediction mode. In this process, when the encoding side predicts any pixel in the block to be encoded, the pixels for predicting that pixel have already been reconstructed. Therefore, the encoding method provided by the embodiment of the present invention predicts each pixel in the block to be encoded in the target prediction order according to the target prediction mode, and can predict some pixels in the block to be encoded in parallel, thus improving the prediction efficiency for pixels in the block to be encoded. When reacquiring the reconstructed value based on the predicted value and residual value, the encoding side does not need to cache the residual value, so the encoding method provided by the embodiment of the present invention not only saves cache space for caching residual values but can also improve encoding efficiency.
[0263] Furthermore, if the target prediction mode instructs the encoding side to sequentially predict each subblock in the target block, using subblocks as units, then in this prediction mode, when the encoding side predicts one subblock, it can predict multiple pixels within that subblock in parallel based on the reconstructed pixels surrounding the subblock. In other words, this prediction mode allows the encoding side to further improve the prediction efficiency for the target block. Moreover, if the encoding side reacquires the reconstructed value based on the predicted value and the residual value, the encoding side does not need to cache the residual value, thus further saving cache space and improving encoding efficiency with the encoding method provided by the embodiment of the present invention.
[0264] As shown in Figure 8, Figure 8 is a schematic flowchart of another image decoding method provided by an embodiment of the present invention. The method shown in Figure 8 includes the following steps.
[0265] In S201, the decoding side analyzes the code stream of the block to be decoded and determines the target prediction mode to predict the pixels within the block to be decoded. Here, the code stream of the block to be decoded may be the code stream received by the decoding side from the encoding side, or may be a code stream obtained from another device, for example, a code stream obtained from a storage device, and the embodiments of the present application do not limit this. Here, the target prediction mode is used to predict the pixels in the block to be decoded to obtain the predicted values of the pixels in the block to be decoded. It is understood that the target prediction mode here is the prediction mode used by the encoding side to predict the pixels in the image block when encoding.
[0266] Specifically, the decoding side can analyze the code stream of the block to be decoded in a decoding method corresponding to the encoding side to obtain the target prediction mode.
[0267] S202. The decoding side determines the target prediction order corresponding to the target prediction mode based on the target prediction mode. Here, for the description of the prediction mode and the prediction order corresponding to the prediction mode, reference can be made to the above description, and duplicate descriptions are omitted here.
[0268] Preferably, a correspondence relationship between a plurality of prediction modes and the corresponding prediction orders can be preset on the decoding side. In this way, when the decoding side determines the prediction mode as the target prediction mode, it can determine the target prediction order corresponding to the target prediction mode from the preset correspondence relationship.
[0269] S203. The decoding side predicts each pixel in the block to be decoded in the target prediction order according to the target prediction mode, and obtains the predicted value of each pixel. Here, for the description of predicting each pixel in the block to be decoded in the prediction order corresponding to the prediction mode based on the prediction mode, reference can be made to the above detailed description of the prediction mode, and duplicate descriptions are omitted here.
[0270] In S204, the decoding side reconstructs each pixel based on the predicted value of each pixel within the block to be decoded, and obtains the reconstructed block of the block to be decoded.
[0271] Preferably, the decoding side can first obtain the residual block of the block to be decoded by analyzing the code stream. Then, the decoding side can dequantize this residual block to obtain the reconstructed residual block of the block to be decoded. In this way, the decoding side can obtain the 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.
[0272] For example, the decoding side first analyzes the code stream of the block to be decoded using the code stream analysis means 301 shown in Figure 5, and obtains the residual block of the block to be decoded. Then, the decoding side inversely quantizes the residual block using the inverse quantization means 302 shown in Figure 5, and obtains the reconstructed residual block of the block to be decoded. In this way, the decoding side can obtain the reconstructed block of the block to be decoded using the reconstruction means 305, based on the predicted values of the pixels in the block to be decoded obtained above and the residual values in the reconstructed residual block.
[0273] Preferably, the decoding side can first obtain the residual coefficient block of the block to be decoded by analyzing the code stream. Then, the decoding side dequantizes this residual block to obtain the dequantized residual coefficient block. Next, the decoding side dequantizes the dequantized residual coefficient block to obtain the reconstructed residual block of the block to be decoded. In this way, the decoding side can obtain the 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.
[0274] For example, the decoding side first analyzes the code stream of the block to be decoded using the code stream analysis means 301 shown in Figure 5, and obtains the residual coefficient block of the block to be decoded. Then, the decoding side inversely quantizes the residual coefficient block using the inverse quantization means 302 shown in Figure 5, and obtains the inversely quantized residual coefficient block. Next, the decoding side inversely transforms the inversely quantized residual coefficient block using the residual inverse transformation means 303 shown in Figure 5, and obtains the reconstructed residual block of the block to be decoded. In this way, the decoding side can obtain a reconstructed block of the block to be decoded using the reconstruction means 305, based on the predicted values of the pixels in the block to be decoded obtained above and the residual values in the reconstructed residual block.
[0275] Here, the decoding side analyzes the code stream of the block to be decoded using a decoding scheme corresponding to the encoding side, and obtains the residual block or residual coefficient block of the block to be decoded. For example, the residual scan order in which the decoding side decodes the code stream of the block to be decoded is the target prediction order for predicting pixels within the block to be decoded. Here, the target prediction order corresponds to the target prediction mode for predicting the block to be decoded. For an explanation of the residual scan order, please refer to the explanation above, and redundant explanations will be omitted here.
[0276] Furthermore, the image decoding method shown in Figure 8 corresponds to the image encoding method shown in Figure 6c. Therefore, this image decoding method contributes to improving the prediction efficiency for the block to be decoded. When reconstructing the block to be decoded based on the predicted value and residual value to obtain the reconstructed value of the block to be decoded, it is possible to save cache space for caching the residual value, thereby improving decoding efficiency.
[0277] In the embodiments of this application, the method for inversely quantizing the residual block or residual coefficient block of the block to be decoded is not particularly limited. For example, the residual block or residual coefficient block of the block to be decoded can be inversely quantized using the inverse quantization method described in the embodiment of Example 2 below, and of course, this does not limit the invention.
[0278] Furthermore, in the embodiments of the present application, the method by which the decoding side decodes the code stream of the block to be decoded is not particularly limited, and decoding can be performed using, for example, a variable code length decoding method described in Embodiment 3 below, and of course, this is not the only option.
[0279] Example 2 As shown in Figure 9a, Figure 9a is a schematic flowchart of yet another image coding method provided by an embodiment of the present invention. The method shown in Figure 9a includes the following steps:
[0280] S301, the encoding side determines the second residual block of the block to be encoded and the quantization parameter QP for each pixel within the block to be encoded. Here, the second residual block may be the original residual value block of the block to be encoded, or it may be the residual coefficient block obtained by transforming this original residual value block.
[0281] Here, the original residual value block of the block to be encoded is a residual block obtained by the encoding side based on the original pixel values of the block to be encoded and the predicted block of the block to be encoded. The process by which the encoding side predicts the pixels in the block to be encoded and obtains the predicted block can be realized based on the method described in Example 1, and of course, it can be obtained based on any of the prior art methods for obtaining the predicted block of the block to be encoded, and it is understood that the embodiments of the present application are not limited thereto. The residual coefficient block is obtained by the encoding side performing a transformation process on the original residual value block, and the embodiments of the present application are not specifically limited to the process by which the encoding side performs a transformation process on the original residual value block.
[0282] To simplify the explanation, the embodiments of this application will be described below using the example that the second residual block is the original residual value block of the block to be encoded.
[0283] Furthermore, the encoding side may determine the quantization parameter QP of each pixel in the block to be encoded before or after obtaining the second residual block of the block to be encoded. For example, the encoding side may read out a pre-set quantization parameter QP. Herein, the embodiments of the present invention do not specifically limit the process by which the encoding side determines the quantization parameter QP of each pixel in the block to be encoded.
[0284] S302, the encoding side quantizes the second residual block based on the QP of each pixel in the block to be encoded and the quantization preset array to obtain the first residual block. Here, the quantization preset array is used to quantize the values in the second residual block.
[0285] In the first feasible form, the quantization preset array includes an amplification parameter array and a displacement parameter array, each containing the same number of numerical values. If the amplification parameter in the amplification parameter array is represented by `amp` and the displacement parameter in the displacement parameter array is represented by `shift`, the encoding side can perform quantization on each value in the second residual block based on equation (1).
[0286]
number
[0287] Here, 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 right-shifting shift[QP] bits to the (residual value before quantization × amp[QP]) binary value.
[0288] In the embodiment of this application, the value of the i-th amplification parameter in the amplification parameter array amp[i] and the value of the i-th displacement parameter in the displacement parameter array shift[i] are given by 2shift[i] The inverse quantization preset array, which consists of the quotient between and amp[i], has the following characteristics: for the 1st to nth digits in the inverse quantization preset array, the interval between two adjacent digits is 1; for the n+1st to n+mth digits, the interval between two adjacent digits is 2; and for the n+k*m+1st to n+k*m+mth digits, the numerical interval between two adjacent digits is 2. k+1 The equation is such that n and m are integers greater than 1, and i and k are both positive integers.
[0289] Here, the inverse quantization preset array is used to implement the inverse quantization process of the first residual block obtained by quantization, and the inverse quantization operation implemented by the inverse quantization preset array and the quantization operation implemented by the quantization preset array are inverse of each other. Therefore, based on the inverse quantization preset array having the above rules, the amplification parameter array and displacement parameter array for implementing the quantization operation can be determined in reverse.
[0290] As an example, let mult represent the amplification parameter in the inverse quantization preset array, and the inverse quantization preset array contains 42 amplification parameters. Taking the example of setting n to 12 and m to 6, the inverse quantization preset array having the above rules is:
number
number
number
[0291] In this way, the encoding side can determine the amplification parameter for each pixel in the amplification parameter array and the displacement parameter for each pixel in the displacement parameter array based on the QP of each pixel in the determined block to be encoded. Then, the encoding side quantizes the second residual block based on the amplification parameter and displacement parameter corresponding to each pixel in the block to be encoded to obtain the first residual block.
[0292] For example, for any pixel in the block to be encoded, the encoding side can search for the QP of the determined pixel in the amplification parameter array, determine the QP-th value in the amplification parameter array as the amplification parameter for that pixel, and determine the QP-th value in the displacement parameter array as the displacement parameter for that pixel. Then, based on the amplification parameter and displacement parameter corresponding to that pixel, the encoding side performs a quantization operation on the residual value corresponding to that pixel in the second residual block using equation (1) above, thereby obtaining the quantized residual value corresponding to that pixel. When the encoding side completes the quantization process for all residual values in the second residual block, the first residual block is obtained.
[0293] In this feasible form, the encoding side only needs to perform up to six types of multiplication when quantizing the residual values in the second residual block. Compared to conventional techniques, this method significantly reduces the computational load on the encoding side, thus saving a considerable amount of computational resources.
[0294] In the second feasible form, the quantization preset array can contain fewer numbers compared to the first feasible form. In this embodiment, the encoding side can perform the quantization of each residual value in the second residual block based on equation (2).
[0295]
number
[0296] Here, amp is the amplification parameter corresponding to each pixel determined by the encoding side based on the QP of each pixel in the block to be encoded and the quantization preset array, and shift is the displacement parameter corresponding to each pixel determined by the encoding side based on the QP of each pixel in the block to be encoded and the quantization preset array. offset is the offset parameter, which can round the residual value after quantization to the nearest integer, (residual value before quantization × amp + offset). "shift" represents right-shifting the shift bit to the binary value of (residual value before quantization × amp + offset).
[0297] Specifically, the value of the amplification parameter amp corresponding to each pixel in the target block to be encoded, as determined by the encoding side, is the logical AND of the QP of each pixel and 7, which corresponds to the value in the quantization preset array, and the value of the displacement parameter shift corresponding to each pixel in the target block to be encoded, as determined by the encoding side, is the logical AND of 7 and the QP of each pixel in question. 3 It is the sum of the quotients obtained by dividing by [the specified number].
[0298] In other words, assuming that the values in the quantization preset array are represented by quant_scal, the amplification parameter amp can be calculated as quant_scale[QP&0x07] and the displacement parameter shift can be calculated as 7+(QP>>3). Here, [QP&0x07] represents the logical AND of the binary value of QP and 7 (corresponding to the mathematical result of dividing QP by 8 and taking the remainder), and quant_scale[QP&0x07] is the number at the QP&0x07th position in the quantization preset array. QP>>3 indicates a 3-bit right shift of the binary value of QP.
[0299] Furthermore, the offset can be calculated using 1<<(shift-1), where 1<<(shift-1) represents left-shifting the binary value of 1 by (shift-1) (the mathematical result is 1 multiplied by 2 to the power of (shift-1)).
[0300] In the embodiment of the present invention, when the encoding side implements the quantization process of the second residual block using equation (2), the quantization preset array may be quant_scal[8]={128,140,153,166,182,197,216,234}.
[0301] In this way, the encoding side calculates the amplification parameter and displacement parameter corresponding to each pixel in the determined block to be encoded, based on the QP and quantization preset array of each pixel. Then, based on the calculated amplification parameter, displacement parameter, and offset parameter of each pixel in the block to be encoded, the encoding side performs quantization of the second residual block using equation (2) to obtain the first residual block.
[0302] As will be seen, in this feasible form, the encoding side needs to perform up to eight types of multiplication when quantizing the residual values in the second residual block. Compared to conventional techniques, this method significantly reduces the computational load on the encoding side, and thus significantly conserves the computational resources of the encoding side.
[0303] In the third feasible form, the encoding side can implement the quantization of each residual value in the second residual block using equation (3).
[0304]
number
[0305] Here, `shift` represents the displacement parameter, and the value of `shift` is a monotonically non-decreasing integer related to QP. Alternatively, if QP is increasing, `shift` should be understood as having a one-to-one correspondence with QP, and the value of `shift` is a monotonically non-decreasing integer. For an explanation of `offset`, please refer to the explanation above, and we will omit a redundant explanation here. The `offset` is determined by (shift==0)?0:(1<<(shift-1)), specifically, if `shift` is 0, the `offset` is taken as 0, and if `shift` is not 0, the `offset` is taken as (1<<(shift-1)) (i.e., the value obtained by left-shifting (shift-1) bits from the binary value of 1).
[0306] In this way, the encoding side can determine the displacement parameter of each pixel in the determined encoding block based on the QP of each pixel, and further determine the corresponding offset parameter. Then, based on the determined displacement parameter and offset parameter of each pixel in the encoding block, the encoding side can quantize the second residual block using equation (3) to obtain the first residual block.
[0307] As will be seen, in this feasible form, the encoding side does not need to perform multiplication operations when quantizing the residual values in the second residual block. Compared to conventional techniques, in encoding scenarios where the requirements for quantization granularity are not high, this method significantly reduces the computational load on the encoding side, and thus significantly conserves the computational resources of the encoding side.
[0308] S303, the encoding side encodes the first residual block and obtains the code stream of the block to be encoded.
[0309] The encoding side obtains the first residual block, encodes it, and obtains the encoded code stream of the block to be encoded.
[0310] Preferably, the encoding side encodes the syntactic elements of the block to be encoded, using the QP corresponding to each pixel when quantizing the second residual block and the specific quantization scheme used as syntactic elements of the block to be encoded. The encoding side may also add the encoded syntactic element data to the encoded code stream of the block to be encoded.
[0311] Preferably, the residual scan order in which the encoding side encodes the first residual block may be a target prediction order in which the encoding side predicts pixels within the block to be encoded. Here, the target prediction order corresponds to a target prediction mode for predicting the block to be decoded. For an explanation of the target prediction mode and target prediction order, please refer to the explanation above, and redundant explanations will be omitted here.
[0312] In the embodiments of this application, the specific mode for predicting the blocks to be encoded is not particularly limited. For example, the prediction mode described in Example 1 above can be used to predict the blocks to be encoded, and of course, this does not limit the application to this mode.
[0313] Furthermore, the embodiments of the present application do not specifically limit the encoding scheme used by the encoding side to encode the first residual block and associated syntactic elements, and can, for example, be encoded using the variable code length encoding scheme described in Example 3.
[0314] According to the image coding method described in S301 to S303 above, a quantization processing method is used that can conserve computational resources on the coding side during the image coding process. In other words, the efficiency of the quantization processing process in this image coding method is greatly improved, and therefore, this image coding method greatly improves the coding efficiency of images.
[0315] As shown in Figure 9b, Figure 9b is a schematic flowchart of another image decoding method provided by an embodiment of the present invention. The method shown in Figure 9b includes the following steps:
[0316] S401, the decoding side analyzes the code stream of the block to be decoded and obtains the inverse quantization parameter of each pixel in the block to be decoded and the first residual block of the block to be decoded. Here, the code stream of the block to be decoded may be a code stream received by the decoder from the encoder, or it may be a code stream obtained from another device, such as a storage device, and the present embodiment is not limited to this. Here, the inverse quantization parameter is used to indicate that the decoding side performs inverse quantization on the residual values in the first residual block using the inverse quantization scheme corresponding to that inverse quantization parameter. The inverse quantization parameter may include the quantization parameter QP.
[0317] Specifically, the decoding side analyzes the code stream of the block to be decoded using a decoding scheme corresponding to the encoding side, and obtains the inverse quantization parameter of each pixel in the block to be decoded and the first residual block of the block to be decoded.
[0318] For example, the residual scan order in which the decoding side decodes the code stream of the block to be decoded is the target prediction order for predicting pixels within the block to be decoded. Here, the target prediction order corresponds to the target prediction mode for predicting the block to be decoded. For explanations of the target prediction mode and target prediction order, please refer to the explanation above, and redundant explanations will be omitted here.
[0319] Preferably, the decoding side analyzes the code stream of the block to be decoded using a variable code length decoding method and obtains an encoded code length CL and a first residual block that encode each value in the residual block corresponding to the block to be decoded. Here, the process by which the decoding side analyzes the code stream of the block to be decoded using a variable code length decoding method and obtains the CL for each value in the residual block corresponding to the block to be decoded can be found in the explanation in S601 below. For an explanation of how the decoding side determines the first residual block based on the CL, please refer to the explanation in S602, and redundant explanations will be omitted here.
[0320] Other possible forms of step S401 will be discussed later, but redundant explanations will be omitted here.
[0321] S402, the decoding side dequantizes the first residual block based on the QP indicated by the dequantization parameter of each pixel in the block to be decoded and the dequantization preset array, thereby obtaining the second residual block.
[0322] In the first feasible form, once the decoding side determines, based on the inverse quantization parameter of each pixel in the block to be decoded, that the inverse quantization method of the first residual block and the quantization method described in the first feasible form in S302 are inverse of each other, the explanation of the inverse quantization preset array can be found in the explanation of the inverse quantization preset array in S302, and redundant explanations are omitted here.
[0323] In this case, the decoding side can determine the amplification parameter corresponding to each pixel from the inverse quantization preset array based on the QP of each pixel in the block to be decoded. Then, based on the amplification parameter corresponding to each pixel, the decoding side can perform inverse quantization on the first residual block to obtain the second residual block.
[0324] For example, for any pixel within the block to be decoded, the decoding side can search the inverse quantization preset array based on the QP of that pixel and determine the QP-th value in the inverse quantization preset array as the amplification parameter for that pixel. Then, the decoding side obtains the inversely quantized residual value corresponding to that pixel by multiplying it by the residual value corresponding to that pixel in the first residual block based on the amplification parameter corresponding to that pixel. Once the decoding side has completed the inverse quantization process for all residual values in the first residual block, a second residual block is obtained.
[0325] Preferably, the decoding side can perform multiplication of the residual value and the amplification parameter corresponding to that residual value by determining the amplification parameter corresponding to each pixel in the block to be decoded, and the embodiments of the present application are not limited to this.
[0326] In the second feasible form, once the decoding side determines, based on the inverse quantization parameter of each pixel in the block to be decoded, that the inverse quantization method of the first residual block and the quantization method described in the second feasible form in S302 are inverse of each other, the decoding side can perform the inverse quantization process on each residual value in the first residual block based on equation (2) above to obtain the second residual block.
[0327] In this case, the amplification parameter mult in equation (2) (distinguishable from the amp used in the quantization process described above) is obtained by calculating dequant_scale[QP&0x07], where dequant_scale[QP&0x07] is the QP&0x07th value in the inverse quantization preset array. The displacement parameter shift in equation (2) is obtained by calculating 7-(QP>>3). The offset parameter offset in equation (2) is obtained by calculating (shift==0)?0:(1<(shift-1)).
[0328] In the embodiment of the present invention, when the decoding side implements the inverse quantization process of the first residual block using equation (2), the inverse quantization preset array may be dequant_scal[8]={128,117,107,99,90,83,76,70}.
[0329] Thus, the decoding side calculates the amplification parameter and displacement parameter corresponding to each pixel in the block to be decoded based on the QP of each pixel and the inverse quantization preset array. Then, based on the calculated amplification parameter, displacement parameter, and offset parameter of each pixel in the block to be decoded, the decoding side performs inverse quantization of the first residual block using equation (2) to obtain the second residual block.
[0330] As will be seen, in this feasible form, the decoding side needs to perform up to eight types of multiplication operations when inverse quantizing the residual values in the first residual block. Compared to conventional techniques, this method significantly reduces the computational complexity on the encoding side, and thus significantly conserves the computational resources of the encoding side.
[0331] In the third feasible form, once the decoding side determines, based on the inverse quantization parameter of each pixel in the block to be decoded, that the inverse quantization method of the first residual block and the quantization method described in the third feasible form in S302 are inverse of each other, the decoding side can perform the inverse quantization process on each residual value in the first residual block based on equation (4) to obtain the first residual block.
number
[0332] Here, the explanation of the offset parameter and the displacement parameter shift can be found in the description of the third feasible form in S302, and therefore, redundant explanations are omitted here.
[0333] In this way, the decoding side can determine the displacement parameter of each pixel based on the QP of each pixel in the block to be decoded, and further determine the corresponding offset parameter. Then, based on the determined displacement parameter and offset parameter of each pixel in the block to be decoded, the decoding side can perform inverse quantization of the first residual block using equation (4) to obtain the second residual block.
[0334] As will be seen, in this feasible form, the decoding side does not need to perform a multiplication operation when dequantizing the residual values in the first residual block. Compared to conventional techniques, in encoding scenarios where the requirements for quantization granularity are not high, this method significantly reduces the computational load on the encoding side, that is, it saves a great deal of computational resources on the encoding side.
[0335] Furthermore, the inverse quantization schemes in some of the above feasible forms can be applied to the encoding process (for example, obtaining reconstruction blocks to predict pixels within an image block) and to the decoding process (for decoding image data) on the decoding side, and the embodiments of this application are not limited to these.
[0336] S403, the decoding side reconstructs the block to be decoded based on the second residual block and obtains the reconstructed block.
[0337] Preferably, the decoding side can reconstruct the second residual block as is to obtain the reconstructed block of the block to be decoded. Specifically, the decoding side can reconstruct the block to be decoded as is based on the second residual block and the predicted block of the block to be decoded to obtain the reconstructed block of the block to be decoded. For example, the decoding side can obtain the reconstructed block of the block to be decoded by adding the second residual block and the predicted block of the block to be decoded.
[0338] Here, the predicted block of the block to be decoded can be obtained by the decoder predicting the block to be decoded based on a prediction mode. Preferably, this prediction mode may be obtained by analyzing the code stream of the block to be decoded, and may be, for example, any of the prediction modes in Embodiment 1 above, or it may be any of the prior art prediction modes, and the embodiments of this application are not limited thereto. Furthermore, the process by which the decoder predicts the predicted block of the block to be decoded will not be described in detail here.
[0339] Preferably, the decoding side can predict each pixel in the block to be decoded in the target prediction order corresponding to the target prediction mode, according to the target prediction mode. The decoding side reconstructs the block to be decoded based on the predicted value of each pixel and the second residual block to obtain the reconstructed block.
[0340] Preferably, the decoding side can first inversely transform the second residual block to reconstruct the residual value block of the block to be decoded. In this case, the second residual block is actually the residual coefficient block. Then, the decoding side can reconstruct the block to be decoded based on the reconstructed residual value block and the predicted block of the block to be decoded to obtain the reconstructed block of the block to be decoded. For example, the decoding side can obtain the reconstructed block of the block to be decoded by adding the reconstructed residual value block and the predicted block of the block to be decoded.
[0341] Here, the explanation of the predicted block of the block to be decoded can be found in the explanation above, and redundant explanations are omitted here. Furthermore, in the embodiments of this application, the process by which the decoding side performs inverse transformation on the second residual block is not described in detail.
[0342] Furthermore, the image decoding method shown in Figure 9b corresponds to the image encoding method shown in Figure 9a. Based on the image decoding method described in S401 to S403 above, an inverse quantization processing method is used in the image decoding process that can save computational resources on the decoding side. In other words, the efficiency of the inverse quantization processing process in this image decoding method has been greatly improved, and therefore the image decoding efficiency is greatly improved by this image decoding method.
[0343] Furthermore, in the embodiments of the present application, the specific mode for predicting the block to be decrypted is not particularly limited. For example, the prediction mode described in Example 1 above can be used to predict the block to be decrypted, and of course, this is not a limitation.
[0344] Furthermore, in the embodiments of the present application, the method by which the decoding side decodes the code stream of the block to be decoded is not particularly limited. For example, decoding can be performed using the variable code length decoding method described in Example 3 below, and of course, this is not the only option.
[0345] Next, possible embodiments of step S401 will be described.
[0346] Preferably, the decoding side determines a target prediction mode for predicting pixels within the block to be decoded and an inverse quantization parameter for each pixel within the block to be decoded, based on the code stream of the block to be decoded. Based on the target prediction mode, the decoding side determines a residual scan order corresponding to the target prediction mode. Based on the residual scan order, the decoding side analyzes the code stream of the block to be decoded and obtains a first residual block.
[0347] Here, if the target prediction mode is the first target prediction mode, the residual scan order is the first scan order; if the target prediction mode is the second target prediction mode, the residual scan order is the second scan order, and the first scan order and the second scan order are different.
[0348] The first or second scan sequence described above is a type of residual scan sequence, and the first or second scan sequence corresponds to the target prediction mode described above. For example, the first scan sequence corresponds to the first target prediction mode, and the second scan sequence corresponds to the second target prediction mode. Preferably, the residual scan sequence may be the same as the target prediction sequence described above. The first and second scan sequences described above are used to represent two different scan sequences for different target prediction modes.
[0349] For example, if the image block to be decoded is a 16x2 size image block, and the first target prediction mode is one of the prediction modes shown in Table 1 above, the first scan order may be the order shown by the pre-set trajectory in Figure 7a. If the second target prediction mode is one of the prediction modes shown in Table 2 above, the second scan order may be the order shown by the pre-set trajectory in Figure 7b.
[0350] Furthermore, for example, if the first target prediction mode is one of the prediction modes shown in Table 3-1 above, the first scanning sequence may be the sequence shown by the preset trajectory in Figure 7c-1. If the second target prediction mode is one of the prediction modes shown in Table 4-1 above, the second scanning sequence may be the sequence shown by the preset trajectory in Figure 7d-1.
[0351] As can be seen, the residual scan order corresponding to the target prediction mode differs in different prediction modes.
[0352] Preferably, in addition to the feasible form of step S401 above, when the decoding side determines the target prediction mode, it can analyze the code stream of a first-size decoded block using a third scan order in the target prediction mode. For a second-size decoded block, it can analyze the code stream of a second-size decoded block using a fourth scan order in the target prediction mode.
[0353] Here, the third scan order and the fourth scan order described above are different. The third scan order and the fourth scan order are types of residual scan orders.
[0354] Furthermore, the residual scan sequence indicated by the first scan sequence may be the same as or different from the residual scan sequence indicated by the third scan sequence or the fourth scan sequence. Similarly, the residual scan sequence indicated by the second scan sequence may be the same as or different from the residual scan sequence indicated by the third scan sequence or the fourth scan sequence. Embodiments of the present application are not limited thereto.
[0355] Next, we will explain the selectable implementation forms described above, using the example of a first size being 8 x 1 and a second size being 8 x 2.
[0356] For example, if the target prediction mode is one of the prediction modes shown in Table 3-2 or Table 5, and the block to be decoded is of a first size, the residual scan sequence may be a third scan sequence, such as the scan sequence shown in Figure 7e. If the block to be decoded is of a second size, the residual scan sequence may be a fourth scan sequence, such as the scan sequence shown in Figure 7c-2. Here, the prediction modes shown in Tables 3-2 and 5 can represent two prediction modes of the same target prediction mode but with different sizes.
[0357] Furthermore, for example, if the target prediction mode is one of the prediction modes shown in Table 4-2 or Table 4-3, and the block to be decoded is of a first size, the residual scan sequence may be a third scan sequence, such as the scan sequence shown in Figure 7d-3. If the block to be decoded is of a second size, the residual scan sequence may be a fourth scan sequence, such as the scan sequence shown in Figure 7d-2. Here, the prediction modes shown in Tables 4-2 and 4-3 can represent two prediction modes of the same target prediction mode but with different sizes.
[0358] Example 3 As shown in Figure 10a, Figure 10a is a schematic flowchart of yet another image coding method provided by an embodiment of the present invention. The method shown in Figure 10a includes the following steps.
[0359] S501, the encoding side determines the residual block corresponding to the block to be encoded. Here, this residual block may be the original residual value block of the block to be encoded, or it may be a residual coefficient block obtained by transforming this original residual value block, or this residual block may be a quantized residual block obtained by the encoding side quantizing this residual coefficient block, and is not limited to these.
[0360] Here, the original residual value block of the block to be encoded is the residual block obtained by the encoding side based on the original pixel value of the block to be encoded and the predicted block of the block to be encoded.
[0361] Furthermore, the process by which the encoding side predicts pixels within the block to be encoded and obtains a predicted block can be realized based on the method described in Example 1, and of course, it can be obtained based on any of the prior art methods for obtaining a predicted block of the block to be encoded, and the embodiments of the present invention are not limited thereto.
[0362] The residual coefficient block is a result of the encoding side performing a transformation process on the original residual value block, and the embodiments of this application do not specifically limit the process by which the encoding side performs the transformation process on the original residual value block.
[0363] The process by which the encoding side quantizes the residual coefficient block to obtain the quantized residual block can be realized based on the method described in Example 2, and of course, it can be realized based on any of the prior art methods for quantizing residual blocks, and the embodiments of the present application are not limited thereto.
[0364] To simplify the explanation, the embodiments of this application will be described below using a residual coefficient block, where the residual block is the block to be encoded, as an example.
[0365] S502, The encoding side encodes the residual block of the block to be encoded using a variable code length encoding scheme to obtain the code stream of the block to be encoded.
[0366] Preferably, the variable code length coding scheme can include a variable-order exponential Columbus coding scheme. In this way, the coding side can first determine the attribute type of each pixel in the block to be coded. For the first value corresponding to the third pixel of the block to be coded in the residual block of the block to be coded, the coding side can determine the target order for coding the first value based on the preset policy and the attribute type of the third pixel. The coding side can then code the first value in the residual block of the block to be coded using the target-order exponential Columbus coding algorithm. Once the coding side has coded each value in the residual block of the block to be coded, an coded code stream of the block to be coded can be obtained. Here, the coding side can pre-set the above-mentioned prediction policy to indicate the order used to code the residual values corresponding to pixels of different attribute types. Here, the third pixel represents at least one pixel in the block to be coded.
[0367] It should be understood that the coding rules for exponential Columbus coding schemes of different degrees are different. Referring to Table 6, Table 6 shows the coding rules (including codeword structures and corresponding coding ranges) for exponential Columbus coding schemes when the degree k takes different values. As shown in Table 6, X in the codeword structures shown in Table 6 may be 0 or 1.
[0368] [Table 6]
[0369] Thus, for a first value corresponding to a third pixel of the target block in the residual block of the target block, the encoding side determines the target order for encoding the first value based on the preset policy and the attribute type of the third pixel. Then, based on the target order exponential Columbus coding algorithm and the magnitude of the first value, the encoding side determines a codeword structure for encoding the first value, and can encode the first value with this codeword structure. Similarly, once the encoding side has encoded each value in the residual block of the target block, it obtains the encoded code stream of the target block.
[0370] For example, suppose the encoding side determines the target order for encoding the first value corresponding to the third pixel to be 0, based on the preset policy and the attribute type of the third pixel. Assuming the first value is 2, as shown in Table 6, if the first value falls within the encoding range 1-2, the encoding side can determine the codeword structure for encoding the first value to be 011 (i.e., the codeword structure corresponding to encoding range 1-2 is 01X), based on the zero-order exponential Columbus coding algorithm and the magnitude of the first value. This allows the encoding side to encode the first value with 011. Assuming the first value is 7, as shown in Table 6, if the first value falls within the encoding range 7-14, the encoding side can determine the codeword structure for encoding the first value to be 00010000 (i.e., the codeword structure corresponding to encoding range 7-14 is 0001XXXX), based on the zero-order exponential Columbus coding algorithm and the magnitude of the first value. This allows the encoding side to encode the first value with 00010000. When the encoding side encodes each value in the residual block of the block to be encoded, it obtains the encoded code stream of the block to be encoded.
[0371] Preferably, the variable code length coding scheme may include a preset order exponential Columbus coding scheme. This preset order may be a value set in advance by the coding side, for example, 0 or 1 (i.e., the value of K may be a preset 0 or 1), and the embodiments of this application are not limited thereto.
[0372] As can be seen from Table 6, if the encoding side pre-specifies the order value (i.e., the K value) of the exponential Columbus coding scheme, it is also possible to achieve variable code length coding of residual values within residual blocks (or residual coefficient values within residual coefficient blocks).
[0373] The encoding side can determine the syntactic element corresponding to the residual block after encoding the residual block of the block to be encoded. For example, it should be understood that this syntactic element includes the coded length (CL) that encodes each value in the residual block.
[0374] Preferably, the encoding side can encode CL using the above-mentioned variable-order exponential Columbus coding algorithm to achieve the objective of saving bits, and furthermore, it can achieve the objective of increasing the compression ratio of image coding while simultaneously improving coding efficiency.
[0375] For example, for any value within the residual block of the block to be coded, the coding side can determine the target order for coding that CL based on the CL of that value. Then, the coding side can code the CL using the target order exponential Columbus coding algorithm and add the coded data to the coded code stream of the block to be coded.
[0376] As can be seen, when the encoding side uses a variable-order exponential Columbus coding algorithm to encode the residual block (or the CL of the residual value within the residual block) of the block to be encoded, it can adaptively encode smaller residual values (or CL values) with fewer bits, thus achieving the goal of saving bits. In other words, it is possible to increase the compression ratio of image encoding while simultaneously improving encoding efficiency.
[0377] Preferably, the encoding side 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 encoding side can encode the CL of any of those values using fixed-length coding or truncated unary coding.
[0378] Specifically, if the CL of any of the above values is less than or equal to the threshold, the encoding side encodes the CL of that value using a predetermined number of bits with fixed-length encoding and adds the encoded data to the code stream of the block to be encoded. If the CL of any of the above values is greater than the threshold, the encoding side encodes the CL of that value using truncated unary coding and adds the encoded data to the code stream of the block to be encoded. Note that the embodiments of this application do not limit the specific way in which this threshold is set.
[0379] As an example, taking this threshold as 2, Table 7 shows the codewords obtained by the encoding side encoding CL values of 2 or less with fixed-length 2-bit coding, and Table 7 shows the codewords obtained by the encoding side encoding CL values greater than 2 with truncated unary coding. Here, if the maximum CL value is represented by CLmax, for CL values greater than 2, the codeword CLmax contains CLmax-1 1s, the codeword CLmax-1 contains CLmax-2 1s and 1 0, ..., the codeword CLmax-j contains CLmax-j-1 1s and 1 0, where j is a positive integer.
[0380] [Table 7]
[0381] The encoding side may also use fixed-length coding and truncated unary coding to encode each value in the residual block of the block to be encoded. Specifically, refer to the CL description where the encoding side uses fixed-length coding or truncated unary coding to encode each value in the residual block of the block to be encoded. It should be understood that redundant explanations are omitted here.
[0382] When the encoding side uses fixed-length coding and truncated unary coding to encode CL (or residual values), it can adaptively encode smaller CL values (or residual values) with fewer bits, thus saving bits. In other words, it can achieve the goal of increasing the compression ratio of image coding while simultaneously improving coding efficiency.
[0383] As shown in Figure 10b, Figure 10b is a schematic flowchart of another image decoding method provided by an embodiment of the present invention. The method shown in Figure 10b includes the following steps.
[0384] S601, the decoding side analyzes the code stream of the block to be decoded using a variable code length decoding method and obtains the CL of each value in the residual block corresponding to the block to be decoded.
[0385] Preferably, the variable code length decoding method described above may be a variable-order exponential Columbus decoding method. The decoding side first analyzes the target order for decoding the code stream of the block to be decoded from the code stream, and then analyzes the code stream of the block to be decoded using the target-order exponential Columbus decoding algorithm to obtain the CL of each value in the residual block of the block to be decoded.
[0386] Here, the variable-order exponential Columbus decoding scheme can be explained by referring to the above explanation of the variable-order exponential Columbus coding scheme. Since the coding process is understood to be the inverse operation of the decoding process, redundant explanations are omitted here.
[0387] Preferably, the variable code length decoding method described above may be a preset-order exponential Columbus decoding method. In this case, the decoding side can analyze the code stream of the block to be decoded using a preset-order exponential Columbus decoding algorithm and obtain the CL of each value in the residual block of the block to be decoded.
[0388] Preferably, if the number of bits in the CL for encoding any value in the residual block of the block to be decoded is a predetermined number, the decoder can also parse the code stream of the block to be decoded based on a fixed-length decoding policy in order to obtain the CL for encoding any value in the residual block of the block to be decoded. Furthermore, if the number of bits in the CL for encoding any value in the residual block of the block to be decoded is greater than the predetermined number, the decoder can parse the code stream of the block to be decoded based on a truncated unary coding rule to obtain the CL for encoding any value. Here, a specific explanation can be found in the above-mentioned explanation of the encoding of the CL based on fixed-length coding and truncated unary coding by the encoding side. Since the decoding process is understood to be the inverse operation of the coding process, redundant explanations are omitted here.
[0389] S602, The decoding side determines the residual block of the block to be decoded based on the CL obtained above.
[0390] The encoding side determines the CL for each value in the residual block of the block to be decoded, and then determines the number of bits to encode each value in the residual block. In this way, the decoding side can determine the set of bits corresponding to each pixel in the code stream of the block to be decoded based on the CL for encoding each value, and then determine the target order for analyzing each set of bits.
[0391] In one possible case, the decoder can first determine the attribute type of each pixel in the decoded block after analyzing the CL of each value in the residual block of the decoded block. Then, for the first set of bits corresponding to a third pixel in the decoded block, the decoder can determine the target order for analyzing the first set of bits based on the preset policy and the attribute type of the third pixel. In another possible case, if the decoder has preset orders for the bit sets corresponding to each pixel in the decoded block, the decoder determines the preset order for the bit sets corresponding to each pixel in the decoded block as the target order for each bit set. For example, the attribute type of a pixel may include whether or not the pixel has a symbol, the number of bits in the pixel, the format information of the pixel, etc.
[0392] Then, the decoding side uses an exponential Columbus decoding algorithm of the target order to analyze the set of bits corresponding to each pixel in the block to be decoded, thereby obtaining the residual value of each pixel and obtaining the residual block of the block to be decoded.
[0393] It is understood that the order in which the decoding side obtains residual values in the residual block based on its analysis of the code stream of the block to be decoded is the same as the order in which the encoding side encodes the residual values in the residual block.
[0394] S603, the decryption side reconstructs the target block based on the residual block of the target block and obtains the reconstructed block.
[0395] Preferably, if the residual block of the block to be decoded is a residual coefficient block, the decoding end can sequentially perform inverse quantization and inverse transformation on the residual block of the block to be decoded in order to obtain the reconstructed residual value block of the block to be decoded. Then, the decoding side can reconstruct the block to be decoded based on the reconstructed residual value block to obtain the reconstructed block. For example, the decoding side can obtain the reconstructed block of the block to be decoded by adding the reconstructed residual value block and the predicted block of the block to be decoded.
[0396] Preferably, if the residual block of the block to be decoded is a residual value block, the decoding end can dequantize the residual block of the block to be decoded in order to obtain the reconstructed residual value block of the block to be decoded. Then, the decoding side can reconstruct the block to be decoded based on the reconstructed residual value block to obtain the reconstructed block. For example, the decoding side can obtain the reconstructed block of the block to be decoded by adding the reconstructed residual value block and the predicted block of the block to be decoded.
[0397] Preferably, the decoding side may also determine a target prediction mode for predicting pixels within the block to be decoded, based on the code stream of the block to be decoded. Based on the target prediction mode, the decoding side determines a target prediction order corresponding to the target prediction mode. The decoding side predicts each pixel within the block to be decoded in the target prediction order according to the target prediction mode. The decoding end reconstructs the decoded block based on the predicted values of each pixel within the block to be decoded and the residual block to obtain a reconstructed block. Specifically, details of any of the embodiments described above can be found in the description of Example 1, and redundant explanations are omitted here.
[0398] Here, the predicted block of the block to be decoded may be obtained by predicting the decoded block based on a prediction mode, and the prediction mode may be obtained by the decoding end analyzing the code stream of the target block. Preferably, the prediction mode may be any of the prediction modes of Embodiment 1, or any of the prediction modes of the prior art, and the embodiments of the present application are not limited thereto. Note that the process by which the decoding side predicts the predicted block of the block to be decoded will not be described in detail here.
[0399] Here, the process by which the decoding end dequantizes the residual block of the decoded block can dequantize the residual block based on the dequantization parameters and dequantization preset array of each pixel in the decoded block obtained by analyzing the code stream of the decoded block. Specifically, this can be achieved based on the method in Example 2, and of course, it can be achieved based on any method that can achieve dequantization of residual blocks in the prior art, and the embodiments of this application are not limited thereto.
[0400] Furthermore, since the image decoding method shown in Figure 10b corresponds to the image encoding method shown in Figure 10a, this method can achieve the objective of increasing the compression ratio of image encoding while simultaneously improving decoding efficiency.
[0401] Furthermore, the variable code length encoding / decoding method provided in Example 3 can also be applied to Examples 1 and 2, or to any scene where image encoding / decoding is required, and the embodiments of the present application are not limited thereto.
[0402] To realize the functions described in the above embodiments, it is understood that the encoding side / decoding side comprises hardware structures and / or software modules for performing their respective functions. Those skilled in the art will readily recognize that the combined means and method steps described in the embodiments disclosed herein are implemented in hardware or in a combination of hardware and computer software. Depending on the specific application scenario and design constraints of the technical means, the functions are performed by driving hardware with hardware or with computer software.
[0403] The decoding and encoding devices provided by embodiments of the present application will be described below.
[0404] In one example, any of the decoding devices provided by the embodiments of this application may be the target device 12 or decoder 122 in Figure 1. In another example, any of the encoding devices provided below may be the source device 11 or encoder 112 in Figure 1. They will be described together here, but redundant explanations will be omitted below.
[0405] Figure 11 is a schematic diagram of the structure of a decoding device 1100 provided by an embodiment of the present invention, and all embodiments of the decoding method described above can be performed by the decoding device 1100. The decoding device 1100 comprises an analysis means 1101, a determination means 1102, a prediction means 1103, and a reconstruction means 1104. Here, the analysis means 1101 is used to analyze the code stream of the block to be decoded and to determine a target prediction mode for predicting pixels within the block to be decoded. The determination means 1102 is used to determine a target prediction order corresponding to the target prediction mode based on the target prediction mode. The prediction means 1103 is used to predict each pixel within the block to be decoded in a target prediction order corresponding to the determined target prediction mode. The reconstruction means 1104 is used to reconstruct each pixel based on the predicted value of each pixel within the block to be decoded and to obtain a reconstructed block of the block to be decoded.
[0406] In one example, the analysis means 1101 may be implemented by the code stream analysis means 301 in Figure 5. The determination means 1102 and prediction means 1103 are implemented by the prediction processing means 304 in Figure 5, and the reconstruction means 1104 is implemented by the reconstruction means 305 in Figure 5. The encoded bitstream in Figure 5 may be the code stream of the decoded block in the embodiment of the present invention.
[0407] For a more detailed explanation of the analysis means 1101, determination means 1102, prediction means 1103, and reconstruction means 1104, as well as a more detailed explanation of their respective technical features and a description of beneficial effects, please refer to the corresponding embodiment of the method described above, and redundant explanations will be omitted here.
[0408] In one possible design configuration, the prediction means 1103, specifically, predicts any pixel in the decoded block in the target prediction order, where the pixels for predicting any pixel have already been reconstructed.
[0409] In another possible design configuration, the prediction means 1103 is used to predict each pixel in the decoded block dot by dot along the direction indicated by the target prediction order, in accordance with the target prediction mode, when the target prediction mode instructs to predict each pixel in the decoded block dot by dot in the target prediction order. Here, if the target prediction mode is a first target prediction mode, the target prediction order is a first prediction order, and if the target prediction mode is a second target prediction mode, the target prediction order is a second prediction order, and the first and second prediction orders are different.
[0410] In another possible design configuration, for a first size of decryption target block, the prediction means 1103 is specifically used to predict the decryption block in a third prediction order in the target prediction mode, and for a second size of decryption target block, the prediction means 1103 is specifically used to predict the decryption block in a fourth prediction order in the target prediction mode, although the third and fourth prediction orders are different.
[0411] In yet another possible design configuration, if the target prediction mode instructs sequentially to predict the pixels of each subblock in the decoded block as subblock units having a preset size within the decoded block, the prediction means 1103 is specifically used to sequentially predict the pixels in each subblock in the decoded block in the direction indicated by the target prediction order, according to the target prediction mode.
[0412] In yet another possible design configuration, the target prediction mode includes a prediction mode for each subblock in the block to be decoded, where for a first subblock in the block to be decoded, if the first subblock contains a first pixel and a second pixel, the prediction mode for the first subblock is used to predict the first and second pixels in parallel based on the reconstructed pixels surrounding the first subblock.
[0413] In yet another possible design configuration, the reconstruction means 1104 comprises an inverse quantization subunit and a reconstruction subunit. Here, the inverse quantization subunit is used to obtain a second residual block by inverse quantizing the first residual block of the decoded block obtained by analyzing the code stream of the decoded block, based on the inverse quantization parameters and inverse quantization preset array of each pixel in the decoded block obtained by analyzing the code stream of the decoded block. The reconstruction subunit is used to reconstruct each pixel based on the predicted value of each pixel and the second residual block, and to obtain a reconstructed block.
[0414] In yet another possible design configuration, the inverse quantization subunit is specifically used to analyze the code stream of the block to be decoded using a variable code length decoding scheme to obtain an encoded code length CL and a first residual block that encode each value of the residual block corresponding to the block to be decoded.
[0415] For a detailed explanation of the other possible design configurations described above, a more detailed explanation of their respective technical characteristics, and a description of their beneficial effects, please refer to the corresponding section on the embodiment of the method described above; redundant explanations are omitted here.
[0416] Figure 12 is a schematic diagram of the structure of an encoding device 1200 provided by an embodiment of the present invention, and all embodiments of the above encoding method can be performed by this encoding device 1200. The encoding device 1200 comprises a determination means 1201, a prediction means 1202, and an encoding means 1203. Here, the determination means 1201 is used to determine the target prediction mode of the block to be encoded and to determine the target prediction order corresponding to the target prediction mode. The prediction means 1202 is used to predict each pixel in the block to be encoded in the target prediction order according to the target prediction mode. The determination means 1201 is also used to determine the residual block of the block to be encoded based on the predicted value of each pixel. The encoding means 1203 is used to encode the residual block in the target prediction order to obtain a code stream of the block to be encoded.
[0417] In one example, the determination means 1201 and the prediction means 1202 can be implemented by the prediction processing means 201 in Figure 2. The determination means 1201 can be implemented by the residual calculation means 202 in Figure 2. The encoding means 1203 can be implemented by the encoding means 205 in Figure 2. The encoding target block in Figure 2 may be the encoding target block in the embodiment of the present invention.
[0418] For a more detailed explanation of the determination means 1201, prediction means 1202, and encoding means 1203, as well as a more detailed explanation of their respective technical features and a description of beneficial effects, refer to the corresponding embodiment of the method described above, and redundant explanations will be omitted here.
[0419] Figure 13 is a schematic diagram of the structure of a decoding device 1300 provided by an embodiment of the present invention, and all embodiments of the decoding method described above can be performed by the decoding device 1300. The decoding device 1300 comprises an analysis means 1301, an inverse quantization means 1302, and a reconstruction means 1303. Here, the analysis means 1301 is also used to analyze the code stream of the block to be decoded and 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. The inverse quantization means 1302 is also used to inverse quantize the first residual block based on the QP and quantization preset array indicated by the inverse quantization parameter of each pixel and to obtain a second residual block. The reconstruction means 1303 is also used to reconstruct the decoded block based on the second residual block and to obtain a reconstructed block.
[0420] In one example, the analysis means 1301 can be implemented by the code stream analysis means 301 in Figure 5. The inverse quantization means 1302 can be implemented by the inverse quantization means 302 in Figure 5. The reconstruction means 1303 can be implemented by the reconstruction means 305 in Figure 5. The encoded bitstream in Figure 5 may be the code stream of the decoded block in the embodiment of the present invention.
[0421] For a more detailed explanation of the analysis means 1301, the inverse quantization means 1302, and the reconstruction means 1303, as well as a more detailed explanation of their respective technical features and a description of beneficial effects, please refer to the corresponding embodiment of the method described above. Therefore, redundant explanations are omitted here.
[0422] In one possible design configuration, the analysis means 1301 is specifically used to determine a target prediction mode for predicting pixels within a block to be decoded and an inverse quantization parameter for each pixel within the block to be decoded, based on the code stream of the block to be decoded, and to determine a residual scan order corresponding to the target prediction mode based on the target prediction mode. Here, if the target prediction mode is a first target prediction mode, the residual scan order is a first scan order, and if the target prediction mode is a second target prediction mode, the residual scan order is a second scan order, and the first scan order and the second scan order are different. The code stream of the block to be decoded is analyzed based on the residual scan order to obtain a first residual block.
[0423] In another possible design configuration, for a first-size decryption target block, the analysis means 1301 analyzes the code stream of the decryption target block using a third scan order in target prediction mode, and for a second-size decryption target block, the analysis means 1301 analyzes the code stream of the decryption target block using a fourth scan order in target prediction mode, where the third scan order and the fourth scan order are different.
[0424] In another possible design configuration, in the inverse quantization preset array, the interval between adjacent digits is 1 for digits 1 through n, the interval between adjacent digits is 2 for digits n+1 through n+m, and the numerical interval between adjacent digits is 2 for digits n+k*m+1 through n+k*m+m. k+1 The equation is given, where n and m are integers greater than 1, and k is a positive integer.
[0425] In yet another possible design configuration, the inverse quantization means 1302 is specifically used to determine the amplification parameter corresponding to each pixel in the inverse quantization preset array based on the QP of each pixel, and to perform an inverse quantization operation on the first residual block based on the amplification parameter corresponding to each pixel to obtain the second residual block.
[0426] In yet another possible design configuration, the inverse quantization means 1302 is specifically used to determine the amplification parameter and displacement parameter corresponding to each pixel based on the QP of each pixel and the inverse quantization preset array, where the value of the amplification parameter corresponding to each pixel is the value in the inverse quantization preset array obtained by logically ANDing the QP of each pixel with 7, and the value of the displacement parameter corresponding to each pixel is obtained by 2... 3 The difference is obtained by dividing by , and the first residual block is inversely quantized based on the amplification and displacement parameters corresponding to each pixel to obtain the second residual block.
[0427] In yet another possible design configuration, the reconstruction means 1303 is specifically used to inversely transform the second residual block to reconstruct the residual value block of the block to be decoded, to reconstruct the decoded block based on the residual value block, and to obtain the reconstructed block.
[0428] In yet another possible design configuration, the reconstruction means 1303 is specifically used to predict each pixel in the decoded block in a target prediction order corresponding to the target prediction mode, according to the target prediction mode, to reconstruct the decoded block based on the predicted value of each pixel and the second residual block, and to obtain the reconstructed block.
[0429] In yet another possible design configuration, the analysis means 1301 is specifically used to analyze the code stream of the block to be decoded using a variable code length decoding scheme, and to obtain an encoded code length CL and a first residual block that encode each value in the residual block corresponding to the block to be encoded.
[0430] Detailed descriptions of the possible design configurations described above, as well as more detailed descriptions of their respective technical features and beneficial effects, can be found in the corresponding sections on the embodiments of the methods described above; therefore, redundant explanations are omitted here.
[0431] Figure 14 is a schematic diagram of the structure of an encoding device 1400 provided by an embodiment of the present invention, and all embodiments of the encoding method can be performed by the encoding device 1400. The encoding device 1400 comprises a determination means 1401, a quantization means 1402, and an encoding means 1403. Here, the determination means 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 means 1402 is used to quantize the second residual block based on the QP of each pixel and a quantization preset array to obtain the first residual block. The encoding means 1403 is used to encode the first residual block and obtain the code stream of the block to be encoded.
[0432] For example, the determination means 1401 can be implemented by the residual calculation means 202 in Figure 2, or by a combination of the residual calculation means 202 and the residual conversion means 203 in Figure 2. The quantization means 1402 can be implemented by the quantization means 204 in Figure 2. The encoding means 1403 can be implemented by the encoding means 205 in Figure 2. The encoding target block in Figure 2 may be the encoding target block in the embodiment of the present invention.
[0433] For a more detailed explanation of the determination means 1401, the quantization means 1402, and the encoding means 1403, as well as a more detailed explanation of their respective technical features and a description of beneficial effects, refer to the corresponding embodiment of the method described above, and redundant explanations will be omitted here.
[0434] Figure 15 is a schematic diagram of the structure of an encoding device 1500 provided by an embodiment of the present invention, and all embodiments of the encoding method can be performed by the encoding device 1500. The encoding device 1500 comprises a determination means 1501 and an encoding means 1502. Here, the determination means 1501 is used to determine the residual block corresponding to the block to be encoded. The encoding means 1502 is used to encode the residual block using a variable code length encoding scheme and to obtain a code stream of the block to be encoded.
[0435] For example, the determination means 1501 can be implemented by the residual calculation means 202 in Figure 2, or by a combination of the residual calculation means 202 and the residual conversion means 203 in Figure 2, or by a combination of the residual calculation means 202, the residual conversion means 203, and the quantization means 204 in Figure 2. The encoding means 1502 can be implemented by the encoding means 205 in Figure 2. The encoding target block in Figure 2 may be the encoding target block in the embodiment of the present invention.
[0436] For a more detailed explanation of the determination means 1501 and the encoding means 1502, as well as a more detailed explanation of their respective technical features and a description of beneficial effects, please refer to the corresponding embodiment of the method described above. Therefore, redundant explanations are omitted here.
[0437] Figure 16 is a schematic diagram of the structure of a decoding device 1600 provided by an embodiment of the present invention, and all embodiments of the decoding method described above can be performed by the decoding device 1600. The decoding device 1600 comprises an analysis means 1601, a determination means 1602, and a reconstruction means 1603. Here, the analysis means 1601 is used to analyze the code stream of the block to be decoded using a variable code length decoding scheme and to obtain an encoded code length CL that encodes each value in the residual block corresponding to the block to be decoded. The determination means 1602 is used to determine the residual block of the block to be decoded based on the CL of each encoded value. The reconstruction means 1603 is used to reconstruct the decoded block based on the residual block of the block to be decoded and to obtain a reconstructed block.
[0438] For example, the analysis means 1601 can be implemented by the code stream analysis means 301 in Figure 5. The determination means 1602 can be implemented by the inverse quantization means 302 in Figure 5, or by a combination of the inverse quantization means 302 and the residual inverse transform means 303 in Figure 5. The reconstruction means 1603 can be implemented by the reconstruction means 305 in Figure 5. The encoded bitstream in Figure 5 may be the code stream of the decoded block in the embodiment of the present invention.
[0439] For a more detailed explanation of the analysis means 1601, the determination means 1602, and the reconstruction means 1603, as well as a more detailed explanation of their respective technical features and a description of beneficial effects, refer to the corresponding embodiment of the method described above, and redundant explanations will be omitted here.
[0440] In one possible design configuration, if the variable code length decoding scheme includes a variable-order or preset-order exponential Columbus decoding scheme, the analysis means 1601 is specifically used to determine the target order when analyzing the CL for encoding each value in the residual block, to analyze the code stream using the target-order exponential Columbus decoding algorithm, and to obtain the CL for encoding each value in the residual block.
[0441] In another possible design configuration, the analysis means 1601 is used to analyze the code stream based on a fixed-length decoding policy to obtain a CL for encoding any of the values in the residual block if the number of bits in the CL for encoding any of the values in the residual block is a preset number, and to analyze the code stream based on a truncated unary coding rule to obtain a CL for encoding any of the values if the number of bits in the CL for encoding any of the values in the residual block is greater than the preset number.
[0442] In another possible design configuration, the determination means 1602 is used to determine a set of bits corresponding to each pixel in the decoded block from the code stream based on a CL for encoding each value, to determine the attribute type of each pixel in the decoded block, to determine the target order for analyzing the first set of bits corresponding to a third pixel in the decoded block based on a preset policy and the attribute type of the third pixel, and to analyze the first set of bits using an exponential Columbus decoding algorithm of the target order to obtain the residual block.
[0443] In further possible design configurations, the determination means 1602 is used to determine a set of bits corresponding to each pixel in the decoded block from the code stream based on the CL for encoding each of the above values, and to analyze the first set of bits corresponding to the third pixel in the decoded block using a preset-order exponential Columbus decoding algorithm to obtain the residual block.
[0444] In further possible design configurations, the reconstruction means 1603 is specifically used to reconstruct the residual value block of the decoded target block by performing inverse quantization and inverse transformation on the residual block, or by inverse quantization of the residual block, to reconstruct the decoded target block based on the residual value block, and to obtain the reconstructed block.
[0445] In further possible design configurations, the reconstruction means 1603 is used to determine a target prediction mode for predicting pixels within a block to be decoded based on the code stream of the block to be decoded, to determine a target prediction order corresponding to the target prediction mode based on the target prediction mode, to predict each pixel within the block to be decoded in the target prediction order according to the target prediction mode, and to reconstruct the block to be decoded based on the predicted values of each pixel within the block to be decoded and the residual block, thereby obtaining a reconstructed block.
[0446] In further possible design configurations, the reconstruction means 1603 is specifically used to dequantize the residual blocks based on the dequantization parameters and dequantization preset arrays of each pixel in the decoded block obtained by analyzing the code stream of the decoded block.
[0447] Detailed descriptions of the possible design configurations described above, as well as more detailed descriptions of their respective technical features and beneficial effects, can be found in the corresponding sections on the embodiments of the methods described above; therefore, redundant explanations are omitted here.
[0448] The present invention further provides an electronic device for performing any of the above embodiments of the image encoding / decoding method. As shown in Figure 17, Figure 17 is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention, the electronic device comprising a processor 1701 and a communication interface 1702. The processor 1701 and the communication interface 1702 are coupled to each other. The communication interface 1702 is understood to be a transceiver or an input / output interface.
[0449] In one example, the electronic device 1700 further includes a memory 1703, which is used to store instructions executed by the processor 1701, or input data necessary for the processor 1701 to execute the instructions, or data generated after the processor 1701 has executed the instructions.
[0450] In the embodiments of this application, the specific connection medium between the communication interface 1702, the processor 1701, and the memory 1703 is not limited. In the embodiments of this application, in Figure 17, the communication interface 1702, the processor 1701, and the memory 1703 are connected via a bus 1704, which is shown as a thick line in Figure 17. The connection configurations between other components are described in general terms and are not limited. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For the sake of visual convenience, the bus is shown as a single thick line in the figure, but this does not mean that there is only one bus or only one type of bus.
[0451] Memory 1703 can be used to store software programs and modules, such as program instructions / modules corresponding to the image decoding method or image encoding method provided by embodiments of the present invention. The processor 1701 executes various functional applications and data processing to implement any of the image decoding methods or image encoding methods by executing the software programs and modules stored in memory 1703. The communication interface 1702 can be used to signal or communicate data with other devices. In this application, the electronic device 1700 may include a plurality of communication interfaces 1702.
[0452] The processor in the embodiments of this application may be a central processing unit (CPU), a neural processing unit (NPU), or a graphics processing unit (GPU), and may also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field programmable gate arrays (FPGAs), or other programmable logic devices, transistor logic devices, hardware, or combinations thereof. The general-purpose processor may be a microprocessor or a conventional processor.
[0453] The steps of the method in embodiments of the present invention may be implemented by hardware, or by a processor executing software instructions. The software instructions consist of corresponding software blocks, which may be stored in random access memory (RAM), flash memory, read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), registers, hard disks, mobile hard disks, CD-ROMs, or any other form of storage medium known in the art. Exemplarily, the storage medium is coupled to the processor so that the processor can read information from and write information to the storage medium. Of course, the storage medium may be a component of the processor. The processor and storage medium may reside in an ASIC. Furthermore, the ASIC may reside in a network device or terminal device. Of course, the processor and storage medium may reside as separate components in a network device or terminal device.
[0454] The present invention further provides a computer-readable storage medium in which a computer program or instruction is stored, and when the computer program or instruction is executed by a processor, any embodiment of the image encoding / decoding method described above is realized.
[0455] The present invention further provides an image coding and decoding system comprising an coding side and a decoding side, wherein the coding side is used to perform any of the above-described image coding methods, and the decoding side is used to perform the corresponding image coding method.
[0456] In the embodiments described above, all or part of the implementation can be achieved by software, hardware, firmware, or any combination thereof. When implemented by software, all or part of the implementation can be achieved in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the process or function described in the embodiments of this application is generated. The computer can be a general-purpose computer, a dedicated computer, a computer network, or other programmable device. The computer instructions 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 instructions can be transmitted from a website, computer, server, or data center to another website, computer, server, or data center via wired or wireless means. The computer-readable storage medium can be any available medium accessible by a computer, or a data storage device such as a server or data center that comprises one or more available media. The above-mentioned usable media may include, for example, magnetic media such as floppy disks, hard disks, and magnetic tapes; optical media such as digital video discs (DVDs); or semiconductor media such as solid state drives (SSDs).
[0457] In each embodiment of the present application, unless there is a specific conflict of description and logic, the terminology and / or descriptions between different embodiments are consistent and can refer to one another, and the technical features in different embodiments can be combined based on their underlying logical relationships to form new embodiments.
[0458] The various numerical designations in the embodiments of this application are for illustrative purposes only and are not intended to limit the scope of the embodiments. The magnitude of the sequence numbers of the processes described above does not indicate the order of execution, and the execution order of each process must be determined by its function and inherent logic. The above description is merely a preferred embodiment of this application and does not limit it. Any amendments, equivalent substitutions, modifications, etc., made within the spirit and principles of this application shall all be included within the scope of protection.
Claims
1. Based on the code stream of the block to be decoded, a target prediction mode for predicting the pixels of the block to be decoded and the inverse quantization parameter for each pixel within the block to be decoded are determined. The method involves determining a residual scan order corresponding to a target prediction mode based on the target prediction mode, wherein if the target prediction mode is a first target prediction mode, the residual scan order is the first scan order, and if the target prediction mode is a second target prediction mode, the residual scan order is the second scan order, and the first scan order and the second scan order are different. Based on the residual scanning order, the code stream of the block to be decoded is analyzed to obtain the first residual block. 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. This includes reconstructing the decoded block based on the second residual block and obtaining a reconstructed block, An image decoding method characterized by the following features.
2. For the first size of the decryption target block, the code stream of the decryption target block is analyzed using the third scan order in the target prediction mode, and for the second size of the decryption target block, the code stream of the decryption target block is analyzed using the fourth scan order in the target prediction mode. The third scan order and the fourth scan order are different, The image decoding method according to claim 1, characterized in that
3. The code stream of the block to be decoded is analyzed to determine the target prediction mode for predicting the pixels of the block to be decoded, Based on the target prediction mode, the target prediction order corresponding to the target prediction mode is determined, The method further includes predicting each pixel in the decoded block in the target prediction order according to the target prediction mode, The image decoding method according to claim 1, characterized in that
4. When predicting any pixel within the decoded block in the target prediction order, the pixels have already been reconstructed in order to predict any of the pixels. The image decoding method according to claim 3, characterized in that
5. If the target prediction mode instructs to predict each pixel in the decoded block in the target prediction order, then predicting each pixel in the decoded block in the target prediction order according to the target prediction mode is: This includes predicting each pixel in the decoded block dot by dot along the direction indicated by the target prediction order, in accordance with the target prediction mode, wherein if the target prediction mode is a first target prediction mode, the target prediction order is a first prediction order, and if the target prediction mode is a second target prediction mode, the target prediction order is a second prediction order. The first prediction order and the second prediction order are different, The image decoding method according to claim 4, characterized in that
6. For the first size of the decryption target block, the decryption target block is predicted using the third prediction order in the target prediction mode, and for the second size of the decryption target block, the decryption target block is predicted using the fourth prediction order in the target prediction mode, and the third prediction order and the fourth prediction order are different. The image decoding method according to claim 5, characterized in that
7. If the target prediction mode instructs to sequentially predict the pixels within each subblock in the decoded block, using the preset-size subblocks within the decoded block as units, then predicting each pixel within the decoded block in the target prediction order according to the target prediction mode is: This includes sequentially predicting the pixels within each subblock in the decoded block in the direction indicated by the target prediction order, according to the target prediction mode. The image decoding method according to claim 4, characterized in that
8. The target prediction mode includes a prediction mode for each subblock in the decoded block, and for a first subblock in the decoded block, if the first subblock contains a first pixel and a second pixel, the prediction mode for the first subblock is used to predict the first pixel and the second pixel in parallel based on the reconstructed pixels surrounding the first subblock. The image decoding method according to claim 7, characterized in that
9. Analyzing the code stream of the aforementioned decryption target block is: This includes analyzing the code stream of the block to be decoded using a variable code length decoding method to obtain an encoded code length CL and the first residual block for encoding each value in the first residual block corresponding to the block to be decoded, The image decoding method according to any one of claims 1 to 8, characterized in that
10. The residual scanning order and the target prediction order are the same. The image decoding method according to any one of claims 3 to 8, characterized in that
11. The aforementioned target prediction mode includes at least one prediction method from among the following: a T prediction method using vertical prediction, a TB prediction method using vertical average prediction, an L prediction method using horizontal prediction, and an RL prediction method using horizontal average prediction. The image decoding method according to any one of claims 1 to 8, characterized in that
12. Determining the second residual block of the block to be encoded and the quantization parameter QP of each pixel within the block to be encoded, Based on the QP of each pixel and the quantization preset array, the second residual block is quantized to obtain the first residual block. Determining the target prediction mode for the aforementioned block to be coded, The method involves determining a residual scan order corresponding to a target prediction mode based on the target prediction mode, wherein if the target prediction mode is a first target prediction mode, the residual scan order is the first scan order, and if the target prediction mode is a second target prediction mode, the residual scan order is the second scan order, and the first scan order and the second scan order are different. This includes encoding the first residual block in the residual scan order to obtain a code stream of the block to be encoded, An image encoding method characterized by the following features.
13. An image decoding apparatus comprising a determination means, an analysis means, an inverse quantization means, and a reconstruction means, The determination means is used to determine a target prediction mode for predicting the pixels of the block to be decoded and an inverse quantization parameter for each pixel in the block to be decoded, based on the code stream of the block to be decoded, and to determine a residual scan order corresponding to the target prediction mode based on the target prediction mode, wherein if the target prediction mode is a first target prediction mode, the residual scan order is a first scan order, and if the target prediction mode is a second target prediction mode, the residual scan order is a second scan order, and the first scan order and the second scan order are different. The analysis means is used to analyze the code stream of the blocks to be decoded based on the residual scanning order and to obtain a first residual block. The inverse quantization means is used to inverse quantize the first residual block and obtain a second residual block based on the QP indicated by the inverse quantization parameter of each pixel and the inverse quantization preset array. The reconstruction means is used to reconstruct the decoded block based on the second residual block and obtain a reconstructed block. An image decoding device characterized by the following features.
14. An image coding apparatus comprising a determination means, a quantization means, and an encoding means, The determination means 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 means is used to quantize the second residual block based on the QP of each pixel and the quantization preset array to obtain the first residual block. The determination means is further used to determine the target prediction mode of the block to be encoded, and to determine the residual scan order corresponding to the target prediction mode based on the target prediction mode, wherein if the target prediction mode is a first target prediction mode, the residual scan order is a first scan order, and if the target prediction mode is a second target prediction mode, the residual scan order is a second scan order, and is different from the first scan order and the second scan order. The encoding means is used to encode the first residual block in residual scan order to obtain a code stream of the block to be encoded. An image coding device characterized by the following features.
15. An electronic device comprising a processor and 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 in order to implement the image decoding method according to any one of claims 1 to 8 or the image encoding method according to claim 12. An electronic device characterized by the following features.
16. A computer-readable storage medium, wherein a computer program or instruction is stored in the computer-readable storage medium, and when the computer program or instruction is executed by a processor, an image decoding method according to any one of claims 1 to 8 or an image encoding method according to claim 12 is realized. A computer-readable storage medium characterized by the following features.