With the increase in people's demands for video display quality, new video application forms such as high-definition and ultra-high-definition videos have emerged in response. The next generation video coding standard H.266/Versatile Video Coding (VVC) has been established by the Joint Video Exploration Team (JVET) of International Organization for Standardization (ISO)/International Electrotechnical Commission (IEC) and International Telecommunication Union Telecommunication Standardization Sector (ITU-T).
Inter-color component prediction technology is included in the H.266/VVC. However, there is a large deviation between prediction values of blocks to be coded calculated using the inter-color component prediction technology in the H.266/VVC and original values, which leads to low prediction accuracy, resulting in a decrease in the quality of decoded videos and reducing coding performance.
To solve the above technical problems, embodiments of the present disclosure provide encoding and decoding methods and apparatuses, an encoding device, a decoding device, and a storage medium.
In a first aspect, an embodiment of the present disclosure provides a decoding method, which includes following operations. A bitstream is decoded to determine a first control parameter of a current block. A reference sample value of a first color component of the current block is determined. A weighting coefficient is determined according to the reference sample value of the first color component of the current block and the first control parameter. A prediction value of a second color component of the current block is determined according to the weighting coefficient and a reference sample value of the second color component of the current block. A reconstruction value of a second color component sampling point of the current block is determined according to the prediction value of the second color component of the current block.
In a second aspect, an embodiment of the present disclosure provides an encoding method, which includes the following operations. First control parameter candidates for a current block are determined. A reference sample value of a first color component of the current block is determined. A weighting coefficient is determined according to the reference sample value of the first color component of the current block and a candidate value of the first control parameter candidates. A prediction value of a second color component of the current block is determined according to the weighting coefficient and a reference sample value of the second color component of the current block. A reference value of a prediction difference of the second color component of the current block is determined according to the prediction value and an original value of the second color component of the current block. A first control parameter of the current block is determined according to the reference value of the prediction difference of the second color component of the current block. The first control parameter of the current block is encoded to write obtained encoded bits into a bitstream.
In a third aspect, there is provided a decoder, including: a memory and a processor, wherein the memory stores a computer program executable on the processor, and the processor is configured to execute the computer program to perform operations of: decoding a bitstream to determine a first control parameter of a current block; determining a reference sample value of a first color component of the current block; determining a weighting coefficient according to the reference sample value of the first color component of the current block and the first control parameter; determining, according to the weighting coefficient and a reference sample value of a second color component of the current block, a prediction value of the second color component of the current block; and determining, according to the prediction value of the second color component of the current block, a reconstruction value of a second color component sampling point of the current block.
In order to understand characteristics and technical contents of the embodiments of the disclosure more thoroughly, implementations of the embodiments of the disclosure would be described in detail below with reference to the drawings. The drawings are provided for the purpose of reference and illustration only, and are not intended to limit the embodiments of the disclosure.
Unless otherwise defined, all technical and scientific terms used here have the same meaning as usually understood by technicians in the technical field to which the disclosure belongs. The terms used here are only for the purpose of describing the embodiments of the disclosure, and are not intended to limit the disclosure.
In the following descriptions, reference is made to “some embodiments” which describe a subset of all possible embodiments. However, it may be understood that “some embodiments” may be the same or different subsets of all possible embodiments, and may be combined with each other without conflict. It should also be noted that terms “first\second\third” involved in the embodiments of the disclosure are only intended to distinguish similar objects and do not represent a specific order of the objects. It may be understood that “first\second\third” may exchange their specific orders or sequences in an allowable situation, so that the embodiments of the disclosure described here may be implemented in an order other than those illustrated or described here.
In a video picture, a color space can be represented in a YUV format, a YCbCr format, an RGB format, or a YCgCo format. A coding block (CB) is generally represented by using a first color component, a second color component, and a third color component. The three color components are a luminance component, a blue chroma component, and a red chroma component, respectively. Taking a video picture represented in the YCbCr format or the YUV format as an example, the luminance component is generally represented by a symbol Y, the blue chroma component is generally represented by a symbol Cb or U, and the red chroma component is generally represented by a symbol Cr or V.
It can be understood that in existing video picture or video coding/decoding processes, cross-component prediction technology mainly includes the Cross-Component Linear Model (CCLM) prediction mode and the Multi-Directional Linear Model (MDLM) prediction mode. Regardless of whether model parameters are derived according to the CCLM prediction mode or the MDLM prediction mode, both corresponding prediction models thereof can implement the cross-color component prediction, such as from the first color component to the second color component, from the second color component to the first color component, from the first color component to the third color component, from the third color component to the first color component, from the second color component to the third color component, or from the third color component to the second color component.
Taking the prediction from the first color component to the second color component as an example, assuming that the first color component is a luminance component and the second color component is a chroma component, in order to reduce the redundancy between the luminance component and the chroma component, the CCLM prediction mode is used in the VVC, that is, a chroma prediction value is constructed according to a luminance reconstruction value of the same coding block, as shown in the following equation:
PredC(i,j)=α×RecL(i,j)+β, where (i,j) denotes the position coordinates of a pixel to be predicted in a coding block, i denotes a horizontal direction, and j denotes a vertical direction; PredC(i,j) denotes a chroma prediction value corresponding to the pixel to be predicted at the position coordinates (i,j) in the coding block, and RecL(i,j) denotes a luminance reconstruction value corresponding to the pixel to be predicted at the (downsampled) position coordinates (i,j) in the same coding block. In addition, α and β are linear model parameters, which can be derived from reference pixels.
For a coding block, reference regions of a current block thereof may be divided into five parts: a left neighboring region, an upper neighboring region, a lower-left neighboring region, an upper left neighboring region, and an upper-right neighboring region. The following three cross-component linear model prediction modes are included in the H.266/VVC: a left and upper neighboring intra CCLM prediction mode (which may be denoted by INTRA_LT_CCLM), a left and lower-left neighboring intra CCLM prediction mode (which may be denoted by INTRA_L_CCLM), and an upper and upper-right neighboring intra CCLM prediction mode (which may be denoted by INTRA_T_CCLM). Each prediction mode of these three prediction modes may select a preset number (e.g., 4) of reference pixels for the derivation of model parameters α and β, and the biggest difference between these three prediction modes is that the selection regions corresponding to the reference pixels used to derive model the parameters α and β are different.
Referring to
After the preset number of reference pixels is acquired, chroma prediction is performed according to the flow chart of a model parameter derivation scheme shown in
It should be noted that in the VVC, the operation in which the number of valid reference pixels is 0 is determined according to the validity of the neighboring regions.
It should also be noted that the prediction model is constructed using the principle of “determining a straight line by using two points”. The two points may be referred to as fitting points. In the current technical solution, after four reference pixels are acquired, two reference pixels with larger values in the luminance component and two reference pixels with smaller values in the luminance component are obtained through comparison. Then, a mean point (which may be represented by meanmax) is obtained according to the two reference pixels with larger values, and another mean point (which can be represented by meanmin) is obtained according to the two reference pixels with smaller values. That is, two mean points meanmax and meanmin can be obtained. Next, meanmax and meanmin are used as two fitting points, and the model parameters (represented by α and β) can be derived. Finally, a prediction model is constructed according to α and β, and prediction processing for the chroma components is performed according to the prediction model.
However, in the related art, a simple linear model PredC(i,j)=α·RecL(i,j)+β is used for each coding block to predict chroma components, and the same model parameters α and β are used for the prediction of pixels at any position in each coding block, which may lead to the following drawbacks: on the one hand, coding blocks with different content characteristics all use a simple linear model to perform luminance-to-chroma mapping, so as to achieve chroma prediction, but not all luminance-to-chroma mapping functions in any coding block can be accurately fitted by this simple linear model, which leads to inaccurate prediction of some coding blocks. On the other hand, in the prediction process, pixel points at different positions within the coding block all use the same model parameters α and β, and there is also a large difference in prediction accuracy for different positions within the coding block. That is, in current CCLM technology, there is a large deviation between prediction values and original values for some coding blocks, which leads to low prediction accuracy and quality degradation, thereby further reducing encoding and decoding efficiency.
On the basis of the foregoing, embodiments of the present disclosure provide encoding and decoding methods. Whether at the encoding end or at the decoding end, a weighting coefficient corresponding to a pixel to be predicted in a current block is calculated, and is used to predict a color component of the pixel to be predicted in the current block, thereby not only improving prediction accuracy and reducing bitrates, but also enhancing encoding and decoding performance. In addition, the encoding end transmits a first control parameter to the decoding end through a bitstream, which can increase the reliability of the weighting coefficient, and further improve the accuracy of chroma prediction to a certain extent.
Embodiments of the present disclosure would be described in detail below with reference to the drawings.
Referring to
Referring to
It should be noted that the method according to the embodiments of the present disclosure is mainly applied to the intra prediction unit 103 shown in
It should further be noted that, when the method according to the embodiments of the present disclosure is applied to the intra prediction unit 103, the “current block” specifically refers to a current coding block to be subjected to intra prediction. When the method according to the embodiments of the present disclosure is applied to the intra prediction unit 203, the “current block” specifically refers to a current decoding block to be subjected to intra prediction.
In an embodiment of the present disclosure, referring to
At operation 501: a bitstream is decoded to determine a first control parameter of a current block.
It should be noted that the decoding method in the embodiment of the present disclosure is applied to a decoder. In addition, the decoding method may specifically refer to an intra prediction method, and more specifically, the decoding method refers to a color component prediction method. A video picture may be divided into a plurality of decoding blocks, and each decoding block may include a first color component, a second color component and a third color component. The current block in the embodiment of the present disclosure refers to a current decoding block to be subjected to the intra prediction in the video picture.
When the prediction of the first color component needs to be performed, a component to be predicted is the first color component. When the prediction of the second color component needs to be performed, a component to be predicted is the second color component. When the prediction of the third color component needs to be performed, a component to be predicted is the third color component. In addition, assuming that the prediction of the first color component is performed on the current block, and that the first color component is a luminance component (that is, the component to be predicted is a luminance component), the current block may also be referred to as a luminance block. Alternatively, assuming that the prediction of the second color component is performed on the current block, and that the second color component is a chroma component (that is, the component to be predicted is a chroma component), the current block may also be referred to as a chroma block. In addition, in the embodiment of the present disclosure, the current block may also be referred to as a coding block or a decoding block.
Here, the first control parameter is a control parameter of the weighting coefficient, and is used to set the size of the weighting coefficient. The weighting coefficient is a weighting coefficient of a reference sample value of the second color component of the current block, and is used to determine a prediction value of the second color component of the current block. It can be understood that, when the prediction of the second color component needs to be performed, the first control parameter is a control parameter corresponding to the second color component. When the prediction of the first color component needs to be performed, the first control parameter is a control parameter corresponding to the first color component. When the prediction of the third color component needs to be performed, the first control parameter is a control parameter corresponding to the third color component. Control parameters corresponding to different color components may be equal or unequal, and control parameters corresponding to different color components may be collectively referred to as a “first control parameter”, or may be distinguished by a “first control parameter”, a “second control parameter”, and a “third control parameter”. The embodiments of the present disclosure are not specifically limited thereto.
In some embodiments, the operation that the bitstream is decoded to determine the first control parameter of the current block may include the following operations. Data units at a block layer and above in the bitstream are decoded to the first control parameter of the current block.
In some embodiments, the operation that the bitstream is decoded to determine the first control parameter of the current block may include the following operations. Data units at a block layer and above in the bitstream are decoded to determine first control parameter candidates, and the first control parameter are determined according to the first control parameter candidates.
The first control parameter candidates include one or more candidate values of the first control parameter of the current block. That is, a decoding end may obtain one or more candidate values of the first control parameter of the current block from the data units at the block layer and above in the bitstream. When a candidate value of the first control parameter is obtained, it can be understood that an encoding end transmits control parameters for each block in the bitstream, and the decoding end obtains the first control parameter of the current block according to decoding, and directly applies the same to color component prediction. When the first control parameter candidates include multiple candidate values of the first control parameter, it can be understood that the encoding end transmits some typical control parameters in the bitstream without transmitting corresponding control parameters for each block, and the decoding end may select the corresponding first control parameters according to a prediction parameter of the current block after decoding the bitstream. The encoding end transmits the first control parameter to the decoding end through the bitstream, and the decoding end calculates the weighting coefficient according to the received first control parameter, which may increase the reliability of the weighting coefficient and further improve the accuracy of color component prediction to a certain extent.
In some embodiments, the data units at the block layer and above include at least one of the following: a parameter set data unit, a Picture Header (PH), a Slice Header (SH), a Coding Tree Unit (CTU) or a Coding Unit (CU).
Here, the parameter set data unit includes at least one of a Sequence Parameter Set (SPS), a Picture Parameter Set (PPS) or an Adaptation Parameter Set (APS).
That is, the encoding end transmits the first control parameter candidates in the data units at the block layer and above. Specifically, the first control parameter may be transmitted at an SPS layer, a PPS layer, an APS layer, a PH layer, an SH layer, a CTU layer, or a CU layer in the bitstream.
In some embodiments, when the first control parameter candidates include one candidate value of the first control parameter, the control parameter may be understood as the best control parameter determined by the encoding end for the current block. When the best control parameter is transmitted at the CU layer, the control parameter S may be separately transmitted for different CU blocks, so that the prediction accuracy can be improved. In an embodiment, when the transmission is at the SPS layer, pictures of the same sequence use the same S. When the transmission is at the PPS layer, the same frame uses the same S. When the transmission is at the APS layer, the same frame uses the same S. When the transmission is at the PH layer, the same frame uses the same S. When the transmission is at the SH layer, the same slice uses the same S. When the transmission is at the CTU layer, the same CTU uses the same S.
Further, one coding block may correspond to one control parameter selection, or different control parameter selections may be set for different color components in the coding block. For example, for the chroma components Cb and Cr, the same prediction is performed for Cb and Cr chroma blocks, and the same obtained best S is used for the components Cr and Cb. Alternatively, for the chroma components Cb and Cr, the prediction is performed for the chroma components Cb and Cr respectively, and each of the Cb and Cr uses a respective best S.
In some embodiments, the operation that the bitstream is decoded to determine the first control parameter of the current block may include the following operations. The bitstream is decoded to determine an index parameter of the first control parameter of the current block. In some other embodiments, the operation that the data units at a block layer and above in the bitstream are decoded to determine the first control parameter candidates may include the following operations. The data units at the block layer and above in the bitstream are decoded to determine an index parameter of a candidate value of the first control parameter. That is, the encoding end may further transmit, in the bitstream, the index parameter of the control parameter to the decoding end, and the decoding end may determine the corresponding control parameter according to the decoded index parameter.
In an embodiment, the decoding end may obtain the best control parameter S for the current block from the CU layer by parsing, and the specific process is as follows:
In an embodiment, the decoding end may obtain the best control parameter S for the current block under different chroma components from the CU layer by parsing, and the specific process is as follows:
At operation 502: a reference sample value of a first color component of the current block is determined.
In the embodiments of the present disclosure, the first color component and the second color component are different color components. The second color component is a component to be predicted in the embodiments of the present disclosure. The first color component is a reference color component in the embodiments of the present disclosure. The reference sample value of the first color component and the first control parameter are used to determine the weighting coefficient.
In some embodiments, the operation that the reference sample value of the first color component of the current block is determined may include the following operations. The reference sample value of the first color component of the current block is determined according to an neighboring sampling value of the first color component of the current block and a reconstruction value of the first color component of the current block.
In an embodiment, the reference sample value of the first color component of the current block is set to be equal to the absolute value of the difference between a first intra-block reference value and a first neighboring reference value. The first intra-block reference value is the reconstruction value of the first color component of the current block or a value obtained by filtering the reconstruction value of the first color component of the current block; and the first neighboring reference value is the neighboring sampling value of the first color component of the current block or a value obtained by filtering the neighboring sampling value of the first color component of the current block.
Here, the first intra-block reference value may be understood as the reconstruction value of the first color component of a pixel to be predicted in the current block, or a value obtained by filtering the reconstruction value of the first color component of the pixel to be predicted. The first neighboring reference value may be understood as a reconstruction value of the first color component of a reference pixel in the reference region, or a value obtained by filtering the reconstruction value of the first color component of the reference pixel.
In an embodiment, the first color component is exemplified as a luminance component, and the second color component is exemplified as a chroma component. The reference sample value of the first color component is the difference between a luminance reconstruction value (recY) of the pixel to be predicted and a luminance reconstruction value (refY) of the reference pixel. Under certain conditions, refY and recY may be pre-processed. In an embodiment, the pre-processing operation includes: (1) in order to reduce computational complexity, a point selection operation or a downsampling operation may be performed on refY or recY; (2) different filtering operations may be performed on refY or recY for current blocks of different sizes; (3) when the resolution of the chroma component of the video is not consistent with the resolution of the luminance component of the video, upsampling and downsampling operations may be performed on refY or recY to facilitate subsequent chroma prediction calculation; (4) when the resolution of the chroma component of the video is consistent with the resolution of the luminance component of the video, multiple rows/columns of reference pixels may be used, and in this case, the upsampling and downsampling operations may also be performed on refY or recY to facilitate subsequent chroma prediction calculation; and (5) when the quantity of the obtained refY is different from the quantity of a core parameter inSize, it is necessary to perform the point selection operation or the upsampling and downsampling operations on refY.
The process of acquiring the weighting coefficient includes constructing a luminance difference vector and calculating the weighting coefficient. A weighted chroma prediction value is obtained by acquiring the weighting coefficient and performing weighted prediction according to the weighting coefficient.
Specifically, for i=0, . . . , predSizeW−1, j=0, . . . , predSizeH−1, and k=0, 1 . . . inSize−1, each element diffY[i][j][k] in a luminance difference vector is constructed, each element cWeight[i][j][k] (or cWeightFloat[i][j][k]) in a weight vector is calculated, and a chroma prediction value Cpred[i][j] is calculated according to cWeight[i][j] (or cWeightFloat[i][j][k]) and refC. Referring to equation (1), K=inSize. predSizeW is the width of the prediction block, predSizeH is the height of the prediction block, and the quantity of the inSize is the quantity of the reference luminance.
The luminance difference vector is constructed. For each pixel to be predicted, the luminance difference vector diffY[i][j][k] is obtained by subtracting luminance reconstruction information recY[i][j] corresponding to the pixel from the reference luminance information refY of the quantity of the inSize and taking an absolute value.
RecY[i][j] represents a luminance reconstruction value of a pixel to be predicted (i,j) in the current block, recY[k] denotes a luminance reconstruction value of a k-th reference pixel, diffY[i][j][k] denotes the difference between the luminance reconstruction values of the pixel to be predicted (i,j) and the k-th reference pixel, diffY[i][j] denotes a luminance difference vector (i.e., including the absolute value of the difference between the luminance reconstruction value of each pixel to be predicted in the current block and the k-th reference pixel), and abs denotes taking the absolute value. In the embodiment of the present disclosure, the luminance difference vector of the pixel to be predicted is processed using the control parameter S.
At operation 503: a weighting coefficient is determined according to the reference sample value of the first color component of the current block and the first control parameter.
Here, the weighting coefficient may be calculated by means of a preset mapping relationship. In the embodiments of the present disclosure, the preset mapping relationship is a non-linear mapping relationship. Specifically, a function model (i.e., the preset mapping relationship, represented by f) for calculating the weighting coefficient is constructed according to the trend that the closer the luminance information of reference pixel is to the luminance information of the pixel to be predicted (i,j) in the current block, the higher the importance of the chroma of the reference pixel to the pixel to be predicted (i,j).
In some embodiments, the operation that the weighting coefficient is determined according to the reference sample value of the first color component of the current block and the first control parameter may include the following operations. A first input parameter is determined according to the reference sample value of the first color component of the current block and the first control parameter, and the weighting coefficient is determined according to a preset mapping relationship and the first input parameter.
In some embodiments, both the reference sample value of the first color component of the current block and the first control parameter may be used as the first input parameter, and inputted into a non-linear mapping function corresponding to the preset mapping relationship, and the weighting coefficient is used as an output value of the non-linear function. That is, both the reference sample value of the first color component and the first control parameter are used as input parameters of the non-linear function, and the value of the non-linear function changes as its input parameters change. In some embodiments, the preset mapping relationship is a softmax function.
In an embodiment, the preset mapping relationship is a softmax function. In practical application, the mapping relationship may be the softmax function itself, or may be part of the softmax function. The luminance difference vector diffY[i][j] corresponding to each pixel to be predicted is used as an input of the non-linear mapping model, and the model outputs a floating-point-type weight vector cWeightFloat[i][j] corresponding to each pixel to be predicted, and the calculation equation thereof is as shown in (3):
Under certain conditions, the equation (3) may be adjusted according to the control parameter (S). It should be noted that the weight vector cWeightFloat[i][j] includes a weight value of each reference pixel, and cWeightFloat[i][j] includes a weight value of the quantity of inSize. The weight value in the embodiment of the present disclosure is the weighting coefficient to be calculated.
For example, when the size of the current prediction block is flexible, the non-linear mapping model may be adjusted according to the WCP control parameter (S). Taking the non-linear softmax function as an example, different scale parameter adjustment functions may be selected according to different block classification categories to which the current prediction block belongs, and in this case, equation for calculating the weight vector corresponding to each pixel to be predicted is as shown in (4):
After the above calculation is completed, cWeightFloat may be fixed-point converted, for example:
Among the above,
Floor(x) denotes the largest integer less than or equal to x
To improve the accuracy of the weight of the chroma reference point in the WCP algorithm to obtain a weighted chroma prediction value closer to the non-compressed original chroma value, in the present patent, the present disclosure mainly uses the non-linear softmax function (e.g., the equation (4)) as a basic mapping model, thereby adjusting the control parameter S of the non-linear model.
In an embodiment, in some embodiments, the operation that the first input parameter is determined according to the reference sample value of the first color component of the current block and the first control parameter may include the following operations. The first input parameter is set to be equal to the ratio of the reference sample value of the first color component of the current block to the first control parameter. That is, diffY[i][j][k]/S is taken as the first input parameter, the ratio of diffY[i][j][k] to S is calculated first, and is then substituted into equation (4) to calculate the weight value.
In an embodiment, in some embodiments, the operation that the first input parameter is determined according to the reference sample value of the first color component of the current block and the first control parameter may include the following operations. The first input parameter is set to be equal to the product of the reference sample value of the first color component of the current block and the first control parameter. That is, diffY[i][j][k]/S is regarded as the first input parameter, the division operation is converted into a multiplication operation to calculate the product of diffY[i][j][k] and 1/S, and the product is substituted into equation (4) to calculate the weight value.
In some embodiments, the operation that the first input parameter is determined according to the reference sample value of the first color component of the current block and the first control parameter may include the following operations. The first input parameter is set to be equal to a value obtained by right-shifting the reference sample value of the first color component of the current block by S bits. The value of S is determined according to the first control parameter. In an embodiment, the value of S is set to be equal to the first control parameter. That is, diffY[i][j][k]/S is taken as the first input parameter, and the division operation is converted into a right shift operation, which can reduce the computational difficulty since the implementation of the right shift operation is less difficult than the implementation of division.
In some embodiments, the operation that the first input parameter is determined according to the reference sample value of the first color component of the current block and the candidate value among the first control parameter candidates may include the following operations. The reference sample value of the first color component of the current block and the first control parameter are used as index values for a value mapping lookup table, and the value mapping lookup table is searched to obtain a corresponding array element value. The first input parameter is set to be equal to the array element value.
In addition, in some embodiments, the mapping relationship may simplify operations, for example, an array element lookup may be used to reduce part of the calculation operations. For example, a mapping lookup table consisting of reference sample values of the first color component, first control parameters and array elements is preset. The reference sample value of the first color component and the first control parameter are used as index values, the mapping lookup table is searched to obtain the array element, and then a value corresponding to the array element value in a preset non-linear mapping function relationship is determined. The weighting coefficient is then set to be equal to this value.
In an embodiment, when calculating a floating-point-type weighting coefficient or a fixed-point converted weighting coefficient, operations the same as those of numerator calculation are all obtained through a look-up table, thereby avoiding calculation operations of numerator and denominator parts. The details are as follows:
For example, a calculation equation for the floating-point-type weighting coefficient may be presented as follows:
The numerator of the function expression of equation (6) described above may be completely stored by using an independent variable diffY[i][j][k] and the value of S to be traversed as the array indexes.
Complete storage means that the value range of diffY[i][j][k] and numerators of the number of S to be traversed are all stored. Under the complete storage, an array space with the size of (the value range of diffY[i][j][k] multiplied by the number of S to be traversed) is required. For a certain control parameter S value, the size of the table required to be stored is the size of the value range of diffY[i][j][k]. The case that the pixel of 10 bits and the equation (6) are used to calculate the weighting coefficient is taken as an example.
The variable diffY[i][j][k] is an integer ranging from 0 to 1023. In this main embodiment, the range of the control parameter S is not limited temporarily. If the selection range of the parameter S is continuous, the starting value of S is 1, and the difference between two neighboring values of S is 1, i.e., 1, 2, 3, 4, . . . S. The corresponding index is 1, 2, 3, 4, . . . S. The values of diffY[i][j][k] and S are used as the indexes of a two-dimensional array storMole to completely store the numerator:
The calculation of the floating-point-type weighting coefficient may be presented as:
The elements of [index 1] and [index 2] of the two-dimensional array storMole are as shown in Table 1.1. The diffY[i][j][k] is the index 1, and flags is the index 2.
In some embodiments, for the fixed-point calculation, an enlarged integer value may also be stored. That is, the array elements in Table 1.1 are enlarged integer values, and a corresponding reduction operation needs to be performed after a prediction value is obtained.
Further, the operation that the weighting coefficient is determined according to the preset mapping relationship and the first input parameter may include the following operations. The first input parameter is used as an input value of the preset mapping relationship, and the weighting coefficient is set to be equal to an output value of the preset mapping relationship. The preset mapping relationship is a correspondence between the first input parameter and the weighting coefficient, and the value of the weighting coefficient decreases as the value of the first input parameter increases. That is, after the first input parameter of equation (4) is determined, a function operation is performed to obtain a corresponding weight value.
At operation 504: a prediction value of the second color component of the current block is determined determining according to the weighting coefficient and a reference sample value of a second color component of the current block.
In some embodiments, the operation that the prediction value of the second color component of the current block is determined determining according to the weighting coefficient and the reference sample value of the second color component of the current block may include the following operations. A weighted sum of the weighting coefficient and the reference sample value of the second color component of the current block is calculated to determine the prediction value of the second color component of the current block.
In some embodiments, the operation that the prediction value of the second color component of the current block is determined determining according to the weighting coefficient and the reference sample value of the second color component of the current block may include the following operations. A weighted sum of the weighting coefficient and the reference sample value of the second color component of the current block is calculated to determine a first prediction value of the second color component of the current block, and the first prediction value of the second color component of the current block is filtered to determine the prediction value of the current block.
In some embodiments, the reference sample value of the second color component of the current block is set to be equal to an neighboring sampling value of the second color component of the current block or a value obtained by filtering the neighboring sampling value of the second color component of the current block.
The neighboring sampling value of the second color component is a value obtained according to the reconstruction value of the second color component of the reference pixel. The reconstruction value of the second color component of the reference pixel is directly used as the neighboring sampling value of the second color component, or the reconstruction value of the second color component of the reference pixel is filtered to obtain the neighboring sampling value of the second color component. In an embodiment, when the second color component is a chroma component, the reference sample value of the second color component is a reconstruction value of the chroma component of the reference pixel or a value obtained by filtering the reconstruction value of the second color component of the reference pixel.
A weight vector cWeightFloat[i][j] or cWeight[i][j] corresponding to each pixel to be predicted in the current block is calculated according to the control parameter S. The weight vector may be fixed-point converted or not fixed-point converted. Then, the chroma prediction value of the pixel to be predicted is calculated according to the weight vector cWeight[i][j] (or cWeightFloat[i][j]) and reference chroma information refC corresponding to each pixel to be predicted. Specifically, the reference chroma information refC of each pixel to be predicted Cpred[i][j] is multiplied one by one with the weight vector element corresponding to the each pixel to be predicted to obtain subC[i][j] (or subCFloat[i][j]), and the multiplication results are accumulated to obtain the chroma prediction value Cpred[i][j] of each pixel to be predicted (i.e., weighted prediction). The calculation equation is as follows:
After the calculation is completed, the subCFloat may be fixed-point converted, and in the process of fixed-point conversion, in order to maintain a certain calculation accuracy, a coefficient may be multiplied, for example:
Further, the method may also include the following operations. The prediction value is corrected. In an embodiment, for the correction of the chroma prediction value Cpred[i][j], the chroma prediction value should be within a limited range, and if the range is exceeded, a corresponding correction operation should be performed.
In an embodiment, a clipping operation can be performed on the chroma prediction value of Cpred[i][j], which is specifically as follows:
That is:
Further, the method may also include the following operations. The prediction value is post-processed. The weighted chroma prediction value (here represented by a predWcp) needs to be post-processed under certain conditions to obtain a final chroma prediction value predSamples. Otherwise, the final chroma prediction value predSamples is predWcp.
In an embodiment, the post-processing operation includes: (1) when predSizeW in the WCP core parameters is not equal to the width nTbW of the current block, or when predSizeH is not equal to the width nTbH of the current block, the upsampling or downsampling operation needs to be performed on predWcp to obtain the final chroma prediction value predSamples.
The embodiments of the present disclosure provide a weighted chroma prediction method (WCP). As shown in
At operation 505: a reconstruction value of a second color component sampling point of the current block is determined according to the prediction value of the second color component of the current block.
In some embodiments, the operation that the reconstruction value of the second color component sampling point of the current block is determined according to the prediction value of the second color component of the current block may include the following operations. The bitstream is decoded to determine a reconstruction value of a prediction difference of the second color component of the current block, and the reconstruction value of the second color component sampling point of the current block is determined according to a sum of the prediction value of the second color component of the current block and the reconstruction value of the prediction difference of the second color component of the current block.
Here, the prediction difference may be understood as a residual of the second color component, and the decoding end adds the prediction value and the reconstruction value of the prediction difference obtained by decoding the bitstream, so as to obtain the reconstruction value of the second color component of the pixel to be predicted in the current block.
Due to the flexibility of block division, the prediction blocks may be divided into large and small blocks, square and rectangular blocks, and so on. To deal with various block types, prediction blocks may be classified according to the size of the prediction blocks or the number of pixels of the prediction blocks through theoretical analysis, and the same fixed control parameter S can be used for the same type of prediction blocks. S=0.5 in
Based on the foregoing, the selection of the first control parameter would be further exemplified in the embodiments of the present disclosure.
In some embodiments, operation that the first control parameter is determined according to the first control parameter candidates may include the following operations. The first control parameter is determined from the first control parameter candidates according to a prediction parameter of the current block. It can be understood that, when the first control parameter candidates include multiple candidate values of the first control parameter, the decoding end determines one first control parameter from the multiple candidate values according to the prediction parameter of the current block.
In some embodiments, the operation that the first control parameter is determined from the first control parameter candidates according to the prediction parameter of the current block may include the following operations. The first control parameter is determined from the first control parameter candidates based on a preset correspondence between prediction parameters and first control parameters according to the prediction parameter of the current block. It can be understood that all of the first control parameters included in the correspondence are regarded as first control parameter candidates of the current block, and according to the prediction parameter of the current block, a corresponding first control parameter is determined as the first control parameter of the current block. That is, the first control parameter is set to be equal to a first control parameter corresponding to the prediction parameter of the current block among the first control parameter candidates.
In some embodiments, the prediction parameter of the current block at least includes a size of the current block. The size of the current block includes at least one of a height of a current block, a width of the current block, a number of first color component sampling points included in the current block, or a number of second color component sampling points included in the current block. Here, the first color component sampling points and the second color component sampling points are pixel points to be predicted within the current block, and the first color component sampling points and the second color component sampling points may be pixel points completely identical to each other or not completely identical to each other.
It should be noted that, in the embodiments of the present disclosure, the value of the first control parameter may be determined by means of classification. For example, three categories are obtained by classification according to the size parameter of the current block, and the value of the first control parameter corresponding to each category is determined. Alternatively, three categories are obtained by classification according to the number of sampling points of the current block, and the value of the first control parameter corresponding to each category is determined. In this case, in the embodiments of the present disclosure, a correspondence between classification parameters and first control parameters may be transmitted in the bitstream, and the value of the first control parameter may be determined according to the correspondence. In an embodiment, Table 1.2 shows a correspondence between the first control parameter and a size parameter of the current block provided in an embodiment of the present disclosure, and Table 1.3 shows a correspondence between the first control parameter and the number of sampling points of the current block provided in an embodiment of the present disclosure. It should be noted that Tables 1.2 and 1.3 are merely exemplary look-up tables, and the present disclosure is not specifically limited thereto.
It should be noted that different control parameters S may be designed for different coding chroma block size classification manners or different numbers of pixels in coding blocks, which includes, but is not limited to, the above classification manners and classification theory. For the classification theory, for example, it is also possible to take into account the content specificity of certain sequences: small blocks tend to be given large weights, and large blocks tend to be given small weights, and so on.
In some embodiments, the prediction parameter of the current block include a prediction mode of the current block. In an embodiment, the prediction mode may be a chroma prediction mode, which is a weighted chroma prediction (WCP) method. When multiple WCP modes are included, different control parameters may be set for different WCP modes in some embodiments.
In some embodiments, the WCP modes are divided into three types of modes according to available reference regions: a WCP mode, a WCP_L mode, and a WCP_T mode. As shown in
In an embodiment, Table 1.4 shows a correspondence between a control parameter and a prediction mode according to an embodiment of the present disclosure.
In some embodiments, the prediction parameter of the current block includes an index parameter of the first control parameter. Here, the index parameter is used to index the first control parameter corresponding to a pixel to be predicted in the current block. In some other embodiments, the prediction parameter of the current block includes at least two parameters among the size of the current block, the prediction mode of the current block, and the index parameter of the first control parameter. In an embodiment, Table 1.5 shows a correspondence between the first control parameter and a prediction mode according to an embodiment of the present disclosure.
In some embodiments, the method further includes the following operations. A bitstream is parsed, and the preset correspondence between prediction parameters and first control parameters is determined. In an embodiment, the method includes the following operations. A slice header in the bitstream is decoded, and a parameter set directly or indirectly referenced by a slice is determined, and the slice corresponding to the slice header includes the current block. The preset correspondence between prediction parameters and first control parameters is determined according to the parameter set directly or indirectly referenced by the slice.
In some embodiments, the parameter set directly or indirectly referenced by the slice includes at least one of a sequence parameter set (SPS), a picture parameter set (PPS) or an adaptation parameter set (APS). That is, the correspondence may be in the PPS or APS directly referenced by the slice, or in the SPS indirectly referenced by the slice.
In some embodiments, the method further includes the following operations. The slice header is decoded, and the preset correspondence between prediction parameters and first control parameters is updated. It should be noted that, in actual application, the encoding end may retransmit all or part of the parameters in the correspondence in the slice header, and the retransmitted parameters may be the same as or different from the corresponding parameters in the parameter set, so that the correspondence may be updated using the data retransmitted in the slice header. Here, the update includes operations such as maintaining, replacing, modifying, adding, deleting, and other operations.
In some embodiments, the method further includes the following operations. A picture header in the bitstream is decoded, and the preset correspondence between prediction parameters and first control parameters is updated. A picture corresponding to the picture header includes the slice. It should be noted that, in actual application, the encoding end may also retransmit all or part of the parameters in the correspondence in the picture header, and the retransmitted parameters may be the same as or different from the corresponding parameters in the parameter set, and may be the same as or different from the corresponding parameters in the slice data unit, so that the correspondence may be updated by using the retransmitted data in the slice header.
Further, at the encoding end, several typical values of control parameter S may be [00171] configured by means of a CTC cfg configuration file, or the values of control parameter S may be directly given without configuring the control parameter S by means of the cfg file. When the control parameter S is configured in the cfg file, the encoding end reads the values of control parameter S when parsing the cfg configuration file, and sequentially writes the values of control parameter S or indexes of the control parameter S into the bitstream at the SPS layer. When the control parameter S is not configured in the cfg configuration file, the encoding end directly writes given values of control parameter S or indexes of the control parameter S into the bitstream sequentially at the SPS layer. The manner of writing the bitstream may be variable-length coding or fixed-length coding. When the WCP chroma prediction is performed on the current block, the decoding end acquires the values of control parameter S or the indexes of the control parameter S transmitted from the SPS layer by parsing the bitstream, and uses the acquired corresponding values of control parameter S for the calculation process of the weight vector during the chroma prediction of the current block by means of a certain condition, for example, limitation conditions such as a block size or the number of pixels in a block. An example of acquiring the control parameter S from the SPS layer according to the block size condition is as shown in the tables below.
It should be noted that, when the control parameter S is configured by means of the cfg file, this manner of reading the S control parameter configured in the cfg file at the SPS layer may set different values for the S control parameter according to different characteristics (e.g., size, prediction mode, etc.) of different sequences, thereby achieving an adaptive effect.
In an embodiment, a syntax parsing process in which fixed-length coding of S is performed at the decoding end is as follows:
A syntax process in which variable-length coding of S is performed at the decoding end is as follows:
In addition to configuring several typical values of control parameter S in the CTC cfg configuration file or directly providing the control parameter values without configuring the cfg file. In some embodiments, some threshold parameters Thr may be added to the CTC cfg configuration file or may be directly given without configuring the cfg file. That is, the corresponding values of control parameter S may be adaptively selected through the threshold parameters which are configured by the cfg file or directly given. The details are as follows:
Several typical values of control parameter S and several threshold parameters Thr may be configured by the CTC cfg configuration file, or may be directly given without being configured by cfg, and there is a correspondence between the values of control parameter S and the threshold parameters Thr. The number sps_wcp_S_Num of values of control parameter S and the number sps_wcp_Thr_Num of the threshold parameters Thr are fixed, and may also be transmitted at the encoding end. The threshold parameters Thr may be any parameter related to the coding block, such as a quantization parameter (QP), a width, a height, a number of pixels etc., of the coding block. When the control parameter S and the threshold parameters Thr are configured in the cfg file, the encoding end reads the values of the control parameter S and the threshold parameters Thr when parsing the cfg file, and sequentially writes the values of the control parameter S or the indexes of the control parameter S, and the threshold parameters Thr or the indexes of the threshold parameters Thr into the bitstream at the SPS layer. When the control parameter S and the threshold parameters Thr are not configured in the cfg file, the encoding end directly writes the given values of control parameter S or the indexes of the control parameter S, and the threshold parameters Thr or the indexes of the threshold parameters Thr into the bitstream sequentially at the SPS layer. The manner of writing the bitstream may be variable-length coding or fixed-length coding. When WCP chroma prediction is performed on the current block, the decoding end acquires the values of control parameter S or the indexes of the control parameter S, and the values of the threshold parameters Thr or the indexes of the threshold parameters Thr transmitted from the SPS layer by parsing the bitstream, and uses the acquired corresponding values of control parameter S for the calculation process of the weight vector during the chroma prediction of the current block according to the threshold parameters Thr. A related example of the threshold parameters Thr and the control parameter S is as follows:
For example, the threshold parameter Thr may be related to a QP value: when QP<QP_Thr0, S=S0; when QP_Thr0<QP<=QP_Thr1, S=S1; and when QP>QP_Thr1, S=S2. QP is a QP value of the current coding block, QP_Thr0 and QP_Thr1 are threshold parameters, and S0, S1, and S2 are control parameters S.
It should be noted that, when the control parameters S and the threshold parameters Thr are configured by the cfg file, this manner of reading the control parameters S and the threshold parameters Thr configured in the cfg file at the SPS layer may set different values of control parameters S and threshold parameters Thr according to different characteristics of different sequences, thereby achieving an adaptive effect.
A syntax parsing process in which the fixed-length coding of the control parameter S or its index and the threshold Thr or its index is performed at the decoding end is as follows:
A syntax parsing process in which variable-length coding of the control parameter S or its index and the threshold Thr or its index is performed at the decoding end is as follows:
In addition to acquiring the control parameters S transmitted at the SPS layer according to certain limitation conditions, it is also possible to acquire control parameters S transmitted at the APS layer according to certain limitation conditions (for example, the limitation conditions may be the same as those for acquiring the control parameters S in the SPS layer above). It should be noted that the values of the control parameters S transmitted at the APS layer and the number of S may be flexibly set. The syntax semantics are as follows (where S or its index may be variable-length coded or fixed-length coded):
Different control parameters S are used according to different categories of block classification, and transmitted through the SPS layer, the APS layer, or the PPS layer. The selectable range of the control parameter S is small, and the implementation at the encoding and decoding ends is relatively simple, which is applicable to most coding blocks.
In addition to the above and the transmission of a few candidate control parameters, it is also possible to have more options for the control parameter S to comprehensively measure the characteristics of all coding blocks in all sequences. Therefore, in the embodiment of the present disclosure, more candidate control parameters S are further given at the encoding end, the best control parameter S is selected from these candidate control parameters by introducing the original value of the coding block, and the selection process of the best control parameter at the encoding end is described in detail below.
A weighted chroma prediction (WCP) method is provided in an embodiment of the present disclosure. When the chroma prediction is performed on the current block, luminance reconstruction information of the current block, and luminance reconstruction information and chroma reconstruction information of neighboring reference regions are all coded reconstruction information. The weighted chroma prediction is implemented by using the above reconstruction information. The chroma prediction process would be introduced in detail below, which includes the following operations.
The prediction process of the WCP technique includes determination of WCP core parameters, acquisition of input information, weighted chroma prediction and post-processing process. The chroma prediction value of the current chroma prediction block can be obtained through the above operations.
The WCP core parameters include: a control parameter (S), the number inSize of weighted chroma prediction inputs, and the number of weighted chroma prediction outputs (predWcp) (arranged in predSizeW×predSizeH). The number of weighted chroma prediction outputs (predWcp) may be set to the same value (e.g., predSizeW=redSizeH=S/4) or related to the current block size (e.g., predSizeW=nTbW, predSizeH=nTbH). The control parameter S may be used to adjust a non-linear function in subsequent operations or to adjust data involved in subsequent operations. The determination of the WCP core parameters is affected by the block size or block content under certain conditions. For example, if there are many types of block sizes applied by WCP, or the block contents are significantly different, or the numbers of pixels in the blocks are significantly different, the blocks may be classified, and the same or different core parameters may be determined according to different types of blocks.
In an embodiment, the chroma block is classified according to the width and height of the chroma prediction block, and the type of the chroma block is represented by wcpSizeId. For different types of chroma blocks, the WCP control parameter (S), the number inSize of weighted chroma prediction inputs, the number of weighted chroma prediction outputs (predWcp) (arranged in predSizeW×predSizeH) may be the same or different. Here, an example is provided to illustrate the case that classification includes three categories. nTbW is the width of the current chroma prediction block, nTbH is the height of the current chroma prediction block, and the category wcpSizeId of the chroma block is defined as follows:
Another example can be further provided to illustrate the case that the classification includes three categories. The type wcpSizeId of the chroma block is defined as follows:
In WCP, the chroma block may also be classified according to the number of pixels in the chroma prediction block, and the type of the chroma block is denoted by wcpSizeId. The definition of the type wcpSizeId of the chroma block is as follows:
Another example can be further provided to illustrate the case that the classification includes three categories:
The definition of the type wcpSizeId of the chroma block is as follows:
The above quantitative relationship is correspondingly presented in the form of a table, as shown in Table 1.9:
When the input information is acquired and the current block is predicted, the upper region, the upper left region and the left region of the current prediction block are referred to as reference regions. As shown in
Reference chroma information refC and reference luminance information refY are acquired from the reference regions. The acquired reference chroma information includes, but is not limited to: selecting a reference chroma reconstruction value of an upper reference region and a reference chroma reconstruction value of a left reference region of the current chroma prediction block. The acquired reference luminance information includes, but is not limited to, acquiring corresponding reference luminance information according to the position of the reference chroma information. The luminance reconstruction information recY of the current prediction block is acquired, and the manner of acquisition includes, but is not limited to, acquiring the corresponding luminance reconstruction information to serve as the luminance reconstruction information of the current prediction block according to the position of chroma information in the current chroma prediction block.
Under certain conditions, refC or refY or recY may be a weighted chroma prediction input after being subjected to the pre-processing. In an embodiment, the pre-processing operation includes: (1) in order to reduce computational complexity, a point selection operation or a downsampling operation may be performed on refC or refY or recY; (2) different filtering operations may be performed on refC or refY or recY for current blocks of different sizes; (3) when the resolution of the chroma component of the video is not consistent with the resolution of the luminance component of the video, upsampling and downsampling operations may be performed on refC or refY or recY to facilitate subsequent chroma prediction calculation; (4) when the resolution of the chroma component of the video is consistent with the resolution of the luminance component of the video, multiple rows/columns of reference pixels may be used, and in this case, the upsampling and downsampling operations may also be performed on refC or refY or rec Y to facilitate subsequent chroma prediction calculation; and (5) when the quantity of the obtained refC or refY is different from the quantity of a core parameter inSize, it is necessary to perform the point selection operation or the upsampling and downsampling operations on refC or refY.
The operation that the input information is acquired includes acquiring the reference chroma information refC of the quantity of inSize (if the pre-processing is needed, the information has been pre-processed), acquiring the reference luminance information refY of the quantity of inSize (if the pre-processing is needed, the information has been pre-processed), and acquiring the luminance reconstruction information recY of the current prediction block (if the pre-processing is needed, the information has been pre-processed).
For weighted chroma prediction, for i=0, . . . , predSizeW−1, j=0, . . . , predSizeH−1, and k=0, 1 . . . inSize−1, each element diffY[i][j][k] in the luminance difference vector is constructed, each element cWeight[i][j][k] (or cWeightFloat[i][j][k]) in the weight vector is calculated, and a chroma prediction value Cpred[i][j] is calculated by cWeight[i][j] (or cWeightFloat[i][j][k]) and refC. predSizeW is the width of a prediction block, predSizeH is the height of the prediction block, and inSize is the number of reference pixels.
In still another embodiment of the present disclosure, referring to
At operation 801: first control parameter candidates are determined for a current block.
It should be noted that the encoding method in the embodiments of the present disclosure is applied to an encoder. In addition, the encoding method may specifically refer to an intra prediction method, more specifically, a color component prediction method. A video picture may be divided into multiple coding blocks, each coding block may include a first color component, a second color component, and a third color component. The current block in the embodiment of the present disclosure refers to a current coding block to be subjected to the intra prediction in the video picture.
When prediction of the first color component needs to be performed, a component to be predicted is the first color component. When prediction of the second color component needs to be performed, the component to be predicted is the second color component. When prediction of the third color component needs to be performed, the component to be predicted is the third color component. In addition, assuming that the prediction of the first color component is performed on the current block, and that the first color component is a luminance component (i.e., the component to be predicted is the luminance component), the current block may also be referred to as a luminance block. Alternatively, assuming that the prediction of the second color component is performed on the current block, and that the second color component is the chroma component (i.e., the component to be predicted is the chroma component), the current block may also be referred to as the chroma block. In addition, in the embodiments of the present disclosure, the current block may also be referred to as a prediction block, a coding block, or a decoding block.
The first control parameter candidates include multiple candidate values of the first control parameter, and the first control parameter candidates may be understood as a control parameter selection range corresponding to the current block. An encoding end determines one or more first control parameters for the current block from the control parameter selection range, writes the obtained first control parameters into the bitstream, and transmits the bitstream to a decoding end. In an embodiment, the control parameter selection range may be a continuous range, or may be a discontinuous range including several control parameters.
Further, one coding block may correspond to one selection range of the control parameter, or different selection ranges of the control parameter may be set for different color components in the coding block.
In an embodiment, in a first selection scheme, for the chroma components Cb and Cr, the same prediction is performed for Cb and Cr chroma blocks, and the same best S that is obtained is used for the components Cr and Cb. For all blocks, the selection range of a control parameter S is given, and S is traversed at a certain step size D within this selection range. Table 2.1 shows a correspondence between a selection range of the control parameter and a coding chroma block provided according to an embodiment of the present disclosure.
In addition to traversing the control parameters S within a certain selection range, several typical control parameters S may also be selected. Table 2.2 shows a correspondence between several typical control parameters S and coding chroma blocks according to an embodiment of the present disclosure.
In a second selection scheme, regarding the chroma components Cb and Cr, the prediction is performed separately for the components Cb and Cr, and each of Cb and Cr obtains a respective best S by traversing. The WCP does not classify the block size. For all blocks, the selection range of the control parameter S is given, and S is traversed at a certain step size D within this range, as shown in Table 2.3 below:
In addition to traversing the control parameters S within a certain selection range, several typical control parameters S may also be selected, and the several typical control parameters S selected for the components Cb and Cr may be the same or different, for example, as shown in Tables 2.4 and 2.5 below:
At operation 802: a reference sample value of a first color component of the current block is determined.
In the embodiments of the present disclosure, the first color component and the second color component are different color components. The second color component is a component to be predicted in the embodiment of the present disclosure, the first color component is a reference color component in the embodiment of the present disclosure, and the reference sample value of the first color component and the first control parameter are used to determine the weighting coefficient.
In some embodiments, the operation that the reference sample value of the first color component of the current block is determined may include the following operations. the reference sample value of the first color component of the current block is determined according to an neighboring sampling value of the first color component of the current block and a reconstruction value of the first color component of the current block.
In an embodiment, the reference sample value of the first color component of the current block is set to be equal to the absolute value of the difference between a first intra-block reference value and a first neighboring reference value. The first intra-block reference value is the reconstruction value of the first color component of the current block or a value obtained by filtering the reconstruction value of the first color component of the current block. The first neighboring reference value is the neighboring sampling value of the first color component of the current block or a value obtained by filtering the neighboring sampling value of the first color component of the current block.
Here, the first intra-block reference value may be understood as the reconstruction value of the first color component of a pixel to be predicted in the current block, or a value obtained by filtering the reconstruction value of the first color component of the pixel to be predicted. The first neighboring reference value may be understood as a reconstruction value of the first color component of a reference pixel in the reference region, or a value obtained by filtering the reconstruction value of the first color component of the reference pixel.
In an embodiment, the first color component is exemplified as a luminance component, and the second color component is exemplified as a chroma component. The reference sample value of the first color component is the difference between a luminance reconstruction value (recY) of the pixel to be predicted and a luminance reconstruction value (refY) of the reference pixel. Under certain conditions, refY and recY may be pre-processed. In an embodiment, the pre-processing operation includes: (1) in order to reduce computational complexity, a point selection operation or a downsampling operation may be performed on refY or recY; (2) different filtering operations may be performed on refY or recY for current blocks of different sizes; (3) when the resolution of the chroma component of the video is not consistent with the resolution of the luminance component, upsampling and downsampling operations may be performed on refY or recY to facilitate the subsequent chroma prediction calculation; (4) when the resolution of the chroma component of the video is consistent with the resolution of the luminance component, multiple rows/columns of reference pixels may be used, and in this case, the upsampling and downsampling operations may also be performed on refY or recY to facilitate the subsequent chroma prediction calculation; and (5) when the quantity of the obtained refY is different from the quantity of a core parameter inSize, it is necessary to perform the point selection operation or the upsampling and downsampling operations on refY.
A luminance difference vector is constructed. For each pixel to be predicted, a luminance difference vector diffY[i][j][k] is obtained by subtracting luminance reconstruction information recY[i][j] corresponding to the pixel from the reference luminance information refY of inSize reference pixels and taking an absolute value, as shown in equation (2).
At operation 803: a weighting coefficient is determined according to the reference sample value of the first color component of the current block and a candidate value of the first control parameter candidates.
Here, the weighting coefficient may be calculated by means of a preset mapping relationship. In the embodiment of the present disclosure, the preset mapping relationship is a non-linear mapping relationship. Specifically, a function model (i.e., the preset mapping relationship, represented by f) for calculating the weighting coefficient may be constructed according to the trend that the closer the reference pixel is to the luminance information of the pixel to be predicted (i,j) in the current block, the higher the importance of the chroma of the reference pixel to the pixel to be predicted (i,j).
In some embodiments, the operation that the weighting coefficient is determined according to the reference sample value of the first color component of the current block and the candidate value of the first control parameter candidates may include the following operations. A first input parameter is determined according to the reference sample value of the first color component of the current block and the candidate value of the first control parameter candidates; and the weighting coefficient is determined according to a preset mapping relationship and the first input parameter.
In some embodiments, both the reference sample value of the first color component of the current block and the candidate value of the first control parameter candidates may be taken as the first input parameter, and inputted into a non-linear mapping function corresponding to the preset mapping relationship. The weighting coefficient is taken as an output value of the non-linear function. That is, both the reference sample value of the first color component and the first control parameter are taken as the input parameters of the non-linear function, and the value of the non-linear function changes as its input parameters change.
In an embodiment, the preset mapping relationship is a softmax function. Reference can be made to equations (4) and (5) for the specific mapping relationship.
In some embodiments, the operation that the first input parameter is determined according to the reference sample value of the first color component of the current block and the candidate value of the first control parameter candidates may include the following operations. The first input parameter is set to be equal to the ratio of the reference sample value of the first color component of the current block to the candidate value of the first control parameter candidates. That is, diffY[i][j][k]/S is taken as the first input parameter, and the division operation is converted into a multiplication operation to calculate the product of diffY[i][j][k] and 1/S, and the product is substituted into equation (4) to calculate a weight value.
In some embodiments, the operation that the first input parameter is determined according to the reference sample value of the first color component of the current block and the candidate value of the first control parameter candidates may include the following operations. The first input parameter is set to be equal to the product of the reference sample value of the first color component of the current block and the candidate value of the first control parameter candidates. That is, diffY[i][j][k]/S is regarded as the first input parameter, and the division operation is converted into a multiplication operation to calculate the product of diffY[i][j][k] and 1/S, and the product is substituted into equation (4) to calculate a weight value.
In some embodiments, the operation that the first input parameter is determined according to the reference sample value of the first color component of the current block and the candidate value among the first control parameter candidates may include the following operations. The first input parameter is set to be equal to a value obtained by right-shifting the reference sample value of the first color component of the current block by S bits. A value of S is determined according to the first control parameter. In an embodiment, the value of S is set to be equal to the candidate value of the first control parameter candidates. That is, diffY[i][j][k]/S is regarded as the first input parameter, and the division operation is converted into a right shift operation, which can reduce computational difficulty since the implementation of the right shift operation is less difficult than the implementation of division.
In some embodiments, the operation that the first input parameter is determined according to the reference sample value of the first color component of the current block and the candidate value of the first control parameter candidates include the following operations. The reference sample value of the first color component of the current block and the first control parameter are used as index values for a value mapping lookup table, and the value mapping lookup table is searched to obtain a corresponding array element value. The first input parameter is set to be equal to the array element value.
In addition, in some embodiments, the mapping relationship may simplify operations. For example, an array element lookup may be used to reduce part of the calculation operations. In an embodiment, a mapping lookup table consisting of reference sample values of the first color component, first control parameters, and array elements is preset. The reference sample value of the first color component and the candidate value of the first control parameter candidates are used as index values, the mapping lookup table is searched to obtain an array element, and then a value corresponding to the array element value in a preset non-linear mapping function relationship is determined. The weighting coefficient is then set to be equal to this value. The elements of the two-dimensional array storMole [index 1][index 2] are as shown in Table 1.1. diffY[i][j][k] is the index 1, and flags is the index 2. The indexed array elements are substituted into equation (7).
In some embodiments, the operation that the weighting coefficient is determined according to the preset mapping relationship and the first input parameter may include the following operations. The first input parameter is used as an input value of the preset mapping relationship, and the weighting coefficient is set to be equal to an output value of the preset mapping relationship. The preset mapping relationship is a correspondence between the first input parameter and the weighting coefficient, and the value of the weighting coefficient decreases as the value of the first input parameter increases. That is, after the first input parameter of equation (4) is determined, a function operation is performed to obtain a corresponding weight value.
At operation 804: a prediction value of the second color component of the current block is determined according to the weighting coefficient and a reference sample value of a second color component of the current block.
In some embodiments, the operation that the prediction value of the second color component of the current block is determined according to the weighting coefficient and the reference sample value of the second color component of the current block may include the following operations. A weighted sum of the weighting coefficient and the reference sample value of the second color component of the current block is calculated to determine the prediction value of the second color component of the current block.
In some embodiments, the operation that the prediction value of the second color component of the current block is determined according to the weighting coefficient and the reference sample value of the second color component of the current block may include the following operations. A weighted sum of the weighting coefficient and the reference sample value of the second color component of the current block is calculated to determine a first prediction value of the second color component of the current block. The first prediction value of the second color component of the current block is filtered to determine the prediction value of the current block.
In some embodiments, the reference sample value of the second color component of the current block is set to be equal to the neighboring sampling value of the second color component of the current block or a value obtained by filtering the neighboring sampling value of the second color component of the current block.
The neighboring sampling value of the second color component is a value obtained according to the reconstruction value of the second color component of the reference pixel. The reconstruction value of the second color component of the reference pixel is directly used as the neighboring sampling value of the second color component, or the reconstruction value of the second color component of the reference pixel is filtered to obtain the neighboring sampling value of the second color component. In an embodiment, when the second color component is a chroma component, the reference sample value of the second color component is a reconstruction value of the chroma component of the reference pixel, or a value obtained by filtering the reconstruction value of the second color component of the reference pixel. Reference can be made to equation (8) for the specific calculation process.
Further, the method also includes correcting the prediction value. In an embodiment, the chroma prediction value Cpred[i][j] is corrected. The chroma prediction value should be within a limited range. If the range is exceeded, a corresponding correction operation should be performed.
Further, the method may further include post-processing the prediction value. The weighted chroma prediction output predWcp needs to be post-processed under certain conditions to serve as a final chroma prediction value predSamples, otherwise the final chroma prediction value predSamples is predWcp.
In an embodiment, the post-processing operation includes: (1) when predSizeW in the WCP core parameters is not equal to the width nTbW of the current block, or predSizeH is not equal to the width nTbH of the current block, the upsampling or downsampling operation needs to be performed on predWcp to obtain the final chroma prediction value predSamples.
At operation 805: a reference value of a prediction difference of the second color component of the current block is determined according to the prediction value and an original value of the second color component of the current block.
Here, the reference value of the prediction difference is used to denote a degree of distortion of the prediction value compared to the original value. A smaller reference value of the prediction difference indicates higher prediction accuracy, and a larger reference value of the prediction difference indicates lower prediction accuracy. In the embodiments of the present disclosure, the reference value of the prediction difference is used to select the best control parameter S within the control parameter selection range for the current block.
In an embodiment, the reference value of the prediction difference is presented according to parameters such as Sum of Absolute Difference (SAD), Sum of Absolute Transformed Difference (SATD), Sum of Squares for Error (SSE), Mean Absolute Difference (MAD), Mean Squared Error (MSE), and Rate Distortion Optimation (RDO). Using the MSE as the reference value of the prediction difference as an example, the calculation equation of the MSE is as follows:
In other embodiments, the prediction value of the second color component is a prediction value for some pixels to be predicted in the current block. Specifically, on the basis of a preset sampling ratio, pixels to be predicted are determined in the current picture unit, and some pixels in the current block are selected to participate in the traversal of S, so as to reduce the calculation quantities and improve search efficiency. For example, a quarter of pixels of the current block can be selected to participate in the traversal of S at a sampling ratio of 2:1 in both horizontal and vertical directions. The calculation equation of the MSE is as follows:
At operation 806: a first control parameter of the current block is determined according to the reference value of the prediction difference of the second color component of the current block.
In some embodiments, the operation that the first control parameter of the current block is determined according to the reference value of the prediction difference of the second color component of the current block may include the following operations. A minimum reference value is determined according to reference values of the prediction difference corresponding to multiple candidate values of the first control parameter candidates. The first control parameter is set to be equal to a candidate value corresponding to the minimum reference value.
It should be noted that, each candidate value of the first control parameter candidates corresponds to a reference value of the prediction difference. In order to make the prediction value closest to the original value, the control parameter corresponding to the smallest reference value of the prediction difference should be selected as the best control parameter. In an embodiment, a method for selecting the best control parameter S_best is as follows: a variable S_best is used to record the best control parameter S, a variable MSE_best is used to record the minimum MSE, and a variable MSE_s is used to record the MSE when the control parameter is s. A process of selecting the best control parameter S_best is as follows:
Step 807: the first control parameter of the current block is encoded to write obtained encoded bits into a bitstream.
Here, the first control parameter may be the best control parameter determined by the encoding end for the current block, or multiple first control parameter candidates determined by the encoding end for the current block. The encoding end transmits the first control parameter to the decoding end through the bitstream, and the decoding end calculates a weighting coefficient according to the received first control parameter, which can increase the reliability of the weighting coefficient and further improve the accuracy of the color component prediction to a certain extent.
In some embodiments, the operation that the first control parameter of the current block is encoded may include the following operation. An index parameter of the first control parameter of the current block is encoded.
With respect to the first selection scheme,
In an embodiment, the decoding end may obtain the best control parameter S for the current block from the CU layer by parsing, and the specific process is as follows:
In the scheme, the added chroma prediction mode of the WCP is in a competitive relationship with other chroma prediction modes. The specific parsing of the mode index wcp_mode_idx of the chroma prediction mode is as follows:
With respect to second selection scheme,
In an embodiment, the decoding end may obtain, from the CU layer, the best control parameter S for the current block under different chroma components by parsing, and the specific process is as follows:
In the embodiments of the present disclosure, the operation that the first control parameter candidates are determined is further exemplified.
In some embodiments, the method further includes the operation that the first control parameter candidates are determined according to a prediction parameter of the current block. That is, different selection ranges for the control parameter are set for different coding blocks, and a matching selection range for the control parameter is selected according to the prediction parameter of the current block, thereby improving the efficiency of the selection of the control parameter.
In an embodiment, in some embodiments, the method may further include the operation that a selection step size of the first control parameter candidates is determined based on the prediction parameter of the current block. In subsequent operations, the first control parameter candidates are traversed according to the selection step size. Every time one candidate value is selected from the first control parameter candidates, a weighting coefficient is obtained by performing non-linear mapping using the selected candidate value. A weighting operation is performed using the weighting coefficient to obtain prediction values of all or some of the pixels in the current block. A reference value of a prediction difference is calculated according to the prediction values and the original values until the traversal is completed. The best control parameter is determined according to the obtained reference value of the prediction difference corresponding to each candidate value.
In some embodiments, the operation that the first control parameter candidates are determined according to the prediction parameter of the current block may include the following operation. First control parameter candidates corresponding to the current block are determined based on a preset correspondence between prediction parameters and first control parameter candidates according to the prediction parameter of the current block. That is, the correspondence is preset, and the correspondence is a correspondence between prediction parameters and the selection ranges of the control parameter. A corresponding selection range of the control parameter is determined according to the prediction parameter of the current block, and one or more candidate values of the first control parameter are further selected from the control parameter selection range.
In some embodiments, the prediction parameter of the current block at least includes a size of the current block. The size of the current block includes at least one of a height of a current block, a width of the current block, a number of first color component sampling points included in the current block, or a number of second color component sampling points included in the current block. Here, the first color component sampling points and the second color component sampling points are pixel points within the current block, and the first color component sampling points and the second color component sampling points may be identical pixel points or non-identical pixel points.
In some embodiments, the prediction parameter of the current block includes a prediction mode of the current block. It should be noted that, in the embodiments of the present disclosure, when the selection range of the candidate control parameters is determined, the prediction parameter may include at least one of a component to be predicted, a size of the current block, a prediction mode, and an index parameter of a control parameter.
In some embodiments, the method may further include the operation that the selection step size of first control parameter candidates is determined based on the prediction parameter of the current block. When the selection range of the control parameter is continuous, the selection step size is set according to the prediction parameter, and all or some of the candidate values in the selection range are traversed according to the selection step size.
It should be noted that, in the embodiments of the present disclosure, the selection range of the first control parameter may be determined by means of classification. For example, three categories are obtained by classification according to the size parameter of the current block, and the respective selection range of the first control parameter corresponding to each category is determined. Alternatively, three categories are obtained by classification according to the number of sampling points of the current block, and the respective selection range of the first control parameter corresponding to each category is determined.
In an embodiment, in the third selection scheme, N-classification is performed according to the block size or the number of pixels in a block, the corresponding selection range of the control parameter is determined according to the type of the block. Regarding chroma components Cb and Cr, the same prediction is performed for Cb and Cr chroma blocks, and the same best S that is obtained is used for components Cr and Cb. For each category of blocks, one respective selection range of the control parameter S is given, the purpose of which is to make the prediction blocks of different categories traverse the control parameters S within different selection ranges. The encoding end traverses S at a certain step size D within this range. For example, the determination is made according to the minimum size and the maximum size of the coding chroma block. For example, the classification is performed according to the block size, as shown in Table 2.6 below.
For example, the classification is performed according to the number W×H of pixels in the block, as shown in Table 2.7 below:
With respect to selection scheme 3,
For the selection scheme, the decoding end may obtain, from the CU layer, the best control parameter S for different categories of current blocks by parsing, and the specific process is as follows:
In the third selection scheme, the added chroma prediction mode of the WCP is in a competitive relationship with other chroma prediction modes. The specific parsing of the mode index wcp_mode_idx of the chroma prediction mode is the same as that of the first selection scheme and the second selection scheme.
In fourth selection scheme, the block size or the number of pixels in the block is not classified. The WCP mode is divided into three modes according to available reference regions: WCP, WCP_L, and WCP_T. The reference regions of the WCP mode are upper region+left region, the reference regions of the WCP_T mode are upper region+upper right region, and the reference regions of the WCP_L mode are left region+lower left region. For the chroma components Cb and Cr, the same prediction is performed for Cb and Cr chroma blocks, and the same best S that is obtained is used for the components Cr and Cb. For each WCP mode, a selection range of the control parameter S is given, and S is traversed at a certain step size D within this range, as shown in Table 2.8 below:
With respect to the fourth selection scheme,
For the fourth selection scheme, the decoding end may obtain, from the CU layer, the best control parameter S for the current block in different WCP modes by parsing, and the specific process is as follows:
In the fourth selection scheme, the newly added three chroma prediction modes WCP, WCP_L, and WCP_T are in a competitive relationship with other chroma prediction modes. The specific parsing of the mode index wcp_mode_idx of the chroma prediction mode is as follows:
In the fifth selection scheme, the WCP mode is divided into three modes according to available reference regions: WCP, WCP_L, and WCP_T. The reference regions of the WCP mode are upper region +left region, the reference regions of the WCP_T mode are upper region +upper right region, and the reference regions of the WCP_L mode are left region+lower left region. For each WCP mode, N-classification is performed according to the block size or the number of pixels in the block, and the corresponding selection range of the control parameter is determined according to the type of the block. It is noted that the number of classifications Nin different WCP modes may be the same or different, and the classifications manner may be the same or different. For each category of blocks, one selection range of the control parameter S is given, the purpose of which is to make the prediction blocks of different categories traverse the control parameters S within different selection ranges. The encoding end traverses S at a certain step size D within this range. Here, for the chroma components Cb and Cr, the same prediction is performed for Cb and Cr chroma blocks, and the same best S that is obtained is used for the components Cr and Cb. For example, block sizes in different WCP modes are classified as shown in Table 2.9 below:
The number W×H of pixels in the block in different WCP modes may be also classified as shown in Table 2.10 below:
With respect to the fifth selection scheme,
For the fifth selection scheme, the decoding end may obtain, from the CU layer, the best control parameter S for different categories of current blocks in different WCP modes by parsing, and the specific process is as follows:
In the fifth selection scheme, the newly added three chroma prediction modes WCP, WCP_L, and WCP_T are in a competitive relationship with other chroma prediction modes. The specific parsing of the mode index wcp_mode_idx of the chroma prediction mode is the same as that of the fifth selection scheme.
It should be noted that, in the third selection scheme and the fifth selection scheme described above, regarding the chroma components Cb and Cr, the same prediction is performed for Cb and Cr chroma blocks, and the same best S that is obtained is used for the components Cr and Cb. The prediction may also be performed separately for the components Cb and Cr, and each of the components Cb and Cr may obtain a respective best S by transversing.
In the embodiments of the present disclosure, in addition to the transmission of the best control parameter S at the CU layer in the bitstream, an original value of a coding block may be introduced at an SPS layer, a PPS layer, an APS layer, a PH layer, an SH layer, a CTU layer, or the like in the bitstream to perform distortion cost calculation to obtain the best control parameter S, and to perform the transmission of the best control parameter S.
When being transmitted at the SPS layer: the same S is used for the same sequence of frames, and the syntax semantics are as follows:
When being transmitted at the PPS layer: the same S is used for the same frame, and the syntax semantics are as follows:
When being transmitted at the APS layer: the same S is used for the same frame, an APS parameter type WCP_APS may be added at the APS layer. When aps_params_type is WCP_APS, the syntax structure of wcp_data( ) is parsed. A control parameter set of WCP is included in wcp_data( ), and the control parameter set includes several typical control parameters S. A control parameter set including three control parameters is used as an example as shown in Table 2.11 below.
The encoding end introduces the original value of the current coding block and selects the best control parameter value from the control parameter set through the distortion cost such as SAD, SATD, MSE, etc.
The decoding end acquires the best control parameter S corresponding to the WCP by parsing wcp_data( ) at the APS layer. The syntax semantics are as follows:
When being transmitted at the PH layer: the same S is used for the same picture, and the syntax semantics are as follows:
When being transmitted at the SH layer: the same S is used for the same slice, and the syntax semantics are as follows:
When being transmitted at the CTU layer: the same S is used for the same CTU, and the syntax semantics are as follows:
By adopting the above technical solution, a weighting coefficient is calculated by means of luminance information of neighboring region reference points and a current block, and the weighting coefficient is used for the chroma prediction of the current coding block, which fully explores the correlation between the current coding block and neighboring reference regions in the luminance information. The correlation is used to participate in the chroma prediction of the current coding block, thereby improving the accuracy of chroma prediction. At the same time, the original value of the current block is introduced into a larger control parameter selection, the best control parameter S is selected at the encoding end according to the deviation between the original value and the prediction value, and the best control parameter S is transmitted to the decoding end through the bitstream, which can improve the mapping ability of the non-linear mapping model, increase the credibility of the reference pixel weight, and further improve the accuracy of chroma prediction to a certain extent.
In yet another embodiment of the present disclosure, the embodiment of the present disclosure further provides a bitstream, which is generated by bit coding according to information to be coded. The information to be coded includes at least a first control parameter of a current block.
In some embodiments, the information to be coded further includes a preset correspondence between prediction parameters and first control parameters. In an embodiment, the prediction parameter includes at least one of a component to be predicted, a size of the current block, a prediction mode, and an index parameter of a control parameter. The current block size may include at least one of the height of the current block, the width of the current block, the number of first color component sampling points included in the current block, and the number of second color component sampling points included in the current block. Here, the first color component sampling points and the second color component sampling points are pixel points to be predicted within the current block, and the first color component sampling points and the second color component sampling points may be pixel points completely identical to each other or not completely identical to each other. In this way, the encoding end transmits the first control parameters to the decoding end through the bitstream, which can increase the reliability of the weighting coefficient and improve the accuracy of the chroma prediction to a certain extent.
In yet another embodiment of the present disclosure, referring to
The first determination unit 1401 is configured to determine first control parameter candidates for a current block.
The first calculation unit 1402 is configured to determine a reference sample value of a first color component of the current block, and determine a weighting coefficient according to the reference sample value of the first color component of the current block and a candidate value of the first control parameter candidates.
The first prediction unit 1403 is configured to determine, according to the weighting coefficient and a reference sample value of a second color component of the current block, a prediction value of the second color component of the current block; determine, according to the prediction value and an original value of the second color component of the current block, a reference value of a prediction difference of the second color component of the current block; and determine a first control parameter of the current block according to the reference value of the prediction difference of the second color component of the current block.
The encoding unit 1404 is configured to encode the first control parameter of the current block to write obtained coded bits into a bitstream.
In some embodiments, the first control parameter candidates include multiple candidate values of the first control parameter.
In some embodiments, the first control parameter candidates are determined according to a prediction parameters of the current block.
In some embodiments, the prediction parameters of the current block at least include a size of the current block. The size of the current block includes at least one of a height of the current block, a width of the current block, a number of first color component sampling points included in the current block, or a number of second color component sampling points included in the current block.
In some embodiments, the prediction parameters of the current block include a prediction mode of the current block.
In some embodiments, the first determination unit 1401 is configured to determine, according to the prediction parameters of the current block, first control parameter candidates corresponding to the current block based on a preset correspondence between prediction parameters and first control parameter candidates.
In some embodiments, the first calculation unit 1402 is configured to determine, according to neighboring sampling values of the first color component of the current block and a reconstruction value of the first color component of the current block, the reference sample value of the first color component of the current block.
In some embodiments, the first calculation unit 1402 is configured to set the reference sample value of the first color component of the current block to be equal to an absolute value of a difference between a first intra-block reference value and a first neighboring reference value. The first intra-block reference value is the reconstruction value of the first color component of the current block or a value obtained by filtering the reconstruction value of the first color component of the current block. The first neighboring reference value is the neighboring sampling value of the first color component of the current block or a value obtained by filtering the neighboring sampling value of the first color component of the current block.
In some embodiments, the first calculation unit 1402 is configured to determine a first input parameter according to the reference sample value of the first color component of the current block and the candidate value of the first control parameter candidates, and determine the weighting coefficient according to a preset mapping relationship and the first input parameter.
In some embodiments, the first calculation unit 1402 is configured to set the first input parameter to be equal to a ratio of the reference sample value of the first color component of the current block to the candidate value of the first control parameter candidates.
In some embodiments, the first calculation unit 1402 is configured to set the first input parameter to be equal to a product of the reference sample value of the first color component of the current block and the candidate value of the first control parameter candidates.
In some embodiments, the first calculation unit 1402 is configured to set the first input parameter to be equal to a value obtained by right-shifting the reference sample value of the first color component of the current block by S bits. A value of S is determined according to the candidate value of the first control parameter candidates.
In some embodiments, the value of S is set to be equal to the candidate value of the first control parameter candidates.
In some embodiments, the first calculation unit 1402 is configured to use the reference sample value of the first color component of the current block and the first control parameter as index values for a value mapping lookup table, search the value mapping lookup table to obtain a corresponding array element value, and set the first input parameter to be equal to the array element value.
In some embodiments, the first calculation unit 1402 is configured to use the first input parameter as an input value of the preset mapping relationship and set the weighting coefficient to be equal to an output value of the preset mapping relationship, wherein the preset mapping relationship is a correspondence between the first input parameter and the weighting coefficient, and a value of the weighting coefficient decreases as a value of the first input parameter increases.
In some embodiments, the preset mapping relationship is a softmax function.
In some embodiments, the first prediction unit 1403 is configured to calculate a weighted sum of the weighting coefficient and the reference sample value of the second color component of the current block to determine the prediction value of the second color component of the current block.
In some embodiments, the first prediction unit 1403 is configured to calculate a weighted sum of the weighting coefficient and the reference sample value of the second color component of the current block to determine a first prediction value of the second color component of the current block, and filter the first prediction value of the second color component of the current block to determine the prediction value of the current block.
In some embodiments, the first prediction unit 1403 is configured to determine, according to an neighboring sampling value of the second color component of the current block, the reference sample value of the second color component of the current block.
In some embodiments, the first prediction unit 1403 is configured to set the reference sample value of the second color component of the current block to be equal to the neighboring sampling value of the second color component of the current block or a value obtained by filtering the neighboring sampling value of the second color component of the current block.
In some embodiments, the first prediction unit 1403 is configured to determine, according to a difference between the prediction value and the original value of the second color component of the current block, the reference value of the prediction difference of the second color component of the current block.
In some embodiments, the first prediction unit 1403 is configured to determine a minimum reference value according to reference values of prediction differences corresponding to multiple candidate values of the first control parameter candidates, and set the first control parameter to be equal to a candidate value corresponding to the minimum reference value.
In some embodiments, the coding unit 1404 is configured to encode the first control parameter of the current block in data units at a block layer and above in the bitstream.
In some embodiments, the data units at the block layer and above include at least one of a parameter set data unit, a picture header, a slice header, a coding tree unit, or a current unit.
In some embodiments, the first control parameter candidates include one or more [00492] candidate values of the first control parameter.
In some embodiments, the coding unit 1404 is configured to encode, in a parameter set data unit in the bitstream, a preset correspondence between prediction parameters and first control parameters. A parameter set corresponding to the parameter set data unit is a parameter set directly or indirectly referenced by a slice, and the slice comprises the current block.
In some embodiments, the parameter set directly or indirectly referenced by the slice includes at least one of a sequence parameter set, a picture parameter set, or an adaptation parameter set.
In some embodiments, the coding unit 1404 is configured to encode the preset correspondence between prediction parameters and first control parameters in a slice header in the bitstream.
In some embodiments, the coding unit 1404 is configured to encode the preset correspondence between prediction parameters and first control parameters in a picture header in the bitstream. A picture corresponding to the picture header includes the slice.
In actual application, the embodiments of the present disclosure further provide an encoding device.
The first memory 1501 stores a computer program executable on the first processor 1502, and the first processor 1502, when executing the program, implements an encoding method of an encoder side.
In actual application, the encoding device may further include a first communication interface used for reception and transmission of signals in the process sending information to other external network elements and receiving information from other external network elements.
By adopting the above coding apparatus or coding device, a weighting coefficient is calculated by means of luminance information of neighboring region reference points and a current block, and the weighting coefficient is used for the chroma prediction of the current coding block, which fully explores the correlation between the current coding block and neighboring reference regions in the luminance information. The correlation is used to participate in the chroma prediction of the current coding block, thereby improving the accuracy of chroma prediction. At the same time, the original value of the current block is introduced into a larger control parameter selection, the best control parameter S is selected at the encoding end according to the deviation between the original value and the prediction value, and the best control parameter S is transmitted to the decoding end through the bitstream, which can improve the mapping ability of the non-linear mapping model, increase the credibility of the reference pixel weight, and further improve the accuracy of chroma prediction to a certain extent.
In yet another embodiment of the present disclosure, referring to
The decoding unit 1601 is configured to decode a bitstream to determine a first control parameter of a current block.
The second calculation unit 1602 is configured to determine a reference sample value of a first color component of the current block, determine a weighting coefficient according to the reference sample value of the first color component of the current block and the first control parameter, and determine, according to the weighting coefficient and a reference sample value of a second color component of the current block, a prediction value of the second color component of the current block.
The second prediction unit 1603 is configured to determine a reconstruction value of a second color component sampling point of the current block according to the prediction value of the second color component of the current block.
In some embodiments, the decoding unit 1601 is configured to: decode data units at a block layer and above in the bitstream to determine first control parameter candidates, and determine the first control parameter according to the first control parameter candidates.
In some embodiments, the data units at the block layer and above include at least one of a parameter set data unit, a picture header, a slice header, a coding tree unit, or a current unit.
In some embodiments, the first control parameter candidates include one or more candidate values of the first control parameter.
In some embodiments, the decoding unit 1601 is configured to determine the first control parameter from the first control parameter candidates according to a prediction parameter of the current block.
In some embodiments, the prediction parameter of the current block at least includes a size of the current block. The size of the current block comprises at least one of a height of the current block, a width of the current block, a number of first color component sampling points included in the current block, or a number of second color component sampling points included in the current block.
In some embodiments, the prediction parameter of the current block includes a prediction mode of the current block.
In some embodiments, the prediction parameter of the current block includes an index parameter of the first control parameter.
In some embodiments, the decoding unit 1601 is configured to determine the first control parameter from the first control parameter candidates based on a preset correspondence between prediction parameters and first control parameters.
In some embodiments, the first control parameter is set to be equal to a first control parameter corresponding to the prediction parameter of the current block from the first control parameter candidates.
In some embodiments, the decoding unit 1601 is configured to decode a slice header in the bitstream to determine a parameter set directly or indirectly referenced by a slice. The slice corresponding to the slice header includes the current block. The decoding unit 1601 is configured to determine the preset correspondence between prediction parameters and first control parameters according to the parameter set directly or indirectly referenced by the slice.
In some embodiments, the parameter set directly or indirectly referenced by the slice includes at least one of a sequence parameter set, a picture parameter set, or an adaptation parameter set.
In some embodiments, the decoding unit 1601 is configured to decode the slice header, and update the preset correspondence between prediction parameters and first control parameters.
In some embodiments, the decoding unit 1601 is configured to decode a picture header in the bitstream, and update the preset correspondence between prediction parameters and first control parameters. A picture corresponding to the picture header includes the slice.
In some embodiments, the second calculation unit 1602 is configured to determine the reference sample value of the first color component of the current block according to an neighboring sampling value of the first color component of the current block and a reconstruction value of the first color component of the current block.
In some embodiments, the second calculation unit 1602 is configured to set the reference sample value of the first color component of the current block to be equal to an absolute value of a difference between a first intra-block reference value and a first neighboring reference value. The first intra-block reference value is the reconstruction value of the first color component of the current block or a value obtained by filtering the reconstruction value of the first color component of the current block. The first neighboring reference value is the neighboring sampling value of the first color component of the current block or a value obtained by filtering the neighboring sampling value of the first color component of the current block.
In some embodiments, the second calculation unit 1602 is configured to determine a first input parameter according to the reference sample value of the first color component of the current block and the first control parameter, and determine the weighting coefficient according to a preset mapping relationship and the first input parameter.
In some embodiments, the second calculation unit 1602 is configured to set the first input parameter to be equal to a ratio of the reference sample value of the first color component of the current block to the first control parameter.
In some embodiments, the second calculation unit 1602 is configured to set the first input parameter to be equal to a product of the reference sample value of the first color component of the current block and the first control parameter.
In some embodiments, the second calculation unit 1602 is configured to set the first input parameter to be equal to a value obtained by right-shifting the reference sample value of the first color component of the current block by S bits. A value of S is determined according to the first control parameter.
In some embodiments, the second calculation unit 1602 is configured to set the value of S to be equal to the first control parameter.
In some embodiments, the second calculation unit 1602 is configured to use the reference sample value of the first color component of the current block and the first control parameter as index values for a value mapping lookup table, search the value mapping lookup table to obtain a corresponding array element value, and set the first input parameter to be equal to the array element value.
In some embodiments, the second calculation unit 1602 is configured to use the first input parameter as an input value of the preset mapping relationship, and set the weighting coefficient to be equal to an output value of the preset mapping relationship. The preset mapping relationship is a correspondence between the first input parameter and the weighting coefficient, and a value of the weighting coefficient decreases as a value of the first input parameter increases.
In some embodiments, the preset mapping relationship is a softmax function.
In some embodiments, the second prediction unit 1603 is configured to calculate a weighted sum of the weighting coefficient and the reference sample value of the second color component of the current block to determine the prediction value of the second color component of the current block.
In some embodiments, the second prediction unit 1603 is configured to calculate a weighted sum of the weighting coefficient and the reference sample value of the second color component of the current block to determine a first prediction value of the second color component of the current block; and filtering the first prediction value of the second color component of the current block to determine the prediction value of the current block.
In some embodiments, the second prediction unit 1603 is configured to determine, according to an neighboring sampling value of the second color component of the current block, the reference sample value of the second color component of the current block.
In some embodiments, the reference sample value of the second color component of the current block is set to be equal to the neighboring sampling value of the second color component of the current block or a value obtained by filtering the neighboring sampling value of the second color component of the current block.
In some embodiments, the decoding unit 1601 is configured to decode the bitstream to determine a reconstruction value of a prediction difference of the second color component of the current block.
The second prediction unit 1603 is configured to determine the reconstruction value of the second color component sampling point of the current block according to a sum of the prediction value of the second color component of the current block and the reconstruction value of the prediction difference of the second color component of the current block.
In actual application, embodiments of the present disclosure further provide a decoding device.
The second memory 1701 stores a computer program executable on the second processor 1702, and the second processor 1702, when executing the program, implements a decoding method of a decoder side.
In actual application, the decoding device may further include a second communication interface used for reception and transmission of signals in the process sending information to other external network elements and receiving information from other external network elements.
By adopting the above decoding apparatus or decoding device, a weighting coefficient is calculated by means of luminance information of neighboring region reference points and a current block, and the weighting coefficient is used for the chroma prediction of the current coding block, which fully explores the correlation between the current coding block and neighboring reference regions in the luminance information. The correlation is used to participate in the chroma prediction of the current coding block, thereby improving the accuracy of chroma prediction. The decoding end receives the best control parameter or the control parameter candidates through the bitstream, so as to improve the mapping capability of the non-linear mapping model by using the control parameter in the bitstream, increase the reliability of the reference pixel weight, thereby further improving the accuracy of the chroma prediction to a certain extent.
In addition, various functional units in this embodiment may be integrated in one processing unit, or each unit may be individually physically present, or two or more units may be integrated into one unit. The integrated units described above may be implemented in the form of hardware or in the form of software functional modules.
In yet another embodiment of the present disclosure, referring to
In the embodiments of the present disclosure, in the coding and decoding system 180, both the encoder 1801 and the decoder 1802 may use color component information of neighboring reference pixels and a pixel to be predicted to calculate a weighting coefficient corresponding to the pixel to be predicted. Furthermore, different reference pixels may have different weighting coefficients, and the weighting coefficients are applied to the chroma prediction of the pixel to be predicted in the current block, thereby not only improving the accuracy of chroma prediction and reducing bitrates, but also enhancing encoding and decoding performance.
Correspondingly, an embodiment of the present disclosure provides a computer storage medium having stored thereon a computer program. When the computer program is executed by a first processor, an encoding method performed of an encoder is implemented. Alternatively, when the computer program is executed by a second processor, a decoding method of a decoder is implemented.
It should be pointed out here that the above description of the storage medium and apparatus embodiments is similar to the description of the method embodiments described above, and has similar beneficial effects as the method embodiments. For technical details not disclosed in the storage medium and apparatus embodiments of the present disclosure, reference can be made to the description of the method embodiments of the present disclosure for understanding.
It should be noted that the expressions “first”, “second”, and the like are used for distinguishing similar objects and are not necessarily for describing a particular sequential or chronological order.
The methods disclosed in several method embodiments according to the present disclosure may be arbitrarily combined without conflict to obtain new method embodiments. The features disclosed in several product embodiments provided by the present disclosure may be arbitrarily combined without conflict to obtain new product embodiments. The features disclosed in several method or apparatus embodiments according to the present disclosure may be arbitrarily combined without conflict to obtain new method embodiments or apparatus embodiments. The above description is merely the detailed description of the present disclosure, but the scope of protection of the present disclosure is not limited thereto. Any changes or substitutions that can be easily thought of by those skilled in the art within the scope of the disclosure should be included in the scope of protection of the present disclosure. Therefore, the scope of protection of the present disclosure should be defined by the scope of protection of the claims.
The present disclosure provides encoding and decoding methods and apparatuses, an encoding device, a decoding device, and a storage medium. The decoding method includes: decoding a bitstream to determine a first control parameter of a current block; determining a reference sample value of a first color component of the current block; determining a weighting coefficient according to the reference sample value of the first color component of the current block and the first control parameter; determining, according to the weighting coefficient and a reference sample value of a second color component of the current block, a prediction value of the second color component of the current block; and determining, according to the prediction value of the second color component of the current block, a reconstruction value of a second color component sampling point of the current block. In this way, a weighting coefficient corresponding to a pixel to be predicted in a current block is calculated. The weighting coefficient is used to predict a color component of the pixel to be predicted in the current block, which can not only improve prediction accuracy and reduce bitrates, but also enhance encoding and decoding performance. In addition, the encoding end transmits the first control parameter to the decoding end through a bitstream, which can increase the reliability of the weighting coefficient, and further improve the accuracy of color component prediction to a certain extent.
This application is a continuation of International Patent Application No. PCT/CN2022/086466 filed on Apr. 12, 2022, the disclosure of which is hereby incorporated by reference in its entirety.
Number | Date | Country | |
---|---|---|---|
Parent | PCT/CN2022/086466 | Apr 2022 | WO |
Child | 18908346 | US |