Embodiments of the disclosure relate to the technical field of video encoding and decoding, and in particular to a method for encoding, a method for decoding, and a device for decoding.
With the improvement of video display quality requirements, new forms of video application such as high definition (HD) and ultra-high definition (UHD) videos, or the like have emerged accordingly. The Joint Video Exploration Team (JVET) of the International Organization for Standardization (ISO)/International Electrotechnical Commission (IEC) and International Telecommunication Union Telecommunication Standardization Sector (ITU-T) has developed a next-generation video coding standard H.266/Versatile Video Coding (VVC).
H.266/VVC includes a cross-color component prediction technology. However, there is a large deviation between a predicted value of a Coding Block (CB) calculated by the cross-color component prediction technology of H.266/VVC and an original value, which results in a low prediction accuracy, results in reduction of quality of a decoded video, and reduces coding performance.
In order to understand characteristics and technical contents of the embodiments of the disclosure in more detail, implementations of the embodiments of the disclosure will be described in detail below with reference to the drawings. The drawings are only for reference and illustration, 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 pointed out 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 specific orders or sequences of “first\second\third” may be interchanged if allowable, so that the embodiments of the disclosure described here may be implemented in an order besides that illustrated or described here.
In a video image, a Coding Block (CB) is usually characterized by using a first color component, a second color component and a third color component. Here, the three color components are a luma component, a blue chroma component, and a red chroma component respectively. Exemplarily, the luma component is usually indicated by a symbol Y, the blue chroma component is usually indicated by a symbol Cb or U, and the red chroma component is usually indicated by a symbol Cr or V. In this way, the video image may be represented in a YCbCr format or a YUV format. Furthermore, the video image may also be in a RGB format, a YCgCo format or the like, and the embodiments of the disclosure do not impose any limitation thereto.
It may be understood that in current processes of video image or video encoding and decoding, cross-component prediction technologies mainly include a Cross-component Linear Model (CCLM) prediction mode and a Multi-Directional Linear Model (MDLM) prediction mode, no matter model parameters derived according to the CCLM prediction mode or model parameters derived according to the MDLM prediction mode, prediction models corresponding thereto may implement prediction cross color components, 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, etc.
Taking the prediction from the first color component to the second color component as an example, it is assumed that the first color component is the luma component and the second color component is the chroma component, then in order to reduce redundancy between the luma component and the chroma component, the CCLM prediction mode is used in H.266/Versatile Video Coding (VVC), that is, a predicted value of chroma is created according to a reconstructed luma value of the same CB, such as PredC(i,j)=α·RecL(i,j)+β.
Here, i, j indicate a position coordinate of a to-be-predicted pixel in the CB, i indicates a horizontal direction, and j indicates a vertical direction; PredC(i,j) indicates a predicted chroma value corresponding to the to-be-predicted pixel in the CB with the position coordinate (i,j), RecL(i,j) indicates a reconstructed luma value corresponding to the to-be-predicted pixel in the same CB with the (downsampled) position coordinate (i,j). Furthermore, α and β indicate model parameters, which may be derived from reference pixels.
With respect to a CB, a neighboring area thereof may be divided into five parts: a left neighboring area, an upper neighboring area, a lower left neighboring area, an upper left neighboring area, and an upper right neighboring area. H.266/VVC includes three CCLM prediction modes, which are a left and upper neighboring intra-CCLM prediction mode (it may be indicated by INTRA_LT_CCLM), a left and lower left neighboring intra-CCLM prediction mode (it may be indicated by INTRA_L_CCLM), and an upper and upper right neighboring intra-CCLM prediction mode (it may be indicated by INTRA_T_CCLM) respectively. Each of the three prediction modes may select a preset number (such as 4) of reference pixels to derive the model parameters α and β. A biggest difference between the three prediction modes lies in that selection areas corresponding to the reference pixels for deriving the model parameters α and β are different.
Specifically, a size of the CB corresponding to the chroma component is W×H, it is assumed that an upper selection area corresponding to the reference pixels is W′, and a left selection area corresponding to the reference pixels is H′, then the reference pixels are selected as follows.
With respect to the INTRA_LT_CCLM mode, the reference pixels may be selected from the upper neighboring area and the left neighboring area, that is, W′=W, H′=H.
With respect to the INTRA_L_CCLM mode, the reference pixels may be selected from the left neighboring area and the lower left neighboring area, that is, H′=W+H, and W′=0 is set.
With respect to the INTRA_T_CCLM mode, the reference pixels may be selected from the upper neighboring area and the upper right neighboring area, that is, W′=W+H, and H′=0 is set.
It should be noted that in VTM, at most only pixels in the W range are stored in the upper right neighboring area, and at most only pixels in the H range are stored in the lower left neighboring area. Although the range of selection areas of the INTRA_L_CCLM mode and the INTRA_T_CCLM mode is defined as W+H, in an actual application, the selection area of the INTRA_L_CCLM mode will be limited to H+H, and the selection area of the INTRA_T_CCLM mode will be limited to W+W, then the reference pixels are selected as follows.
With respect to the INTRA_L_CCLM mode, the reference pixels may be selected from the left neighboring area and the lower left neighboring area, that is, H′=min {W+H, H+H}.
With respect to the INTRA_T_CCLM mode, the reference pixels may be selected from the upper neighboring area and the upper right neighboring area, that is, W′=min {W+H, W+W}.
With reference to
In this way, based on
After a preset number of reference pixels are acquired, chroma prediction is currently performed according to a schematic flowchart of a solution of deriving model parameters shown in
At S301, reference pixels are acquired from a selected area.
At S302, a number of valid reference pixels is determined.
At S303, if the number of the valid reference pixels is 0, a model parameter α is set as 0, and a model parameter β is set as a default value.
At S304, a predicted chroma value is filled with a default value.
At S305, if the number of the valid reference pixels is 4, two reference pixels with larger values and two reference pixels with smaller values from a luma component are obtained through comparison.
At S306, a mean value point corresponding to the larger values and a mean value point corresponding to the smaller values are calculated.
At S307, the model parameters α and β are derived according to the two mean value points.
At S308, chroma prediction is performed by using a prediction model constructed by α and β.
It should be noted that in VVC, the operation in which the number of valid reference pixels is 0, is determined according to validity of neighboring areas.
It should also be noted that the prediction model is constructed by using a principle of “two points determine a straight line”, and the two points here may be referred to as fitting points. In the current technical solution, after four reference pixels are acquired, two reference pixels with larger values and two reference pixels with smaller values in the luma component are obtained through comparison. Then a mean value point (which may be indicated by meanmax) is calculated according to the two reference pixels with larger values, and another mean value point (which may be indicated by meanmin) is calculated according to the two reference pixels with smaller values, so that two mean value points meanmax and meanmin may be obtained. Then meanmax and meanmin are used as two fitting points, so that the model parameters (indicated by α and β) may be derived. Finally, the prediction model is constructed according to α and β, and prediction process of the chroma component is performed according to the prediction model.
However, in the related art, the chroma component is predicted by using a simple linear model PredC(i,j)=α·RecL(i,j)+β for each CB, and a pixel at any position of each CB is predicted by using the same model parameters α and β. This may result in defects as follows. On one hand, CBs with different content characteristics perform mapping from luma to chroma by using a simple linear model, to achieve chroma prediction, however, not the mapping function from luma to chroma in any CB may accurately fit according to the simple linear model, which results in inaccurate prediction results of some CBs. On the other hand, during prediction, pixel points at different positions in the CB use the same model parameters α and β, and there are also large differences in prediction accuracy at different positions in the CB. On the other hand, during prediction with CCLM technology, high correlation between reconstructed luma information of a current block and reference information of the neighboring area is not fully considered, which may result in that some CBs cannot be accurately predicted with this technology, thereby affecting gain effects of this technology. Simply speaking, in case of the current CCLM technology, there are large deviations between predicted values and original values of some CBs, resulting in a low prediction accuracy, reducing quality, and thus reducing encoding and decoding efficiencies.
Based on this, an embodiment of the disclosure provides a method for encoding, in which reference information of a current block is determined; a filtering process is performed on partial information in the reference information of the current block, to determine target information of the current block; a respective one of weighting coefficients is determined according to each of reference sample values of a first color component in the target information; a prediction block of a second color component of the current block is determined according to the weighting coefficients and reference sample values of a second color component in the target information; predicted difference values of second color component samples of the current block are determined according to the prediction block.
An embodiment of the disclosure further provides a method for decoding, in which reference information of a current block is determined; a filtering process is performed on partial information in the reference information of the current block, to determine target information of the current block; a respective one of weighting coefficients is determined according to each of reference sample values of a first color component in the target information; a prediction block of a second color component of the current block is determined according to the weighting coefficients and reference sample values of a second color component in the target information; reconstructed values of second color component samples of the current block are determined according to the prediction block.
In this way, with respect to color component information in the neighboring area of the current block and color component information in the current block, accuracy of these reference information may be improved since characteristics of color format information are fully considered; and upsampling, downsampling or other filtering processes are performed on these reference information, so that continuity of spatial correlation thereof may be enhanced to a certain extent, or some information with weak spatial correlation may be removed, chroma prediction may be performed better by using the target information obtained after the filtering processes, thereby improving accuracy of the chroma prediction, saving bitrates, while improving encoding and decoding performance.
Each embodiment of the disclosure will be described in detail below with reference to the drawings.
With reference to
With reference to
It should be noted that the methods according to the embodiments of the disclosure are mainly applied to the intra prediction unit 103 part as shown in
It should also be noted that when it is applied to the intra prediction unit 103 part, the “current block” specifically refers to a CB currently to be intra-predicted; when it is applied to the intra prediction unit 203 part, the “current block” specifically refers to a decoding block currently to be intra-predicted.
In an embodiment of the disclosure, with reference to
At S501, reference information of a current block is determined.
It should be noted that the method for decoding according to the embodiment of the disclosure is applied to an apparatus for decoding, or a device for decoding integrated with the apparatus for decoding (which may also be referred to as a “decoder” for short). Furthermore, the method for decoding according to the embodiment of the disclosure may specifically refer to an intra prediction method, and more specifically, to a pre-processing operation method of Weight-based Chroma Prediction (WCP).
In the embodiment of the disclosure, a video image may be divided into multiple decoding blocks, each of the decoding blocks may include a first color component, a second color component, and a third color component, and a current block here refers to a decoding block currently to be intra-predicted in the video image. Furthermore, it is assumed that prediction of the first color component is performed on the current block, and the first color component is a luma component, that is, a to-be-predicted component is a luma component, then the current block may also be referred to as a luma prediction block. Alternatively, it is assumed that prediction of the second color component is performed on the current block, and the second color component is a chroma component, that is, the to-be-predicted component is the chroma component, then the current block may also be referred to as a chroma prediction block.
It should also be noted that in the embodiment of the disclosure, the reference information of the current block may include values of first color component samples in a neighboring area of the current block and values of second color component samples in the neighboring area of the current block. These samples may be determined according to decoded pixels in the neighboring area of the current block. In some embodiments, the neighboring area of the current block may include at least one of an upper neighboring area, an upper right neighboring area, a left neighboring area, or a lower left neighboring area.
Here, the upper neighboring area and the upper right neighboring area may be considered as an upper area as a whole, and the left neighboring area and the lower left neighboring area may be considered as a left area as a whole. Furthermore, the neighboring area may further include an upper left area, details thereof are shown in
Furthermore, the reference information of the current block may further include reconstructed values of first reference color component samples in the current block. Therefore, in some embodiments, the operation of determining the reference information of the current block may include the following operations.
The reference information of the current block is determined according to values of first color component samples in a neighboring area of the current block, values of second color component samples in the neighboring area of the current block, and the reconstructed values of first reference color component samples in the current block.
It should be noted that in the embodiment of the disclosure, the reference pixels of the current block may refer to reference pixel points neighboring the current block, or may be referred to as the first color component samples or the second color component samples in the neighboring area of the current block, and are indicated by Neighboring Samples or Reference Samples. “Neighboring” here may be spatially neighboring, but is not limited thereto. For example, “neighboring” may also be temporally neighboring, or spatially and temporally neighboring. Or even, the reference pixels of the current block may be reference pixels obtained after a certain process is performed on reference pixel points spatially neighboring, temporally neighboring, and spatially and temporally neighboring, etc. The embodiment of the disclosure does not impose any limitation thereto.
It should also be noted that in the embodiment of the disclosure, the first color component is the luma component, and the second color component is the chroma component. Then, the values of the first color component samples in the neighboring area of the current block are indicated as reference luma information corresponding to the reference pixels of the current block, and the values of the second color component samples in the neighboring area of the current block are indicated as reference chroma information corresponding to the reference pixels of the current block.
In some embodiments, determination of the reference pixels of the current block may include screening pixels in the neighboring area of the current block, to determine the reference pixels.
Specifically, in the embodiment of the disclosure, a first reference pixel set is formed according to the pixels in the neighboring area of the current block; then the first reference pixel set may be screened to determine the reference pixels. Here, a number of reference pixels may be M, and M is a positive integer. In other words, M reference pixels may be selected from the pixels in the neighboring area. The value of M may be 4 usually, but is not specifically limited.
It should also be noted that there may be some unimportant pixels (for example, there is a poor correlation between these pixels) or some abnormal pixels in the pixels in the neighboring area of the current block. In order to ensure accuracy of prediction, these pixels need to be removed to obtain valid reference pixels.
In a specific embodiment, the operation of screening pixels in the neighboring area, to determine the reference pixels may include the following operations.
Positions of to-be-selected pixels are determined based on color component intensities and/or positions of the pixels in the neighboring area.
The reference pixels are determined from the pixels in the neighboring area according to the positions of the to-be-selected pixels.
It should be noted that in the embodiment of the disclosure, the color component intensity may be indicated by color component information, such as reference luma information, reference chroma information, etc. Here, the greater the value of the color component information, the higher the color component intensity. In this way, with respect to screening the pixels in the neighboring area, the pixels in the neighboring area may be screened according to the positions of the pixels or according to the color component intensities, so that the reference pixels of the current block are determined according to the screened pixels, and the values of the first color component samples in the neighboring area of the current block and the values of the second color component samples in the neighboring area of the current block may be further determined.
At S502, a filtering process is performed on partial information in the reference information of the current block, to determine target information of the current block.
In the embodiment of the disclosure, since there is a case where a number of values of the first color component samples in the neighboring area of the current block is different from a number of values of the second color component samples in the neighboring area of the current block, at this time, it may need to perform the filtering process on the values of the first color component samples or the values of the second color component samples, so that the number of the values of the first color component samples is the same as the number of the values of the second color component samples. Furthermore, since a number of reconstructed values of the first reference color component samples in the current block is different from a preset size, at this time, it may also need to perform the filtering process on the reconstructed values of the first reference color component samples in the current block, to convert the number of reconstructed values of the first reference color component samples acquired from the current block into the preset size, for input. That is, with respect to the reference information of the current block, it may be that the filtering process is performed on only the values of the first color component samples in the neighboring area of the current block, or it may be that the filtering process is performed on only the values of the second color component samples in the neighboring area of the current block, or it may be that the filtering process is performed on only the reconstructed values of the first reference color component samples in the current block, or it may be that the filtering process is performed on any two of the above three values, or even it may be that the filtering process is performed on all the above three values, the embodiment of the disclosure does not impose any limitation thereto. These cases will be respectively described below.
In a possible implementation, the operation of performing the filtering process on the partial information in the reference information of the current block, to determine the target information of the current block may include the following operations.
A first filtering process is performed on the values of the first color component samples in the neighboring area of the current block, to obtain filtered sample values of a first color component in the neighboring area of the current block.
The target information of the current block is determined according to the filtered sample values of the first color component in the neighboring area of the current block.
In the embodiment of the disclosure, a number of filtered sample values (Samples) of the first color component in the neighboring area of the current block is equal to L, here, L indicates a number of the values (Samples) of the second color component samples in the neighboring area of the current block, and L is a positive integer.
In a specific embodiment, the first filtering process may be a downsampling filtering process. Exemplarily, a number of reference luma information of the current block is usually greater than a number of reference chroma information of the current block. Therefore, the downsampling filtering process may be performed on the reference luma information of the current block, so that the number of reference luma information is the same as the number of reference chroma information.
It should also be noted that since the number of reference luma information and the number of reference chroma information of the current block may also be affected by color format information, in some embodiments, the method may further include the following operation. The first filtering process is performed on the values of the first color component samples in the neighboring area of the current block based on color format information, to obtain the filtered sample values of the first color component in the neighboring area of the current block.
In a specific embodiment, the first filtering process may further include the following operations.
If the color format information indicates 4:4:4 sampling, downsampling filtering is not performed on the values of the first color component samples in the neighboring area of the current block.
If the color format information indicates 4:2:2 sampling, downsampling filtering is performed on the values of the first color component samples in the neighboring area of the current block.
If the color format information indicates 4:2:0 sampling, downsampling filtering is performed on the values of the first color component samples in the neighboring area of the current block.
It should be noted that in the embodiment of the disclosure, when the color format information indicates 4:2:0 sampling, a downsampling rate is a reciprocal of a positive integer multiple of 2.
It should also be noted that in the embodiment of the disclosure, the color format information may include 4:4:4 sampling, 4:2:2 sampling, 4:2:0 sampling, etc. If the color format information indicates 4:4:4 sampling (which may also be indicated by YUV444), that is, a ratio of luma samples to chroma samples is 4:4:4, then the number of reference luma information acquired from the neighboring area is the same as the number of reference chroma information acquired from the neighboring area, any action is not required. If the color format information indicates 4:2:2 sampling (which may also be indicated by YUV422), that is, the ratio of luma samples to chroma samples is 4:2:2, or if the color format information indicates 4:2:0 sampling (which may also be indicated by YUV420), that is, the ratio of luma samples to chroma samples is 4:1:1, then the number of reference luma information acquired from the neighboring area is different from the number of reference chroma information acquired from the neighboring area. At this time, it needs to perform downsampling filtering on the reference luma information acquired from the neighboring area, to match the number of reference chroma information.
In this way, with respect to downsampling filtering performed on the reference luma information acquired from the neighboring area, downsampling may be performed by using a multi-tap filter (such as a four-tap filter, a five-tap filter, a six-tap filter, etc.), or acquiring a certain pixel from multiple reference luma pixels at a corresponding position of a reference chroma pixel, or even using other downsampling modes, the embodiment of the disclosure does not impose specific limitation thereto.
Exemplarily, as shown in
Further, when a number of reference luma information after downsampling filtering is L and is the same as the number of reference chroma information, it also needs to match L with a preset number at this time. Therefore, in some embodiments, the method may further include the following operations.
L is compared with the preset number.
A second filtering process is performed on the filtered sample values of the first color component in the neighboring area of the current block and the values of the second color component samples in the neighboring area of the current block according to a comparison result between L and the preset number, to determine filtered neighboring sample values of a first color component of the current block and filtered neighboring sample values of the second color component of the current block.
The target information of the current block is determined according to the filtered neighboring sample values of the first color component of the current block and the filtered neighboring sample values of the second color component of the current block.
In a specific embodiment, the operation of performing the second filtering process on the filtered sample values of the first color component in the neighboring area of the current block and the values of the second color component samples in the neighboring area of the current block according to the comparison result between L and the preset number, to determine the filtered neighboring sample values of the first color component of the current block and the filtered neighboring sample values of the second color component of the current block may include the following operations.
If L is greater than the preset number, a first sub-filtering process is performed on the filtered sample values of the first color component in the neighboring area of the current block and the values of the second color component samples in the neighboring area of the current block, to determine the filtered neighboring sample values of the first color component of the current block and the filtered neighboring sample values of the second color component of the current block.
If L is less than the preset number, a second sub-filtering process is performed on the filtered sample values of the first color component in the neighboring area of the current block and the values of the second color component samples in the neighboring area of the current block, to determine the filtered neighboring sample values of the first color component of the current block and the filtered neighboring sample values of the second color component of the current block.
It should be noted that in the embodiment of the disclosure, the preset number may be indicated by inSize. Here, inSize indicates a number of inputs when prediction is performed based on the weighting coefficient, and a value of inSize is relevant to a type of the current block. Exemplarily, it is assumed that a width of the current block is nTbW and a height of the current block is nTbH, then the value of inSize may be 2×nTbH+2×nTbW, or may be 1.5×nTbH+1.5×nTbW, or even may be nTbH+nTbW, specific limitation is not imposed thereto here.
It should also be noted that in the embodiment of the disclosure, if L is equal to the preset number, no operation is required; if L is greater than the preset number, it needs to perform the first sub-filtering process (that is, reducing the size) on the reference luma information and the reference chroma information; if L is less than the preset number, it needs to perform the second sub-filtering process (that is, enlarging the size) on the reference luma information and the reference chroma information.
In another possible implementation, the operation of performing the filtering process on the partial information in the reference information of the current block, to determine the target information of the current block may include the following operations.
A third filtering process is performed on the values of the second color component samples in the neighboring area of the current block, to obtain filtered sample values of a second color component in the neighboring area of the current block.
The target information of the current block is determined according to the filtered sample values of the second color component in the neighboring area of the current block.
In the embodiment of the disclosure, a number of filtered sample values of the second color component in the neighboring area of the current block is equal to K, K indicates a number of the values of the first color component samples in the neighboring area of the current block, and K is a positive integer.
In a specific embodiment, the third filtering process is an upsampling filtering process. Exemplarily, the number of reference luma information of the current block is usually greater than the number of reference chroma information of the current block. Therefore, the upsampling filtering process may also be performed on the reference chroma information of the current block, so that the number of reference luma information is the same as the number of reference chroma information.
Since the number of reference luma information and the number of reference chroma information of the current block may also be affected by color format information, in some embodiments, the method may further include the following operation. The third filtering process is performed on the values of the second color component samples in the neighboring area of the current block based on color format information, to obtain the filtered sample values of the second color component in the neighboring area of the current block.
In a specific embodiment, the third filtering process may further include the following operations.
If the color format information indicates 4:4:4 sampling, upsampling filtering is not performed on the values of the second color component samples in the neighboring area of the current block.
If the color format information indicates 4:2:2 sampling, upsampling filtering is performed on the values of the second color component samples in the neighboring area of the current block.
If the color format information indicates 4:2:0 sampling, upsampling filtering is performed on the values of the second color component samples in the neighboring area of the current block.
It should be noted that in the embodiment of the disclosure, when the color format information indicates 4:2:0 sampling, an upsampling rate is a positive integer multiple of 2. In this way, when the number of reference luma information acquired from the neighboring area is different from the number of reference chroma information acquired from the neighboring area, upsampling filtering may be performed on the reference chroma information acquired from the neighboring area, to match the number of reference luma information.
In this way, with respect to upsampling filtering performed on the reference chroma information acquired from the neighboring area, upsampling may be performed by using linear interpolation, nonlinear interpolation or other modes, or copying a certain reference chroma pixel, or even using other upsampling modes, the embodiment of the disclosure does not impose specific limitation thereto.
Exemplarily, as shown in
Further, when a number of reference chroma information after upsampling filtering is K and is the same as the number of reference luma information, it also needs to match K with a preset number at this time. Therefore, in some embodiments, the method may further include the following operations.
K is compared with the preset number.
A fourth filtering process is performed on the values of the first color component samples in the neighboring area of the current block and the filtered sample values of the second color component in the neighboring area of the current block according to a comparison result between K and the preset number, to determine filtered neighboring sample values of a first color component of the current block and filtered neighboring sample values of the second color component of the current block.
The target information of the current block is determined according to the filtered neighboring sample values of the first color component of the current block and the filtered neighboring sample values of the second color component of the current block.
In a specific embodiment, the operation of performing the fourth filtering process on the values of the first color component samples in the neighboring area of the current block and the filtered sample values of the second color component in the neighboring area of the current block according to the comparison result between K and the preset number, to determine the filtered neighboring sample values of the first color component of the current block and the filtered neighboring sample values of the second color component of the current block may include the following operations.
If K is greater than the preset number, a first sub-filtering process is performed on the values of the first color component samples in the neighboring area of the current block and the filtered sample values of the second color component in the neighboring area of the current block, to determine the filtered neighboring sample values of the first color component of the current block and the filtered neighboring sample values of the second color component of the current block.
If K is less than the preset number, a second sub-filtering process is performed on the values of the first color component samples in the neighboring area of the current block and the filtered sample values of the second color component in the neighboring area of the current block, to determine the filtered neighboring sample values of the first color component of the current block and the filtered neighboring sample values of the second color component of the current block.
It should be noted that in the embodiment of the disclosure, the preset number may be indicated by inSize. Specifically, if K is equal to inSize, no operation is required; if K is greater than inSize, it needs to perform the first sub-filtering process (that is, reducing the size) on the reference luma information and the reference chroma information; if K is less than inSize, it needs to perform the second sub-filtering process (that is, enlarging the size) on the reference luma information and the reference chroma information.
It may also be understood that in the embodiment of the disclosure, if the color format information is not considered, the number of reference luma information or the number of reference chroma information acquired from the neighboring area may also be directly matched with inSize, so that the number of reference luma information or the number of reference chroma information is the same as inSize.
In a possible implementation, the operation of performing the filtering process on the partial information in the reference information of the current block, to determine the target information of the current block may include the following operations.
A number of the values of the first color component samples in the neighboring area of the current block is determined as a first number.
A fifth filtering process is performed on the values of the first color component samples in the neighboring area of the current block according to a comparison result between the first number and a preset number, to determine filtered neighboring sample values of a first color component of the current block.
The target information of the current block is determined according to the filtered neighboring sample values of the first color component of the current block.
In a specific embodiment, the operation of performing the fifth filtering process on the values of the first color component samples in the neighboring area of the current block, to determine the filtered neighboring sample values of the first color component of the current block may include the following operations.
If the first number is greater than the preset number, a first sub-filtering process is performed on the values of the first color component samples in the neighboring area of the current block, to determine the filtered neighboring sample values of the first color component of the current block.
If the first number is less than the preset number, a second sub-filtering process is performed on the values of the first color component samples in the neighboring area of the current block, to determine the filtered neighboring sample values of the first color component of the current block.
It should be noted that in the embodiment of the disclosure, the number of reference luma information acquired from the neighboring area may be matched with the preset number. The number of reference luma information acquired from the neighboring area (that is, the first number) may be indicated by refYnum; the preset number may be indicated by inSize. Specifically, if refYnum is equal to inSize, no operation is required; if refYnum is greater than inSize, it needs to perform the first sub-filtering process (that is, reducing the size) on the reference luma information; if refYnum is less than inSize, it needs to perform the second sub-filtering process (that is, enlarging the size) on the reference luma information.
In another possible implementation, the operation of performing the filtering process on the partial information in the reference information of the current block, to determine the target information of the current block may further include the following operations.
A number of the values of the second color component samples in the neighboring area of the current block is determined as a second number.
A sixth filtering process is performed on the values of the second color component samples in the neighboring area of the current block according to a comparison result between the second number and a preset number, to determine filtered neighboring sample values of the second color component of the current block.
The target information of the current block is determined according to the filtered neighboring sample values of the second color component of the current block.
In a specific embodiment, the operation of performing the sixth filtering process on the values of the second color component samples in the neighboring area of the current block, to determine the filtered neighboring sample values of the second color component of the current block may include the following operations.
If the second number is greater than the preset number, a first sub-filtering process is performed on the values of the second color component samples in the neighboring area of the current block, to determine the filtered neighboring sample values of the second color component of the current block.
If the second number is less than the preset number, a second sub-filtering process is performed on the values of the second color component samples in the neighboring area of the current block, to determine the filtered neighboring sample values of the second color component of the current block.
It should also be noted that in the embodiment of the disclosure, the number of reference chroma information acquired from the neighboring area may be matched with the preset number. The number of reference chroma information acquired from the neighboring area (that is, the second number) may be indicated by refCnum; the preset number may be indicated by inSize. Specifically, if refCnum is equal to inSize, no operation is required; if refCnum is greater than inSize, it needs to perform the first sub-filtering process (that is, reducing the size) on the reference chroma information; if refCnum is less than inSize, it needs to perform the second sub-filtering process (that is, enlarging the size) on the reference chroma information.
Here, the first sub-filtering process may be a downsampling filtering process. Furthermore, in some embodiments, the first sub-filtering process may further include at least one of: a sub-filtering process is performed by using a fixed-interval position selection mode; or the sub-filtering process is performed by using a continuous position selection mode.
It should be noted that taking the reference luma information as an example, the number of reference luma information acquired from the neighboring area is refYnum. If the fixed-interval position selection mode is used to reduce the size, that is, refYnum reference luma pixels are arranged into a one-dimensional vector according to a certain position relationship, and then points are selected at a fixed interval according to a size relationship between inSize and refYnum, which may reduce the size of the reference luma information. As shown in
It should also be noted that still taking the reference luma information as an example, if the continuous position selection mode is used to reduce the size, that is, refYnum reference luma pixels are arranged into a one-dimensional vector according to a certain position relationship, and then inSize pixels are continuously selected from a preset position of the one-dimensional vector, to obtain reference luma information of the number of inSize. The preset position may be a first pixel position or a pos-th pixel position, any limitation is not imposed thereto here.
Furthermore, the second sub-filtering process may be an upsampling filtering process. Furthermore, in some embodiments, the second sub-filtering process may further include: a sub-filtering process is performed by using a fixed-interval position interpolation mode.
It should be noted that if the fixed-interval position interpolation mode is used to enlarge the size, refCnum reference chroma pixels are arranged into a one-dimensional vector according to a certain position relationship, and then points are selected at a fixed interval according to a size relationship between inSize and refCnum, thereby enlarging the size of the reference chroma information. The mode for arranging into the one-dimensional vector and the starting position for the fixed-interval interpolation may be set freely, any limitation is not imposed thereto here. In this way, with respect to the reference luma information, after an arrangement mode similar to reducing size, the one-dimensional vector is obtained; then based on the fixed interval used to enlarge the size, starting from the first pixel position of the one-dimensional vector, reference luma information of the number of inSize may be obtained by interpolation finally.
Furthermore, it should be noted that after the first filtering process is performed on the values of the first color component samples in the neighboring area of the current block, the target information of the current block is determined according to the filtered neighboring sample values of the first color component of the current block. At this time, the target information may include the filtered neighboring sample values of the first color component of the current block, the values of the second color component samples in the neighboring area of the current block, and the reconstructed values of the first reference color component samples in the current block. Similarly, after the second filtering process is performed on the values of the second color component samples in the neighboring area of the current block, the target information of the current block is determined according to the filtered neighboring sample values of the second color component of the current block. At this time, the target information may include the filtered neighboring sample values of the second color component of the current block, the values of the first color component samples in the neighboring area of the current block, and the reconstructed values of the first reference color component samples in the current block. Alternatively, after the first filtering process is performed on the values of the first color component samples in the neighboring area of the current block, and the second filtering process is performed on the values of the second color component samples in the neighboring area of the current block, at this time, the target information may include the filtered neighboring sample values of the first color component of the current block, the filtered neighboring sample values of the second color component of the current block, and the reconstructed values of the first reference color component samples in the current block.
It may also be understood that if prediction of the chroma component is performed on the current block, the reference information of the current block may further include reconstructed luma information of the current block. Therefore, in some embodiments, the operation of determining the reference information of the current block may further include the following operation. The reference information of the current block is determined based on the reconstructed values of the first reference color component samples in the current block.
It should be noted that in the embodiment of the disclosure, the first reference color component may be a luma component; then, the reconstructed values of the first reference color component samples in the current block are the reconstructed luma information of the current block.
It should also be noted that in the embodiment of the disclosure, since a number of reconstructed luma information of the current block is different from a preset size, it also needs to perform a filtering process on the reconstructed luma information of the current block, to convert the number of reconstructed luma information acquired from the current block into the preset size, for input. Here, the preset size is predSizeW×predSizeH, predSizeW indicates a width of the prediction block, and predSizeH indicates a height of the prediction block.
In some embodiments, the operation of performing the filtering process on the partial information in the reference information of the current block, to determine the target information of the current block may include the following operations.
A seventh filtering process is performed on the reconstructed values of the first reference color component samples in the current block, to determine filtered sample values of the first reference color component samples in the current block.
The target information of the current block is determined according to the filtered sample values of the first reference color component samples in the current block.
In a specific embodiment, the operation of performing the seventh filtering process on the reconstructed values of the first reference color component samples in the current block, to determine the filtered sample values of the first reference color component samples in the current block may include the following operations.
A first width and a first height are determined according to the reconstructed values of the first reference color component samples in the current block.
If the first width is greater than a width of the prediction block, or the first height is greater than a height of the prediction block, a third sub-filtering process is performed on the reconstructed values of the first reference color component samples in the current block, to determine the filtered sample values of the first reference color component samples in the current block.
If the first width is less than the width of the prediction block, or the first height is less than the height of the prediction block, a fourth sub-filtering process is performed on the reconstructed values of the first reference color component samples in the current block, to determine the filtered sample values of the first reference color component samples in the current block.
It should be noted that in the embodiment of the disclosure, it is assumed that the number of reconstructed luma information is recSizeW×recSizeH, then recSizeW indicates the first width, and recSizeH indicates the first height. Specifically, if recSizeW is equal to predSizeW, and recSizeH is equal to predSizeH, no operation is required; if recSizeW is greater than predSizeW, or recSizeH is greater than predSizeH, it needs to perform the first sub-filtering process (that is, reducing the size) on the reconstructed luma information; if recSizeW is less than predSizeW, or recSizeH is less than predSizeH, it needs to perform the second sub-filtering process (that is, enlarging the size) on the reconstructed luma information.
It should also be noted that in the embodiment of the disclosure, the third sub-filtering process may be a downsampling filtering process. Furthermore, in some embodiments, the third sub-filtering process may further include at least one of: the downsampling filtering process is performed in a horizontal direction on the reconstructed values of the first reference color component samples in the current block; the downsampling filtering process is performed in a vertical direction on the reconstructed values of the first reference color component samples in the current block; the downsampling filtering process is performed in the horizontal direction and then in the vertical direction on the reconstructed values of the first reference color component samples in the current block; or the downsampling filtering process is performed in the vertical direction and then in the horizontal direction on the reconstructed values of the first reference color component samples in the current block.
Here, at first, a horizontal downsampling factor may be calculated according to recSizeW and predSizeW, and a vertical downsampling factor may be calculated according to recSizeH and predSizeH; then, downsampling filtering is performed on the reconstructed luma information according to the horizontal downsampling factor and the vertical downsampling factor. Specifically, if the horizontal downsampling factor is greater than 1 and the vertical downsampling factor is equal to 1, it only needs to perform downsampling in the horizontal direction on the reconstructed luma information; if the horizontal downsampling factor is equal to 1 and the vertical downsampling factor is greater than 1, it only needs to perform downsampling in the vertical direction on the reconstructed luma information; if the horizontal downsampling factor is greater than 1 and the vertical downsampling factor is greater than 1, it needs to perform downsampling in both horizontal and vertical directions on the reconstructed luma information, here, downsampling in the horizontal direction and then in the vertical direction may be performed, or downsampling in the vertical direction and then in the horizontal direction may be performed, or even downsampling operations here may be replaced by convolution operations in a neural network structure, the embodiment of the disclosure does not impose any limitation thereto.
It should also be noted that in the embodiment of the disclosure, the fourth sub-filtering process is an upsampling filtering process. Furthermore, in some embodiments, the fourth sub-filtering process may further include at least one of: the upsampling filtering process is performed in a horizontal direction on the reconstructed values of the first reference color component samples in the current block; the upsampling filtering process is performed in a vertical direction on the reconstructed values of the first reference color component samples in the current block; the upsampling filtering process is performed in the horizontal direction and then in the vertical direction on the reconstructed values of the first reference color component samples in the current block; or the upsampling filtering process is performed in the vertical direction and then in the horizontal direction on the reconstructed values of the first reference color component samples in the current block.
Here, at first, a horizontal upsampling factor is calculated according to recSizeW and predSizeW, and a vertical upsampling factor is calculated according to recSizeH and predSizeH; then, upsampling filtering is performed on the reconstructed luma information according to the horizontal upsampling factor and the vertical upsampling factor. Specifically, if the horizontal upsampling factor is greater than 1 and the vertical upsampling factor is equal to 1, it only needs to perform upsampling in the horizontal direction on the reconstructed luma information; if the horizontal upsampling factor is equal to 1 and the vertical upsampling factor is greater than 1, it only needs to perform upsampling in the vertical direction on the reconstructed luma information; if the horizontal upsampling factor is greater than 1 and the vertical upsampling factor is greater than 1, it needs to perform upsampling in both horizontal and vertical directions on the reconstructed luma information, here, upsampling in the horizontal direction and then in the vertical direction may be performed, or upsampling in the vertical direction and then in the horizontal direction may be performed, or even an upsampling result of “in the horizontal direction and then in the vertical direction” and an upsampling result of “in the vertical direction and then in the horizontal direction” may be average-weighted to determine a final upsampling result, or even upsampling operations here may be replaced by convolution operations in a neural network structure, the embodiment of the disclosure does not impose any limitation thereto.
That is, in the embodiment of the disclosure, the reference information of the current block may include the values of the first color component samples in the neighboring area of the current block, the values of the second color component samples in the neighboring area of the current block, and the reconstructed values of the first reference color component samples in the current block. The target information may include the filtered neighboring sample values of the first color component of the current block, the filtered neighboring sample values of the second color component of the current block, and the filtered sample values of the first reference color component samples in the current block. If it does not need to perform a filtering process on the values of the first color component samples in the neighboring area of the current block, the filtered neighboring sample values of the first color component of the current block are equal to the values of the first color component samples in the neighboring area of the current block. Similarly, if it does not need to perform a filtering process on the values of the second color component samples in the neighboring area of the current block, the filtered neighboring sample values of the second color component of the current block are equal to the values of the second color component samples in the neighboring area of the current block. If it does not need to perform a filtering process on the reconstructed values of the first reference color component samples in the current block, the filtered sample values of the first reference color component samples in the current block are equal to the reconstructed values of the first reference color component samples in the current block.
In this way, the obtained target information may include the filtered neighboring sample values of the first color component of the current block, the filtered neighboring sample values of the second color component of the current block, and the filtered sample values of the first reference color component samples in the current block, that is, reference chroma information of the number of inSize, reference luma information of the number of inSize, and reconstructed luma information conforming to the preset size.
At S503, a respective one of weighting coefficients is determined according to each of reference sample values of a first color component in the target information.
It should be noted that in some embodiments, the method may further include the following operations. After determining the filtered neighboring sample values of the first color component of the current block, the filtered neighboring sample values of the second color component of the current block, and the filtered sample values of the first reference color component samples in the current block, each of the reference sample values of the first color component in the target information is set as an absolute value of a difference between a respective one of the filtered neighboring sample values of the first color component of the current block and a filtered sample value of a respective one of the first reference color component samples in the current block.
In some embodiments, the method may further include the following operation. The reference sample values of the second color component in the target information are set as the filtered neighboring sample values of the second color component of the current block.
Furthermore, considering the filtering process on the reference information, it may be that the filtering process is performed on only the reference luma information, or may be that the filtering process is performed on only the reconstructed luma information, or may be that the filtering process is performed on only the reference luma information and the reconstructed luma information, or even may be that the filtering process is performed on the reference chroma information, the reference luma information and the reconstructed luma information, any limitation is not imposed thereto here. Then, with respect to calculation of a luma difference, it may be an absolute value of a difference between the reference luma information and the reconstructed luma information, or may be an absolute value of a difference between the filtered reference luma information and the reconstructed luma information, or may be an absolute value of a difference between the reference luma information and the filtered reconstructed luma information, or even may be an absolute value of a difference between the filtered reference luma information and the filtered reconstructed luma information. Therefore, in the embodiment of the disclosure, with respect to the reference sample values of the first color component in the target information, the method may further include the following operations. Each of the reference sample values of the first color component in the target information is set as an absolute value of a difference between a value of a respective one of the first color component samples in the neighboring area of the current block and a reconstructed value of a respective one of the first reference color component samples in the current block; or, each of the reference sample values of the first color component in the target information is set as an absolute value of a difference between a respective one of the filtered neighboring sample values of the first color component of the current block and a reconstructed value of a respective one of the first reference color component samples in the current block; or, each of the reference sample values of the first color component in the target information is set as an absolute value of a difference between a value of a respective one of the first color component samples in the neighboring area of the current block and a filtered sample value of a respective one of the first reference color component samples in the current block, specific limitation is not imposed thereto here.
In some embodiments, the operation of determining the respective one of the weighting coefficients according to each of the reference sample values of the first color component in the target information may include the following operations.
A respective value corresponding to each of the reference sample values of the first color component under a preset mapping relationship is determined.
The respective one of the weighting coefficients is set to be equal to the respective value.
It should be noted that in the embodiment of the disclosure, each of the reference sample values of the first color component may be the absolute value of the difference between the respective one of the filtered neighboring sample values of the first color component of the current block and the filtered sample value of the respective one of the first reference color component samples in the current block. The first reference color component is the first color component, and the first color component is a color component different from the second color component to be predicted in the embodiment of the disclosure.
Exemplarily, it is assumed that the first color component is a chroma component and the second color component is a luma component, mainly a chroma component of a to-be-predicted pixel in the current block is predicted in the embodiment of the disclosure. First, at least one to-be-predicted pixel in the current block is selected, and a respective chroma difference (indicated by |ΔCk|) between reconstructed chroma of each of the at least one to-be-predicted pixel and the reference chroma in the neighboring area is calculated respectively; chroma differences, in the neighboring area, of to-be-predicted pixels at different positions are different. Position of the reference pixel with a minimum chroma difference will follow variation of the to-be-predicted pixel in the current block. The size of the chroma difference usually indicates a degree of similarity between chroma. If |ΔCk| is small, it indicates that similarity between chroma values is relatively strong, and a large weight may be provided to a weighting coefficient (indicated by wk) corresponding thereto. On the contrary, if |ΔCk| is large, it indicates that similarity between chroma values is relatively weak, and a small weight may be provided to wk. That is, a relationship between wk and |ΔCk| is approximately in an inverse ratio. In this way, a preset mapping relationship may be established according to |ΔCk|, which is shown as follows.
Here, taking formula (1) as an example, |ΔCk| indicates the reference sample value of the first color component, ƒ(|ΔCk|) indicates the value corresponding to the reference sample value of the first color component under the preset mapping relationship, wk indicates the weighting coefficient, that is, wk is set to be equal to ƒ(|ΔCk|).
It should also be noted that in the embodiment of the disclosure, if a number of reference sample values of the second color component is N, then a number of weighting coefficients is also N. A sum of the N weighting coefficients is equal to 1, and each of the weighting coefficients is a value equal to or greater than 0 and less than or equal to 1, that is, 0≤wk≤1. However, it should be noted that “a sum of the N weighting coefficients is equal to 1” is only a theoretical concept. In an actual fixed-point implementation process, an absolute value of the weighting coefficient may be greater than 1.
It may be understood that in probability theory and relevant fields, a normalized exponential function, or a Softmax function, is generalization of a logical function. It may “compress” an N-dimensional vector z containing any real number into another N-dimensional vector σ(z), so that a range of each element is between (0, 1), and a sum of all elements is 1. It is often used as a nonlinear activation function for a multi-classification neural network. The Softmax function is shown as follows.
However, the Softmax function may satisfy conditional constraints of wk, but a function value thereof increases with the increase of vector elements, which does not conform to the approximately inverse ratio relationship between wk and |ΔCk|. Therefore, in order to adapt to design of wk and meet expectation of nonlinearity of wk, the Softmax function with a parameter γ may be proposed to implement the ƒ function of formula (1), which is shown as follows for the details.
In order to implement the approximately inverse ratio relationship between wk and |ΔCk|, γ may be limited to a negative number. That is, when a first reference color component parameter is |ΔCk|, the mapping relationship between |ΔCk| and wk may be indicated by:
According to formula (4), in some embodiments, the operation of determining the respective value corresponding to each of the reference sample values of the first color component under the preset mapping relationship may include the following operations.
A first factor is determined.
A respective first product value is determined according to the first factor and each of the reference sample values of the first color component.
A value corresponding to the respective first product value under the preset mapping relationship is determined.
It should be noted that in the embodiment of the disclosure, the first factor is a constant value less than zero. Taking the Softmax function as an example, in formula (4), γ indicates the first factor, |ΔCk| indicates the first reference color component parameter, γ|ΔCk| indicates the first product value, wk indicates the weighting coefficient; where k=1, 2, . . . , N.
In a specific embodiment, the operation of determining the first factor may include: the first factor is a preset constant value.
It should be noted that in this case, with respect to γ, a weighting coefficient distribution of neighboring chroma may be adjusted according to relatively flat characteristics of chroma, thereby capturing a weighting coefficient distribution suitable for natural image chroma prediction. In order to determine the parameter γ suitable for natural image chroma prediction, a given γ set is traversed, and whether γ is suitable is measured by a difference between predicted and original chroma under different γ. Exemplarily, γ may take −2ε, here ε∈{1, 0, −1, −2, −3}; it is found after experiments that in this γ set, a best value of γ is −0.25. Therefore, in a specific embodiment, γ may be set as −0.25, however, the embodiment of the disclosure does not impose specific limitation thereto.
In another specific embodiment, the operation of determining the first factor may include the following operation. A value of the first factor is determined according to size parameters of the current block.
Further, in some embodiments, the method may further include the following operation. The value of the first factor is determined according to a preset look-up table mapping the size parameters of the current block to the value of the first factor.
Here, the size parameters of the current block may include at least one of a width of the current block, a height of the current block, or a product of the width and height of the current block.
It should be noted that in the embodiment of the disclosure, a classification mode may be used to fix the value of the first factor. For example, size parameters according to the current block are divided into three categories, and a respective value of the first factor corresponding to each of the categories is determined. In this case, in the embodiment of the disclosure, a look-up table mapping the size parameters of the current block to the value of the first factor may also be stored in advance, and then the value of the first factor may be determined according to the look-up table. Exemplarily, Table 1 shows a correspondence between the first factor and the size parameters of the current block provided in an embodiment of the disclosure. It should be noted that Table 1 is only an exemplary look-up table, specific limitation is not imposed thereto.
In yet another specific embodiment, the operation of determining the first factor may include the following operation. The value of the first factor is determined according to a number of reference pixels of the current block.
Further, in some embodiments, the method may further include the following operation. The value of the first factor is determined according to a preset look-up table mapping the number of reference pixels of the current block to the value of the first factor.
It should be noted that in the embodiment of the disclosure, the number of reference pixels may be divided into three categories, and a classification mode is still used to fix the value of the first factor. For example, the number of reference pixels according to the current block is divided into three categories, and a value of the first factor corresponding to each of the categories is determined. In this case, in the embodiment of the disclosure, a look-up table mapping the number of reference pixels of the current block to the value of the first factor may also be stored in advance, and then the value of the first factor may be determined according to the look-up table. Exemplarily, Table 2 shows a correspondence between the first factor and the number of reference pixels of the current block provided in an embodiment of the disclosure. It should be noted that Table 2 is only an exemplary look-up table, specific limitation is not imposed thereto.
Further, with respect to the first product value, the operation of determining the respective first product value according to the first factor and each of the reference sample values of the first color component may include the following operations.
The respective first product value is set to be equal to a product of the first factor and each of the reference sample values of the first color component.
Or, the respective first product value is set to be equal to a value obtained by bit-right-shifting of each of the reference sample values of the first color component, here, a number of bits of the bit-right-shifting is equal to the first factor.
Or, the respective first product value is set as a value obtained by addition and bit-shifting operations of each of the reference sample values of the first color component according to the first factor.
Exemplarily, it is assumed that the first factor is equal to 0.25 and the reference sample value of the first color component is indicated by Ref, then the first product value may be equal to 0.25×Ref, and 0.25×Ref may be written as Ref/4, that is, Ref>>2. Furthermore, during fixed-point calculation, floating-point numbers may be converted into addition and shifting operations; that is, any limitation is not imposed to calculation modes of the first product value.
It may also be understood that in the embodiment of the disclosure, the first color component may also be a luma component, and the second color component may be a chroma component. At this time, at least one to-be-predicted pixel in the current block is selected, and a respective luma difference (indicated by |ΔYk|) between reconstructed luma of each of the at least one to-be-predicted pixel and the reference luma in the neighboring area is calculated respectively. If |ΔYk| is small, it indicates that similarity between luma values is relatively strong, and a large weight may be provided to a weighting coefficient (indicated by wk) corresponding thereto. On the contrary, if |ΔYk| is large, it indicates that similarity between luma values is relatively weak, and a small weight may be provided to wk. That is, when the weighting coefficient is calculated, the reference sample value of the first color component may also be |ΔYk|, and then the weighting coefficient is calculated.
It should be noted that when the chroma component of the to-be-predicted pixel in the current block is predicted, since value of the chroma component of the to-be-predicted pixel cannot be determined directly, the chroma difference |ΔCk| between the reference pixel and the to-be-predicted pixel cannot be obtained directly. However, there is a strong correlation between components in a local area of the current block. At this time, |ΔCk| may be derived according to the luma difference |ΔYk| between the reference pixel and the to-be-predicted pixel; that is, |ΔCk| may be obtained according to a product of |ΔYk| and a second factor. In this way, the first product value is equal to a product of the first factor and |ΔYk|.
That is, in the embodiment of the disclosure, the reference sample value of the first color component may be |ΔCk|, that is, an absolute value of the chroma difference; or may be |ΔYk|, that is, an absolute value of the luma difference; or may be |αΔYk|, that is, a product of the absolute value of the luma difference and a preset multiplier, etc. The preset multiplier here is the second factor described in the embodiment of the disclosure.
Further, with respect to the second factor, in a specific embodiment, the method may further include the following operation. A least square method calculation is performed according to first and second color component values of the reference pixel, to determine the second factor.
That is, it is assumed that a number of reference pixels is N, the first color component value of the reference pixel is the reference luma information of the current block, and the second color component value of the reference pixel is the reference chroma information of the current block, then a least square method calculation may be performed on chroma component values and luma component values of the N reference pixels, to obtain the second factor. Exemplarily, a least square regression calculation is shown as follows.
Where Lk indicates a luma component value of a k-th reference pixel, Ck indicates a chroma component value of the k-th reference pixel, N indicates a number of reference pixels; a indicates the second factor, which may be obtained by using the least square regression calculation. It should be noted that the second factor may also be a fixed value, or finely adjusted based on the fixed value, or the like, the embodiment of the disclosure does not impose specific limitation thereto.
Furthermore, with respect to the preset mapping relationship, in some embodiments, the preset mapping relationship may be a preset function relationship. In some embodiments, the preset mapping relationship may be a Softmax function. The Softmax function is a normalized exponential function, however, normalization may not be required by the embodiment of the disclosure, and a value thereof is not limited to be in a range of [0, 1].
Exemplarily, taking |ΔYk| used as the reference sample value of the first color component as an example, then a weighting coefficient wk corresponding to the k-th reference pixel may be calculated by formula (4), or may be replaced by formulas as follows.
Where S indicates a control parameter, and a relationship between S and the first factor (γ) is
Exemplarily, the value of S is relevant to the size parameters of the current block. The size parameters of the current block include the width and height of the current block. In a possible implementation, if a minimum value from the width and height is less than or equal to 4, the value of S is equal to 8; if the minimum value from the width and height is greater than 4 and less than or equal to 16, the value of S is equal to 12; if the minimum value from the width and height is greater than 16, the value of S is equal to 16. In another possible implementation, if the minimum value from the width and height is less than or equal to 4, the value of S is equal to 7; if the minimum value from the width and height is greater than 4 and less than or equal to 16, the value of S is equal to 11; if the minimum value from the width and height is greater than 16, the value of S is equal to 15. Or, the value of S is relevant to the number (R) of reference pixels of the current block. In a possible implementation, if R is less than 16, the value of Sis equal to 8; if R is equal to or greater than 16 and less than 32, the value of Sis equal to 12; if R is equal to or greater than 16, the value of S is equal to 16; the embodiment of the disclosure does not impose any limitation thereto.
It should also be noted that besides the Softmax function, in some other embodiments, the preset mapping relationship may be a weighting function having an inverse ratio relationship with the reference sample values of the first color component.
Exemplarily, still taking |ΔYk| used as the reference sample value of the first color component as an example, the Softmax function of formula (4) may also be replaced by formulas as follows.
In this way, when the preset mapping relationship is the preset function relationship, it may be as shown in formula (4), or may be as shown in formula (6) or formula (7), or may be as shown in formula (8) or formula (9), or even may be other function models capable of fitting a trend of the closer the reference luma value of the reference pixel relative to the reconstructed luma value of the to-be-predicted pixel in the current block, the higher the importance of the reference chroma value of the reference pixel to the to-be-predicted pixel in the current block, to create the weighting coefficients, or the like, the embodiment of the disclosure does not impose specific limitation thereto.
Furthermore, in some embodiments, the preset mapping relationship may also be in form of a preset look-up table. That is, the embodiment of the disclosure may also simplify operations, for example, an array element look-up mode is used to reduce part of calculation operations. With respect to the preset mapping relationship, it may be that a value of array element is determined according to a preset reference sample value of the first color component and a look-up table mapping the first factor to the array element; then a value corresponding to the value of the array element under the preset mapping relationship is determined; then the weighting coefficient is set to be equal to the value.
Specifically, the ƒ model for calculating the weighting coefficient may be implemented through simplified operations, such as in form of a look-up table. The luma difference |ΔYk| of the to-be-predicted pixel (i,j) may also be indicated by |ΔYkij|; in this way, the weighting coefficient wkij=ƒ(ΔYkij) is calculated by the ƒ model. Here, numerators in the ƒ model may be stored as an array index with an independent variable |ΔYkij| and a category number of S. Subsequent operations which are the same as calculation of numerators involved in the ƒ model, are all obtained by the look-up table, thereby avoiding calculation operations of numerator and denominator parts.
It should be noted that in the embodiment of the disclosure, storage here may be divided into complete storage or partial storage.
In a specific embodiment, the complete storage is to store all numerators of a codomain range of |ΔYkij| and the category number of S. With respect to the complete storage, an array space with a size of (the codomain range of |ΔYkij| multiplied by the category number of S) needs to be set up. A required size of a storage array is a size of the codomain range of |ΔYkij|, and performance remains unchanged at this time.
Exemplarily, taking a 10-bit pixel and formula (7) as an example, the codomain range of the variable |ΔYkij| is an integer in a range of 0 to 1023, the category number of S is 3, and numerators are completely stored by using |ΔYkij| and the category number of S as indices of a two-dimensional array storMole.
At this time, calculation of the weighting coefficient in formula (7) may be simplified as follows.
In this way, elements of the two-dimensional array storMole [index 1][index 2] are as shown in Table 3.
Furthermore, a corresponding array offset may also be provided for the complete storage according to classification of S, and then numerators are completely stored by using (|ΔYkij| plus offset) as an index of a one-dimensional array ostorMole, which is shown as follows for the details.
At this time, calculation of the weighting coefficient in formula (7) may be simplified as follows.
In this way, elements of the one-dimensional array ostorMole [index] are as shown in Table 4.
In another specific embodiment, the partial storage is to select a part of all numerator values in calculation of the weighting coefficient, for storage. Numerator values in a part of the codomain range of |ΔYkij| and/or a part of categories of S may be selected for storage. Value of the ƒ model out of the selected range is 0 by default, and a required size of a storage array is a size of (the selected codomain range of |ΔYkij| multiplied by the selected category number of S).
Exemplarily, taking a 10-bit pixel and formula (7) as an example, it is assumed that numerator values in the codomain range of |ΔYkij| which is an integer from 0 to 99 and three categories of S are selected for the partial storage, then the codomain range of |ΔYkij| is an integer in a range of 0 to 99, and the category number of S is 3, and numerators are stored by using such |ΔYkij| and the category number of S as indices of a two-dimensional array partstorMole.
At this time, calculation of the weighting coefficient in formula (7) may be simplified as follows.
In this way, elements of the two-dimensional array partstorMole [index 1][index 2] are as shown in Table 5.
That is, a storage range of the partial storage may be stored according to actual requirements, and is not limited to |ΔYkij| with an integer less than 100 and 3 categories of S in the example; in the partial storage, a corresponding offset may also be provided for the selected part of categories of S, to set up a one-dimensional storage space for storage, the embodiment of the disclosure does not impose any limitation thereto. Furthermore, with respect to Table 3 to Table 5, enlarged integer values may also be stored here, to perform the fixed-point calculation; in this way, corresponding reduction operations need to be performed after predicted values are determined subsequently.
In this way, the weighting coefficients may be determined according to the reference sample values of the first color component (for example, |ΔYkij|), and may specifically include N weighting coefficients such as w1, w2, . . . , wN, here N indicates the number of reference sample values of the second color component. Here, theoretically speaking, a sum of the N weighting coefficients is equal to 1, and each of the weighting coefficients is a value equal to or greater than 0 and less than or equal to 1. However, it should be noted that “a sum of the N weighting coefficients is equal to 1” is only a theoretical concept; in an actual fixed-point implementation process, an absolute value of the weighting coefficient may be greater than 1.
At S504, a prediction block of a second color component of the current block is determined according to the weighting coefficients and reference sample values of a second color component in the target information.
At S505, reconstructed values of second color component samples of the current block are determined according to the prediction block.
It should be noted that after the weighting coefficients are determined, weighted calculation may be performed on the reference sample values of the second color component by using the weighting coefficients, thereby obtaining predicted values of second color component samples in the prediction block.
In some embodiments, the operation of determining the prediction block of the second color component of the current block according to the weighting coefficients and the reference sample values of the second color component in the target information may include the following operations.
A respective weighted value between each of the reference sample values of the second color component and a weighting coefficient corresponding to the reference sample value is determined.
A predicted value of a respective one of second color component samples in the prediction block is set to be equal to a sum of N weighted values, N indicates a number of the reference sample values of the second color component, and N is a positive integer.
That is, if the number of the reference sample values of the second color component is N, a respective weighted value (that is, wkCk) between each of the reference sample values of the second color component and a weighting coefficient corresponding to the reference sample value is determined, and then a sum of the N weighted values is used as the predicted value of the respective one of the second color component samples in the prediction block. Specifically, a calculation formula thereof is specifically shown as follows.
Exemplarily, an absolute luma difference is calculated according to reconstructed luma information at a (i,j) position in the current block and reference luma information in the neighboring area; then the weighting coefficient is calculated according to the Softmax function, and then a predicted value of a chroma component at a (i,j) position in the prediction block may be obtained by using formula (16). In particular, it should be noted that such mode is conducive to parallel processing and may speed up calculation.
It should also be noted that in the embodiment of the disclosure, the first color component is the luma component, and the second color component is the chroma component. Since there is a case where resolution of the luma component is different from resolution of the chroma component, when the filtering process is performed on the reference information, it includes that downsampling filtering is performed on the luma component to align the resolution of the chroma component, or upsampling filtering is performed on the chroma component to align the resolution of the luma component.
In the embodiment of the disclosure, the prediction block includes predicted values of at least a part of the second color component samples in the current block. If there is a case where the prediction block contains only predicted values of a part of the second color component samples in the current block or does not contain predicted values of the second color component samples (it needs to perform filtering enhancement on the predicted values, to obtain final predicted values), the filtering process may also be performed on the prediction block. At this time, the prediction block may be referred to as a first prediction block, and then an upsampling filtering process is performed on the first prediction block, to determine a second prediction block of the second color component of the current block. At this time, the second prediction block is a final prediction block of the second color component of the current block, and contains predicted values of all the second color component samples in the current block. Specifically, in some embodiments, the operation of performing the upsampling filtering process on the first prediction block, to determine the second prediction block of the second color component of the current block may include: an input of the upsampling filtering process is a first upsampling input block; and an output of the upsampling filtering process is a first upsampling output block.
Further, in some embodiments, the upsampling filtering process may include the following operations.
An upsampling factor is determined, the upsampling factor includes at least one of a horizontal upsampling factor or a vertical upsampling factor.
The upsampling filtering process is performed on the first upsampling input block according to the upsampling factor, to obtain the first upsampling output block.
In a possible implementation, the operation of performing the upsampling filtering process on the first upsampling input block according to the upsampling factor, to obtain the first upsampling output block may include the following operations. If the horizontal upsampling factor is greater than 1, or the vertical upsampling factor is greater than 1, the upsampling filtering process is performed on the first upsampling input block, to obtain the first upsampling output block.
In the embodiment of the disclosure, the operation of performing the upsampling filtering process on the first upsampling input block includes at least one of: the upsampling filtering process is performed in a horizontal direction on the first upsampling input block; the upsampling filtering process is performed in a vertical direction on the first upsampling input block; the upsampling filtering process is performed in the horizontal direction and then in the vertical direction on the first upsampling input block; or the upsampling filtering process is performed in the vertical direction and then in the horizontal direction on the first upsampling input block.
Here, at first, the horizontal upsampling factor may be calculated according to a width of the first upsampling input block and a width of the first upsampling output block, and the vertical upsampling factor may be calculated according to a height of the first upsampling input block and a height of the first upsampling output block; then, upsampling filtering is performed on the first upsampling input block according to the horizontal upsampling factor and the vertical upsampling factor. Specifically, if the horizontal upsampling factor is greater than 1 and the vertical upsampling factor is equal to 1, it only needs to perform upsampling in the horizontal direction on the first upsampling input block; if the horizontal upsampling factor is equal to 1 and the vertical upsampling factor is greater than 1, it only needs to perform upsampling in the vertical direction on the first upsampling input block; if the horizontal upsampling factor is greater than 1 and the vertical upsampling factor is greater than 1, it needs to perform upsampling in both horizontal and vertical directions on the first upsampling input block. Here, upsampling in the horizontal direction and then in the vertical direction may be performed, or upsampling in the vertical direction and then in the horizontal direction may be performed, or even upsampling operations here may be replaced by convolution operations in a neural network structure, the embodiment of the disclosure does not impose any limitation thereto.
In another possible implementation, upsampling filtering is performed on the first prediction block, to determine the second prediction block. At this time, the method may further include the following operations. The first prediction block is used as the first upsampling input block. The first upsampling output block is used as the second prediction block of the second color component of the current block.
In another possible implementation, enhanced filtering is performed on the first prediction block, and then upsampling filtering is performed, to determine the second prediction block. At this time, the method may further include the following operations. A filtering enhancement process is performed on the first prediction block, to determine a first enhanced prediction block. The first enhanced prediction block is used as the first upsampling input block. The first upsampling output block is used as the second prediction block of the second color component of the current block.
In yet another possible implementation, upsampling filtering is performed on the first prediction block, and then enhanced filtering is performed, to determine the second prediction block. At this time, the method may further include the following operations. The first prediction block is used as the first upsampling input block. The first upsampling output block is used as a first upsampling filtering prediction block. A filtering enhancement process is performed on the first upsampling filtering prediction block, to determine the second prediction block of the second color component of the current block.
In yet another possible implementation, enhanced filtering is performed on the first prediction block, then upsampling filtering is performed, and then enhanced filtering is performed, to determine the second prediction block. At this time, the method may further include the following operations. A first filtering enhancement process is performed on the first prediction block, to determine a second enhanced prediction block. The second enhanced prediction block is used as the first upsampling input block. The first upsampling output block is used as a second upsampling filtering prediction block. A second filtering enhancement process is performed on the second upsampling filtering prediction block, to determine the second prediction block of the second color component of the current block.
Further, it usually needs to limit the predicted value of the respective one of the second color component samples in the prediction block to be in a preset range. Therefore, in some embodiments, the method may further include the following operations. A correction operation is performed on the predicted value of the respective one of the second color component samples in the prediction block, to determine the prediction block of the second color component of the current block.
It should be noted that in the embodiment of the disclosure, the preset range may be between 0 and (1<<BitDepth)−1, here, BitDepth is a bit depth required by the chroma component. If the predicted value exceeds values of the preset range, it needs to perform a corresponding correction operation on the predicted value. Exemplarily, a clamping operation may be performed on Ci,jpred, which is specifically shown as follows.
When value of Ci,jpred is less than 0, it is set as 0.
When the value of Ci,jpred is equal to or greater than 0 and less than or equal to (1<<BitDepth)−1, it is equal to Ci,jpred.
When the value of Ci,jpred is greater than (1<<BitDepth)−1, it is set as (1<<BitDepth)−1.
In this way, after a correction process is performed on the predicted value, it may be ensured that predicted values of all the second color component samples in the prediction block are between 0 and (1<<BitDepth)−1.
Further, after the prediction block is determined, the prediction block still needs to be post-processed as the final prediction block under certain conditions. Therefore, in some embodiments, the method may further include the following operation.
A relevant process is performed on the prediction block, and the processed prediction block is used as the prediction block of the second color component of the current block.
In a possible implementation, the operation of performing the relevant process on the prediction block may include the following operation. A filtering enhancement process is performed on the prediction block, and the processed prediction block is used as the prediction block of the second color component of the current block.
It should be noted that in a WCP mode, in order to reduce instability caused by pixel-by-pixel independent and parallel prediction, for example, a smooth filtering process may be performed on the prediction block, and then the processed prediction block is used as the final prediction block.
In another possible implementation, the operation of performing the relevant process on the prediction block may include the following operation. A compensation value of a second color component of the prediction block is determined according to reference sample values in a neighboring area of the current block. A correction process is performed on a predicted value of a respective one of second color component samples in the prediction block according to the compensation value, to determine the prediction block of the second color component of the current block.
It should be noted that in order to further improve prediction accuracy in the WCP mode, a position-related correction process may be performed on the prediction block. For example, a chroma compensation value is calculated for each to-be-predicted second color component sample by using reference pixels with close spatial positions, the second color component sample in the prediction block is corrected by using the chroma compensation value, and final predicted values (predSamples) of the second color component samples are determined according to the corrected predicted values, thereby obtaining the final prediction block.
In yet another possible implementation, the operation of performing the relevant process on the prediction block may include the following operations. A prediction process is performed on a respective one of second color component samples in the prediction block according to at least one prediction mode, to determine at least one initial predicted value of the respective one of the second color component samples in the prediction block. A weighted fusion process is performed according to the at least one initial predicted value and a predicted value of the respective one of the second color component samples in the prediction block, to determine the prediction block of the second color component of the current block.
It should be noted that in order to further improve prediction accuracy in the WCP mode, predicted chroma values calculated in other prediction modes may also be weighted-fused with a predicted chroma value calculated in the WCP mode, and a final chroma prediction block is determined according to the fusion result. Exemplarily, as shown in
In some embodiments, after the prediction block is determined, the operation of determining the reconstructed values of the second color component samples of the current block according to the prediction block may include the following operations.
For each of the second color component samples of the current block, a predicted difference value of the second color component sample is determined; a predicted value of the second color component sample is determined according to the prediction block; and a reconstructed value of the second color component sample is determined according to the predicted difference value of the second color component sample and the predicted value of the second color component sample.
It should be noted that in the embodiment of the disclosure, the operation of determining of the predicted difference value (residual) of the second color component sample of the current block may be to determine the predicted difference value of the second color component sample of the current block by parsing the bitstream.
It should also be noted that in the embodiment of the disclosure, the prediction block may contain predicted values of at least a part of the second color component samples in the current block. If the prediction block contains predicted values of all the second color component samples in the current block, the predicted values of the second color component samples of the current block may be set to be equal to the values of the prediction block; if the prediction block contains predicted values of a part of the second color component samples in the current block, upsampling filtering may be performed on the values of the prediction block, and the predicted values of the second color component samples of the current block is set to be equal to output values after the upsampling filtering.
That is, in the embodiment of the disclosure, the operation of determining the predicted values of the second color component samples of the current block according to the prediction block may be to set the predicted values of the second color component samples of the current block to be equal to the values of the prediction block; or may also be to filter the values of the prediction block, and then set the predicted values of the second color component samples of the current block to be equal to the filtered output values.
In this way, taking the chroma component as an example, a predicted chroma difference value of the current block is determined by parsing the bitstream; then, a predicted chroma value of the current block may be determined according to the prediction block; and then the predicted chroma value and the predicted chroma difference value are added to obtain a reconstructed chroma value of the current block.
It may be understood that in the embodiment of the disclosure, a process of acquiring input information in a prediction process of the WCP mode is optimized, which mainly includes three aspects as follows. On one hand, characteristics of input color format information are fully considered, to improve accuracy of the reference luma information and the reference chroma information; on the other hand, spatial correlation is fully utilized, to perform upsampling, downsampling, size enlargement, size reduction, or other filtering processes on the reference luma information, the reference chroma information and the reconstructed luma information of the current block; on yet another hand, relevant information of the prediction block is fully considered, and different filtering process methods are used for the reference luma information, the reference chroma information and the reconstructed luma information of the current block, to improve accuracy of WCP prediction technology.
Simply speaking, the embodiment of the disclosure further provides a weight-based chroma prediction framework. As shown in
The embodiment of the disclosure further provides a method for decoding, in which reference information of a current block is determined; a filtering process is performed on partial information in the reference information of the current block, to determine target information of the current block; a respective one of weighting coefficients is determined according to each of reference sample values of a first color component in the target information; a prediction block of a second color component of the current block is determined according to the weighting coefficients and reference sample values of a second color component in the target information; reconstructed values of second color component samples of the current block are determined according to the prediction block. In this way, with respect to color component information in the neighboring area of the current block and color component information in the current block, accuracy of these reference information may be improved since characteristics of color format information are fully considered; and upsampling, downsampling or other filtering processes are performed on these reference information, so that continuity of spatial correlation thereof may be enhanced to a certain extent, or some information with weak spatial correlation may be removed, chroma prediction may be performed better by using the target information obtained after the filtering processes, thereby improving accuracy of the chroma prediction, saving bitrates, while improving encoding and decoding performance.
In another embodiment of the disclosure, based on the method for decoding described in the foregoing embodiment, taking chroma prediction performed on the current block as an example, in the embodiment of the disclosure, the reconstructed luma information of the current block, and the reference luma information and the reference chroma information of the neighboring area are decoded reference information. Therefore, the embodiment of the disclosure proposes a weight-based chroma prediction technology using the above information, and in a process of determining the target information of the current block according to these information, information of the neighboring area of the current block, information of the current block and the current color format information may be analyzed and processed. The information of the neighboring area mainly refers to a position of a sample in the neighboring area, the reference luma information and the reference chroma information. The information of the current block mainly refers to the reconstructed luma information in the current block. The current color format information mainly refers to a parameter InputChromaFormat in a configuration file (in a *.cfg format) during decoding, that is, a ratio of luma and chroma samples of an input video.
It may be understood that in the embodiment of the disclosure, it is mainly proposed: (1) whether downsampling is performed on the reference luma information of the neighboring area, or whether upsampling is performed on the reference chroma information of the neighboring area, is selected according to the current color format information; (2) the reference luma information and the reference chroma information of the neighboring area, and the reconstructed luma information in the current block may be matched with a preset size of core parameters through different operations of size enlargement/reduction.
Here, detailed operations of the chroma prediction process of the WCP mode are as follows.
Input of the WCP mode: the position (xTbCmp, yTbCmp) of the current block, the width nTbW of the current block, and the height nTbH of the current block.
Output of the WCP mode: the predicted value predSamples[x][y] of the current block, an upper left corner position in the current block is a coordinate origin, where x=0, . . . , nTbW−1, and y=0, . . . , nTbH−1.
The prediction process of the WCP mode may include operations of determining core parameters, acquiring the target information, weight-based chroma prediction, a post-processing process or other operations, and a pre-processing operation is added in a process of acquiring the target information. After these operations, the predicted chroma value of the current block may be obtained.
In a specific embodiment, with reference to
At S1101, core parameters of a WCP mode are determined.
It should be noted that with respect to the operation S1101, the core parameters involved in the WCP mode are determined, that is, the core parameters of the WCP mode may be acquired or inferred through configuration or in a certain manner, for example, the core parameters are acquired from a bitstream at the decoding side.
Here, the core parameters of the WCP mode include, but are not limited to a control parameter(S), a number (inSize) of weight-based chroma prediction inputs, and a number of weight-based chroma prediction outputs (arranged in predSizeW×predSizeH). A prediction block of the weight-based chroma prediction output may be indicated by predWcp. Here, the number of weight-based chroma prediction outputs may be set as the same value (for example, predSizeW=predSizeH=T/4), or set to be relevant to size parameters of the current block (for example, predSizeW=nTbW, predSizeH=nTbH). The control parameter(S) may be configured to adjust nonlinear functions in subsequent links or to adjust data involved in subsequent links.
Determination of the core parameters is affected by block sizes or block contents or a number of pixels in the block under certain conditions.
For example, if there are many types of block sizes applied to the WCP mode, or there is a large difference between the block sizes, or there is a large difference between the block contents, or there is a large difference between the number of pixels in the block, the current block may be classified according to its block size or block content or the number of pixels in the block, and the same or different core parameters are determined according to different categories. That is, the control parameter(S), or the number inSize of weight-based chroma prediction inputs, or the number of weight-based chroma prediction outputs (arranged in predSizeW×predSizeH) corresponding to different categories may be the same or different. It should be noted that predSizeW and predSizeH may also be the same or different.
Hereinafter, in order to explain determination of the core parameters better, explanation is made by taking two simple classifications as examples.
First classification example: the WCP mode may classify the current block according to the width and height of the current block, and the category of the block is indicated by wcpSizeld. For different categories of blocks, the control parameter(S), the number inSize of weight-based chroma prediction inputs, and the number of weight-based chroma prediction outputs (arranged in predSizeW×predSizeH) may be the same or different. Here, explanation is made by an example of dividing into three categories.
The current block is divided into three categories according to the width and the height of the current block. The control parameter(S) in different categories may be set to be different, inSize in different categories may be set to be the same, and the number of weight-based chroma prediction outputs (arranged into predSizeW×predSizeH) in different categories may be set to be the same. nTbW is the width of the current block, nTbH is the height of the current block, and the category wcpSizeld of the block is defined as follows.
wcpSizeId=0: it indicates the current block with min (nTbW, nTbH)<=4. The control parameter(S) is 8, inSize is (2×nTbH+2×nTbW), and the weight-based chroma prediction outputs nTbH×nTbW predicted chroma values.
wcpSizeId=1: it indicates the current block with 4<min (nTbW, nTbH)<=16. The control parameter(S) is 12, inSize is (2×nTbH+2×nTbW), and the weight-based chroma prediction outputs nTbH×nTbW predicted chroma values.
wcpSizeId=2: it indicates the current block with min (nTbW, nTbH)>16. The control parameter(S) is 16, inSize is (2×nTbH+2×nTbW), and the weight-based chroma prediction outputs nTbH×nTbW predicted chroma values.
A numeric relationship of the above core parameters is represented in a table form, as shown in Table 6.
Division into three categories may also be explained by another example.
The current block is divided into three categories according to the width and the height of the current block. The control parameter(S) in different categories may be set to be different, inSize in different categories may be set to be different, and the number of weight-based chroma prediction outputs (arranged into predSizeW×predSizeH) in different categories may be set to be different. nTbW is the width of the current block, nTbH is the height of the current block, and the category wcpSizeld of the block is defined as follows.
wcpSizeId=0: it indicates the current block with min (nTbW, nTbH)<=4. The control parameter(S) is 8, inSize is (2×nTbH+2×nTbW), and the weight-based chroma prediction outputs nTbH×nTbW predicted chroma values.
wcpSizeId=1: it indicates the current block with 4<min (nTbW, nTbH)<=16. The control parameter(S) is 12, inSize is (1.5×nTbH+1.5×nTbW), and the weight-based chroma prediction outputs nTbH/2×nTbW/2 predicted chroma values.
wcpSizeId=2: it indicates the current block with min (nTbW, nTbH)>16. The control parameter(S) is 16, inSize is (nTbH+nTbW), and the weight-based chroma prediction outputs nTbH/4×nTbW/4 predicted chroma values.
A numeric relationship of the above core parameters is represented in a table form, as shown in Table 7.
Second classification example: the WCP mode may also classify the current block according to the width and height of the current block, and the category of the block is indicated by wcpSizeld. For different categories of blocks, the control parameter(S), the number inSize of weight-based chroma prediction inputs, and the number of weight-based chroma prediction outputs (arranged in predSizeW×predSizeH) may be the same or different. Here, explanation is made by an example of dividing into three categories.
The current block is divided into three categories according to the width and the height of the current block. The control parameter(S) in different categories may be set to be different, inSize in different categories may be set to be the same, and the number of weight-based chroma prediction outputs (arranged into predSizeW×predSizeH) in different categories may be set to be the same. nTbW is the width of the current block, nTbH is the height of the current block, and nTbW×nTbH indicates the number of pixels in the current block. The category wcpSizeId of the block is defined as follows.
wcpSizeId=0: it indicates the current block with (nTbW×nTbH)<128. The control parameter(S) is 10, inSize is (2×nTbH+2×nTbW), and the weight-based chroma prediction outputs nTbH×nTbW predicted chroma values.
wcpSizeId=1: it indicates the current block with 128<=(nTbW×nTbH)<=256. The control parameter(S) is 8, inSize is (2×nTbH+2×nTbW), and the weight-based chroma prediction outputs nTbH×nTbW predicted chroma values.
wcpSizeId=2: it indicates the current block with (nTbW×nTbH)>256. The control parameter(S) is 1, inSize is (2×nTbH+2×nTbW), and the weight-based chroma prediction outputs nTbH×nTbW predicted chroma values.
A numeric relationship of the above core parameters is represented in a table form, as shown in Table 8.
Division into three categories may also be explained by another example.
The current block is divided into three categories according to the width and the height of the current block. The control parameter(S) in different categories may be set to be different, inSize in different categories may be set to be different, and the number of weight-based chroma prediction outputs (arranged into predSizeW×predSizeH) in different categories may be set to be different. nTbW is the width of the current block, nTbH is the height of the current block, and nTbW×nTbH indicates the number of pixels in the current block. The category wcpSizeId of the block is defined as follows.
wcpSizeId=0: it indicates the current block with (nTbW×nTbH)<64. The control parameter(S) is 16, inSize is (2×nTbH+2×nTbW), and the weight-based chroma prediction outputs nTbH×nTbW predicted chroma values.
wcpSizeId=1: it indicates the current block with 64<=(nTbW×nTbH)<=512. The control parameter(S) is 4, inSize is (1.5×nTbH+1.5×nTbW), and the weight-based chroma prediction outputs nTbH/2×nTbW/2 predicted chroma values.
wcpSizeId=2: it indicates the current block with (nTbW×nTbH)>512. The control parameter(S) is 1, inSize is (nTbH+nTbW), and the weight-based chroma prediction outputs nTbH/4×nTbW/4 predicted chroma values.
A numeric relationship of the above core parameters is represented in a table form, as shown in Table 9.
At S1102, target information after a pre-processing operation is determined according to the core parameters.
It should be noted that with respect to the operation S1102, the target information may include reference chroma information (refC), reference luma information (refY) and reconstructed luma information (recY). For acquisition of the target information (that is, input information), when the current block is predicted, the upper area, the upper left area and the left area of the current block are used as the neighboring area (it may also be referred to as a “reference area”), as shown in the foregoing
It should also be noted that the reference chroma information refC and the reference luma information refY are acquired from the neighboring area. The acquired reference chroma information includes, but is not limited to selecting a reference chroma reconstructed value of the upper area of the current block, and/or a reference chroma reconstructed value of the left area of the current block. The acquired reference luma information includes, but is not limited to acquiring corresponding reference luma information according to a position of the reference chroma information.
The reconstructed luma information recY of the current block is acquired. Acquisition modes include, but are not limited to acquiring corresponding reconstructed luma information according to the position of the chroma information in the current block, as the reconstructed luma information of the current block.
It may be understood that when the number of the reference chroma information refC and the number of the reference luma information refY acquired from the neighboring area as described above are partially or completely different from inSize specified in the operation of determining the core parameters, or when the number of the reconstructed luma information recY acquired from the current block is different from the preset size (predSizeW×predSizeH) specified in the operation of determining the core parameters, then it needs to perform a relevant process on the three acquired information, and this operation occurs before the prediction process, therefore it is named as a process of pre-processing operation.
Here, the embodiment of the disclosure is mainly directed to a case where inSize specified in the operation of determining the core parameters is different from the number of the reference chroma information refC and the number of the reference luma information refY acquired from the neighboring area, or a case where the number of the reconstructed luma information recY acquired from the current block is different from the preset size (predSizeW×predSizeH) specified in the operation of determining the core parameters. The two cases will be respectively introduced in detail below.
First case: when inSize specified in the operation of determining the core parameters is different from the number of the reference chroma information refC and the number of the reference luma information refY acquired from the neighboring area, it needs to convert the number of pixels of the reference chroma information refC and the reference luma information refY acquired from the neighboring area into inSize specified in the operation of determining the core parameters, for input. The current color format information also determines the number of the reference chroma information and the number of the reference luma information, then specific processes of the pre-processing operation in the first case are as follows.
(1) If the current color format information is considered, the number of the reference luma information and the number of the reference chroma information acquired from the neighboring area are usually unified, and then matched with inSize in the core parameters, processes thereof are as follows.
a. The number of the reference luma information and the number of the reference chroma information acquired from the neighboring area are unified as refNum.
b. The number refNum of reference information is matched with inSize in the core parameters.
It should be noted that downsampling processes mentioned in the process of the first case are specifically as follows. For reference chroma information refC of the number of refNum acquired from the neighboring area, downsampling of the reference luma information refY may be performed by downsampling using a multi-tap filter, or acquiring a certain pixel from multiple reference luma pixels at a corresponding position of the reference chroma pixel, or other downsampling modes, the embodiment of the disclosure does not impose any limitation thereto.
Exemplarily, when the color format information indicates 4:2:0 sampling, taking a neighboring area with a luma pixel size of 8×4 as an example, it needs to downsample the neighboring area into an area with a pixel size of 4×2, as shown in the foregoing
Upsampling processes mentioned in the process of the first case are specifically as follows. For reference luma information refY of the number of refNum acquired from the neighboring area, upsampling of the reference chroma information refC may be performed by upsampling using linear interpolation, nonlinear interpolation or other modes, or copying a certain reference chroma pixel, or even using other upsampling modes, the embodiment of the disclosure does not impose any limitation thereto, either.
Exemplarily, when the color format information indicates 4:2:0 sampling, taking a neighboring area with a chroma pixel size of 4×2 as an example, it needs to upsample the neighboring area into an area with a pixel size of 8×4, as shown in
Where offset=1<<(shift−1). {w0, w1, w2, w3, w4, w5, w6, w7} and shift may be differently selected according to block sizes or block contents. Here is an example of a commonly used combination of coefficients:
offset=1<<(shift−1). {w0, w1, w2, w3, w4, w5, w6, w7} and shift may be differently selected according to block sizes or block contents. Here is an example of a commonly used combination of coefficients:
(2) If the current color format information is not considered, it only needs to match with inSize in the core parameters, processes thereof are as follows.
a. A number refYnum of the reference luma information acquired from a neighboring reference area is matched with inSize in the core parameters.
b. A number refCnum of the reference chroma information acquired from the reference area is matched with inSize in the WCP core parameters.
Processes of the operation of reducing the size mentioned in the process of the first case are specifically as follows. Taking the reference luma information as an example, the number of the reference luma information acquired from the neighboring area is refYnum.
Exemplarily, as shown in
Here, the fixed interval used to reduce the size is subDist=(refYnum+inSize−1)/inSize. Starting from the first pixel position of refY′ obtained as above, a pixel is selected every (subDist−1) pixel positions, and finally reference luma information in_refY of the number of inSize is obtained, detailed processes thereof are as follows.
Processes of the operation of enlarging the size mentioned in the process of the first case are specifically as follows. Taking the reference chroma information as an example, the number of the reference chroma information acquired from the neighboring area is refCnum.
Where {w0, w1} changes with positions according to values of the fixed interval, offset=1<<(shift−1). Here, shift may be differently selected according to block sizes or block contents. If subDist=3, here is an example of a commonly used combination of coefficients:
Second case: when the number (recSizeW×recSizeH) of the reconstructed luma information refY acquired from the current block is different from the preset size (predSizeW×predSizeH) specified in the operation of determining the core parameters, it needs to convert the number of the reconstructed luma information refY acquired from the current block into the preset size (predSizeW×predSizeH) specified in the operation of determining the WCP core parameters, for input, processes thereof are specifically as follows.
Processes of the operation of reducing the size mentioned in the process of the second case are specifically as follows. At first, the horizontal downsampling factor downHor is calculated according to the width predSizeW determined by the core parameters and the width recSizeW of the reconstructed luma information recY. Similarly, the vertical downsampling factor downVer is calculated according to the height predSizeH determined by the core parameters and the height recSizeH of the reconstructed luma information recY, calculation methods thereof are shown as follows.
Then, downsampling is performed according to conditions as follows, to generate the input reconstructed luma information in_recY.
(1) If downHor is greater than 1 and downVer is equal to 1, it only needs to perform downsampling in the horizontal direction, specific formula thereof is as follows.
(2) If downHor is equal to 1 and downVer is greater than 1, it only needs to perform downsampling in the vertical direction, specific formula thereof is as follows.
(3) If both downHor and downVer are greater than 1, it needs to perform downsampling in both horizontal and vertical directions, specific formula thereof is as follows.
Processes of the operation of enlarging the size mentioned in the process of the second case are specifically as follows. At first, the horizontal upsampling factor upHor is calculated according to the width predSizeW determined by the core parameters and the width recSizeW of the reconstructed luma information recY. Similarly, the vertical upsampling factor upVer is calculated according to the height predSizeH determined by the core parameters and the height recSizeH of the reconstructed luma information recY, calculation methods thereof are shown as follows.
Then, upsampling is performed according to conditions as follows, to generate the input reconstructed luma information in_recY.
At first, an upper reference reconstructed luma pixel refY_T is filled into an upper row in_recY[x][−1] of to-be-input reconstructed luma information, and a left reference reconstructed luma pixel refY_L is filled into a left column in_recY[−1][y] of the to-be-input reconstructed luma information, where x=0, . . . , predSizeW−1, y=0, . . . , predSizeH−1. At this time, recY is placed into a corresponding position ((x+1)×upHor−1, (y+1)×upVer−1) in in_recY by formula as follows.
It may be understood that in_recY is equally divided into recSizeW×recSizeH sub-blocks, and the position for placement is a lower right corner position of each of the sub-blocks. With reference to
This process is shown in
The upsampling method uses linear interpolation upsampling, that is, a value of each point (horizontal bar filling) obtained by interpolation between two upsampling luma reference points (grid filling) is weighted average of two upsampling reference luma points. According to formulas (45) and (46), a weight of a left upsampling reference chroma point is (upHor−dX)/upHor, and a weight of a right upsampling reference chroma point is dX/upHor, here dX=1, . . . , upHor−1 (that is, a distance between the current interpolation point and a left reference point). In this way, when interpolation in the horizontal direction is performed, the weight is only relevant to the horizontal upsampling factor upHor.
This process is shown in
The upsampling method also uses linear interpolation. According to formulas (47) and (48), weight of an upper upsampling reference point is (upVer−dY)/upVer, and weight of a lower reference point is dY/upVer, where dY=1, . . . , upVer−1 (that is, a distance between the current interpolation point and an upper reference point). In this way, during vertical interpolation, the weight is only relevant to the vertical upsampling factor up Ver.
In this way, the final in_recY may be obtained according to the above processes. With respect to the above processes of enlarging the size, besides using the “horizontal and then vertical” upsampling method, the “vertical and then horizontal” upsampling method may be used, or the reconstructed luma value after “horizontal and then vertical” upsampling and the reconstructed luma value after “vertical and then horizontal” upsampling may be averaged to obtain the final input reconstructed luma value in_recY, or upsampling operations may be replaced by convolution operations in a neural network, the embodiment of the disclosure does not impose any limitation thereto.
In this way, the input target information acquired finally may include reference chroma information refC of the number of inSize, reference luma information refY of the number of inSize, and the reconstructed luma information recY of the current prediction block.
At S1103, weight-based chroma prediction calculation is performed according to the target information, to determine a prediction block of the current block.
It should be noted that with respect to the operation S1103, the predicted chroma value in the preset size specified by the core parameters is indicated by Cpred[i][j], where i=0, . . . , predSizeW−1, j=0, . . . , predSizeH−1, and they are obtained one by one. It should be noted that predSizeH and predSizeW are core parameters, and may be the same as or different from the height nTbH or the width nTbW of the current block. In this way, under certain conditions, the following calculations may also be performed on only a part of the to-be-predicted pixels in the current block.
The chroma prediction calculation in the WCP mode may include the following operations. Weight-based predicted chroma values are obtained by acquiring weights and performing weighted prediction according to the weights. Processes of acquiring the weights include creating the luma difference vector and calculating the weights. Detailed calculation processes thereof are as follows.
creating each element diffY[i][j][k] in the luma difference vector calculating each element cWeight[i][j][k] (or cWeightFloat[i][j][k]) in the weight vector, and then calculating the predicted chroma value Cpred[i][j] by using cWeight[i][j] (or cWeightFloat[i][j][k]) and refC.
In a specific embodiment, with reference to
At S1601, for each to-be-predicted pixel, a luma difference vector is created by using reference chroma information included in target information, reference luma information included in the target information, and reconstructed luma information of a current block.
It should be noted that with respect to each to-be-predicted pixel Cpred[i][j] within the size specified by the core parameters, the reconstructed luma information recY[i][j] corresponding thereto is subtracted from reference luma information refY of the number of inSize, and an absolute value of the subtracted difference is acquired to obtain the luma difference vector diffY[i][j][k]. Specific calculation formula thereof is as follows.
abs(x) indicates an absolute value of x.
It should also be noted that under certain conditions, linear or nonlinear numerical processes may be performed on the luma difference vector of the to-be-predicted pixel. For example, the value of the luma difference vector of the to-be-predicted pixel may be scaled according to a control parameter S in the core parameters.
At S1602, for each to-be-predicted pixel, a weight vector is calculated by using a nonlinear function according to the luma difference vector.
It should be noted that in the embodiment of the disclosure, the luma difference vector diffY[i][j] corresponding to each to-be-predicted pixel Cpred[i][j] is processed by using a weight model, to obtain a floating-point type weight vector cWeightFloat[i][j] corresponding thereto. The weight model here includes, but is not limited to nonlinear functions such as a nonlinear normalization function, a nonlinear exponential normalization function or the like, any limitation is not imposed thereto.
Exemplarily, a nonlinear Softmax function may be used as the weight model, the luma difference vector diffY[i][j] corresponding to each to-be-predicted pixel is used as an input of the weight model, and the weight model outputs a floating-point type weight vector cWeightFloat[i][j] corresponding to each to-be-predicted pixel, calculation formula thereof is shown as follows.
Under certain conditions, the weight model may also be adjusted according to the control parameter(S) in the core parameters. Exemplarily, if the current block has a flexible size, the weight model may be adjusted according to the control parameter(S). Taking the nonlinear Softmax function as an example, different control parameters may be selected according to different categories of block classification to which the current block belongs, to adjust the function. At this time, calculation formula of the weight vector corresponding to each to-be-predicted pixel is shown as follows.
In the embodiment of the disclosure, a fixed-point process may also be performed on the weighting coefficient. Therefore, in some embodiments, the method further includes the following operations. If the weighting coefficient is a floating-point weighting coefficient, the fixed-point process is performed on the floating-point weighting coefficient, to obtain a fixed-point weighting coefficient.
In this way, after calculation of the above formula (50) or formula (51) is completed, the fixed-point processes may be performed on cWeightFloat, which is shown as follows.
Here, round(x)=Sign(x)×Floor(abs(x)+0.5). Here, Floor(x) indicates a maximum integer less than or equal to x,
abs (x) indicates an absolute value of x. Furthermore, Shift is a shift amount set in the fixed-point operation to improve accuracy.
At S1603, for each to-be-predicted pixel, weighted calculation is performed according to the weight vector and the reference chroma information included in the target information, to obtain a predicted chroma value.
It should be noted that the predicted chroma value of each to-be-predicted pixel is calculated according to the weight vector cWeight[i][j] (or cWeightFloat[i][j]) and the reference chroma information refC corresponding to the to-be-predicted pixel. Specifically, the reference chroma information refC of each to-be-predicted pixel Cpred[i][j] is multiplied by elements of the weight vector corresponding to the to-be-predicted pixel one by one, to obtain subC[i][j] (or subCFloat[i][j]), results of multiplication are accumulated to obtain the predicted chroma value Cpred[i][j] of the to-be-predicted pixel, that is, weighted prediction of the chroma component is achieved.
In a possible implementation, this may include the following operations. Weighted calculation is performed according to the floating-point weighting coefficient and the reference chroma information, to obtain an initial predicted value of the to-be-predicted pixel. The fixed-point process is performed on the initial predicted value, to obtain a target predicted value of the to-be-predicted pixel.
Exemplarily, calculation formula thereof is shown as follows.
After calculation is completed, the fixed-point process may also be performed on subCFloat[i][j][k]. In order to keep a certain calculation accuracy in the fixed-point process, it may be multiplied by a coefficient here, which is specifically shown as follows.
After calculation is completed, fixed-point is performed on Cpred Float [i][j], which is shown as follows.
In another possible implementation, weighted calculation may be performed according to the fixed-point weighting coefficient and the reference chroma information, to obtain an initial predicted value of the to-be-predicted pixel. A fixed-point compensation process is performed on the initial predicted value, to obtain a target predicted value of the to-be-predicted pixel.
Exemplarily, calculation formula thereof is shown as follows.
Then, calculation is performed by using fixed-point subC[i][j][k], which is specifically shown as follows.
Where Offset=1<< (Shift1−1), Shift1 is a shift amount required when cWeight[i][j][k] or subC[i][j][k] is calculated (Shift1=Shift), or may be a shift amount required in the fixed-point operation to improve accuracy in other links.
At S1604, for each to-be-predicted pixel, a correction process is performed on the predicted chroma value obtained by calculation, to determine a prediction block of the current block.
It should be noted that the predicted chroma value should be limited to be in a preset range. If the predicted chroma value exceeds the preset range, it needs to perform a corresponding correction operation on the predicted chroma value. Exemplarily, in a possible implementation, a clamping operation may be performed on the predicted chroma value of Ci,jpred[i][j], which is specifically as follows.
Here, BitDepth is a bit depth required by a chroma pixel value, to ensure that all the predicted chroma values in the prediction block are between 0 and (1<<BitDepth)−1.
That is as follows.
Or, formula (59) and formula (60) are combined to obtain a formula as follows.
At S1104, a post-processing operation is performed on the prediction block, to determine a target prediction block of the current block.
It should be noted that after weight-based chroma prediction outputs the predicted chroma value (predWcp), it also needs to be post-processed under certain conditions, to be used as the final predicted chroma value (predSamples); otherwise, the final predicted chroma value predSamples is predWcp.
Exemplarily, in order to reduce instability caused by WCP pixel-by-pixel independent and parallel prediction, smooth filtering may be performed on predWcp, to be used as the final predicted chroma value predSamples. Or, in order to further improve accuracy of the WCP predicted value, a position-related correction process may be performed on predWcp. For example, a chroma compensation value is calculated for each to-be-predicted pixel by using reference pixels with close spatial positions, predWcp is corrected by using the chroma compensation value, and the corrected predicted value is used as the final predicted chroma value predSamples. Or, in order to further improve accuracy of the WCP predicted value, predicted chroma values calculated in other chroma prediction modes may be weighted-fused with the predicted chroma value predWcp calculated in WCP, and the fusion result is used as the final predicted chroma value predSamples. For example, the predicted chroma value predicted by the CCLM mode and the predicted chroma value predWcp calculated in WCP may be weighted with equal or unequal weight, and the weighted result is used as the final predicted chroma value predSamples. Or, in order to improve WCP prediction performance, the predicted output predWcp of WCP may be corrected by using a neural network model or the like, the embodiment of the disclosure does not impose any limitation thereto.
It may also be understood that in the embodiment of the disclosure, if the reference chroma information redCref and the reference luma information redYref with a size of the parameter inSize determined in the WCP mode, and the reconstructed luma information redYrec of the current block with a size of the parameter (predSizeW×predSizeH) determined in the WCP mode have been obtained. Since some of the above three information have been subjected to operations of upsampling, downsampling or size reduction/enlargement, or have not been subjected to these operations, there is still spatial redundancy between them. At this time, the reference chroma information redCref, the reference luma information redYref and the reconstructed luma information redYrec may be filtered. Different filtering operations may be used according to different parameter values of inSize and predSizeW×predSizeH determined in the WCP mode, to obtain three new sets of information including reference chroma information redCref, reference luma information redYref and reconstructed luma information redYrec′. For example, redCref, redYref and redYrec are filtered through linear filtering and nonlinear filtering of mean value, median value and Gaussian, or neural network, or other methods. Furthermore, these filtering operations may also occur before operations of upsampling, downsampling or size reduction/enlargement, to obtain three new sets of information including reference chroma information redC′, reference luma information redY′ and reconstructed luma information redY′, and then operations of upsampling, downsampling or size reduction/enlargement are performed on these information.
It may also be understood that in the embodiment of the disclosure, the number of the reference chroma information refC acquired from the neighboring area is refSizeC, and the number of the reference luma information refY acquired from the neighboring area is refSizeY; the size of the reconstructed luma information recY acquired from the current block is recSizeW×recSizeH, recSizeW is the block width of the reconstructed luma information recY, recSizeH is the block height of the reconstructed luma information recY. The reference chroma information, the reference luma information and the reconstructed luma information are all matched with inSize and (predSizeW×predSizeH) specified in the operation of determining the core parameters by using a neural network. The three information may use the same or different neural network models according to various situations, that is, operations of upsampling, downsampling or size reduction/enlargement are replaced by neural network models. Furthermore, filtering operations involved in the foregoing embodiments may also be performed before or after using the neural network models, to obtain three new sets of information including reference luma information, reference chroma information and reconstructed luma information.
It may also be understood that in the embodiment of the disclosure, reference information used by a certain predicted chroma pixel in weight-based chroma prediction in the WCP mode is fixed, which will affect prediction accuracy inevitably. Therefore, a solution of changing the reference pixel of each pixel is also proposed here, detailed processes thereof are as follows.
At first, the core parameters include, but are not limited to the control parameter(S), the number inSize[i][j] of weight-based chroma prediction inputs, and the number of weight-based chroma prediction outputs (predWcp) (arranged into predSizeW×predSizeH). Here, inSize[i][j] indicates a number of reference pixels used by a certain to-be-predicted pixel Cpred[i][j], where i=0, . . . , predSizeW−1, j=0, . . . , predSizeH−1.
Secondly, the reference chroma information refC and the reference luma information refY are acquired from the neighboring area. The acquired reference chroma information includes, but is not limited to selecting a reference chroma reconstructed value of the upper area of the current block, and a reference chroma reconstructed value of the left area of the current block. The acquired reference luma information includes, but is not limited to acquiring corresponding reference luma information according to a position of the reference chroma information.
The reconstructed luma information recY of the current block is acquired. Acquisition modes include, but are not limited to acquiring corresponding reconstructed luma information according to the position of the chroma information in the current block, as the reconstructed luma information of the current block.
Thirdly, with respect to different prediction positions of the block with a size of predSizeW×predSizeH, different reference luma information refY[i][j] and reference chroma information refC[i][j] are selected from the reference chroma information refC and the reference luma information refY acquired from the neighboring area, detailed processes are as follows.
Fourthly, with respect to each to-be-predicted pixel Cpred[i][j] within the size specified by the core parameters, the reconstructed luma information recY[i][j] corresponding thereto is subtracted from reference luma information refY[i][j] of the number of inSize[i][j], and an absolute value of the subtracted difference is acquired to obtain the luma difference vector diffY[i][j][k]. Where refY[i][j] is a set of reference luma vectors corresponding to the to-be-predicted pixel Ci,jpred Detailed calculation formula thereof is as follows.
Under certain conditions, linear or nonlinear numerical processes may be performed on the luma difference vector of the to-be-predicted pixel. Exemplarily, value of the luma difference vector of the to-be-predicted pixel may be scaled according to the control parameter S′ in the core parameters.
Fifthly, the predicted chroma value of each to-be-predicted pixel is calculated according to the weight vector cWeight[i][j] and the reference chroma information refC corresponding to the to-be-predicted pixel. Specifically, the reference chroma information refC[i][j] of each to-be-predicted pixel Cpred[i][j] is multiplied by elements of the weight vector corresponding to the to-be-predicted pixel one by one, to obtain subC[i][j], results of multiplication are accumulated to obtain the predicted chroma value Cpred[i][j] (that is, weighted prediction) of the to-be-predicted pixel. Where refC[i][j] is a set of reference chroma vectors corresponding to the to-be-predicted pixel Cpred[i][j]. Calculation formula thereof is shown as follows.
After calculation is completed, fixed-point may be performed on subCFloat. In order to keep a certain calculation accuracy in the fixed-point process, it may be multiplied by a coefficient here, which is shown by formula as follows.
It may also be understood that in the embodiment of the disclosure, the neighboring area is the same as that used in other existing chroma prediction modes, which will affect prediction accuracy inevitably. Therefore, the neighboring area may also be changed. Exemplarily, the existing multi-reference row technology in H.266 may be used to extend the reference area of the WCP prediction technology. As shown in
The embodiment provides a decoding method. Specific implementations of the foregoing embodiments are described in detail through the embodiment. It may be seen that according to technical solutions of the foregoing embodiments, accuracy of the WCP prediction technology may be improved. Specifically, the process of acquiring the target information is optimized, in case of different core parameters, different processing modes (including upsampling, downsampling, size reduction, size enlargement, or other filtering methods) are used according to current different color format information or different numbers of acquired information, to match the acquired information with the number of information specified by WCP, complete the correction process of the target information, and thus obtain the final predicted chroma value. Since spatial characteristics presented by all pixels in the reference luma pixel and the reference chroma pixel acquired from the neighboring area in case of different color format information, are different according to images with different content characteristics, then through upsampling or downsampling processes, continuity of spatial correlation thereof may be enhanced to a certain extent, or some information with weak spatial correlation are removed, so that it is used as the final input target information of the WCP prediction technology, which may make the predicted value more accurate, thereby improving accuracy of the chroma prediction, saving bitrates, while improving encoding and decoding performance.
In yet another embodiment of the disclosure, with reference to
At S1801, reference information of a current block is determined.
It should be noted that the method for encoding according to the embodiment of the disclosure is applied to an apparatus for encoding, or a device for encoding (which may also be referred to as an “encoder” for short) integrated with the apparatus for encoding. Furthermore, the method for encoding according to the embodiment of the disclosure may specifically refer to an intra prediction method, and more specifically, to a pre-processing operation method of Weight-based Chroma Prediction (WCP).
In the embodiment of the disclosure, a video image may be divided into multiple CBs, each of the CBs may include a first color component, a second color component, and a third color component, and the current block here refers to a CB currently to be intra-predicted in the video image. Furthermore, it is assumed that prediction of the first color component is performed on the current block, and the first color component is a luma component, that is, a to-be-predicted component is a luma component, then the current block may also be referred to as a luma prediction block. Or, it is assumed that prediction of the second color component is performed on the current block, and the second color component is a chroma component, that is, the to-be-predicted component is the chroma component, then the current block may also be referred to as a chroma prediction block.
It should also be noted that in the embodiment of the disclosure, the reference information of the current block may include values of first color component samples in a neighboring area of the current block and values of second color component samples in the neighboring area of the current block. These samples may be determined according to encoded pixels in the neighboring area of the current block. In some embodiments, the neighboring area of the current block may include at least one of an upper neighboring area, an upper right neighboring area, a left neighboring area, or a lower left neighboring area.
Furthermore, the reference information of the current block may further include reconstructed values of first reference color component samples in the current block. Therefore, in some embodiments, the operation of determining the reference information of the current block may include the following operations.
The reference information of the current block is determined according to values of first color component samples in a neighboring area of the current block, values of second color component samples in the neighboring area of the current block, and the reconstructed values of first reference color component samples in the current block.
It should be noted that in the embodiment of the disclosure, the reference pixels of the current block may refer to reference pixel points neighboring the current block, or may be referred to as the first color component samples or the second color component samples in the neighboring area of the current block, and are indicated by Neighboring Samples or Reference Samples. “Neighboring” here may be spatially neighboring, but is not limited thereto. For example, “neighboring” may also be temporally neighboring, or spatially and temporally neighboring. Or even, the reference pixels of the current block may be reference pixels obtained after a certain process is performed on reference pixel points spatially neighboring, temporally neighboring, and spatially and temporally neighboring, etc. The embodiment of the disclosure does not impose any limitation thereto.
It should also be noted that in the embodiment of the disclosure, the first color component is the luma component, and the second color component is the chroma component. Then, the values of the first color component samples in the neighboring area of the current block are indicated as reference luma information corresponding to the reference pixels of the current block, and the values of the second color component samples in the neighboring area of the current block are indicated as reference chroma information corresponding to the reference pixels of the current block.
At S1802, a filtering process is performed on partial information in the reference information of the current block, to determine target information of the current block.
In the embodiment of the disclosure, since there is a case where a number of values of the first color component samples in the neighboring area of the current block is different from a number of values of the second color component samples in the neighboring area of the current block, at this time, it may need to perform the filtering process on the values of the first color component samples or the values of the second color component samples, so that the number of the values of the first color component samples is the same as the number of the values of the second color component samples.
In a possible implementation, the operation of performing the filtering process on the partial information in the reference information of the current block, to determine the target information of the current block may include the following operations.
A first filtering process is performed on the values of the first color component samples in the neighboring area of the current block, to obtain filtered sample values of a first color component in the neighboring area of the current block.
The target information of the current block is determined according to the filtered sample values of the first color component in the neighboring area of the current block.
In the embodiment of the disclosure, a number of filtered sample values of the first color component in the neighboring area of the current block is equal to L, here, L indicates a number of the values of the second color component samples in the neighboring area of the current block, and L is a positive integer.
In a specific embodiment, the first filtering process may be a downsampling filtering process. Exemplarily, a number of reference luma information of the current block is usually greater than a number of reference chroma information of the current block. Therefore, the downsampling filtering process may be performed on the reference luma information of the current block, so that the number of reference luma information is the same as the number of reference chroma information.
It should also be noted that since the number of reference luma information and the number of reference chroma information of the current block may also be affected by color format information, in some embodiments, the method may further include the following operation. The first filtering process is performed on the values of the first color component samples in the neighboring area of the current block based on color format information, to obtain the filtered sample values of the first color component in the neighboring area of the current block.
In a specific embodiment, the first filtering process may further include the following operations.
If the color format information indicates 4:4:4 sampling, downsampling filtering is not performed on the values of the first color component samples in the neighboring area of the current block.
If the color format information indicates 4:2:2 sampling, downsampling filtering is performed on the values of the first color component samples in the neighboring area of the current block.
If the color format information indicates 4:2:0 sampling, downsampling filtering is performed on the values of the first color component samples in the neighboring area of the current block.
It should be noted that in the embodiment of the disclosure, when the color format information indicates 4:2:0 sampling, a downsampling rate is a reciprocal of a positive integer multiple of 2.
In this way, with respect to downsampling filtering performed on the reference luma information acquired from the neighboring area, downsampling may be performed by using a multi-tap filter (such as a four-tap filter, a five-tap filter, a six-tap filter, etc.), or acquiring a certain pixel from multiple reference luma pixels at a corresponding position of a reference chroma pixel, or even using other downsampling modes, the embodiment of the disclosure does not impose specific limitation thereto.
Further, when a number of reference luma information after downsampling filtering is L and is the same as the number of reference chroma information, it also needs to match L with a preset number at this time. Therefore, in some embodiments, the method may further include the following operations.
L is compared with the preset number.
A second filtering process is performed on the filtered sample values of the first color component in the neighboring area of the current block and the values of the second color component samples in the neighboring area of the current block according to a comparison result between L and the preset number, to determine filtered neighboring sample values of a first color component of the current block and filtered neighboring sample values of the second color component of the current block.
The target information of the current block is determined according to the filtered neighboring sample values of the first color component of the current block and the filtered neighboring sample values of the second color component of the current block.
In a specific embodiment, the operation of performing the second filtering process on the filtered sample values of the first color component in the neighboring area of the current block and the values of the second color component samples in the neighboring area of the current block according to the comparison result between L and the preset number, to determine the filtered neighboring sample values of the first color component of the current block and the filtered neighboring sample values of the second color component of the current block may include the following operations.
If L is greater than the preset number, a first sub-filtering process is performed on the filtered sample values of the first color component in the neighboring area of the current block and the values of the second color component samples in the neighboring area of the current block, to determine the filtered neighboring sample values of the first color component of the current block and the filtered neighboring sample values of the second color component of the current block.
If L is less than the preset number, a second sub-filtering process is performed on the filtered sample values of the first color component in the neighboring area of the current block and the values of the second color component samples in the neighboring area of the current block, to determine the filtered neighboring sample values of the first color component of the current block and the filtered neighboring sample values of the second color component of the current block.
It should be noted that in the embodiment of the disclosure, the preset number may be indicated by inSize. Specifically, if L is equal to the preset number, no operation is required; if L is greater than the preset number, it needs to perform the first sub-filtering process (that is, reducing the size) on the reference luma information and the reference chroma information; if L is less than the preset number, it needs to perform the second sub-filtering process (that is, enlarging the size) on the reference luma information and the reference chroma information.
In another possible implementation, the operation of performing the filtering process on the partial information in the reference information of the current block, to determine the target information of the current block may include the following operations.
A third filtering process is performed on the values of the second color component samples in the neighboring area of the current block, to obtain filtered sample values of a second color component in the neighboring area of the current block.
The target information of the current block is determined according to the filtered sample values of the second color component in the neighboring area of the current block.
In the embodiment of the disclosure, a number of filtered sample values of the second color component in the neighboring area of the current block is equal to K, K indicates a number of the values of the first color component samples in the neighboring area of the current block, and K is a positive integer.
In a specific embodiment, the third filtering process is an upsampling filtering process. Exemplarily, the number of reference luma information of the current block is usually greater than the number of reference chroma information of the current block. Therefore, the upsampling filtering process may also be performed on the reference chroma information of the current block, so that the number of reference luma information is the same as the number of reference chroma information.
Since the number of reference luma information and the number of reference chroma information of the current block may also be affected by color format information, in some embodiments, the method may further include the following operation. The third filtering process is performed on the values of the second color component samples in the neighboring area of the current block based on color format information, to obtain the filtered sample values of the second color component in the neighboring area of the current block.
In a specific embodiment, the third filtering process may further include the following operations.
If the color format information indicates 4:4:4 sampling, upsampling filtering is not performed on the values of the second color component samples in the neighboring area of the current block.
If the color format information indicates 4:2:2 sampling, upsampling filtering is performed on the values of the second color component samples in the neighboring area of the current block.
If the color format information indicates 4:2:0 sampling, upsampling filtering is performed on the values of the second color component samples in the neighboring area of the current block.
It should be noted that in the embodiment of the disclosure, when the color format information indicates 4:2:0 sampling, an upsampling rate is a positive integer multiple of 2. In this way, when the number of reference luma information acquired from the neighboring area is different from the number of reference chroma information acquired from the neighboring area, upsampling filtering may be performed on the reference chroma information acquired from the neighboring area, to match the number of reference luma information.
In this way, with respect to upsampling filtering performed on the reference chroma information acquired from the neighboring area, upsampling may be performed by using linear interpolation, nonlinear interpolation or other modes, or copying a certain reference chroma pixel, or even using other upsampling modes, the embodiment of the disclosure does not impose specific limitation thereto.
Further, when a number of reference chroma information after upsampling filtering is K and is the same as the number of reference luma information, it also needs to match K with a preset number at this time. Therefore, in some embodiments, the method may further include the following operations.
K is compared with the preset number.
A fourth filtering process is performed on the values of the first color component samples in the neighboring area of the current block and the filtered sample values of the second color component in the neighboring area of the current block according to a comparison result between K and the preset number, to determine filtered neighboring sample values of a first color component of the current block and filtered neighboring sample values of the second color component of the current block.
The target information of the current block is determined according to the filtered neighboring sample values of the first color component of the current block and the filtered neighboring sample values of the second color component of the current block.
In a specific embodiment, the operation of performing the fourth filtering process on the values of the first color component samples in the neighboring area of the current block and the filtered sample values of the second color component in the neighboring area of the current block according to the comparison result between K and the preset number, to determine the filtered neighboring sample values of the first color component of the current block and the filtered neighboring sample values of the second color component of the current block may include the following operations.
If K is greater than the preset number, a first sub-filtering process is performed on the values of the first color component samples in the neighboring area of the current block and the filtered sample values of the second color component in the neighboring area of the current block, to determine the filtered neighboring sample values of the first color component of the current block and the filtered neighboring sample values of the second color component of the current block.
If K is less than the preset number, a second sub-filtering process is performed on the values of the first color component samples in the neighboring area of the current block and the filtered sample values of the second color component in the neighboring area of the current block, to determine the filtered neighboring sample values of the first color component of the current block and the filtered neighboring sample values of the second color component of the current block.
It should be noted that in the embodiment of the disclosure, the preset number may be indicated by inSize. Specifically, if K is equal to inSize, no operation is required; if K is greater than inSize, it needs to perform the first sub-filtering process (that is, reducing the size) on the reference luma information and the reference chroma information; if K is less than inSize, it needs to perform the second sub-filtering process (that is, enlarging the size) on the reference luma information and the reference chroma information.
It may also be understood that in the embodiment of the disclosure, if the color format information is not considered, the number of reference luma information or the number of reference chroma information acquired from the neighboring area may also be directly matched with inSize, so that the number of reference luma information or the number of reference chroma information is the same as inSize.
In a possible implementation, the operation of performing the filtering process on the partial information in the reference information of the current block, to determine the target information of the current block may include the following operations.
A number of the values of the first color component samples in the neighboring area of the current block is determined as a first number.
A fifth filtering process is performed on the values of the first color component samples in the neighboring area of the current block according to a comparison result between the first number and a preset number, to determine filtered neighboring sample values of a first color component of the current block.
The target information of the current block is determined according to the filtered neighboring sample values of the first color component of the current block.
In a specific embodiment, the operation of performing the fifth filtering process on the values of the first color component samples in the neighboring area of the current block, to determine the filtered neighboring sample values of the first color component of the current block may include the following operations.
If the first number is greater than the preset number, a first sub-filtering process is performed on the values of the first color component samples in the neighboring area of the current block, to determine the filtered neighboring sample values of the first color component of the current block.
If the first number is less than the preset number, a second sub-filtering process is performed on the values of the first color component samples in the neighboring area of the current block, to determine the filtered neighboring sample values of the first color component of the current block.
It should be noted that in the embodiment of the disclosure, the number of reference luma information acquired from the neighboring area may be matched with the preset number. The number of reference luma information acquired from the neighboring area (that is, the first number) may be indicated by refYnum; the preset number may be indicated by inSize. Specifically, if refYnum is equal to inSize, no operation is required; if refYnum is greater than inSize, it needs to perform the first sub-filtering process (that is, reducing the size) on the reference luma information; if refYnum is less than inSize, it needs to perform the second sub-filtering process (that is, enlarging the size) on the reference luma information.
In another possible implementation, the operation of performing the filtering process on the partial information in the reference information of the current block, to determine the target information of the current block may further include the following operations.
A number of the values of the second color component samples in the neighboring area of the current block is determined as a second number.
A sixth filtering process is performed on the values of the second color component samples in the neighboring area of the current block according to a comparison result between the second number and a preset number, to determine filtered neighboring sample values of the second color component of the current block.
The target information of the current block is determined according to the filtered neighboring sample values of the second color component of the current block.
In a specific embodiment, the operation of performing the sixth filtering process on the values of the second color component samples in the neighboring area of the current block, to determine the filtered neighboring sample values of the second color component of the current block may include the following operations.
If the second number is greater than the preset number, a first sub-filtering process is performed on the values of the second color component samples in the neighboring area of the current block, to determine the filtered neighboring sample values of the second color component of the current block.
If the second number is less than the preset number, a second sub-filtering process is performed on the values of the second color component samples in the neighboring area of the current block, to determine the filtered neighboring sample values of the second color component of the current block.
It should also be noted that in the embodiment of the disclosure, the number of reference chroma information acquired from the neighboring area may be matched with the preset number. The number of reference chroma information acquired from the neighboring area (that is, the second number) may be indicated by refCnum; the preset number may be indicated by inSize. Specifically, if refCnum is equal to inSize, no operation is required; if refCnum is greater than inSize, it needs to perform the first sub-filtering process (that is, reducing the size) on the reference chroma information; if refCnum is less than inSize, it needs to perform the second sub-filtering process (that is, enlarging the size) on the reference chroma information.
In the embodiment of the disclosure, the first sub-filtering process may be a downsampling filtering process. Furthermore, in some embodiments, the first sub-filtering process may further include at least one of: a sub-filtering process is performed by using a fixed-interval position selection mode; or the sub-filtering process is performed by using a continuous position selection mode.
In the embodiment of the disclosure, the second sub-filtering process may be an upsampling filtering process. Furthermore, in some embodiments, the second sub-filtering process may further include: a sub-filtering process is performed by using a fixed-interval position interpolation mode.
It may also be understood that if prediction of the chroma component is performed on the current block, the reference information of the current block may further include reconstructed luma information of the current block. Therefore, the reference information of the current block may also be determined based on the reconstructed values of the first reference color component samples in the current block.
In the embodiment of the disclosure, the first reference color component may be a luma component; then, the reconstructed values of the first reference color component samples in the current block are the reconstructed luma information of the current block. Since a number of reconstructed luma information of the current block is different from a preset size, it also needs to perform a filtering process on the reconstructed luma information of the current block, to convert the number of reconstructed luma information acquired from the current block into the preset size, for input. Here, the preset size is predSizeW×predSizeH, predSizeW indicates a width of the prediction block, and predSizeH indicates a height of the prediction block.
In some embodiments, the operation of performing the filtering process on the partial information in the reference information of the current block, to determine the target information of the current block may include the following operations. A seventh filtering process is performed on the reconstructed values of the first reference color component samples in the current block, to determine filtered sample values of the first reference color component samples in the current block. The target information of the current block is determined according to the filtered sample values of the first reference color component samples in the current block.
In a specific embodiment, the operation of performing the seventh filtering process on the reconstructed values of the first reference color component samples in the current block, to determine the filtered sample values of the first reference color component samples in the current block may include the following operations.
A first width and a first height are determined according to the reconstructed values of the first reference color component samples in the current block.
If the first width is greater than a width of the prediction block, or the first height is greater than a height of the prediction block, a third sub-filtering process is performed on the reconstructed values of the first reference color component samples in the current block, to determine the filtered sample values of the first reference color component samples in the current block.
If the first width is less than the width of the prediction block, or the first height is less than the height of the prediction block, a fourth sub-filtering process is performed on the reconstructed values of the first reference color component samples in the current block, to determine the filtered sample values of the first reference color component samples in the current block.
It should be noted that in the embodiment of the disclosure, it is assumed that the number of reconstructed luma information is recSizeW×recSizeH, then recSizeW indicates the first width, and recSizeH indicates the first height. Specifically, if recSizeW is equal to predSizeW, and recSizeH is equal to predSizeH, no operation is required; if recSizeW is greater than predSizeW, or recSizeH is greater than predSizeH, it needs to perform the first sub-filtering process (that is, reducing the size) on the reconstructed luma information; if recSizeW is less than predSizeW, or recSizeH is less than predSizeH, it needs to perform the second sub-filtering process (that is, enlarging the size) on the reconstructed luma information.
It should also be noted that in the embodiment of the disclosure, the third sub-filtering process may be a downsampling filtering process. Furthermore, in some embodiments, the third sub-filtering process may further include at least one of: the downsampling filtering process is performed in a horizontal direction on the reconstructed values of the first reference color component samples in the current block; the downsampling filtering process is performed in a vertical direction on the reconstructed values of the first reference color component samples in the current block; the downsampling filtering process is performed in the horizontal direction and then in the vertical direction on the reconstructed values of the first reference color component samples in the current block; or the downsampling filtering process is performed in the vertical direction and then in the horizontal direction on the reconstructed values of the first reference color component samples in the current block.
Here, at first, a horizontal downsampling factor may be calculated according to recSizeW and predSizeW, and a vertical downsampling factor may be calculated according to recSizeH and predSizeH; then, downsampling filtering is performed on the reconstructed luma information according to the horizontal downsampling factor and the vertical downsampling factor. Specifically, if the horizontal downsampling factor is greater than 1 and the vertical downsampling factor is equal to 1, it only needs to perform downsampling in the horizontal direction on the reconstructed luma information; if the horizontal downsampling factor is equal to 1 and the vertical downsampling factor is greater than 1, it only needs to perform downsampling in the vertical direction on the reconstructed luma information; if the horizontal downsampling factor is greater than 1 and the vertical downsampling factor is greater than 1, it needs to perform downsampling in both horizontal and vertical directions on the reconstructed luma information, here, downsampling in the horizontal direction and then in the vertical direction may be performed, or downsampling in the vertical direction and then in the horizontal direction may be performed, or even downsampling operations here may be replaced by convolution operations in a neural network structure, the embodiment of the disclosure does not impose any limitation thereto
It should also be noted that in the embodiment of the disclosure, the fourth sub-filtering process is an upsampling filtering process. Furthermore, in some embodiments, the fourth sub-filtering process may further include at least one of: the upsampling filtering process is performed in a horizontal direction on the reconstructed values of the first reference color component samples in the current block; the upsampling filtering process is performed in a vertical direction on the reconstructed values of the first reference color component samples in the current block; the upsampling filtering process is performed in the horizontal direction and then in the vertical direction on the reconstructed values of the first reference color component samples in the current block; or the upsampling filtering process is performed in the vertical direction and then in the horizontal direction on the reconstructed values of the first reference color component samples in the current block.
Here, at first, a horizontal upsampling factor is calculated according to recSizeW and predSizeW, and a vertical upsampling factor is calculated according to recSizeH and predSizeH; then, upsampling filtering is performed on the reconstructed luma information according to the horizontal upsampling factor and the vertical upsampling factor. Specifically, if the horizontal upsampling factor is greater than 1 and the vertical upsampling factor is equal to 1, it only needs to perform upsampling in the horizontal direction on the reconstructed luma information; if the horizontal upsampling factor is equal to 1 and the vertical upsampling factor is greater than 1, it only needs to perform upsampling in the vertical direction on the reconstructed luma information; if the horizontal upsampling factor is greater than 1 and the vertical upsampling factor is greater than 1, it needs to perform upsampling in both horizontal and vertical directions on the reconstructed luma information, here, upsampling in the horizontal direction and then in the vertical direction may be performed, or upsampling in the vertical direction and then in the horizontal direction may be performed, or even an upsampling result of “in the horizontal direction and then in the vertical direction” and an upsampling result of “in the vertical direction and then in the horizontal direction” may be average-weighted to determine a final upsampling result, or even upsampling operations here may be replaced by convolution operations in a neural network structure, the embodiment of the disclosure does not impose any limitation thereto.
That is, in the embodiment of the disclosure, the reference information of the current block may include the values of the first color component samples in the neighboring area of the current block, the values of the second color component samples in the neighboring area of the current block, and the reconstructed values of the first reference color component samples in the current block. The target information may include the filtered neighboring sample values of the first color component of the current block, the filtered neighboring sample values of the second color component of the current block, and the filtered sample values of the first reference color component samples in the current block. If it does not need to perform a filtering process on the values of the first color component samples in the neighboring area of the current block, the filtered neighboring sample values of the first color component of the current block are equal to the values of the first color component samples in the neighboring area of the current block. Similarly, if it does not need to perform a filtering process on the values of the second color component samples in the neighboring area of the current block, the filtered neighboring sample values of the second color component of the current block are equal to the values of the second color component samples in the neighboring area of the current block. If it does not need to perform a filtering process on the reconstructed values of the first reference color component samples in the current block, the filtered sample values of the first reference color component samples in the current block are equal to the reconstructed values of the first reference color component samples in the current block.
In this way, the obtained target information may include the filtered neighboring sample values of the first color component of the current block, the filtered neighboring sample values of the second color component of the current block, and the filtered sample values of the first reference color component samples in the current block, that is, reference chroma information of the number of inSize, reference luma information of the number of inSize, and reconstructed luma information conforming to the preset size.
At S1803, a respective one of weighting coefficients is determined according to each of reference sample values of a first color component in the target information.
It should be noted that in some embodiments, the method may further include the following operations. After determining the filtered neighboring sample values of the first color component of the current block, the filtered neighboring sample values of the second color component of the current block, and the filtered sample values of the first reference color component samples in the current block, each of the reference sample values of the first color component in the target information is set as an absolute value of a difference between a respective one of the filtered neighboring sample values of the first color component of the current block and a filtered sample value of a respective one of the first reference color component samples in the current block.
In some embodiments, the method may further include the following operation. The reference sample values of the second color component in the target information are set as the filtered neighboring sample values of the second color component of the current block.
Furthermore, considering the filtering process on the reference information, it may be that the filtering process is performed on only the reference luma information, or may be that the filtering process is performed on only the reconstructed luma information, or may be that the filtering process is performed on only the reference luma information and the reconstructed luma information, or even may be that the filtering process is performed on the reference chroma information, the reference luma information and the reconstructed luma information, any limitation is not imposed thereto here. Then, with respect to calculation of a luma difference, the method may further include the following operations. Each of the reference sample values of the first color component in the target information is set as an absolute value of a difference between a value of a respective one of the first color component samples in the neighboring area of the current block and a reconstructed value of a respective one of the first reference color component samples in the current block; or, each of the reference sample values of the first color component in the target information is set as an absolute value of a difference between a respective one of the filtered neighboring sample values of the first color component of the current block and a reconstructed value of a respective one of the first reference color component samples in the current block; or, each of the reference sample values of the first color component in the target information is set as an absolute value of a difference between a value of a respective one of the first color component samples in the neighboring area of the current block and a filtered sample value of a respective one of the first reference color component samples in the current block, specific limitation is not imposed thereto here.
In some embodiments, the operation of determining the respective one of the weighting coefficients according to each of the reference sample values of the first color component in the target information may include the following operations.
A respective value corresponding to each of the reference sample values of the first color component under a preset mapping relationship is determined.
The respective one of the weighting coefficients is set to be equal to the respective value.
It should be noted that in the embodiment of the disclosure, each of the reference sample values of the first color component may be the absolute value of the difference between the respective one of the filtered neighboring sample values of the first color component of the current block and the filtered sample value of the respective one of the first reference color component samples in the current block. The first reference color component is the first color component, and the first color component is a color component different from the second color component to be predicted in the embodiment of the disclosure.
It should be noted that in the embodiment of the disclosure, in order to predict the chroma component of the to-be-predicted pixel in the current block, at least one to-be-predicted pixel in the current block may be selected, and a respective luma difference (indicated by |ΔYk|) between reconstructed luma of each of the at least one to-be-predicted pixel and the reference luma in the neighboring area is calculated respectively. If |ΔYk| is small, it indicates that similarity between luma values is relatively strong, and a large weight is provided to a weighting coefficient (indicated by wk) corresponding thereto. On the contrary, if |ΔYk| is large, it indicates that similarity between luma values is relatively weak, and a small weight is provided to wk. That is, wk and |ΔYk| are approximately in an inverse ratio there-between, under the preset mapping relationship.
Further, in some embodiments, the operation of determining the respective value corresponding to each of the reference sample values of the first color component under the preset mapping relationship may include the following operations. A first factor is determined. A respective first product value is determined according to the first factor and each of the reference sample values of the first color component. A value corresponding to the respective first product value under the preset mapping relationship is determined.
In a specific embodiment, the operation of determining the first factor may include: the first factor is a preset constant value.
In another specific embodiment, the operation of determining the first factor may include the following operation. A value of the first factor is determined according to size parameters of the current block.
Further, in some embodiments, the method may further include the following operation. The value of the first factor is determined according to a preset look-up table mapping the size parameters of the current block to the value of the first factor.
Here, the size parameters of the current block may include at least one of a width of the current block, a height of the current block, or a product of the width and height of the current block.
It should be noted that in the embodiment of the disclosure, a classification mode may be used to fix the value of the first factor. For example, size parameters according to the current block are divided into three categories, and a respective value of the first factor corresponding to each of the categories is determined. Exemplarily, the foregoing Table 1 shows a schematic correspondence between the first factor and the size parameters of the current block.
In yet another specific embodiment, the operation of determining the first factor may include the following operation. The value of the first factor is determined according to a number of reference pixels of the current block.
Further, in some embodiments, the method may further include the following operation. The value of the first factor is determined according to a preset look-up table mapping the number of reference pixels of the current block to the value of the first factor.
It should be noted that in the embodiment of the disclosure, the number of reference pixels may be divided into three categories, and a classification mode is still used to fix the value of the first factor. Exemplarily, the foregoing Table 2 shows a schematic correspondence between the first factor and the number of reference pixels of the current block.
Further, with respect to the first product value, the operation of determining the respective first product value according to the first factor and each of the reference sample values of the first color component may include the following operations.
The respective first product value is set to be equal to a product of the first factor and each of the reference sample values of the first color component.
Or, the respective first product value is set to be equal to a value obtained by bit-right-shifting of each of the reference sample values of the first color component, here, a number of bits of the bit-right-shifting is equal to the first factor.
Or, the respective first product value is set as a value obtained by addition and bit-shifting operations of each of the reference sample values of the first color component according to the first factor.
Exemplarily, it is assumed that the first factor is equal to 0.25 and the reference sample value of the first color component is indicated by Ref, then the first product value may be equal to 0.25×Ref, and 0.25×Ref may be written as Ref/4, that is, Ref>>2. Furthermore, during fixed-point calculation, floating-point numbers may be converted into addition and shifting operations; that is, any limitation is not imposed to calculation modes of the first product value.
It may also be understood that in the embodiment of the disclosure, the first reference color component may also be a chroma component, that is, at least one to-be-predicted pixel with apparent color difference in the current block is selected, and a respective chroma difference (indicated by |ΔCk|) between reconstructed chroma of each of the at least one to-be-predicted pixel and the reference chroma in the neighboring area is calculated respectively. If |ΔCk| is small, it indicates that similarity between chroma values is relatively strong, and a large weight may be provided to a weighting coefficient (indicated by wk) corresponding thereto. On the contrary, if |ΔCk| is large, it indicates that similarity between chroma values is relatively weak, and a small weight may be provided to wk. That is, when the weighting coefficient is calculated, the reference sample value of the first color component may also be |ΔCk|, and then the weighting coefficient is calculated.
Simply speaking, in the embodiment of the disclosure, the reference sample value of the first color component may be |ΔCk|, that is, an absolute value of the chroma difference; or may be |ΔYk|, that is, an absolute value of the luma difference; or may be |αΔYk|, that is, a product of the absolute value of the luma difference and a preset multiplier, etc. The preset multiplier here is the second factor described in the embodiment of the disclosure.
Further, with respect to the second factor, in a specific embodiment, the method may further include the following operation. A least square method calculation is performed according to first and second color component values of the reference pixel, to determine the second factor.
That is, it is assumed that a number of reference pixels is N, the first color component value of the reference pixel is the reference luma information of the current block, and the second color component value of the reference pixel is the reference chroma information of the current block, then a least square method calculation may be performed on chroma component values and luma component values of the N reference pixels, for example, a least square regression calculation is as shown in the foregoing formula (5), so that the second factor may be obtained by calculation.
Furthermore, with respect to the preset mapping relationship, it may be a preset function relationship. In some embodiments, the preset mapping relationship may be a Softmax function, as shown in the foregoing formula (6) or formula (7). The Softmax function is a normalized exponential function, however, normalization may not be required by the embodiment of the disclosure, and a value thereof is not limited to be in a range of [0, 1].
It should also be noted that besides the Softmax function, in some other embodiments, the preset mapping relationship may be a weighting function having an inverse ratio relationship with the reference sample values of the first color component, as shown in the foregoing formula (8) or formula (9).
In this way, the preset mapping relationship may be as shown in formula (4), or may be as shown in formula (6) or formula (7), or may be as shown in formula (8) or formula (9), or even may be other function models capable of fitting a trend of the closer the reference luma value of the reference pixel relative to the reconstructed luma value of the to-be-predicted pixel in the current block, the higher the importance of the reference chroma value of the reference pixel to the to-be-predicted pixel in the current block, to create the weighting coefficients, or the like. Furthermore, the preset mapping relationship may also be in form of a preset look-up table, for example, an array element look-up mode is used to reduce part of calculation operations, or the like, and the embodiment of the disclosure does not impose specific limitation thereto.
In this way, the weighting coefficients may be determined according to the reference sample values of the first color component (for example, |ΔYkij|), and may specifically include N weighting coefficients such as w1, w2, . . . , wN, here N indicates the number of reference sample values of the second color component. Here, theoretically speaking, a sum of the N weighting coefficients is equal to 1, and each of the weighting coefficients is a value equal to or greater than 0 and less than or equal to 1.
At S1804, a prediction block of a second color component of the current block is determined according to the weighting coefficients and reference sample values of a second color component in the target information.
At S1805, predicted difference values of second color component samples of the current block are determined according to the prediction block.
It should be noted that after the weighting coefficients are determined, weighted calculation may be performed on the reference sample values of the second color component by using the weighting coefficients, thereby obtaining predicted values of second color component samples in the prediction block.
In some embodiments, the operation of determining the prediction block of the second color component of the current block according to the weighting coefficients and the reference sample values of the second color component in the target information may include the following operations.
A respective weighted value between each of the reference sample values of the second color component and a weighting coefficient corresponding to the reference sample value is determined.
A predicted value of a respective one of second color component samples in the prediction block is set to be equal to a sum of N weighted values, N indicates a number of the reference sample values of the second color component, and N is a positive integer.
That is, if the number of the reference sample values of the second color component is N, a respective weighted value (that is, wkCk) between each of the reference sample values of the second color component and a weighting coefficient corresponding to the reference sample value is determined, and then a sum of the N weighted values is used as the predicted value of the respective one of the second color component samples in the prediction block. Specifically, a calculation formula thereof is shown as the foregoing formula (16), and this calculation mode is conducive to parallel processing and may speed up calculation.
It should also be noted that in the embodiment of the disclosure, the first color component is the luma component, and the second color component is the chroma component. Since there is a case where resolution of the luma component is different from resolution of the chroma component, when the filtering process is performed on the reference information, it includes that downsampling filtering is performed on the luma component to align the resolution of the chroma component, or upsampling filtering is performed on the chroma component to align the resolution of the luma component.
Further, it usually needs to limit the predicted value of the respective one of the second color component samples in the prediction block to be in a preset range. Therefore, in some embodiments, the method may further include the following operations. A correction operation is performed on the predicted value of the respective one of the second color component samples in the prediction block, to determine the prediction block of the second color component of the current block.
It should be noted that in the embodiment of the disclosure, the preset range may be between 0 and (1<<BitDepth)−1. If the predicted value exceeds values of the preset range, it needs to perform a corresponding correction operation on the predicted value. Exemplarily, a clamping operation may be performed on Ci,jpred, so that it may be ensured that predicted values of all the second color component samples in the prediction block are between 0 and (1<<BitDepth)−1.
Further, after the prediction block is determined, the prediction block still needs to be post-processed as the final prediction block under certain conditions. Therefore, in some embodiments, the method may further include the following operations.
A relevant process is performed on the prediction block, and the processed prediction block is used as the prediction block of the second color component of the current block.
In a possible implementation, the operation of performing the relevant process on the prediction block may include the following operation. A filtering enhancement process is performed on the prediction block, and the processed prediction block is used as the prediction block of the second color component of the current block.
In another possible implementation, the operation of performing the relevant process on the prediction block may include the following operation. A compensation value of a second color component of the prediction block is determined according to reference sample values in a neighboring area of the current block. A correction process is performed on a predicted value of a respective one of second color component samples in the prediction block according to the compensation value, to determine the prediction block of the second color component of the current block.
In yet another possible implementation, the operation of performing the relevant process on the prediction block may include the following operations. A prediction process is performed on a respective one of second color component samples in the prediction block according to at least one prediction mode, to determine at least one initial predicted value of the respective one of the second color component samples in the prediction block. A weighted fusion process is performed according to the at least one initial predicted value and a predicted value of the respective one of the second color component samples in the prediction block, to determine the prediction block of the second color component of the current block.
That is, with respect to the relevant process of the prediction block, in order to reduce instability caused by WCP pixel-by-pixel independent and parallel prediction, smooth filtering may be performed on the prediction block, to be used as the final predicted chroma value. Or, in order to further improve accuracy of the WCP predicted value, a position-related correction process may be performed on the prediction block. For example, a chroma compensation value is calculated for each to-be-predicted pixel by using reference pixels with close spatial positions, the prediction block is corrected by using the chroma compensation value, and the corrected predicted value is used as the final predicted chroma value. Or, in order to further improve accuracy of the WCP predicted value, predicted chroma values calculated in other chroma prediction modes may be weighted-fused with the predicted chroma value calculated in WCP, and the fusion result is used as the final predicted chroma value. Or, in order to improve WCP prediction performance, the predicted chroma value calculated in WCP may be corrected by using a neural network model or the like, the embodiment of the disclosure does not impose any limitation thereto.
In some embodiments, after the prediction block is determined, as shown in
At S1901, predicted values of second color component samples of the current block are determined according to the prediction block.
At S1902, for each of the second color component samples of the current block, a predicted difference value of the second color component sample is determined according to an original value of the second color component sample and a predicted value of the second color component sample.
At S1903, predicted difference values of the second color component samples of the current block are encoded, and obtained encoded bits are written into a bitstream.
It should be noted that in the embodiment of the disclosure, the prediction block may contain predicted values of at least a part of the second color component samples in the current block. If the prediction block contains predicted values of all the second color component samples in the current block, the predicted values of the second color component samples of the current block may be set to be equal to the values of the prediction block; if the prediction block contains predicted values of a part of the second color component samples in the current block, upsampling filtering may be performed on the values of the prediction block, and the predicted values of the second color component samples of the current block is set to be equal to output values after the upsampling filtering.
It should also be noted that after the predicted values of the second color component samples of the current block are determined, for each of the second color component samples of the current block, a predicted difference value of the second color component sample may be determined according to an original value of the second color component sample and a predicted value of the second color component sample. Specifically, for each of the second color component samples of the current block, the predicted value of the second color component sample may be subtracted the original value of the second color component sample, so that predicted difference values of the second color component samples of the current block may be determined. In this way, after the predicted difference values of the second color component samples are written into the bitstream, the predicted difference values of the second color component samples may be obtained by decoding subsequently at the decoding side, to restore reconstructed values of the second color component samples of the current block.
In summary, it may be seen that taking chroma prediction performed on the current block as an example, in the embodiment of the disclosure, the reconstructed luma information of the current block, and the reference luma information and the reference chroma information of the neighboring area are encoded reference information. Therefore, the embodiment of the disclosure proposes a weight-based chroma prediction technology using the above information, and in a process of determining the target information of the current block according to these information, information of the neighboring area of the current block, information of the current block and the current color format information may be analyzed and processed, which mainly includes two aspects as follows: on one hand, whether downsampling is performed on the reference luma information of the neighboring area, or whether upsampling is performed on the reference chroma information of the neighboring area, is selected according to the current color format information; on the other hand, the reference luma information and the reference chroma information of the neighboring area, and the reconstructed luma information in the current block may be matched with a preset size of core parameters through different operations of size enlargement/reduction, which may improve accuracy of WCP prediction technology.
The embodiment of the disclosure further provides a method for encoding, in which reference information of a current block is determined; a filtering process is performed on partial information in the reference information of the current block, to determine target information of the current block; a respective one of weighting coefficients is determined according to each of reference sample values of a first color component in the target information; a prediction block of a second color component of the current block is determined according to the weighting coefficients and reference sample values of a second color component in the target information; predicted difference values of second color component samples of the current block are determined according to the prediction block. In this way, with respect to color component information in the neighboring area of the current block and color component information in the current block, accuracy of these reference information may be improved since characteristics of color format information are fully considered; and upsampling, downsampling or other filtering processes are performed on these reference information, so that continuity of spatial correlation thereof may be enhanced to a certain extent, or some information with weak spatial correlation may be removed, chroma prediction may be performed better by using the target information obtained after the filtering processes, thereby improving accuracy of the chroma prediction, saving bitrates, while improving encoding and decoding performance.
In yet another embodiment of the disclosure, the embodiment of the disclosure further provides a bitstream, the bitstream is generated by bit encoding according to to-be-encoded information, the to-be-encoded information includes at least predicted difference values of second color component samples of the current block.
In the embodiment of the disclosure, after the predicted difference values of the second color component samples of the current block are transmitted from the encoding side to the decoding side, the decoding side obtains the predicted difference values of the second color component samples through decoding, and then combines them with the predicted values of the second color component samples of the current block, so that the reconstructed values of the second color component samples of the current block may be restored. In this way, characteristics of input color format information are fully considered, to improve accuracy of the reference information of the neighboring area; spatial correlation is fully utilized, to perform upsampling, downsampling, size enlargement, size reduction, or other filtering processes on the reference information of the neighboring area and the reconstructed luma information of the current block, which not only improves accuracy of the chroma prediction, saves bitrates, but also improves encoding and decoding performance.
In yet another embodiment of the disclosure, based on an inventive concept the same as the foregoing embodiments, with reference to
The first determination unit 3001 is configured to determine reference information of a current block.
The first filtering unit 3002 is configured to perform a filtering process on partial information in the reference information of the current block, to determine target information of the current block.
The first determination unit 3001 is further configured to determine a respective one of weighting coefficients according to each of reference sample values of a first color component in the target information.
The first prediction unit 3003 is configured to determine a prediction block of a second color component of the current block according to the weighting coefficients and reference sample values of a second color component in the target information.
The first determination unit 3001 is further configured to determine predicted difference values of second color component samples of the current block according to the prediction block.
In some embodiments, the prediction block includes predicted values of at least a part of the second color component samples in the current block.
In some embodiments, the first determination unit 3001 is further configured to determine the reference information of the current block according to values of first color component samples in a neighboring area of the current block, values of second color component samples in the neighboring area of the current block, and reconstructed values of first reference color component samples in the current block.
In some embodiments, the neighboring area of the current block includes at least one of an upper neighboring area, an upper right neighboring area, a left neighboring area, or a lower left neighboring area.
In some embodiments, the first filtering unit 3002 is further configured to: perform a first filtering process on the values of the first color component samples in the neighboring area of the current block, to obtain filtered sample values of a first color component in the neighboring area of the current block; and determine the target information of the current block according to the filtered sample values of the first color component in the neighboring area of the current block.
In some embodiments, a number of filtered sample values of the first color component in the neighboring area of the current block is equal to L, L indicates a number of the values of the second color component samples in the neighboring area of the current block, and L is a positive integer.
In some embodiments, the first filtering process is a downsampling filtering process.
In some embodiments, the first filtering unit 3002 is further configured to perform the first filtering process on the values of the first color component samples in the neighboring area of the current block based on color format information, to obtain the filtered sample values of the first color component in the neighboring area of the current block.
In some embodiments, the first filtering unit 3002 is further configured to: if the color format information indicates 4:2:0 sampling, perform downsampling filtering on the values of the first color component samples in the neighboring area of the current block, a downsampling rate is a reciprocal of a positive integer multiple of 2.
In some embodiments, the first filtering unit 3002 is further configured to: compare L with a preset number; perform a second filtering process on the filtered sample values of the first color component in the neighboring area of the current block and the values of the second color component samples in the neighboring area of the current block according to a comparison result between L and the preset number, to determine filtered neighboring sample values of a first color component of the current block and filtered neighboring sample values of the second color component of the current block; and determine the target information of the current block according to the filtered neighboring sample values of the first color component of the current block and the filtered neighboring sample values of the second color component of the current block.
In some embodiments, the first filtering unit 3002 is further configured to: if L is greater than the preset number, perform a first sub-filtering process on the filtered sample values of the first color component in the neighboring area of the current block and the values of the second color component samples in the neighboring area of the current block, to determine the filtered neighboring sample values of the first color component of the current block and the filtered neighboring sample values of the second color component of the current block; and if L is less than the preset number, perform a second sub-filtering process on the filtered sample values of the first color component in the neighboring area of the current block and the values of the second color component samples in the neighboring area of the current block, to determine the filtered neighboring sample values of the first color component of the current block and the filtered neighboring sample values of the second color component of the current block.
In some embodiments, the first filtering unit 3002 is further configured to: perform a third filtering process on the values of the second color component samples in the neighboring area of the current block, to obtain filtered sample values of a second color component in the neighboring area of the current block; and determine the target information of the current block according to the filtered sample values of the second color component in the neighboring area of the current block.
In some embodiments, a number of filtered sample values of the second color component in the neighboring area of the current block is equal to K, K indicates a number of the values of the first color component samples in the neighboring area of the current block, and K is a positive integer.
In some embodiments, the third filtering process is an upsampling filtering process.
In some embodiments, the first filtering unit 3002 is further configured to perform the third filtering process on the values of the second color component samples in the neighboring area of the current block based on color format information, to obtain the filtered sample values of the second color component in the neighboring area of the current block.
In some embodiments, the first filtering unit 3002 is further configured to: if the color format information indicates 4:2:0 sampling, perform upsampling filtering on the values of the second color component samples in the neighboring area of the current block, an upsampling rate is a positive integer multiple of 2.
In some embodiments, the first filtering unit 3002 is further configured to: compare K with a preset number; perform a fourth filtering process on the values of the first color component samples in the neighboring area of the current block and the filtered sample values of the second color component in the neighboring area of the current block according to a comparison result between K and the preset number, to determine filtered neighboring sample values of a first color component of the current block and filtered neighboring sample values of the second color component of the current block; and determine the target information of the current block according to the filtered neighboring sample values of the first color component of the current block and the filtered neighboring sample values of the second color component of the current block.
In some embodiments, the first filtering unit 3002 is further configured to: if K is greater than the preset number, perform a first sub-filtering process on the values of the first color component samples in the neighboring area of the current block and the filtered sample values of the second color component in the neighboring area of the current block, to determine the filtered neighboring sample values of the first color component of the current block and the filtered neighboring sample values of the second color component of the current block; and if K is less than the preset number, perform a second sub-filtering process on the values of the first color component samples in the neighboring area of the current block and the filtered sample values of the second color component in the neighboring area of the current block, to determine the filtered neighboring sample values of the first color component of the current block and the filtered neighboring sample values of the second color component of the current block.
In some embodiments, the first filtering unit 3002 is further configured to: determine a number of the values of the first color component samples in the neighboring area of the current block as a first number; perform a fifth filtering process on the values of the first color component samples in the neighboring area of the current block according to a comparison result between the first number and a preset number, to determine filtered neighboring sample values of a first color component of the current block; and determine the target information of the current block according to the filtered neighboring sample values of the first color component of the current block.
In some embodiments, the first filtering unit 3002 is further configured to: if the first number is greater than the preset number, perform a first sub-filtering process on the values of the first color component samples in the neighboring area of the current block, to determine the filtered neighboring sample values of the first color component of the current block; and if the first number is less than the preset number, perform a second sub-filtering process on the values of the first color component samples in the neighboring area of the current block, to determine the filtered neighboring sample values of the first color component of the current block.
In some embodiments, the first filtering unit 3002 is further configured to: determine a number of the values of the second color component samples in the neighboring area of the current block as a second number; perform a sixth filtering process on the values of the second color component samples in the neighboring area of the current block according to a comparison result between the second number and a preset number, to determine filtered neighboring sample values of the second color component of the current block; and determine the target information of the current block according to the filtered neighboring sample values of the second color component of the current block.
In some embodiments, the first filtering unit 3002 is further configured to: if the second number is greater than the preset number, perform a first sub-filtering process on the values of the second color component samples in the neighboring area of the current block, to determine the filtered neighboring sample values of the second color component of the current block; and if the second number is less than the preset number, perform a second sub-filtering process on the values of the second color component samples in the neighboring area of the current block, to determine the filtered neighboring sample values of the second color component of the current block.
In some embodiments, the first filtering unit 3002 is further configured to set the reference sample values of the second color component in the target information as the filtered neighboring sample values of the second color component of the current block.
In some embodiments, the first sub-filtering process is a downsampling filtering process.
In some embodiments, the first filtering unit 3002 is further configured for the first sub-filtering process including at least one of: performing a sub-filtering process by using a fixed-interval position selection mode; or performing the sub-filtering process by using a continuous position selection mode.
In some embodiments, the second sub-filtering process is an upsampling filtering process.
In some embodiments, the first filtering unit 3002 is further configured for the second sub-filtering process including at least one of: performing a sub-filtering process by using a fixed-interval position interpolation mode.
In some embodiments, the first filtering unit 3002 is further configured to: perform a seventh filtering process on the reconstructed values of the first reference color component samples in the current block, to determine filtered sample values of the first reference color component samples in the current block; and determine the target information of the current block according to the filtered sample values of the first reference color component samples in the current block.
In some embodiments, the first filtering unit 3002 is further configured to: determine a first width and a first height according to the reconstructed values of the first reference color component samples in the current block; if the first width is greater than a width of the prediction block, or the first height is greater than a height of the prediction block, perform a third sub-filtering process on the reconstructed values of the first reference color component samples in the current block, to determine the filtered sample values of the first reference color component samples in the current block; and if the first width is less than the width of the prediction block, or the first height is less than the height of the prediction block, perform a fourth sub-filtering process on the reconstructed values of the first reference color component samples in the current block, to determine the filtered sample values of the first reference color component samples in the current block.
In some embodiments, the third sub-filtering process is a downsampling filtering process.
In some embodiments, the first filtering unit 3002 is further configured for the third sub-filtering process including at least one of: performing the downsampling filtering process in a horizontal direction on the reconstructed values of the first reference color component samples in the current block; performing the downsampling filtering process in a vertical direction on the reconstructed values of the first reference color component samples in the current block; performing the downsampling filtering process in the horizontal direction and then in the vertical direction on the reconstructed values of the first reference color component samples in the current block; or performing the downsampling filtering process in the vertical direction and then in the horizontal direction on the reconstructed values of the first reference color component samples in the current block.
In some embodiments, the fourth sub-filtering process is an upsampling filtering process.
In some embodiments, the first filtering unit 3002 is further configured for the fourth sub-filtering process including at least one of: performing the upsampling filtering process in a horizontal direction on the reconstructed values of the first reference color component samples in the current block; performing the upsampling filtering process in a vertical direction on the reconstructed values of the first reference color component samples in the current block; performing the upsampling filtering process in the horizontal direction and then in the vertical direction on the reconstructed values of the first reference color component samples in the current block; or performing the upsampling filtering process in the vertical direction and then in the horizontal direction on the reconstructed values of the first reference color component samples in the current block.
In some embodiments, the first filtering unit 3002 is further configured to set each of the reference sample values of the first color component in the target information as an absolute value of a difference between a value of a respective one of the first color component samples in the neighboring area of the current block and a reconstructed value of a respective one of the first reference color component samples in the current block.
In some embodiments, the first filtering unit 3002 is further configured to set each of the reference sample values of the first color component in the target information as an absolute value of a difference between a respective one of the filtered neighboring sample values of the first color component of the current block and a filtered sample value of a respective one of the first reference color component samples in the current block.
In some embodiments, the first determination unit 3001 is further configured to: determine a respective value corresponding to each of the reference sample values of the first color component under a preset mapping relationship; and set the respective one of the weighting coefficients to be equal to the respective value.
In some embodiments, the first determination unit 3001 is further configured to: determine a first factor; determine a respective first product value according to the first factor and each of the reference sample values of the first color component; and determine a value corresponding to the respective first product value under the preset mapping relationship.
In some embodiments, the first factor is a preset constant value.
In some embodiments, the first determination unit 3001 is further configured to determine a value of the first factor according to size parameters of the current block, the size parameters of the current block include at least one of a width of the current block or a height of the current block.
In some embodiments, the preset mapping relationship is a Softmax function.
In some embodiments, the preset mapping relationship is a weighting function having an inverse ratio relationship with the reference sample values of the first color component.
In some embodiments, the first prediction unit 3003 is further configured to: determine a respective weighted value between each of the reference sample values of the second color component and a weighting coefficient corresponding to the reference sample value; and set a predicted value of a respective one of second color component samples in the prediction block to be equal to a sum of N weighted values, N indicates a number of the reference sample values of the second color component, and N is a positive integer.
In some embodiments, the first prediction unit 3003 is further configured to perform a correction operation on the predicted value of the respective one of the second color component samples in the prediction block, to determine the prediction block of the second color component of the current block.
In some embodiments, the first prediction unit 3003 is further configured to perform a filtering enhancement process on the prediction block, and use the processed prediction block as the prediction block of the second color component of the current block.
In some embodiments, the first prediction unit 3003 is further configured to: determine a compensation value of a second color component of the prediction block according to reference sample values in a neighboring area of the current block; and perform a correction process on a predicted value of a respective one of second color component samples in the prediction block according to the compensation value, to determine the prediction block of the second color component of the current block.
In some embodiments, the first prediction unit 3003 is further configured to: perform a prediction process on a respective one of second color component samples in the prediction block according to at least one prediction mode, to determine at least one initial predicted value of the respective one of the second color component samples in the prediction block; and perform a weighted fusion process according to the at least one initial predicted value and a predicted value of the respective one of the second color component samples in the prediction block, to determine the prediction block of the second color component of the current block.
In some embodiments, the first determination unit 3001 is further configured to: determine predicted values of the second color component samples of the current block according to the prediction block; and for each of the second color component samples of the current block, determine a predicted difference value of the second color component sample according to an original value of the second color component sample and a predicted value of the second color component sample.
In some embodiments, with reference to
It may be understood that in the embodiment of the disclosure, the “unit” may be part of a circuit, part of a processor, part of a program or software, or the like, and of course, the “unit” may also be a module, or may be non-modular. Furthermore, components in the embodiment may be integrated into a processing unit, or each unit may physically exist alone, or two or more units may be integrated into a unit. The above integrated unit may be implemented in form of hardware, or may be implemented in form of software function modules.
If the integrated unit is implemented in form of software function modules and is not sold or used as an independent product, the integrated unit may be stored in a computer-readable storage medium. Based on such understanding, the technical solution of the embodiment substantially or parts making contributions to the related art, or all or part of the technical solution may be embodied in form of a software product, and the computer software product is stored in a storage medium, and includes several instructions to enable a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor to execute all or part of operations of the method described in the embodiment. The foregoing storage medium includes various media capable of storing program codes such as a U disk, a mobile hard disk, a Read Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk, etc.
Therefore, an embodiment of the disclosure provides a computer-readable storage medium, applied to the apparatus for encoding 300. The computer-readable storage medium stores a computer program, and the computer program implements the method of any one of the foregoing embodiments when it is executed by a first processor.
Based on composition of the above apparatus for encoding 300 and the computer-readable storage medium, with reference to
The first communication interface 3101 is configured to receive and send signals in a process of receiving/sending information from/to other external network elements.
The first memory 3102 is configured to store a computer program executable on the first processor 3103.
The first processor 3103 is configured to: when it executes the computer program, execute operations of: determining reference information of a current block; performing a filtering process on partial information in the reference information of the current block, to determine target information of the current block; determining a respective one of weighting coefficients according to each of reference sample values of a first color component in the target information; determining a prediction block of a second color component of the current block according to the weighting coefficients and reference sample values of a second color component in the target information; and determining predicted difference values of second color component samples of the current block according to the prediction block.
It may be understood that the first memory 3102 in the embodiment of the disclosure may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. The non-volatile memory may be a ROM, a Programmable ROM (PROM), an Erasable PROM (EPROM), an Electrically EPROM (EEPROM), or a flash memory. The volatile memory may be a RAM, and used as an external cache. By way of exemplary rather than limiting descriptions, many forms of RAMs are available, such as a Static RAM (SRAM), a Dynamic RAM (DRAM), a Synchronous DRAM (SDRAM), a Double Data Rate SDRAM (DDRSDRAM), an Enhanced SDRAM (ESDRAM), a Synchlink DRAM (SLDRAM), and a Direct Rambus RAM (DRRAM). The first memory 3102 of the system and method described in the disclosure is intended to include, but is not limited to these and any other suitable types of memories.
The first processor 3103 may be an integrated circuit chip with signal processing capabilities. During implementation, each operation of the above method may be completed by an integrated logic circuit in form of hardware or instructions in form of software in the first processor 3103. The above first processor 3103 may be a general-purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other programmable logic devices, a discrete gate or a transistor logic device, or a discrete hardware component. Each method, operation and logical block diagram disclosed in the embodiment of the disclosure may be implemented or executed. The general-purpose processor may be a microprocessor, or the processor may be any conventional processor, etc. Operations of the method disclosed in combination with the embodiment of the disclosure may be directly embodied as being executed and completed by a hardware decoding processor, or executed and completed by a combination of hardware in the decoding processor and a software module. The software module may be located in a mature storage medium in this field such as a random memory, a flash memory, a ROM, a PROM or an electrically erasable programmable memory, a register, etc. The storage medium is located in the first memory 3102, the first processor 3103 reads information in the first memory 3102 and completes operations of the above method in combination with hardware thereof.
It may be understood that these embodiments described in the disclosure may be implemented with hardware, software, firmware, middleware, microcode, or a combination thereof. With respect to implementation with hardware, the processing unit may be implemented in one or more ASICs, DSPs, DSP Devices (DSPDs), Programmable Logic Devices (PLDs), FPGAs, general-purpose processors, controllers, microcontrollers, microprocessors, other electronic units configured to perform functions described in the disclosure, or a combination thereof. With respect to implementation with software, technologies described in the disclosure may be implemented by modules (such as procedures, functions, etc.) performing the functions described in the disclosure. Software codes may be stored in a memory and executed by a processor. The memory may be implemented in the processor or out of the processor.
Optionally, as another embodiment, the first processor 3103 is further configured to perform the method of any one of the foregoing embodiments when it executes the computer program.
The embodiment provides a device for encoding, which may further include the apparatus for encoding 300 described in the foregoing embodiment. With respect to the device for encoding, characteristics of input color format information are fully considered, to improve accuracy of the reference information of the neighboring area; spatial correlation is fully utilized, to perform upsampling, downsampling, size enlargement, size reduction, or other filtering processes on the reference information of the neighboring area and the reconstructed luma information of the current block, which not only improves accuracy of the chroma prediction, saves bitrates, but also improves encoding and decoding performance.
Based on an inventive concept the same as the foregoing embodiments, with reference to
The second determination unit 3201 is configured to determine reference information of a current block.
The second filtering unit 3202 is configured to perform a filtering process on partial information in the reference information of the current block, to determine target information of the current block.
The second determination unit 3201 is further configured to determine a respective one of weighting coefficients according to each of reference sample values of a first color component in the target information.
The second prediction unit 3203 is configured to determine a prediction block of a second color component of the current block according to the weighting coefficients and reference sample values of a second color component in the target information.
The second determination unit 3201 is further configured to determine reconstructed values of second color component samples of the current block according to the prediction block.
In some embodiments, the prediction block includes predicted values of at least a part of the second color component samples in the current block.
In some embodiments, the second determination unit 3201 is further configured to determine the reference information of the current block according to values of first color component samples in a neighboring area of the current block, values of second color component samples in the neighboring area of the current block, and reconstructed values of first reference color component samples in the current block.
In some embodiments, the neighboring area of the current block may include at least one of an upper neighboring area, an upper right neighboring area, a left neighboring area, or a lower left neighboring area.
In some embodiments, the second filtering unit 3202 is further configured to: perform a first filtering process on the values of the first color component samples in the neighboring area of the current block, to obtain filtered sample values of a first color component in the neighboring area of the current block; and determine the target information of the current block according to the filtered sample values of the first color component in the neighboring area of the current block.
In some embodiments, a number of filtered sample values of the first color component in the neighboring area of the current block is equal to L, L indicates a number of the values of the second color component samples in the neighboring area of the current block, and L is a positive integer.
In some embodiments, the first filtering process is a downsampling filtering process.
In some embodiments, the second filtering unit 3202 is further configured to perform the first filtering process on the values of the first color component samples in the neighboring area of the current block based on color format information, to obtain the filtered sample values of the first color component in the neighboring area of the current block.
In some embodiments, the second filtering unit 3202 is further configured to: if the color format information indicates 4:2:0 sampling, perform downsampling filtering on the values of the first color component samples in the neighboring area of the current block, a downsampling rate is a reciprocal of a positive integer multiple of 2.
In some embodiments, the second filtering unit 3202 is further configured to: compare L with a preset number; perform a second filtering process on the filtered sample values of the first color component in the neighboring area of the current block and the values of the second color component samples in the neighboring area of the current block according to a comparison result between L and the preset number, to determine filtered neighboring sample values of a first color component of the current block and filtered neighboring sample values of the second color component of the current block; and determine the target information of the current block according to the filtered neighboring sample values of the first color component of the current block and the filtered neighboring sample values of the second color component of the current block.
In some embodiments, the second filtering unit 3202 is further configured to: if L is greater than the preset number, perform a first sub-filtering process on the filtered sample values of the first color component in the neighboring area of the current block and the values of the second color component samples in the neighboring area of the current block, to determine the filtered neighboring sample values of the first color component of the current block and the filtered neighboring sample values of the second color component of the current block; and if L is less than the preset number, perform a second sub-filtering process on the filtered sample values of the first color component in the neighboring area of the current block and the values of the second color component samples in the neighboring area of the current block, to determine the filtered neighboring sample values of the first color component of the current block and the filtered neighboring sample values of the second color component of the current block.
In some embodiments, the second filtering unit 3202 is further configured to: perform a third filtering process on the values of the second color component samples in the neighboring area of the current block, to obtain filtered sample values of a second color component in the neighboring area of the current block; and determine the target information of the current block according to the filtered sample values of the second color component in the neighboring area of the current block.
In some embodiments, a number of filtered sample values of the second color component in the neighboring area of the current block is equal to K, K indicates a number of the values of the first color component samples in the neighboring area of the current block, and K is a positive integer.
In some embodiments, the third filtering process is an upsampling filtering process.
In some embodiments, the second filtering unit 3202 is further configured to perform the third filtering process on the values of the second color component samples in the neighboring area of the current block based on color format information, to obtain the filtered sample values of the second color component in the neighboring area of the current block.
In some embodiments, the second filtering unit 3202 is further configured to: if the color format information indicates 4:2:0 sampling, perform upsampling filtering on the values of the second color component samples in the neighboring area of the current block, an upsampling rate is a positive integer multiple of 2.
In some embodiments, the second filtering unit 3202 is further configured to: compare K with a preset number; perform a fourth filtering process on the values of the first color component samples in the neighboring area of the current block and the filtered sample values of the second color component in the neighboring area of the current block according to a comparison result between K and the preset number, to determine filtered neighboring sample values of a first color component of the current block and filtered neighboring sample values of the second color component of the current block; and determine the target information of the current block according to the filtered neighboring sample values of the first color component of the current block and the filtered neighboring sample values of the second color component of the current block.
In some embodiments, the second filtering unit 3202 is further configured to: if K is greater than the preset number, perform a first sub-filtering process on the values of the first color component samples in the neighboring area of the current block and the filtered sample values of the second color component in the neighboring area of the current block, to determine the filtered neighboring sample values of the first color component of the current block and the filtered neighboring sample values of the second color component of the current block; and if K is less than the preset number, perform a second sub-filtering process on the values of the first color component samples in the neighboring area of the current block and the filtered sample values of the second color component in the neighboring area of the current block, to determine the filtered neighboring sample values of the first color component of the current block and the filtered neighboring sample values of the second color component of the current block.
In some embodiments, the second filtering unit 3202 is further configured to: determine a number of the values of the first color component samples in the neighboring area of the current block as a first number; perform a fifth filtering process on the values of the first color component samples in the neighboring area of the current block according to a comparison result between the first number and a preset number, to determine filtered neighboring sample values of a first color component of the current block; and determine the target information of the current block according to the filtered neighboring sample values of the first color component of the current block.
In some embodiments, the second filtering unit 3202 is further configured to: if the first number is greater than the preset number, perform a first sub-filtering process on the values of the first color component samples in the neighboring area of the current block, to determine the filtered neighboring sample values of the first color component of the current block; and if the first number is less than the preset number, perform a second sub-filtering process on the values of the first color component samples in the neighboring area of the current block, to determine the filtered neighboring sample values of the first color component of the current block.
In some embodiments, the second filtering unit 3202 is further configured to: determine a number of the values of the second color component samples in the neighboring area of the current block as a second number; perform a sixth filtering process on the values of the second color component samples in the neighboring area of the current block according to a comparison result between the second number and a preset number, to determine filtered neighboring sample values of the second color component of the current block; and determine the target information of the current block according to the filtered neighboring sample values of the second color component of the current block.
In some embodiments, the second filtering unit 3202 is further configured to: if the second number is greater than the preset number, perform a first sub-filtering process on the values of the second color component samples in the neighboring area of the current block, to determine the filtered neighboring sample values of the second color component of the current block; and if the second number is less than the preset number, perform a second sub-filtering process on the values of the second color component samples in the neighboring area of the current block, to determine the filtered neighboring sample values of the second color component of the current block.
In some embodiments, the second filtering unit 3202 is further configured to set the reference sample values of the second color component in the target information as the filtered neighboring sample values of the second color component of the current block.
In some embodiments, the first sub-filtering process is a downsampling filtering process.
In some embodiments, the second filtering unit 3202 is further configured for the first sub-filtering process including at least one of: performing a sub-filtering process by using a fixed-interval position selection mode; or performing the sub-filtering process by using a continuous position selection mode.
In some embodiments, the second sub-filtering process is an upsampling filtering process.
In some embodiments, the second filtering unit 3202 is further configured for the second sub-filtering process including at least one of: performing a sub-filtering process by using a fixed-interval position interpolation mode.
In some embodiments, the second filtering unit 3202 is further configured to: perform a seventh filtering process on the reconstructed values of the first reference color component samples in the current block, to determine filtered sample values of the first reference color component samples in the current block; and determine the target information of the current block according to the filtered sample values of the first reference color component samples in the current block.
In some embodiments, the second filtering unit 3202 is further configured to: determine a first width and a first height according to the reconstructed values of the first reference color component samples in the current block; if the first width is greater than a width of the prediction block, or the first height is greater than a height of the prediction block, perform a third sub-filtering process on the reconstructed values of the first reference color component samples in the current block, to determine the filtered sample values of the first reference color component samples in the current block; and if the first width is less than the width of the prediction block, or the first height is less than the height of the prediction block, perform a fourth sub-filtering process on the reconstructed values of the first reference color component samples in the current block, to determine the filtered sample values of the first reference color component samples in the current block.
In some embodiments, the third sub-filtering process is a downsampling filtering process.
In some embodiments, the second filtering unit 3202 is further configured for the third sub-filtering process including at least one of: performing the downsampling filtering process in a horizontal direction on the reconstructed values of the first reference color component samples in the current block; performing the downsampling filtering process in a vertical direction on the reconstructed values of the first reference color component samples in the current block; performing the downsampling filtering process in the horizontal direction and then in the vertical direction on the reconstructed values of the first reference color component samples in the current block; or performing the downsampling filtering process in the vertical direction and then in the horizontal direction on the reconstructed values of the first reference color component samples in the current block.
In some embodiments, the fourth sub-filtering process is an upsampling filtering process.
In some embodiments, the second filtering unit 3202 is further configured for the fourth sub-filtering process including at least one of: performing the upsampling filtering process in a horizontal direction on the reconstructed values of the first reference color component samples in the current block; performing the upsampling filtering process in a vertical direction on the reconstructed values of the first reference color component samples in the current block; performing the upsampling filtering process in the horizontal direction and then in the vertical direction on the reconstructed values of the first reference color component samples in the current block; or performing the upsampling filtering process in the vertical direction and then in the horizontal direction on the reconstructed values of the first reference color component samples in the current block.
In some embodiments, the second filtering unit 3202 is further configured to set each of the reference sample values of the first color component in the target information as an absolute value of a difference between a value of a respective one of the first color component samples in the neighboring area of the current block and a reconstructed value of a respective one of the first reference color component samples in the current block.
In some embodiments, the second filtering unit 3202 is further configured to set each of the reference sample values of the first color component in the target information as an absolute value of a difference between a respective one of the filtered neighboring sample values of the first color component of the current block and a filtered sample value of a respective one of the first reference color component samples in the current block.
In some embodiments, the second determination unit 3201 is further configured to: determine a respective value corresponding to each of the reference sample values of the first color component under a preset mapping relationship; and set the respective one of the weighting coefficients to be equal to the respective value.
In some embodiments, the second determination unit 3201 is further configured to: determine a first factor; determine a respective first product value according to the first factor and each of the reference sample values of the first color component; and determine a value corresponding to the respective first product value under the preset mapping relationship.
In some embodiments, the first factor is a preset constant value.
In some embodiments, the second determination unit 3201 is further configured to determine a value of the first factor according to size parameters of the current block, the size parameters of the current block include at least one of a width of the current block or a height of the current block.
In some embodiments, the preset mapping relationship is a Softmax function.
In some embodiments, the preset mapping relationship is a weighting function having an inverse ratio relationship with the reference sample values of the first color component.
In some embodiments, the second prediction unit 3203 is further configured to: determine a respective weighted value between each of the reference sample values of the second color component and a weighting coefficient corresponding to the reference sample value; and set a predicted value of a respective one of second color component samples in the prediction block to be equal to a sum of N weighted values, N indicates a number of the reference sample values of the second color component, and N is a positive integer.
In some embodiments, the second prediction unit 3203 is further configured to perform a correction operation on the predicted value of the respective one of the second color component samples in the prediction block, to determine the prediction block of the second color component of the current block.
In some embodiments, the second prediction unit 3203 is further configured to perform a filtering enhancement process on the prediction block, and use the processed prediction block as the prediction block of the second color component of the current block.
In some embodiments, the second prediction unit 3203 is further configured to: determine a compensation value of a second color component of the prediction block according to reference sample values in a neighboring area of the current block; and perform a correction process on a predicted value of a respective one of second color component samples in the prediction block according to the compensation value, to determine the prediction block of the second color component of the current block.
In some embodiments, the second prediction unit 3203 is further configured to: perform a prediction process on a respective one of second color component samples in the prediction block according to at least one prediction mode, to determine at least one initial predicted value of the respective one of the second color component samples in the prediction block; and perform a weighted fusion process according to the at least one initial predicted value and a predicted value of the respective one of the second color component samples in the prediction block, to determine the prediction block of the second color component of the current block.
In some embodiments, the second determination unit 3201 is further configured to: for each of the second color component samples of the current block, determine a predicted difference value of the second color component sample; determine a predicted value of the second color component sample according to the prediction block; and determine a reconstructed value of the second color component sample according to the predicted difference value of the second color component sample and the predicted value of the second color component sample.
In some embodiments, with reference to
It may be understood that in the embodiment of the disclosure, the “unit” may be part of a circuit, part of a processor, part of a program or software, or the like, and of course, the “unit” may also be a module, or may be non-modular. Furthermore, components in the embodiment may be integrated into a processing unit, or each unit may physically exist alone, or two or more units may be integrated into a unit. The above integrated unit may be implemented in form of hardware, or may be implemented in form of software function modules.
If the integrated unit is implemented in form of software function modules and is not sold or used as an independent product, the integrated unit may be stored in a computer-readable storage medium. Based on such understanding, the embodiment provides a computer-readable storage medium, applied to the apparatus for decoding 320. The computer-readable storage medium stores a computer program, and the computer program implements the method of any one of the foregoing embodiments when it is executed by a second processor.
Based on composition of the above apparatus for decoding 320 and the computer-readable storage medium, with reference to
The second communication interface 3301 is configured to receive and send signals in a process of receiving/sending information from/to other external network elements.
The second memory 3302 is configured to store a computer program executable on the second processor 3303.
The second processor 3303 is configured to: when it executes the computer program, execute operations of: determining reference information of a current block; performing a filtering process on partial information in the reference information of the current block, to determine target information of the current block; determining a respective one of weighting coefficients according to each of reference sample values of a first color component in the target information; determining a prediction block of a second color component of the current block according to the weighting coefficients and reference sample values of a second color component in the target information; and determining reconstructed values of second color component samples of the current block according to the prediction block.
Optionally, as another embodiment, the second processor 3303 is further configured to perform the method of any one of the foregoing embodiments when it executes the computer program.
It may be understood that hardware functions of the second memory 3302 are similar to those of the first memory 3102, and hardware functions of the second processor 3303 are similar to those of the first processor 3103, which are not elaborated here.
The embodiment provides a device for decoding, which may further include the apparatus for decoding 320 described in the foregoing embodiment. With respect to the device for decoding, characteristics of input color format information are fully considered, to improve accuracy of the reference information of the neighboring area; spatial correlation is fully utilized, to perform upsampling, downsampling, size enlargement, size reduction, or other filtering processes on the reference information of the neighboring area and the reconstructed luma information of the current block, which not only improves accuracy of the chroma prediction, saves bitrates, but also improves encoding and decoding performance.
In yet another embodiment of the disclosure, with reference to
In the embodiment of the disclosure, in the system for encoding and decoding 340, no matter with respect to the encoder 3401 or the decoder 3402, characteristics of input color format information may be fully considered, to improve accuracy of the reference information of the neighboring area; spatial correlation is fully utilized, to perform upsampling, downsampling, size enlargement, size reduction, or other filtering processes on the reference information of the neighboring area and the reconstructed luma information of the current block, which not only improves accuracy of the chroma prediction, saves bitrates, but also improves encoding and decoding performance.
The embodiments of the disclosure provide a method and apparatus for encoding, a method and apparatus for decoding, a device for encoding, a device for decoding, and a storage medium. No matter at an encoding side or a decoding side, reference information of a current block is determined; a filtering process is performed on partial information in the reference information of the current block, to determine target information of the current block; a respective one of weighting coefficients is determined according to each of reference sample values of a first color component in the target information; a prediction block of a second color component of the current block is determined according to the weighting coefficients and reference sample values of a second color component in the target information. In this way, at the encoding side, predicted difference values of second color component samples of the current block may be determined according to the prediction block, so that at the decoding side, reconstructed values of the second color component samples of the current block may be determined according to the prediction block. Therefore, with respect to color component information in the neighboring area of the current block and color component information in the current block, accuracy of these reference information may be improved since characteristics of color format information are fully considered; and upsampling, downsampling or other filtering processes are performed on these reference information, so that continuity of spatial correlation thereof may be enhanced to a certain extent, or some information with weak spatial correlation may be removed, chroma prediction may be performed better by using the target information obtained after the filtering processes, thereby improving accuracy of the chroma prediction, saving bitrates, while improving encoding and decoding performance.
It should be noted that in the disclosure, terms “include”, “includes” or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or apparatus including a series of elements not only includes those elements, but also includes other elements which are not listed explicitly, or elements inherent to such process, method, article or apparatus. Without any further limitation, an element defined by a statement “includes a . . . ” does not exclude presence of additional identical elements in a process, method, article or apparatus including the element.
The above serial numbers of the embodiments of the disclosure are only intended for descriptions, and do not represent advantages or disadvantages of the embodiments.
The methods disclosed in several method embodiments provided in the disclosure may be arbitrarily combined without conflict, to obtain new method embodiments.
The features disclosed in several product embodiments provided in the disclosure may be arbitrarily combined without conflict, to obtain new product embodiments.
The features disclosed in several method or device embodiments provided in the disclosure may be arbitrarily combined without conflict, to obtain new method or device embodiments.
The above descriptions are only specific implementations of the disclosure, however, the scope of protection of the disclosure is not limited thereto. Variations or replacements easily conceived by any technician familiar with the technical field within the technical scope disclosed in the disclosure, should fall within the scope of protection of the disclosure. Therefore, the scope of protection of the disclosure should be subject to the scope of protection of the claims.
In the embodiments of the disclosure, no matter at the encoding side or the decoding side, reference information of a current block is determined; a filtering process is performed on partial information in the reference information of the current block, to determine target information of the current block; a respective one of weighting coefficients is determined according to each of reference sample values of a first color component in the target information; a prediction block of a second color component of the current block is determined according to the weighting coefficients and reference sample values of a second color component in the target information. In this way, at the encoding side, predicted difference values of second color component samples of the current block may be determined according to the prediction block, and the predicted difference values are written into a bitstream; so that at the decoding side, reconstructed values of the second color component samples of the current block may be determined according to the prediction block and predicted difference values obtained by decoding. Therefore, with respect to color component information in the neighboring area of the current block and color component information in the current block, accuracy of these reference information may be improved since characteristics of color format information are fully considered; and upsampling, downsampling or other filtering processes are performed on these reference information, so that continuity of spatial correlation thereof may be enhanced to a certain extent, or some information with weak spatial correlation may be removed, chroma prediction may be performed by using the target information obtained after the filtering processes, which may improve accuracy of the chroma prediction, save bitrates, while improve encoding and decoding performance.
This application is a continuation of International Application No. PCT/CN2022/086469 filed on Apr. 12, 2022, the disclosure of which is hereby incorporated by reference in its entirety.
Number | Date | Country | |
---|---|---|---|
Parent | PCT/CN2022/086469 | Apr 2022 | WO |
Child | 18909187 | US |