Embodiments of the disclosure relate to the field of video coding technology, and more particularly, to a coding method and apparatus, an encoding device, a decoding device, and a storage medium.
With increase in people's requirements on video display quality, new video application forms such as high definition video and ultra-high definition video emerge. Joint video expert team (JVET) of international standard organizations (international organization for standardization (ISO)/international electrotechnical commission (IEC) and international telecommunication union telecommunication standardization sector (ITU-T)) has proposed a next-generation video coding standard, namely H.266/versatile video coding (VVC).
A cross-colour-component prediction technology is applied in H.266/VVC. However, a deviation between a prediction value and an original value of a coding block that is calculated with the cross-colour-component prediction technology in H.266/VVC is large, which results in low prediction accuracy and quality degradation of a decoded video, thus degrading encoding performance.
In a first aspect, a decoding device is provided in embodiments of the disclosure. The decoding device includes a memory and a processor. The memory is configured to store computer programs executable by the processor. The first processor is configured to execute the computer programs to perform the following. A reference sample value for a first colour component of a current block is determined. A weighting factor is determined according to the reference sample value for the first colour component of the current block. A first prediction block for a second colour component of the current block is determined according to the weighting factor and a reference sample value for the second colour component of the current block. First filtering is performed on the first prediction block to determine a second prediction block for the second colour component of the current block, where the second prediction block comprises prediction values of all second-colour-component samples in the current block. A reconstructed value of the second-colour-component sample in the current block is determined according to the second prediction block.
In a second aspect, an encoding device is provided in embodiments of the disclosure. The encoding device includes a memory and a processor. The memory is configured to store computer programs executable by the processor. The first processor is configured to execute the computer programs to perform the following. A reference sample value for a first colour component of a current block is determined. A weighting factor is determined according to the reference sample value for the first colour component of the current block. A first prediction block for a second colour component of the current block is determined according to the weighting factor and a reference sample value for the second colour component of the current block. First filtering is performed on the first prediction block to determine a second prediction block for the second colour component of the current block, where the second prediction block comprises prediction values of all second-colour-component samples in the current block. A residual value of the second-colour-component sample in the current block is determined according to the second prediction block.
In a third aspect, a non-transitory computer readable storage medium storing a bitstream generated according to an encoding method is provided. The encoding method includes the following. A reference sample value for a first colour component of a current block is determined. A weighting factor is determined according to the reference sample value for the first colour component of the current block. A first prediction block for a second colour component of the current block is determined according to the weighting factor and a reference sample value for the second colour component of the current block. First filtering is performed on the first prediction block to determine a second prediction block for the second colour component of the current block, where the second prediction block comprises prediction values of all second-colour-component samples in the current block. A residual value of the second-colour-component sample in the current block is determined according to the second prediction block.
In order for more comprehensive understanding of the features and technical contents of embodiments of the disclosure, the implementation of embodiments of the disclosure will be described in detail below with reference to the accompanying drawings. The accompanying drawings are only intended for illustration rather than limiting embodiments of the disclosure.
Unless defined otherwise, all technology and terminology used herein have the same meaning as that commonly understood by those of skilled in the technical field of the disclosure. The terminology used herein is only for the purpose of describing embodiments of the disclosure rather than limiting the disclosure.
In the following elaborations, “some embodiments” refers to a sub-set of all possible embodiments, but it can be understood that “some embodiments” can be the same sub-set or different sub-sets of all possible embodiments, and can be combined with each other without conflict. It should also be noted that, the terms “first/second/third” in embodiments of the disclosure are merely intended for distinguishing similar objects, and do not mean a specific ordering of the objects. It can be understood that, the order or sequence of “first/second/third” can be changed when allowed, so that embodiments of the disclosure described herein can be implemented in an order other than that illustrated or described herein.
In a video picture, a first colour component, a second colour component, and a third colour component are usually used to represent a coding block (CB). The three colour components are a luma component, a blue chroma component, and a red chroma component respectively. Exemplarily, the luma component is usually represented by a symbol Y, the blue chroma component is usually represented by a symbol Cb or U, and the red chroma component is usually represented by a symbol Cr or V. In this way, the video picture can be expressed in a YCbCr format or a YUV format. In addition, the video picture can also be expressed in a red green blue (RGB) format, a luminance chrominance-green chrominance-orange (YCgCo) format, and the like, which is not limited in embodiments of the disclosure.
It can be understood that, in a current video picture or video coding process, a cross-component prediction technology mainly includes a cross-component linear model (CCLM) prediction mode and a multi-directional linear model (MDLM) prediction mode. No matter whether it is a model parameter derived according to the CCLM prediction mode or a model parameter derived according to the MDLM prediction mode, the prediction model corresponding thereto can be used to implement cross-colour-component prediction, for example, from the first colour component to the second colour component, from the second colour component to the first colour component, from the first colour component to the third colour component, from the third colour component to the first colour component, from the second colour component to the third colour component, or from the third colour component to the second colour component, etc.
Taking prediction from the first colour component to the second colour component as an example, assuming that the first colour component is a luma component and the second colour component is a chroma component, in order to reduce redundancy between the luma component and the chroma component, the CCLM prediction mode is used in versatile video coding (VVC), that is, a chroma prediction value (also known as predicted chroma value) is constructed according to a reconstructed luma value of the same coding block, such as PredC(i,j)=α·RecL(i,j)+β.
i, j represents a position coordinate of a sample to-be-predicted in a coding block, where i represents a horizontal direction, and j represents a vertical direction. PredC(i,j) represents a chroma prediction value corresponding to the sample to-be-predicted at the position coordinate (i,j) in the coding block, and RecL(i,j) represents a reconstructed luma (down-sampled) value corresponding to the sample to-be-predicted at the position coordinate (i,j) in the same coding block. In addition, a and #represent model parameters, and the model parameters can be derived according to a reference sample.
A neighbouring area of the coding block can include five parts: a left neighbouring area, a top neighbouring area, a bottom-left neighbouring area, a top-left neighbouring area, and a top-right neighbouring area. In H.266/VVC, there are three CCLM prediction modes, i. e. a neighbouring left and top intra-CCLM prediction mode (which can be represented by INTRA_LT_CCLM), a neighbouring left and bottom-left intra-CCLM prediction mode (which can be represented by INTRA_L_CCLM), and a neighbouring top and top-right intra-CCLM prediction mode (which can be represented by INTRA_T_CCLM). For each of the three prediction modes, a preset number (for example, four) of reference samples can be selected for derivation of the model parameters α and β, and the major difference between the three prediction modes lies in that selection areas corresponding to the reference sample for derivation of the model parameters α and β are different.
Specifically, for a coding block with a size of W×H corresponding to a chroma component, assuming that a top selection area corresponding to the reference sample is W′ and a left selection area corresponding to the reference sample is H′, then for the INTRA_LT_CCLM mode, the reference sample can be selected from the top neighbouring area and the left neighbouring area, i. e. W′=W and H′=H; for the INTRA_L_CCLM mode, the reference sample can be selected from a left neighbouring area and a bottom-left neighbouring area, i. e. H′=W+H and W′=0; for the INTRA_T_CCLM mode, the reference sample can be selected from a top neighbouring area and a top-right neighbouring area, i. e. W′=W+H and H′=0.
It should be noted that, in VVC test model (VTM), for the top-right neighbouring area, at most samples within the range W are stored, and for the bottom-left neighbouring area, at most samples within the range H are stored. Although the range of the selection area for the INTRA_L_CCLM mode or the INTRA_T_CCLM mode is defined as W+H, in practice, the selection area for the INTRA_L_CCLM mode is limited to H+H, and the selection area for the INTRA_T_CCLM mode is limited to W+W. In this way, for the INTRA_L_CCLM mode, the reference sample can be selected from the left neighbouring area and the bottom-left neighbouring area, where H′=min{W+H, H+H}; for the INTRA_T_CCLM mode, the reference sample can be selected from the top neighbouring area and the top-right neighbouring area, where W′=min{W+H, W+W}.
Referring to
In this way, on the basis of
After the preset number of reference samples are determined, at present, chroma prediction is performed according to a schematic flowchart of a model parameter derivation scheme illustrated in
S301, reference samples are determined from a selection area.
S302, the number of valid reference samples are determined.
S303, if the number of valid reference samples is 0, model parameter α is set to 0 and model parameter, β is set to a default value.
S304, a chroma prediction value is set to the default value.
S305, if the number of valid reference samples is four, two reference samples with greater luma component values and two reference samples with smaller luma component values are determined through comparisons.
S306, a mean point corresponding to the greater values and a mean point corresponding to the smaller values are calculated.
S307, the model parameters α and β are derived according to the two mean points.
S308, chroma prediction is performed by using a prediction model constructed with α and β.
It should be noted that, in VVC, the determination that the number of valid reference samples is 0 is made according to validity of the neighbouring area.
It should be further noted that, the prediction model is constructed based on the principle of “two points determine one straight line”, where the two points can be referred to as fitting points. In an existing technical solution, after four reference samples are determined, two reference samples with greater luma component values and two reference samples with smaller luma component values are determined through comparisons. Then a mean point (which can be represented by meanmax) is calculated according to the two reference samples with greater values, and another mean point (which can be represented by meanmin) is calculated according to the two reference samples with smaller values, so as to obtain the two mean points meanmax and meanmin. Then meanmax and meanmin are taken as two fitting points, so as to derive the model parameters (represented by α and β). The prediction model is constructed according to α and β, and chroma component prediction is implemented with the prediction model.
However, in the related art, for each coding block, a simple linear model PredC(i,j)=α·RecL(i,j)+β is used for chroma component prediction, and a sample at any position in the coding block is predicted with the same model parameters α and β. This can cause the following disadvantages. On one hand, for coding blocks with different content characteristics, a simple linear model is used for luma-to-chroma mapping so as to implement chroma prediction, but for some coding blocks, a luma-to-chroma mapping function cannot be fitted accurately with the simple linear model, and as a result, prediction effect for some coding blocks is not accurate enough. On the other hand, during prediction, the same model parameters α and β are used for samples at different positions in the coding block, and prediction accuracy at different positions in the coding block also has big difference. On the other hand, if the linear model established is not suitable, an inaccurate chroma prediction block obtained will be used as the final chroma prediction block directly, which will affect the subjective and objective quality of a reconstructed block. On the other hand, in CCLM technology, the prediction is implemented with the same linear mapping function for all samples in the coding block to obtain the chroma prediction value, however, the colour components in the same coding block are generally flat and the content characteristics are relatively similar, and in this case, if prediction is performed on all samples in the coding block, the prediction complexity will be increased and the prediction efficiency will be reduced. To summarize, in the existing CCLM technology, for some coding blocks, a deviation between a prediction value and an original value is large, which results in low prediction accuracy and quality degradation.
To this end, embodiments of the disclosure provide an encoding method. A reference sample value for a first colour component of a current block is determined. A weighting factor is determined according to the reference sample value for the first colour component of the current block. A first prediction block for a second colour component of the current block is determined according to the weighting factor and a reference sample value for the second colour component of the current block. First filtering is performed on the first prediction block to determine a second prediction block for the second colour component of the current block, where the second prediction block comprises prediction values of all second-colour-component samples in the current block. A residual value of the second-colour-component sample in the current block is determined according to the second prediction block.
Embodiments of the disclosure further provide a decoding method. A reference sample value for a first colour component of a current block is determined. A weighting factor is determined according to the reference sample value for the first colour component of the current block. A first prediction block for a second colour component of the current block is determined according to the weighting factor and a reference sample value for the second colour component of the current block. First filtering is performed on the first prediction block to determine a second prediction block for the second colour component of the current block, where the second prediction block comprises prediction values of all second-colour-component samples in the current block. A reconstructed value of the second-colour-component sample in the current block is determined according to the second prediction block.
In this way, the weighting factor can be calculated with aid of the reference sample neighbouring the current block and colour component information of the current block, correlation between the current block and neighbouring areas in terms of luma information is fully taken into consideration, and such correlation is used in chroma prediction of the current block, so as to improve accuracy of chroma prediction. Considering that human eyes have low sensitivity to chroma and in order to reduce the complexity in calculating the weighting factor, when the size of the first prediction block is less than the size of the current block, up-sampling filtering is performed on the first prediction block. In addition, considering that the prediction value of the first prediction block is unstable, filtering enhancement can also be performed, so as to further improve accuracy as well as subjective and objective quality of chroma prediction, save bit-rate, improve coding efficiency, and thus improve coding performance.
Embodiments of the disclosure will be described in detail below with reference to the accompanying drawings.
Referring to
Referring to
It should be noted that, the method in embodiments of the disclosure is mainly applied to the intra prediction unit 103 illustrated in
It should be further noted that, when applied to the intra prediction unit 103, the “current block” specifically refers to a coding block on which intra prediction is currently to be performed. When applied to the intra prediction unit 203, the “current block” specifically refers to a coding block on which intra prediction is currently to be performed.
In an embodiment of the disclosure, referring to
S501, a reference sample value for a first colour component of a current block is determined.
It should be noted that, the decoding method in embodiments of the disclosure can be applied to a decoding apparatus, or a decoding device (can also be referred to as a “decoder” for short) integrating the decoding apparatus. In addition, the decoding method in embodiments of the disclosure can specifically refer to an intra prediction method, and more specifically, to a weighted chroma prediction (WCP) based post-processing method.
In embodiments of the disclosure, a video picture can be partitioned into multiple coding blocks, and each coding block can include a first colour component, a second colour component, and a third colour component. The current block herein refers to a coding block on which intra prediction is currently to be performed in the video picture. In addition, assuming that a first colour component of the current block is to be predicted and the first colour component is a luma component, that is, a colour component to-be-predicted is a luma component, the current block can also be called a luma prediction block (also known as predicted luma block). Alternatively, assuming that a second colour component of the current block is to be predicted and the second colour component is a chroma component, that is, the colour component to-be-predicted is a chroma component, the current block can also be called a predicted chroma block.
It should be further noted that, in embodiments of the disclosure, reference information for the current block can include a value of a first-colour-component sample in a neighbouring area of the current block and a value of a second-colour-component sample in the neighbouring area of the current block, and these samples can be determined from decoded samples in the neighbouring area of the current block. In some embodiments, the neighbouring area of the current block can include at least one of: a top neighbouring area, a top-right neighbouring area, a left neighbouring area, or a bottom-left neighbouring area.
Here, the top neighbouring area and the top-right neighbouring area can be collectively regarded as a top area, and the left neighbouring area and the bottom-left neighbouring area can be collectively regarded as a left area. In addition, the neighbouring area can further include a top-left area, as illustrated in
It should be further noted that, in embodiments of the disclosure, the neighbouring area of the current block can be multiple rows or multiple columns neighbouring the current block. For example, the left area can include one or more columns, and the top area can include one or more rows, the number of rows or columns can be increased or decreased, which are not limited in embodiments of the disclosure.
In some embodiments, the reference sample value for the first colour component of the current block can be determined as follows. The reference sample value for the first colour component of the current block is determined according to a value of a first-colour-component sample in the neighbouring area of the current block.
It should be noted that, in embodiments of the disclosure, the reference sample for the current block can refer to a reference sample neighbouring the current block, and can also be referred to as a first-colour-component sample and a second-colour-component sample in the neighbouring area of the current block, which are referred to as “neighbouring sample” or “reference sample”. Here, “neighbouring” can be spatially neighbouring, but is not limited thereto. For example, “neighbouring” can also be temporally neighbouring or spatially and temporally neighbouring. Alternatively, the reference sample for the current block can also be a reference sample obtained through some processing on a spatially neighbouring reference sample, a temporally neighbouring reference sample, or a spatially and temporally neighbouring reference sample, etc., and embodiments of the disclosure are not limited in this regard.
It should be further noted that, in embodiments of the disclosure, the first colour component is a luma component, and the second colour component is a chroma component. In this case, the value of the first-colour-component sample in the neighbouring area of the current block refers to reference luma information corresponding to the reference sample for the current block, and a value of the second-colour-component sample in the neighbouring area of the current block refers to reference chroma information corresponding to the reference sample for the current block.
It should be further noted that, in embodiments of the disclosure, the value of the first-colour-component sample is determined from the neighbouring area of the current block. Here, the neighbouring area can include only the top neighbouring area, or can include only the left neighbouring area, or can include the top neighbouring area and the top-right neighbouring area, or can include the left neighbouring area and the bottom-left neighbouring area, or can include the top neighbouring area and the left neighbouring area, or can even include the top neighbouring area, the top-right neighbouring area, and the left neighbouring area, etc., which is not limited in embodiments of the disclosure.
It should be further noted that, in embodiments of the disclosure, the neighbouring area can also be determined according to a prediction mode for the current block. In an embodiment, if the prediction mode for the current block is a horizontal mode, the reference sample is determined from samples in the top neighbouring area and/or the top-right neighbouring area; if the prediction mode for the current block is a vertical mode, the reference sample is determined from samples in the left neighbouring area and/or the bottom-left neighbouring area.
Exemplarily, if the prediction mode for the current block is the horizontal mode, the neighbouring area for chroma component prediction can be only the top neighbouring area and/or the top-right neighbouring area. If the prediction mode for the current block is the vertical mode, the neighbouring area for chroma component prediction can be only the left neighbouring area and/or the bottom-left neighbouring area.
Further, in some embodiments, in terms of determining the value of the first-colour-component sample, the method can further include the following. The value of the first-colour-component sample is determined by selecting from first-colour-component samples in the neighbouring area.
It should be noted that, among the first-colour-component samples in the neighbouring area, there can be some unimportant samples (for example, these samples have poor correlation) or some abnormal samples. To ensure accuracy of prediction, these samples need to be removed, so as to obtain a value of a valid first-colour-component sample. That is, in embodiments of the disclosure, a first sample set is formed from the first-colour-component samples in the neighbouring area of the current block. In this case, the value of the first-colour-component sample can be determined by selecting from the first sample set.
In an embodiment, the value of the first-colour-component sample can be determined by selecting from the first-colour-component samples in the neighbouring area as follows. A sample position to-be-selected is determined according to a position and/or a colour component intensity of the first-colour-component sample in the neighbouring area. The value of the first-colour-component sample is determined from the neighbouring area according to the sample position to-be-selected.
It should be noted that, in embodiments of the disclosure, the colour component intensity can be represented by colour component information, for example, reference luma information and reference chroma information. Here, a greater value of the colour component information represents a higher colour component intensity. In this way, selection from the first-colour-component samples in the neighbouring area can be performed according to the sample position or according to the colour component intensity, so as to determine a valid first-colour-component sample from the sample thus selected, thereby determining the value of the first-colour-component sample.
In some embodiments, the reference sample value for the first colour component of the current block can be further determined as follows. Second filtering is performed on the value of the first-colour-component sample to obtain a filtered neighbouring sample value for the first colour component of the current block. The reference sample value for the first colour component of the current block is determined according to the filtered neighbouring sample value for the first colour component of the current block.
In embodiments of the disclosure, the number of filtered neighbouring sample values for the first colour component of the current block is less than the number of values of the first-colour-component samples.
In embodiments of the disclosure, the second filtering can be down-sampling filtering. The first colour component is a luma component. Here, down-sampling filtering can be performed on the reference luma information in such a manner that the spatial resolution of the filtered reference luma information is the same as the spatial resolution of the reference chroma information. Exemplarily, if the size of the current block is 2M×2N, and the amount of reference luma information is 2M+2N, then the amount of reference luma information can become M+N after down-sampling filtering.
In some embodiments, the reference sample value for the first colour component of the current block can be further determined as follows. The reference sample value for the first colour component of the current block is determined based on a reconstructed value of a first-reference-colour-component sample in the current block.
It should be noted that, in embodiments of the disclosure, the first reference colour component can be a luma component. In this case, the reconstructed value of the first-reference-colour-component sample in the current block is reconstructed luma information of the current block.
Further, in some embodiments, the reference sample value for the first colour component of the current block can be further determined as follows. Third filtering is performed on the reconstructed value of the first-reference-colour-component sample in the current block to obtain a filtered sample value of the first-reference-colour-component sample in the current block. The reference sample value for the first colour component of the current block is determined according to the filtered sample value of the first-reference-colour-component sample in the current block.
In embodiments of the disclosure, the number of filtered sample values of the first-reference-colour-component samples in the current block is greater than the number of reconstructed values of the first-reference-colour-component samples in the current block.
In embodiments of the disclosure, the third filtering can be down-sampling filtering. The first reference colour component is a luma component. Down-sampling filtering can be performed on the reconstructed luma information of the current block. For example, if the amount of reconstructed luma information of the current block is 2M×2N, then the amount of reconstructed luma information of the current block can become M×N after down-sampling filtering.
It should be noted that, in embodiments of the disclosure, with regard to the filtering of the reference information before weighted prediction, filtering can be performed only on the reference luma information, or can be performed only on the reconstructed luma information, or can be performed on both the reference luma information and the reconstructed luma information, which is not limited herein. Then, with regard to calculating a luma difference, the luma difference can be an absolute value of a difference between the reference luma information and the reconstructed luma information, or can be an absolute value of a difference between the reference luma information subject to filtering and the reconstructed luma information, or can be an absolute value of a difference between the reference luma information and the reconstructed luma information subject to filtering, or can even be an absolute value of a difference between the reference luma information subject to filtering and the reconstructed luma information subject to filtering.
It should be further noted that, in embodiments of the disclosure, the reference sample value for the first colour component of the current block can also be set to luma difference information. Therefore, in a possible implementation, the reference sample value for the first colour component of the current block is set to an absolute value of a difference between the value of the first-colour-component sample and the reconstructed value of the first-reference-colour-component sample.
In another possible implementation, the reference sample value for the first colour component of the current block is set to an absolute value of a difference between the filtered neighbouring sample value for the first colour component and the reconstructed value of the first-reference-colour-component sample.
In another possible implementation, the reference sample value for the first colour component of the current block is set to an absolute value of a difference between the filtered neighbouring sample value for the first colour component and the filtered sample value of the first-reference-colour-component sample.
In another possible implementation, the reference sample value for the first colour component of the current block is set to an absolute value of a difference between the value of the first-colour-component sample and the filtered sample value of the first-reference-colour-component sample.
That is, according to reference information of the current block, such as the reference luma information of the neighbouring area of the current block, the reconstructed luma information of the current block, filtering can be performed before weighted prediction. Specifically, down-sampling filtering can be performed on the reference luma information of the neighbouring area of the current block, or down-sampling filtering can be performed on the reconstructed luma information of the current block, or down-sampling filtering can be performed on both the reference luma information and the reconstructed luma information, or down-sampling filtering is performed on neither the reference luma information nor the reconstructed luma information. Then, the luma difference information can be determined according to different combinations of the above cases, and the luma difference information can be used as the reference sample value for the first colour component of the current block.
S502, a weighting factor is determined according to the reference sample value for the first colour component of the current block.
It should be noted that, in embodiments of the disclosure, the weighting factor can have determined according to the reference sample value for the first colour component of the current block as follows. A value corresponding to the reference sample value for the first colour component in a preset mapping is determined. The weighting factor is set to be equal to the value.
It can be understood that, in embodiments of the disclosure, the reference sample value for the first colour component can be the absolute value of the difference between the filtered neighbouring sample value for the first colour component of the current block and the filtered sample value of the first-reference-colour-component sample in the current block. The first reference colour component is the first colour component, and the first colour component is a colour component different from a second colour component to-be-predicted in embodiments of the disclosure.
Exemplarily, it is assumed that the first colour component is a chroma component and the second colour component is a luma component, and embodiments of the disclosure mainly aims at predicting a chroma component of a sample to-be-predicted in the current block. Firstly, at least one sample to-be-predicted in the current block is selected, and a chroma difference (represented by |ΔCk|) between reconstructed chrominance thereof and reference chrominance of the neighbouring area is calculated. Chroma differences of samples to-be-predicted at different positions relative to the neighbouring area are different. The position of the reference sample with the minimum chroma difference will vary according to the sample to-be-predicted in the current block. Generally, the chroma difference represents the degree of similarity between chrominance. A smaller |ΔCk|indicates higher similarity between chroma values, and the corresponding weighting factor (represented by wk) can be given a greater value; on the contrary, a greater |ΔCk|indicates lower similarity between chroma values, and wk can be given a smaller value. That is, wk and |ΔCk| are in approximately inverse proportion. In this way, the preset mapping can be established according to |ΔCk|, as illustrated below:
Here, taking formula (1) as an example, |ΔCk| represents the reference sample value for the first colour component, f(|ΔCk|) represents the value corresponding to the reference sample value for the first colour component in the preset mapping, and wk represents the weighting factor, that is, wk is set to be equal to f(|ΔCk|).
It should be further noted that, in embodiments of the disclosure, if the number of reference sample values for the second colour component is N, the number of weighting factors is N accordingly, where the sum of the N weighting factors is equal to 1, and each of the weighting factors is a value greater than or equal to 0 and less than or equal to 1, i. e. 0≤wk≤1. However, it should be noted that, “the sum of the N weighting factors is equal to 1” is only a theoretical concept, and in actual implementation of fixed-point, the absolute value of the weighting factor can be greater than 1.
It can be understood that, in the probability theory and related fields, a normalized exponential function, or referred to as a Softmax function, is a generalization of a logic function. It can “convert” an N-dimensional vector z of arbitrary real numbers into another N-dimensional vector σ(z), such that the range of each element is within (0, 1), and the sum of all the elements is 1. The Softmax function is often used as a nonlinear activation function for a multi-class classification neural network. The Softmax function is as follows:
However, although the Softmax function can satisfy conditional constraints of wk, its function value increases as the value of the vector element increases, which does not comply with the approximately inverse proportion between wk and |ΔCk|. Therefore, in order to adapt to the design of wk and meet requirements for nonlinearity of wk, the ƒ function of formula (1) can be implemented by a Softmax function with parameter γ, as illustrated in detail below:
In order to comply with the approximately inverse proportion between wk and |ΔCk|, γ can be defined as a negative number. That is, if the reference sample value of the first colour component is |ΔCk|, the mapping between |ΔCk| and wk can be expressed as:
According to formula (4), in some embodiments, the value corresponding to the reference sample value for the first colour component in the preset mapping can be determined as follows. A first factor is determined. A first product value is determined according to the first factor and the reference sample value for the first colour component. A value corresponding to the first product value in the preset mapping is determined.
It should be noted that, in embodiments of the disclosure, the first factor is a constant value less than zero. Taking the Softmax function as an example, in formula (4), γ represents the first factor, |ΔCk| represents the reference sample value of the first colour component, γ|ΔCk| represents the first product value, and wk represents the weighting factor, where k=1, 2, . . . , N.
In an embodiment, the first factor can be determined as follows. The first factor is a preset constant value.
It should be noted that, in this case, with regard to γ, a distribution of weighting factors for neighbouring chrominance can be adjusted according to relatively flat characteristics of chrominance, so as to determine a distribution of weighting factors that is suitable for chroma prediction of a natural picture. In order to determine parameter γ suitable for chroma prediction of a natural picture, a given set of γ is traversed, and whether γ is suitable or not is determined according to differences between predicted chrominance and original chrominance with respect to different γ. Exemplarily, γ can be −2ε, where ε∈{1, 0, −1, −2, −3}. It is found from experiments that in this set of γ, the optimal value of γ is −0.25. Therefore, in an embodiment, γ can be set to −0.25, but embodiments of the disclosure are not limited thereto.
In another embodiment, the first factor can be determined as follows. A value of the first factor can be determined according to a size parameter of the current block.
Further, in some embodiments, the method can further include the following. The value of the first factor is determined according to a preset mapping look-up table between the size parameter of the current block and the value of the first factor.
Here, the size parameter of the current block can include at least one of: a width of the current block, or a height of the current block.
It should be noted that, in embodiments of the disclosure, the value of the first factor can be set by means of classification. For example, the size parameter of the current block is classified into three categories, and the value of the first factor corresponding to each category is determined. In this case, in embodiments of the disclosure, the mapping look-up table between the size parameter of the current block and the value of the first factor can also be pre-stored, and then the value of the first factor can be determined according to the look-up table. Exemplarily, Table 1 shows a correspondence between the first factor and the size parameter of the current block provided in embodiments of the disclosure. It should be noted that, Table 1 is merely an exemplary look-up table, and is not intended for limitation.
In another embodiment, the first factor can be determined as follows. The value of the first factor is determined according to the number of reference samples for the current block.
Further, in some embodiments, the method can further include the following. The value of the first factor is determined according to a preset mapping look-up table between the number of reference samples for the current block and the value of the first factor.
It should be noted that, in embodiments of the disclosure, the number of reference samples can be classified into three categories, and the value of the first factor can also be set by means of classification. For example, the number of reference samples for the current block is classified into three categories, and the value of the first factor corresponding to each category is determined. In this case, in embodiments of the disclosure, the mapping look-up table between the number of reference samples for the current block and the value of the first factor can also be pre-stored, and then the value of the first factor can be determined according to the look-up table. Exemplarily, Table 2 shows a correspondence between the first factor and the number of reference samples for the current block provided in embodiments of the disclosure. It should be noted that, Table 2 is only an exemplary look-up table, and is not intended for limitation.
Further, for the first product value, the first product value can be determined according to the first factor and the reference sample value for the first colour component as follows. The first product value is set to be equal to a product of the first factor and the reference sample value for the first colour component. Alternatively, the first product value is set to be equal to a numerical value obtained by right-shifting the reference sample value for the first colour component, where the number of bits right shifted is equal to the first factor. Alternatively, the first product value is set to a value obtained by performing addition and bit shift on the reference sample value for the first colour component according to the first factor.
Exemplarily, assuming that the first factor is equal to 0.25, and the reference sample value for the first colour component is represented by Ref, then the first product value can be equal to 0.25×Ref, and 0.25×Ref can also be represented by Ref/4, that is, Ref>>2. In addition, in fixed-point calculation, a floating-point number can be converted into addition and shift operations. That is, there is no limitation on the manner for calculation of the first product value.
It can also be understood that, in embodiments of the disclosure, the first colour component can also be a luma component, and the second colour component is a chroma component. In this case, at least one sample to-be-predicted in the current block is selected, and a luma difference (represented by |ΔYk|) between reconstructed luminance thereof and reference luminance of the neighbouring area is calculated. A smaller |ΔYk| indicates higher similarity between luma values, and the corresponding weighting factor (represented by wk) can be given a greater value; on the contrary, a larger |ΔYk| indicates lower similarity between luma values, and wk can be given a smaller value. That is, when calculating the weighting factor, the reference sample value for the first colour component can also be |ΔYk|, and then the weighting factor can be calculated.
It should be noted that, when predicting the chroma component of the sample to-be-predicted in the current block, since a chroma component value of the sample to-be-predicted cannot be directly determined, a chroma difference |ΔCk| between the reference sample and the sample to-be-predicted cannot be directly obtained. However, there is strong correlation between components in a local area of the current block. In this case, |ΔCk| can be derived according to a luma difference |ΔYk| between the reference sample and the sample to-be-predicted. That is, |ΔCk|can be obtained according to a product of |ΔYk| and a second factor. In this way, the first product value is equal to the product of the first factor and |ΔYk|.
In other words, in embodiments of the disclosure, the reference sample value for the first colour component can be |ΔCk|, that is, an absolute value of the chroma difference. Alternatively, the reference sample value for the first colour component can be |ΔYk|, that is, an absolute value of the luma difference. Alternatively, the reference sample value for the first colour component can be |αΔYk|, that is, a product of the absolute value of the luma difference and a preset multiplier. Here, the preset multiplier is the second factor described in embodiments of the disclosure.
Further, for the second factor, in an embodiment, the method can include the following. The second factor is determined by performing least squares calculation on a first-colour-component value of the reference sample and a second-colour-component value of the reference sample.
That is, assuming that the number of reference samples is N, the first-colour-component value of the reference sample is the reference luma information for the current block, and the second-colour-component value of the reference sample is the reference chroma information for the current block, then least squares calculation can be performed on chroma component values and luma component values of the N reference samples, so as to obtain the second factor. Exemplarily, the least squares regression calculation is as follows:
Lk represents a luma component value of a kth reference sample. Ck represents a chroma component value of the kth reference sample. N represents the number of reference samples. α represents the second factor, which can be calculated by means of least squares regression. It should be noted that, the second factor can also be a fixed value or a value subject to fine adjustment on a fixed value, which is not specifically limited in embodiments of the disclosure.
In addition, for the preset mapping, the preset mapping can be a preset function relationship. In some embodiments, the preset mapping can be a Softmax function. The Softmax function is normalized exponential function. However, in embodiments of the disclosure, normalization may not be needed, and the value thereof is not limited to the range of [0, 1].
Exemplarily, the reference sample value for the first colour component is |ΔYk|, and then a weighting factor wk corresponding to the kth reference sample can be calculated according to formula (4), or can be replaced by the following formulas:
S represents a control parameter, and a relationship between S and the first factor (γ) is
Exemplarily, a value of S depends on the size parameter of the current block, where the size parameter of the current block includes the width and the height of the current block. In a possible implementation, if the minimum value between the width and the height is less than or equal to 4, S=8. If the minimum value between the width and the height is greater than 4 and less than or equal to 16, S=12. If the minimum value between the width and the height is greater than 16, S=16. In another possible implementation, if the minimum value between the width and the height is less than or equal to 4, S=7. If the minimum value between the width and the height is greater than 4 and less than or equal to 16, S=11. If the minimum value between the width and the height is greater than 16, S=15. Alternatively, the value of S depends on the number (R) of reference samples for the current block. In a possible implementation, if R<16, S=8. If 16≤R<32, S=12. If R≥16, S=16. Embodiments of the disclosure are not limited in this regard.
It should be further noted that, in addition to the Softmax function, in other embodiments, the preset mapping can be a weighting function that is in inverse proportion with the reference sample value for the first colour component.
Exemplarily, the reference sample value for the first colour component is |ΔYk|, and then the Softmax function of formula (4) can also be replaced by the following formulas:
Where k=1, 2, . . . N, and offset=1 or 2 or 0.5 or 0.25.
In this way, when the preset mapping is the preset function relationship, the preset mapping can be as illustrated in formula (4), or can be as illustrated in formula (6) or formula (7), or can be as illustrated in formula (8) or formula (9), or can even be another function model of the weighting factor that is constructed by fitting the tendency that higher similarity between the reference luma value of the reference sample and the reconstructed luma value of the sample to-be-predicted in the current block leads to higher importance of a reference chroma value of the reference sample to the sample to-be-predicted in the current block. Embodiments of the disclosure are not limited in this regard.
In addition, in some embodiments, the preset mapping can also be in the form of a preset look-up table. That is, in embodiments of the disclosure, operations can also be simplified, for example, some calculations can be eliminated by means of an array element look-up table. For the preset mapping, an array element value can be determined according to a preset mapping look-up tablet between the reference sample value for the first colour component, the first factor, and an array element, then a value corresponding to the array element value in the preset mapping can be determined, and the weighting factor can be set to be equal to the value.
Specifically, the f model for weighting factor calculation can be implemented through simplified operations, for example, by means of a look-up table. A luma difference |ΔYk| of a sample (i, j) to-be-predicted can also be represented by |ΔYkij|. In this way, the weighting factor is calculated with the ƒ model, i. e. wkij=f(|ΔYkij|). Here, a numerator in the ƒ model can be stored by taking the independent variable |ΔYkij| | and the number of categories of S as an array index(es). Subsequent operations that are the same as calculation of the numerator in the ƒ model are implemented by means of the look-up table, so as to eliminate calculations on the numerator and a denominator.
In embodiments of the disclosure, the storage can be full storage or partial storage.
In an embodiment, the full storage means storing all numerators corresponding to the range of |ΔYkij| and the number of categories of S, and an array space with a size of the range of |ΔYkij| multiplied by the number of categories of S is required for full storage. The size of the array that needs to be stored is the size of the range of |ΔYkij| |, and in this case, the performance remains unchanged.
Exemplarily, taking a 10-bit sample and formula (7) as an example, the range of the variable |ΔYkij| is integers within 0˜1023, the number of categories of S is 3, and the numerators are fully stored by taking |ΔYkij| and the number of categories of S as indexes for a two-dimensional array storMole:
In this case, the weighting factor calculation of formula (7) can be simplified into:
In this way, elements in the two-dimensional array storMole[index 1][index 2] are illustrated in Table 3.
Further, for full storage, a corresponding array offset can also be set according to the categories of S, and then the numerators are fully stored by taking |ΔYkij| plus offset as an index for a one-dimensional array ostorMole, which is specifically as follows:
In this case, the weighting factor calculation of formula (7) can be simplified into:
In this way, elements in the one-dimensional array ostorMole [index] are illustrated in Table 4.
In another embodiment, partial storage refers to storing part of numerator values for weighting factor calculation. Numerator values corresponding to part of the range of |ΔYkij| and/or part of the categories of S can be stored, the value of the ƒ model which is not chosen for storage can be 0 by default, and the size of the array that needs to be stored is the size of the selected range of |ΔYkij| multiplied by the number of the selected categories of S.
Exemplarily, taking a 10-bit sample and formula (7) as an example, assuming that numerator values corresponding to integers within the range of 0˜99 for |ΔYkij| and three categories of S are selected for partial storage, then the range of |ΔYkij| is integers within 0˜99, the number of categories of S is 3, and the numerators are stored by taking such |ΔYkij| and such number of categories of S as indexes for a two-dimensional array partstorMole:
In this case, the weighting factor calculation of formula (7) can be simplified into:
In this way, elements in the two-dimensional array partstorMole[index 1] [index 2] are illustrated in Table 5.
That is, the storage range of partial storage can be determined according to actual needs, and is not limited to integers within 100 for |ΔYkij| and 3 categories of S in the example. Likewise, for partial storage, a corresponding offset can also be set for the selected categories of S, so as to open up a one-dimensional storage space for storage, and embodiments of the disclosure are not limited in this regard. In addition, for Table 3˜Table 5, in order to perform fixed-point calculation, an integer value scaled up can also be stored. In this case, corresponding scale-down operation needs to be performed after the prediction value is determined.
In this way, the weighting factor can be determined according to the reference sample value (such as |ΔYkij|) for the first colour component, and the weighting factor can specifically include N weighting factors, namely w1, w2, . . . , wN, where N indicates the number of reference sample values for the second colour component. Here, theoretically, the sum of the N weighting factors is equal to 1, and each of the weighting factors is a value greater than or equal to 0 and less than or equal to 1. However, it should be noted that, “the sum of the N weighting factors is equal to 1” is only a theoretical concept, and in actual implementation of fixed-point, the absolute value of the weighting factor can be greater than 1.
S503, a first prediction block for the second colour component of the current block is determined according to the weighting factor and a reference sample value for the second colour component of the current block.
It should be noted that, in embodiments of the disclosure, that is, the first prediction block comprises the prediction values of at least part of the second-colour-component samples in the current block.
It should be further noted that, in embodiments of the disclosure, in terms of determining the reference sample value for the second colour component of the current block, the method can further include the following. The reference sample value for the second colour component of the current block is determined according to a value of a second-colour-component sample in the neighbouring area of the current block.
Here, the neighbouring area can include at least one of: a top neighbouring area, a top-right neighbouring area, a left neighbouring area, or a bottom-left neighbouring area.
In an embodiment, the method can further include the following. Fourth filtering is performed on the value of the second-colour-component sample in the neighbouring area of the current block, to obtain a filtered neighbouring sample value for the second colour component of the current block. The reference sample value for the second colour component of the current block is determined according to the filtered neighbouring sample value for the second colour component of the current block.
In embodiments of the disclosure, the number of filtered neighbouring sample values for the second colour component of the current block is greater than the number of values of the second-colour-component samples in the neighbouring area of the current block.
In embodiments of the disclosure, the fourth filtering can be up-sampling filtering, and an up-sampling rate is a positive integer multiple of 2.
That is, the first colour component is a luma component, and the second colour component is a chroma component, and up-sampling filtering can be performed on the reference chroma component in embodiments of the disclosure, such that the spatial resolution of the filtered reference chroma information is the same as the spatial resolution of the reference luma information. Exemplary, if there are 2M+2N pieces of reference luma information and M+N pieces of reference chroma information, after up-sampling filtering on the reference chroma information, there will be 2M+2N pieces of reference chroma information.
It should be further noted that, in embodiments of the disclosure, no matter whether it is the second filtering performed on the value of the first-colour-component sample in the neighbouring area, or the third filtering performed on the reconstructed value of the first-reference-colour-component sample in the current block, the two types of filtering can be down-sampling filtering. The second filtering can be performed by using a first filter, the third filtering can be performed by using a second filter. The first filter and the second filter can be down-sampling filters. Due to different data to-be-processed, down-sampling rates of these filters can also be different. Therefore, the first filter can be the same as or different from the second filter. The fourth filtering can be performed on the value of the second-colour-component sample in the neighbouring area. The fourth filtering can be performed by using a third filter. If the fourth filtering is up-sampling filtering, the third filter can be an up-sampling filter. In addition, the first filter, the second filter, and the third filter can all be neural-network filters, which are not limited in this regard.
It can be understood that, assuming that the first colour component is a luma component and the second colour component is a chroma component, since the spatial resolution of the value (namely, reference luma information) of the first-colour-component sample in the neighbouring area, the spatial resolution of the value (namely, reference chroma information) of the second-colour-component sample in the neighbouring area, and even the spatial resolution of the reconstructed value (namely, reconstructed luma information) of the first-reference-colour-component sample in the current block will be affected by colour format information, the second filtering, the third filtering, or the fourth filtering can also be performed according to the current colour format information. Taking the fourth filtering as an example below, in some embodiments, the method can further include the following. Based on the colour format information, the fourth filtering is performed on the value of the second-colour-component sample in the neighbouring area of the current block, to obtain the filtered neighbouring sample value for the second colour component of the current block.
In an embodiment, for the fourth filtering, the method can further include the following. If the colour format information indicates 4:2:0 sampling, up-sampling filtering is performed on the value of the second-colour-component sample in the neighbouring area of the current block, where an up-sampling rate is a positive integer multiple of 2.
It should be noted that, in embodiments of the disclosure, the colour format information can include 4:4:4 sampling, 4:2:2 sampling, 4:1:1 sampling, 4:2:0 sampling, and the like. If the colour format information indicates a video with 4:4:4 sampling (also represented by YUV444), that is, the spatial resolution of the luminance is equal to the spatial resolution of the chrominance, no operation needs to be performed on the reference chroma information. If the colour format information indicates a video with chroma sub-sampling characteristics such as 4:2:2 sampling (also represented by YUV422), or 4:1:1 sampling (also represented by YUV411), or 4:2:0 sampling (also represented by YUV420), that is, the spatial resolution of the luminance is inconsistent with the spatial resolution of the chrominance, and the spatial resolution of the chroma component is lower than the spatial resolution of the luma component, then up-sampling filtering needs to be performed on the reference chroma information obtained from the neighbouring area.
In this way, with regard to up-sampling filtering performed on the reference chroma information, the manner for the up-sampling filtering can be any one of linear interpolation methods, such as nearest neighbour interpolation, bilinear interpolation, bicubic interpolation, mean interpolation, median interpolation, copy interpolation, etc. Alternatively, the manner for up-sampling filtering can be any one of nonlinear interpolation methods, such as a wavelet transform-based interpolation algorithm or an edge information-based interpolation algorithm. Alternatively, up-sampling filtering can also be performed based on a convolutional neural network (CNN). Embodiments of the disclosure are not limited in this regard. Exemplarily, referring to
Further, after the reference sample value for the second colour component of the current block is determined, in some embodiments, for S503, the first prediction block for the second colour component of the current block can be determined according to the weighting factor and the reference sample value for the second colour component of the current block as follows. A weighted value obtained by multiplying the reference sample value for the second colour component by a corresponding weighting factor is determined. A prediction value of a second-colour-component sample in the first prediction block is set to be equal to a sum of N weighted values, where N represents the number of reference sample values for the second colour component, and N is a positive integer.
That is, if the number of the reference sample values for the second colour component is N, a weighted value (namely wkCk) obtained by multiplying each reference sample value for the second colour component by a corresponding weighting factor is firstly determined, and then the sum of the N weighted values is used as the prediction value of the second-colour-component sample in the prediction block. Specifically, the formula for calculation is as follows:
Exemplarily, an absolute luma difference is firstly calculated according to reconstructed luma information at position (i,j) in the current block and reference luma information of the neighbouring area, and then the weighting factor is calculated according to the Softmax function, so as to obtain a prediction value of a chroma component at position (i,j) in the prediction block according to formula (16). In particular, it should be noted that, in this way, it is conducive to parallel processing and higher calculation speed.
In embodiments of the disclosure, it is assumed that the width of the first prediction block is predSizeW, the height of the first prediction block is predSizeH, the width of the current block is nTbW, and the height of the current block is nTbH, then predSizeH is less than or equal to nTbH, or predSizeW is less than or equal to nTbW. That is, the first prediction block includes predictions values of at least part of the second-colour-component samples in the current block.
S504, first filtering is performed on the first prediction block to determine a second prediction block for the second colour component of the current block.
S505, a reconstructed value of a second-colour-component sample in the current block is determined according to the second prediction block.
It should be noted that, in embodiments of the disclosure, if the first prediction block comprises prediction values of some of the second-colour-component samples in the current block, then up-sampling filtering is required for the first prediction block, to obtain the final second prediction block. Therefore, in some embodiments, “first filtering is performed on the first prediction block to determine the second prediction block for the second colour component of the current block” can include the following: up-sampling filtering is performed on the first prediction block to determine the second prediction block for the second colour component of the current block.
It should be noted that, in embodiments of the disclosure, if the number of prediction values of the second colour component in the second prediction block is the same as the second-colour-component samples in the current block, but the second prediction block does not include the prediction values of the second-colour-component samples in the current block, filtering enhancement needs to be performed on the prediction value to obtain the final second prediction block. Therefore, in some embodiments, “first filtering is performed on the first prediction block to determine the second prediction block for the second colour component of the current block” can include the following: filtering enhancement is performed on the first prediction block, to determine the second prediction block for the second colour component of the current block.
It should be noted that, in embodiments of the disclosure, if the first prediction block includes the prediction values of all the second-colour-component samples in the current block, no processing is required for the first prediction block, and the first prediction block can be used as the final second prediction block directly.
It should be noted that, in embodiments of the disclosure, the first filtering can be up-sampling filtering or can be filtering enhancement, which is not limited herein. For the second prediction block subject to the first filtering, the second prediction block includes the prediction values of all the second-colour-component samples in the current block.
Here, when the first filtering is up-sampling filtering, the up-sampling filtering can be performed on the first prediction block with a fourth filter. The fourth filter can be an up-sampling filter and can be the same as or different from the third filter. The fourth filter can be a neural network filter, which is not limited herein.
In some embodiments, the first filtering can be performed on the first prediction block to determine the second prediction block for the second colour component of the current block as follows. The first filtering includes up-sampling filtering, where an input of the up-sampling filtering is a first up-sampling input block, and an output of the up-sampling filtering is a first up-sampling output block.
Further, in some embodiments, the up-sampling filtering can be performed as follows. An up-sampling factor is determined, where the up-sampling factor includes at least one of a horizontal up-sampling factor or a vertical up-sampling factor. Up-sampling filtering is performed on the first up-sampling input block according to the up-sampling factor, to obtain the first up-sampling output block.
In a possible implementation, up-sampling filtering can be performed on the first up-sampling input block according to the up-sampling factor to obtain the first up-sampling output block as follows. If the horizontal up-sampling factor is greater than 1 or the vertical up-sampling factor is greater than 1, up-sampling filtering is performed on the first up-sampling input block to obtain the first up-sampling output block.
In embodiments of the disclosure, performing up-sampling filtering on the first up-sampling input block includes at least one of: performing up-sampling filtering on the first up-sampling input block in a horizontal direction; performing up-sampling filtering on the first up-sampling input block in a vertical direction; performing up-sampling filtering on the first up-sampling input block in a horizontal direction and then in a vertical direction; or performing up-sampling filtering on the first up-sampling input block in a vertical direction and then in a horizontal direction.
Here, the horizontal up-sampling factor can be calculated according to the width of the first up-sampling input block and the width of the first up-sampling output block, and the vertical up-sampling factor can be calculated according to the height of the first up-sampling input block and the height of the first up-sampling output block. Then up-sampling filtering is performed on the first up-sampling input block according to the horizontal up-sampling factor and the vertical up-sampling factor. Specifically, if the horizontal up-sampling factor is greater than 1 and the vertical up-sampling factor is equal to 1, only horizontal up-sampling needs to be performed on the first up-sampling input block. If the horizontal up-sampling factor is equal to 1 and the vertical up-sampling factor is greater than 1, only vertical up-sampling needs to be performed on the first up-sampling input block. If the horizontal up-sampling factor is greater than 1 and the vertical up-sampling factor is greater than 1, both horizontal up-sampling and vertical up-sampling need to be performed on the first up-sampling input block. Firstly, horizontal up-sampling and then vertical up-sampling can be performed, or firstly vertical up-sampling and then horizontal up-sampling can be performed, or the up-sampling filtering operation herein can even be replaced by a convolution operation in a neural network structure, which is not limited in embodiments of the disclosure.
In another possible implementation, up-sampling filtering is performed on the first prediction block to determine the second prediction block. In this case, the method can further include the following. The first prediction block is taken as the first up-sampling input block, and the first up-sampling output block is taken as the second prediction block for the second colour component of the current block.
In another possible implementation, firstly enhancement filtering and then up-sampling filtering are performed on the first prediction block to determine the second prediction block. In this case, the method can further include the following. Filtering enhancement is performed on the first prediction block to determine a first enhanced prediction block. The first enhanced prediction block is taken as the first up-sampling input block, and the first up-sampling output block is taken as the second prediction block for the second colour component of the current block.
In another possible implementation, firstly up-sampling filtering and then enhancement filtering are performed on the first prediction block to determine the second prediction block. In this case, the method can further include the following. The first prediction block is taken as the first up-sampling input block, and the first up-sampling output block is taken as a first up-sampling-filtered prediction block. Filtering enhancement is performed on the first up-sampling-filtered prediction block, to determine the second prediction block for the second colour component of the current block.
In another possible implementation, firstly enhancement filtering, then up-sampling filtering, and then enhancement filtering is performed on the first prediction block, to determine the second prediction block. In this case, the method can further include the following. First filtering enhancement is performed on the first prediction block to determine a second enhanced prediction block. The second enhanced prediction block is taken as the first up-sampling input block, and the first up-sampling output block is taken as a second up-sampling-filtered prediction block. Second filtering enhancement is performed on the second up-sampling-filtered prediction block, to determine the second prediction block for the second colour component of the current block.
It should be noted that, when the first filtering is up-sampling filtering, the up-sampling filtering can be performed on the first prediction block with a horizontal up-sampling factor and a vertical up-sampling factor. In some embodiments, the up-sampling filtering is performed on the first prediction block to determine the second prediction block for the second colour component of the current block as follows: a horizontal up-sampling factor and a vertical up-sampling factor are determined; the up-sampling filtering is performed on the first prediction block with the horizontal up-sampling factor and the vertical up-sampling factor, to obtain the second prediction block for the second colour component of the current block.
In some embodiments, the up-sampling filtering is performed on the first prediction block with the horizontal up-sampling factor and the vertical up-sampling factor, to obtain the second prediction block for the second colour component of the current block, as follows: if the horizontal up-sampling factor is greater than 1, or the vertical up-sampling factor is greater than 1, the up-sampling filtering is performed on the first prediction block, to obtain the second prediction block.
In embodiments of the disclosure, performing up-sampling filtering on the first up-sampling input block includes at least one of: performing up-sampling filtering on the first up-sampling input block in a horizontal direction; performing up-sampling filtering on the first up-sampling input block in a vertical direction; performing up-sampling filtering on the first up-sampling input block in a horizontal direction and then in a vertical direction; or performing up-sampling filtering on the first up-sampling input block in a vertical direction and then in a horizontal direction.
Here, the horizontal up-sampling factor can be calculated according to the width of the first prediction block and the width of the current block, and the vertical up-sampling factor can be calculated according to the height of the first prediction block and the height of the current block. Then, up-sampling filtering is performed on the first prediction block according to the horizontal up-sampling factor and the vertical up-sampling factor. Specifically, if the horizontal up-sampling factor is greater than 1 and the vertical up-sampling factor is equal to 1, only horizontal up-sampling needs to be performed on the first prediction block. If the horizontal up-sampling factor is equal to 1 and the vertical up-sampling factor is greater than 1, only vertical up-sampling needs to be performed on the first prediction block. If the horizontal up-sampling factor is greater than 1 and the vertical up-sampling factor is greater than 1, both horizontal up-sampling and vertical up-sampling need to be performed on the first prediction block. Firstly, horizontal up-sampling and then vertical up-sampling can be performed, or firstly vertical up-sampling and then horizontal up-sampling can be performed, or the up-sampling operation herein can even be replaced by a convolution operation in a neural network structure, which is not limited in embodiments of the disclosure.
In some embodiments, the up-sampling filtering is implemented by one of: linear interpolation, or convolution operation based on a preset neural network. That is, the up-sampling filtering can be implemented with different filters, such as a two-dimensional filter, a one-dimensional filter, etc. For the one-dimensional filter, the filtering order thereof can be “firstly in a vertical direction and then in a horizontal direction”, or “firstly in a horizontal direction and then in a vertical direction”. The above two orders can be fixed filtering order, or can be a flexible filtering order determined according some parameters (for example, a filtering order directly indicated by identifier information, an implicit order related to prediction mode or block size, etc.), and embodiments of the disclosure are not limited in this regard.
In another possible implementation, when the first filtering is filtering enhancement, the filtering enhancement can be implemented through bilateral filtering. Specifically, performing the first filtering on the first prediction block to determine the second prediction block for the second colour component of the current block includes: determining a first weight value for the first prediction block in a bilateral filtering mode, performing bilateral filtering on the first prediction block according to the first weight value, to obtain the second prediction block.
It should be noted that, bilateral filtering is a non-linear filtering technique that can achieve edge preserving and denoising, it considers both spatial neighboring information and colour similarity information, which can preserve picture edges while denoising and smoothing pictures. The bilateral filtering adopts two Gaussian filters. One Gaussian filter is for calculating a weight value of spatial proximity, which is the common Gaussian filter principle, and the other Gaussian filter is for calculating a weight value of sample value similarity. The bilateral filtering is achieved with the two Gaussian filters. In bilateral filtering, the optimized weight value is then convolved with the picture to achieve the effect of edge preservings and denoising. Refer to
ws is a spatial proximity Gaussian filtering function, wr is a sample value similarity Gaussian filtering function, w(i, j, k, l) is the product of two Gaussian filtering functions, that is, the weight value for the neighbouring points around the center point of the filter. In formula (19), (i−k)2+(j−l)2 is used to measure a spatial distance, and σd is determined by the size of the current block; ∥I(i,j)−I(k,l)∥2 is used to measure a sample intensity difference, and σr is determined by quantizer parameter (QP).
Further, the optimized weight value is then convolved with the picture, to obtain the filtered prediction value as follows:
It should be noted that, in addition to bilateral filtering, the filtering enhancement can also be median filtering, Gaussian filtering, normalized filtering. In other words, the filtering enhancement can include at least of one of the following: bilateral filtering, median filtering, Gaussian filtering, normalized filtering, neural network filtering, which is not limited herein.
In some embodiments, the method further includes: before performing up-sampling filtering on the first prediction block, performing filtering enhancement on the first prediction block, and using the enhanced first prediction block as the first prediction block.
In some embodiments, the method further includes: after performing up-sampling filtering on the first prediction block, performing filtering enhancement on the first prediction block obtained after up-sampling filtering, to obtain the second prediction block for the second colour component of the current block.
That is to say, in embodiments of the disclosure, the first filtering can be up-sampling filtering or filtering enhancement, or may include both the up-sampling filtering and the filtering enhancement. The up-sampling filtering can be performed on the first prediction block first and then the filtering enhancement is performed, or the filtering enhancement can be performed on the first prediction block first and then the up-sampling filtering is performed, which is not limited herein.
As such, for predSamples(i,j) obtained in formula (20), it is not necessarily the final prediction value, but is the prediction value obtained after filtering enhancement but before up-sampling (here, predSamples(i,j) is not the final prediction value), or can be the prediction value obtained after up-sampling filtering and filtering enhancement, or can be the prediction value obtained after filtering enhancement without up-sampling filtering.
For filtering enhancement, in some embodiments, the method further includes: determining a compensation value of a second-colour-component sample of the first prediction block, according to a reference sample value in a neighbouring area of the current block, refining a prediction value of the second-colour-component sample of the first prediction block according to the compensation value, to determine the second prediction block.
It should be noted that, in order to further improve prediction accuracy of the WCP mode, position-related refinement can be performed on the first prediction block. For example, a chroma compensation value for each second-colour-component sample to-be-predicted is calculated by using a reference sample that is near in spatial position, the second-colour-component sample in the second prediction block is refined by using the chroma compensation value, and a final prediction value (predSamples) of the second-colour-component sample is determined according to the refined prediction value, thereby obtaining the final second prediction block.
For filtering enhancement, the method further includes: prediction is performed on the second-colour-component sample in the first prediction block according to at least one prediction mode, to determine at least one initial prediction value of the second-colour-component sample in the second prediction block. Weighted average calculation is performed on the at least one initial prediction value and the prediction value of the second-colour-component sample in the first prediction block to determine the second prediction block.
It should be noted that, in order to further improve prediction accuracy of the WCP mode, weighted average calculation can also be performed on a chroma prediction value(s) calculated in another prediction mode(s) and a chroma prediction value calculated in the WCP mode, and a final predicted chroma value is determined according to the weighted result. Exemplarily, as illustrated in
In some embodiments, after the second prediction block is determined, the reconstructed value of the second-colour-component sample in the current block can be determined according to the second prediction block as follows. A residual value of the second-colour-component sample in the current block is determined. A prediction value of the second-colour-component sample in the current block is determined according to the second prediction block. The reconstructed value of the second-colour-component sample in the current block is determined according to the residual value of the second-colour-component sample in the current block and the prediction value of the second-colour-component sample in the current block.
It should be noted that, in embodiments of the disclosure, in terms of determining the residual value of the second-colour-component sample in the current block, the residual value of the second-colour-component sample in the current block can be determined by parsing a bitstream.
It should be further noted that, in embodiments of the disclosure, in terms of determining the prediction value of the second-colour-component sample in the current block according to the second prediction block, the prediction value of the second-colour-component sample in the current block can be set to be equal to a value of the second prediction block; alternatively, up-sampling filtering can be performed on the value of the second prediction block, and the prediction value of the second-colour-component sample in the current block can be set to be equal to an output value after up-sampling filtering.
In this way, taking the chroma component as an example, a chroma residual value of the current block is determined by parsing the bitstream, and then a chroma prediction value of the current block can be determined according to the second prediction block. Then, the chroma prediction value and the chroma residual value are summed to obtain a reconstructed chroma value of the current block.
It can be understood that, in embodiments of the disclosure, during prediction in the WCP mode, post-processing after the WCP prediction will be detailed below in four aspects. First, luma information of a reference sample and luma information of the current block are fully utilized, so as to realize calculation of a weighting factor of chrominance of the reference sample. Second, utilize the low sensitivity of human eyes to chromaticity and in order to reduce the complexity in calculation of the weighting factor of chrominance, core parameters of WCP mode is fully considered, that is, when predSizeW×predSizeH is less than or equal to nTbW×nTbH, up-sampling is performed on the chroma predication block. Third, when performing up-sampling, reference chroma information is fully utilized, and characteristics in different directions is considered; during linear interpolation, different weight values are assigned to different points to-be-interpolated between existing neighbouring points, as such, spatial correlation between the points to-be-interpolated and existing points are fully considered, which can improve the accuracy of up-sampling filtering. Fourth, consider the possibility of unstable and inaccurate prediction values caused by the chroma prediction block output by WCP prediction as well as inaccurate prediction values caused by up-sampling filtering, for the chroma prediction blocks in those cases, filtering enhancement is performed with bilateral filtering which can achieve edge preserving and denoising, so as to further improve the accuracy and subjective/objective quality of the chroma prediction block. It should be noted that, the above four aspects are not in any particular order, and can be used individually or in combination.
To summarize, embodiments of the disclosure further provide a WCP framework. As illustrated in
Embodiments of the disclosure provide a decoding method. The reference sample value for the first colour component of the current block is determined. The weighting factor is determined according to the reference sample value for the first colour component of the current block. The first prediction block for the second colour component of the current block is determined according to the weighting factor and the reference sample value for the second colour component of the current block. First filtering is performed on the first prediction block to determine the second prediction block for the second colour component of the current block, where the second prediction block comprises prediction values of all second-colour-component samples in the current block. The reconstructed value of the second-colour-component sample in the current block is determined according to the second prediction block. As such, the weighting factor can be calculated with aid of the reference sample neighbouring the current block and colour component information of the current block, correlation between the current block and neighbouring areas in terms of luma information is fully taken into consideration, and such correlation is used in chroma prediction of the current block, so as to improve accuracy of chroma prediction. Considering that human eyes have low sensitivity to chroma information and in order to reduce the complexity in calculating the weighting factor, when the size of the first prediction block is less than the size of the current block, up-sampling filtering is performed on the first prediction block. In addition, considering that the prediction value of the first prediction block is unstable, filtering enhancement can also be performed, so as to further improve accuracy as well as subjective and objective quality of chroma prediction, save bit-rate, improve coding efficiency, and thus improve coding performance.
In another embodiment of the disclosure, based on the decoding method described in the foregoing embodiment, taking chroma prediction of the current block as an example, in embodiments of the disclosure, reconstructed luma information of the current block and reference luma information and reference chroma information of the neighbouring area are all decoded reference information. Therefore, an embodiment of the disclosure provides a WCP technology based on the foregoing information, and based on this, post-processing is performed on the chroma prediction block obtained by WCP, to further improve accuracy of chroma prediction. Here, the detailed steps of the chroma prediction process in the WCP mode are as follows.
Input of the WCP mode: a position (xTbCmp, yTbCmp) of the current block, a width nTbW of the current block, and a height nTbH of the current block.
Output of the WCP mode: a prediction value predSamples[x][y] of the current block, where the top-left position in the current block is taken as a coordinate origin, x=0, . . . , nTbW−1, and y=0, . . . , nTbH−1.
The prediction process in the WCP mode can include determination of a core parameter, acquisition of target information, WCP, and post-processing. After these steps, a chroma prediction value of the current block can be obtained.
In an embodiment, referring to
S1001, determine a core parameter(s) for a WCP mode.
It should be noted that, in terms of determining the core parameter for the WCP mode in S1001, the core parameter for the WCP mode can be obtained or derived through configuration or in some means, for example, the core parameter is obtained from a bitstream at a decoding end.
Here, the core parameter for the WCP mode includes, but is not limited to, a control parameter (S), the number (inSize) of inputs of WCP (hereinafter, “WCP inputs” for short), and the number of outputs of WCP (hereinafter, “WCP outputs” for short) (arranged into predSizeW×predSizeH). The first prediction block output based on WCP can be represented by predWcp. Here, the number of WCP outputs can be set to the same value (for example, predSizeW=predSizeH=S/4) or depend on the size parameter of the current block (for example, predSizeW=nTbW, and predSizeH=nTbH). The control parameter (S) can be used to adjust a nonlinear function in subsequent operations or adjust data involved in subsequent operations.
In some cases, the determination of the core parameter depends on a block size, a block content, or the number of samples in the block. For example, if there are various block sizes to which the WCP mode can be applied, or the difference between the block size is significant, or the difference between the block content is significant, or the difference between the number of samples in the block is significant, the current block can be classified according to the block size, the block content, or the number of samples in the block, and the same or different core parameters can be determined with regard to different categories. That is, the control parameter (S), or the number inSize of WCP inputs, or the number of WCP outputs (arranged into predSizeW×predSizeH) corresponding to different categories can be the same or different. It should be noted that, predSizeW can also be the same as or different from predSizeH.
In order to better illustrate the determination of the core parameter, two classifications are taken as examples for illustration below.
Classification example 1: in the WCP mode, the current block can be classified according to the width and height of the current block, and the category of the block is represented by wcpSizeId. The control parameter (S), the number inSize of WCP inputs, and the number of WCP outputs (arranged into predSizeW×predSizeH) corresponding to different categories of blocks can be the same or different. Here, an example of classification into three categories will be illustrated below.
The current block is classified into three categories according to the width and height of the current block. The control parameter (S) corresponding to different categories can be set to be different, and inSize and the number of WCP outputs (arranged into predSizeW×predSizeH) corresponding to different categories can be set to be the same. nTbW represents the width of the current block, nTbH represents the height of the current block, and the category wcpSizeId of the block is defined as follows.
wcpSizeId=0: represents a current block with min(nTbW, nTbH)<=4, where the control parameter (S) is 8, inSize is (2×nTbH+2×nTbW), and the number of chroma prediction values is the number of WCP outputs nTbH×nTbW.
wcpSizeId=1: represents a current block with 4<min(nTbW, nTbH)<=16, where the control parameter (S) is 12, inSize is (2×nTbH+2×nTbW), and the number of chroma prediction values is the number of WCP outputs nTbH×nTbW.
wcpSizeId=2: represents a current block with min(nTbW, nTbH)>16, where the control parameter (S) is 16, inSize is (2×nTbH+2×nTbW), and the number of chroma prediction values is the number of WCP outputs nTbH×nTbW.
The numerical relationship between the above core parameters is represented in the form of a table, as illustrated in Table 6.
Another example of classification into three categories is described below.
The current block is classified into three categories according to the width and height of the current block. The control parameter (S) corresponding to different categories can be set to be different, and inSize and the number of WCP outputs (arranged into predSizeW×predSizeH) corresponding to different categories can be set to be the same. nTbW represents the width of the current block, nTbH represents the height of the current block, and the category wcpSizeId of the block is defined as follows.
wcpSizeId=0: represents a current block with min(nTbW, nTbH)<=4, where the control parameter (S) is 8, inSize is (2×nTbH+2×nTbW), and the number of chroma prediction values is the number of WCP outputs nTbH×nTbW.
wcpSizeId=1: represents a current block with 4<min(nTbW, nTbH)<=16, where the control parameter (S) is 12, inSize is (1.5×nTbH+1.5×nTbW), and the number of chroma prediction values is the number of WCP outputs nTbH/2×nTbW/2.
wcpSizeId=2: represents a current block with min(nTbW, nTbH)>16, where the control parameter (S) of WCP is 16, inSize is (nTbH+nTbW), and the number of chroma prediction values is the number of WCP outputs nTbH/4×nTbW/4.
The numerical relationship between the above core parameters is represented in the form of a table, as illustrated in Table 7.
Classification example 2: in the WCP mode, the current block can be classified according to the width and height of the current block, and the category of the block is represented by wcpSizeId. The control parameter (S), the number inSize of WCP inputs, and the number of WCP outputs (arranged into predSizeW×predSizeH) corresponding to different categories of blocks can be the same or different. Here, an example of classification into three categories will be illustrated below.
The current block is classified into three categories according to the width and height of the current block. The control parameter (S) corresponding to different categories can be set to be different, and inSize and the number of WCP outputs (arranged into predSizeW×predSizeH) corresponding to different categories can be set to be the same. nTbW represents the width of the current block, nTbH represents the height of the current block, nTbW×nTbH represents the number of samples in the current block, and the category wcpSizeId of the block is defined as follows.
wcpSizeId=0: represents a current block with (nTbW×nTbH)<128, where the control parameter (S) is 10, inSize is (2×nTbH+2×nTbW), and the number of chroma prediction values is the number of WCP outputs nTbH×nTbW.
wcpSizeId=1: represents a current block with 128<=(nTbW×nTbH)<=256, where the control parameter (S) is 8, inSize is (2×nTbH+2×nTbW), and the number of chroma prediction values is the number of WCP outputs nTbH×nTbW.
wcpSizeId=2: represents a current block with (nTbW×nTbH)>256, where the control parameter (S) is 1, inSize is (2×nTbH+2×nTbW), and the number of chroma prediction values is the number of WCP outputs nTbH×nTbW.
The numerical relationship between the above core parameters is represented in the form of a table, as illustrated in Table 8.
Another example of classification into three categories is described below.
The current block is classified into three categories according to the width and height of the current block. The control parameter (S) corresponding to different categories can be set to be different, and inSize and the number of WCP outputs (arranged into predSizeW×predSizeH) corresponding to different categories can be set to be the same. nTbW represents the width of the current block, nTbH represents the height of the current block, nTbW×nTbH represents the number of samples in the current block, and the category wcpSizeId of the block is defined as follows.
wcpSizeId=0: represents a current block with (nTbW×nTbH)<64, where the control parameter (S) is 16, inSize is (2×nTbH+2×nTbW), and the number of chroma prediction values is the number of WCP outputs nTbH×nTbW.
wcpSizeId=1: represents a current block with 64<=(nTbW×nTbH)<=512, where the control parameter (S) is 4, inSize is (1.5×nTbH+1.5×nTbW), and the number of chroma prediction values is the number of WCP outputs nTbH/2×nTbW/2.
wcpSizeId=2: represents a current block with (nTbW×nTbH)>512, where the control parameter (S) is 1, inSize is (nTbH+nTbW), and the number of chroma prediction values is the number of WCP outputs nTbH/4×nTbW/4.
The numerical relationship between the above core parameters is represented in the form of a table, as illustrated in Table 9.
S1002, determine the target information of the current block according to the core parameters.
It should be noted that, for S1002, when predicting the current block, the top area, the top-left area, and the left area of the current block are used as the neighbouring areas (can also be referred to as “reference areas”) of the current block. As illustrated in the foregoing
Here, the reference chroma information refC and the reference luma information refY can be obtained from the neighbouring area.
The reference chroma information obtained includes, but is not limited to, a reference reconstructed chroma value selected from the top area of the current block, and/or a reference reconstructed chroma value selected from the left area of the current block. The reference luma information obtained includes but not limited to: corresponding reference luma information obtained according to the position of the reference chroma information.
The reconstructed luma information recY of the current prediction block is obtained as follows, for example, the corresponding reconstructed luma information obtained according to the position of the luma information in the current block is obtained as the reconstructed luma information of the current block.
It should be further noted that, in embodiments of the disclosure, in some case, refC, refY, or recY can be pre-processed and then taken as the target information of WCP input.
It should be noted that, in order to reduce the complexity in calculation of WCP prediction, extracting or down-sampling filtering can be performed on refC or refY or recY.
Exemplarily, different filtering operations can be performed on refC, refY, or recY for current blocks of different sizes.
Exemplarily, if the spatial resolution of the chroma component and the spatial resolution of luma component of video are inconsistent, up-sampling filtering and down-sampling filtering can be performed on refC, refY, or recY to facilitate subsequent chroma prediction calculations.
Exemplarily, if the spatial resolution of the chroma component and the spatial resolution of luma component of video are consistent, multiple lines or columns of reference samples can be used, and up-sampling filtering and down-sampling filtering can be performed on refC, refY, or recY to facilitate subsequent chroma prediction calculations.
Exemplarily, if the number of refC or recY is different from the number of inSize in the core parameters, extracting or up-sampling/down-sampling filtering can be performed on refC or recY.
That is to say, obtaining the target information may include: inSize pieces of reference chroma information (refC) are obtained (if pre-processing is required, refC is information obtained after pre-processing); inSize pieces of reference luma information refY are obtained (if pre-processing is required, refY is information obtained after pre-processing).
S1003, perform WCP according to the target information, to obtain a first prediction block for the current block.
It can be understood that, for S1004, the chroma prediction values within the size defined by the core parameter are represented by Cpred[i][j] and are obtained one by one, where i=0, . . . , predSizeW−1, and j=0, . . . , predSizeH−1. It should be noted that, predSizeH and predSizeW are core parameters, and in embodiments of the disclosure, predSizeH is greater than or equal to (the same as or different from) the height nTbH of the current block, or predSizeW is greater than or equal to the width nTbW of the current block. In this way, under certain conditions, the following calculations can also be performed only on some of the samples to be predicted in the current block.
It can be understood that, the WCP includes the following. A weight is obtained. Weighted prediction is performed according to the weight to obtain a WCP value. The process of obtaining the weight includes construction of a luma difference vector and calculation of the weight, and the detailed calculation process is as follows.
For i=0, . . . , predSizeW−1, j=0, . . . , predSizeH−1, and for k=0, 1 . . . , inSize−1, each element diffY[i][j][k] in the luma difference vector is constructed, each element cWeight[i][j][k] (or cWeightFloat[i][j][k]) in the weight vector is calculated, and then the chroma prediction value Cpred[i][j] is calculated according to cWeight[i][j](or cWeightFloat[i][j][k]) and refC.
In an embodiment, after obtaining the target information, as illustrated in
S1101, for a sample to-be-predicted, a luma difference vector is constructed by using the reconstructed luma information of the current block, the reference luma information, and the reference chroma information in the target information.
It should be noted that, for each sample to-be-predicted Cpred[i][j] within the size defined by the core parameter, an absolute value(s) of a difference(s) between reconstructed luma information recY[i][j] corresponding to the sample to-be-predicted and inSize pieces of reference luma information refY is calculated to obtain a luma difference vector diffY[i][j][k]. The formula for calculation is as follows:
where
and abs(x) represents an absolute value of x.
It should be further noted that, in some case, linear or nonlinear numerical processing can be performed on the luma difference vector for the sample to-be-predicted. For example, the value of the luma difference vector for the sample to-be-predicted can be scaled according to the control parameter S in the core parameter.
S1102, for the sample to-be-predicted, a weight vector is calculated according to the luma difference vector by using a nonlinear function.
It should be noted that, in embodiments of the disclosure, the luma difference vector diffY[i][j] corresponding to each sample to-be-predicted Cpred[i][j] is processed by using a weight model, to obtain a corresponding floating-point weight vector cWeightFloat[i][j]. The weight model herein includes, but is not limited to, a nonlinear normalized function, a nonlinear normalized exponential function, and other nonlinear functions, which is not limited herein.
Exemplarily, a nonlinear Softmax function can be used as a weight model, a luma difference vector diffY[i][j] corresponding to each sample to-be-predicted is used as an input of the weight model, and the floating-point weight vector cWeightFloat[i][j] corresponding to each sample to-be-predicted is output with the weight model. The formula for calculation is as follows:
In some case, the weight model can also be adjusted according to the control parameter (S) in the core parameter. Exemplarily, if the current block is flexible in size, the weight model can be adjusted according to the control parameter (S). Taking a nonlinear Softmax function as an example, different control parameters can be selected to adjust the function according to different block categories of the current block. In this case, a formula for calculating the weight vector corresponding to each sample to-be-predicted is as follows:
In embodiments of the disclosure, fixed-point calculation can also be performed on the weighting factor. Therefore, in some embodiments, the method further includes the following. If the weighting factor is a floating-point weighting factor, fixed-point calculation is performed on the floating-point weighting factor to obtain a fixed-point weighting factor.
In this way, after calculation according to the above formula (22) or formula (23) is completed, fixed-point calculation can be performed on cWeightFloat, as illustrated below:
Where round(x)=Sign(x)×Floor(abs(x)+0.5). Here, Floor(x) represents the greatest integer less than or equal to x.
abs(x) represents an absolute value of x. In addition, Shift is a shift amount which is set for the fixed-point operation in order to improve accuracy.
S1103, for the sample to-be-predicted, weighted calculation is performed according to the weight vector and the reference chroma information in the target information, to obtain a chroma prediction value.
It should be noted that, the chroma prediction value of each sample to-be-predicted is calculated according to the weight vector cWeight[i][j] (or cWeightFloat[i][j]) and the reference chroma information refC corresponding to the sample to-be-predicted. Specifically, for each sample to-be-predicted Cpred[i][j], the reference chroma information refC for the sample to-be-predicted is multiplied by the weight vector elements corresponding to the sample to-be-predicted one by one to obtain subC[i][j] (or subCFloat[i][j]), and the multiplication results are summed to obtain the chroma prediction value Cpred[i][j] of the sample to-be-predicted, thereby realizing weighted prediction on the chroma component.
In a possible implementation, the method can include the following. Weighted calculation is performed according to a floating-point weighting factor and the reference chroma information, to obtain an initial prediction value of a sample to-be-predicted. Fixed-point calculation is performed on the initial prediction value, to obtain a target prediction value of the sample to-be-predicted.
Exemplarily, the formula for calculation is as follows:
For k=0, 1, . . . , inSize−1,
After the calculation is completed, fixed-point calculation can also be performed on subCFloat[i][j][k]. During fixed-point calculation, in order to maintain a certain calculation precision, a coefficient can be multiplied herein, which is as follows:
Alternatively, for i=0, . . . , predSizeW−1, and j=0, . . . , predSizeH−1,
After the calculation, fixed-point calculation is performed on CpredFloat[i][j], such as:
In another possible implementation, weighted calculation can be performed according to a fixed-point weighting factor and the reference chroma information, to obtain an initial prediction value of a sample to-be-predicted. Fixed-point compensation is performed on the initial prediction value, to obtain a target prediction value of the sample to-be-predicted.
Exemplarily, the formula for calculation is as follows:
For k=0, 1, . . . , inSize−1,
Then, calculation is performed on the subC[i][j][k] subject to fixed-point calculation, which is as follows:
For i=0, . . . , predSizeW−1, j=0, . . . , predSizeH−1,
where Offset=1<<(Shift1−1). Shift1 can be a shift amount required in fixed-point calculation to improve accuracy in calculating cWeight[i][j][k] or subC[i][j][k](Shift1=Shift) or in other operations.
S1104, for the sample to-be-predicted, the chroma prediction value obtained is refined to determine the first prediction block for the current block.
It should be noted that, the chroma prediction value should be restricted to a preset range. If the chroma prediction value exceeds the preset range, a corresponding refinement operation needs to be performed. Exemplarily, in a possible implementation, the chroma prediction value Cpred[i][j] can be clipped as follows. When Cpred[i][j]<0, Cpred[i][j] is set to 0. When Cpred [i][j]>(1<<BitDepth)−1, Cpred[i][j] is set to (1<<BitDepth)−1.
BitDepth is a bit depth required for chroma sample values to ensure that all chroma prediction values of the prediction block are within 0˜(1<<BitDepth)−1. That is,
C
pred
[i][j]=Clip3(0,(1<<BitDepth)−1,Cpred[i][j]) (31)
where
Alternatively, formula (31) and formula (32) are combined to obtain the following formula:
S1004, perform post-processing on the chroma prediction value of the first prediction block, to determine a second prediction block for the current block.
It should be noted that, for S1004, after the chroma prediction value is obtained through weight derivation according to reconstructed chroma information, post-processing is performed on the chroma prediction value obtained, so as to further improve the accuracy in chroma prediction.
Due to the insensitivity of human eyes to partial removal of chroma information, in embodiments of the disclosure, chroma prediction can be performed on only some points in the current block, as such, the size of the first prediction block predSizeW×predSizeH is less than or equal to the size of the current block (that is, the original chroma block) nTbW×nTbH. In embodiments of the disclosure, according to the output size of the first prediction block obtained after WCP prediction, determine whether up-sampling filtering is to be performed on chroma and whether filtering enhancement is to be performed on the chroma prediction value.
In an embodiment, for the post-processing performed on the chroma prediction value of the first prediction block, as illustrated in
S1201, determine the output size of the first prediction block.
S1202, if the output size of the first prediction block is equal to the size of the current block, perform filtering enhancement on the first prediction block directly to obtain the second prediction block.
S1203, if the output size of the first prediction block is less than the size of the current block, determine an execution order for the first prediction block.
S1204, perform up-sampling filtering on the first prediction block first, to obtain the up-sampled prediction block, and the size thereof is restored to the same size as the current block.
S1205, then perform filtering enhancement on the up-sampled prediction block, to obtain the second prediction block.
S1206, perform filtering enhancement performed on the prediction block obtained after up-sampling filtering, to obtain the enhanced prediction block.
S1207, perform up-sampling filtering on the enhanced prediction block, to obtain the second prediction block, and the size thereof is restored to the same size as the current block.
It should be noted that, the execution order for the first prediction block can include a first execution order and a second execution order. The first execution order is: first perform up-sampling filtering on the first prediction block, and then perform filtering enhancement on the up-sampled prediction block. The second execution order is: first perform filtering enhancement on the first prediction block, and then perform up-sampling filtering on the enhanced prediction block.
Here, assume that the execution order for the first prediction block is the first execution order, that is, first perform up-sampling filtering on the first prediction block, and then perform filtering enhancement on the up-sampled prediction block.
In actual coding, chroma sub-sampling utilizes the lower sensitivity of human eyes to chroma signals compared to luma signals to remove some colour information from the picture without being perceived by humans. This means that a lower spatial sampling rate can be given to chroma signals. Furthermore, the chroma components in the same block are relatively flat and have similar content characteristics. In video content with these two characteristics, if all points in the same block of the picture are predicted point by point, it will introduce higher complexity in the calculation of weight vectors and the weighting of chroma prediction values, greatly reducing prediction efficiency. Based on the above two characteristics of the video and the high complexity in calculating the chroma prediction values for all points, it is possible to consider predicting only a portion of the points in the current block, that is, in the core parameters of WCP mode, if predSizeW is less than the width nTbW of the current block or predSizeH is less than the height nTbH of the current block, up-sampling filtering needs to be performed on predWcp to obtain the final predicted chroma value predSamples.
In embodiments of the disclosure, a horizontal up-sampling factor upHor is calculated according to the width predSizeW of the first prediction block output and the width nTbW of the current block. Likewise, a vertical up-sampling factor upVer is calculated according to the height predSizeH of the first prediction block output and the height nTbH of the current block. The method for calculation is illustrated as follows:
The first prediction block predWcp is filled into the current second prediction block predSamples:
Specifically, the up reference reconstructed chroma sample refC_T is filled into an upper row predSamples[x][−1] of the second prediction block, and the left reference reconstructed chroma sample refC_L is filled into is filled into the left column predSamples[−1][y] of the second prediction block. x=0, . . . , nTbW−1, y=0, . . . , nTbH−1.
According to formula (36), predWcp is filled into a corresponding position ((x+1)×upHor−1, (y+1)×upVer−1) in the second prediction block predSamples. It can be considered that the second prediction block is divided into predSizeW×predSizeH sub-blocks equally, and the filled position is the bottom right corner of each sub-block. As illustrated in
When horizontal up-sampling factor upHor is greater than 1, horizontal up-sampling filtering is performed. Up-sampling is illustrated as the following formulas:
The process is illustrated in
Up-sampling adopts linear interpolation, that is, the value of each interpolated point (filled with gray) between two up-sampling chroma reference points (filled with black) is a weighted average of two up-sampling reference chroma points. According to formulas (37) and (38), the weight of the left up-sampling reference chroma point is (upHor−dX)/upHor, and the weight of the right reference chroma point is dX/upHor, where dX=1, . . . , upHor−1 (that is, the distance between the current interpolation point and the left reference point). That is, during horizontal interpolation, the weight is only related to the horizontal up-sampling factor upHor.
When the vertical up-sampling factor upVer is greater than 1, vertical up-sampling filtering is needed, the process of which is similar to the up-sampling, as detailed in the following formulas.
This process is illustrated in
The up-sampling adopts linear interpolation. According to formulas (39) and (40), the upper up-sampling reference point has a weight of (upVer−dY)/upVer, and a lower reference point has a weight of dY/upVer, where dY=1, . . . , upVer−1 (that is, a distance between the current interpolation point and the upper reference point). That is, when performing vertical interpolation, the weight relates to only the vertical up-sampling factor upVer.
As such, with the above process, predSamples obtained through interpolation is the prediction value of the final chroma prediction block of the WCP technology.
Further, in order to compensate for the instability caused by the inaccurate non-linear weight mapping model of WCP technology and the independent point-by-point prediction of each point, the embodiments of the disclosure can also consider filtering enhancement on the output prediction block. The prediction block to be filtering-enhanced may include the first prediction block before the up-sampling filtering, may include the second prediction block after the up-sampling filtering, or may include the first prediction block which does not need up-sampling filtering (when upHor=upVer=1).
Here, the enhancement filtering is bilateral filtering. The bilateral filtering is a non-linear filtering technique that can achieve edge preserving and denoising, it considers both spatial neighboring information and colour similarity information, which can preserve picture edges while denoising and smoothing pictures.
The bilateral filtering adopts two Gaussian filters. One Gaussian filter is for calculating a weight value of spatial proximity, which is the common Gaussian filter principle, and the other Gaussian filter is for calculating a weight value of sample value similarity. The bilateral filtering is achieved with the two Gaussian filters. In bilateral filtering, the optimized weight value is then convolved with the picture to achieve the effect of edge preservings and denoising. The weight value of the two Gaussian filters is obtained through formula (17) to formula (19). The optimized weight value w(i,j, k, l) is then convolved with the picture, to obtain the filtered prediction value illustrated in formula (20). It should be noted that, predSamples(i,j) is the filtered weight value, but predSamples(i,j) does not necessarily the final prediction value, but may be a filtered prediction value before up-sampling (here, predSamples(i,j) is not the final prediction value), may be a filtered prediction value after up-sampling, or may be a filtered chroma prediction value that does not need up-sampling.
It can be understood that in the embodiments of the disclosure, in addition to using bilateral filters as filtering methods, median filters can also be used to replace each sample of the picture with the median of neighboring (square area centered on the current sample) samples; Gaussian filters, Normalized box filters, etc. can also be used, which is not limited herein. Exemplary, for the normalization filter, the output sample value is an average vale of sample values (all samples have the same weighting factor) in a kernal window. The kernal is as follows:
In order to improve WCP prediction performance, in addition to traditional filtering algorithms, a neural network can also be used to perform filtering enhancement on the WCP prediction output predWcp.
It can also be understood that in the embodiments of the disclosure, the traditional refining method for post-processing enhancement on the first prediction block outputted may also include the following.
It can also be understood that in embodiments of the disclosure, for the up-sampling filtering, in addition to an up-sampling method of “first in the horizontal direction and then in the vertical direction”, an up-sampling method of “first in the vertical direction and then in the horizontal direction” can also be used. Exemplary, in
When the vertical up-sampling factor upVer is greater than 1, vertical up-sampling is performed first as follows:
This process is illustrated in
Up-sampling adopts linear interpolation. According to formulas (42) and (43), an upper up-sampling reference point has a weight of (upVer−dY)/upVer, and a lower reference point has a weight of dY/upVer, where dY=1, . . . , upVer−1 (that is, a distance between the current interpolation point and the upper reference point). That is, in vertical interpolation, the weight relates to only the vertical up-sampling factor upVer.
When the horizontal up-sampling factor upHor is greater than 1, horizontal up-sampling is needed, which is similar to the vertical up-sampling, as detailed in the following formulas:
This process is illustrated in
The up-sampling also adopts linear interpolation, that is, the value of each interpolated point (filled with gray) between two up-sampling chroma reference points (filled with black) is a weighted average of two up-sampling reference chroma points. According to formulas (44) and (45), the weight of the left up-sampling reference chroma point is (upHor−dX)/upHor, and the weight of the right reference chroma point is dX/upHor, where dX=1, . . . , upHor−1 (that is, the distance between the current interpolation point and the left reference point). That is, during horizontal interpolation, the weight is only related to the horizontal up-sampling factor upHor.
As such, with the above process, predSamples obtained after interpolation is the prediction value of the final chroma prediction block in WCP technology.
It can also be understood that in embodiments of the disclosure, a chroma prediction value obtained through up-sampling “first in the horizontal direction and then in the vertical direction” and a chroma prediction value obtained through up-sampling “first in the vertical direction and then in the horizontal direction” can be averaged to obtain the final chroma prediction value. Alternatively, when performing up-sampling through linear interpolation, the value of each interpolated point (filled with gray) between two up-sampling chroma reference points (filled with black) can be the average value of two up-sampling reference chroma points, that is, the weight is ½. Alternatively, in addition to traditional up-sampling, convolution operations in neural network structures can also be used to replace up-sampling operations, which is not limited herein.
Embodiments provide a decoding method. The implementations of the foregoing embodiments are described in detail in embodiments. As can be seen, with the technical solutions of the foregoing embodiments, it is possible to improve accuracy of a chroma prediction value in a WCP prediction technology. Specifically, a weighting factor is calculated according to reference information of the neighbouring area and luma information of the current block, and the weighting factor is used for chroma prediction of the current block. In this way, the correlation between the current block and the neighbouring area in terms of luma information is fully utilized for chroma prediction of the current block, thereby improving accuracy of chroma prediction. For example, the decoding method is applied to a test software enhanced compression model (ECM) 3.1, and tested under an all intra frame (All Intra) condition at 48 frame intervals. Bjontegaard-Delta rate (BD-rate) changes (i. e. average bit-rate changes under the same peak signal to noise ratio (PSNR)) of −0.10%, −0.74%, and −0.61% can be achieved in Y, Cb, and Cr respectively. There will be better performance for a higher resolution sequence, and a BD-rate change of up to −0.24% in Y can be achieved for test sequence Class A1. In addition, for the post-processing performed on the chroma prediction block outputted in WCP, which can utilize the low sensitivity of human eyes to chroma, and in order to reduce the complexity in chroma weighting calculation, the situation where the core parameter predSizeW×predSizeH is less than or equal to nTbW×nTbH in the WCP mode is fully considered. When predSizeW×predSizeH is less than nTbW×nTbH, up-sampling filtering is needed, and with up-sampling filtering that is “first in horizontal direction and then in vertical direction”, different weights are assigned to different points to-be-interpolated between existing neighbouring points, as such, spatial correlation between the point to-be-interpolated and the existing points are fully considered. Reference chroma refC_T and refC_L are used as reference for up-sampling filtering, as such, characteristics in different directions are considered to obtain the final up-sampled prediction value. Besides, filtering enhancement can be performed on chroma prediction blocks that subject to up-sampling filtering and chroma prediction blocks that do not need up-sampling filtering (when predSizeW×predSizeH is equal to nTbW×nTbH). Bilateral filtering can achieve edge preserving and denoising, which can further improve the accuracy in chroma prediction.
In another embodiment of the disclosure, referring to
S2001, a reference sample value for a first colour component of a current block is determined.
It should be noted that, the encoding method in embodiments of the disclosure is applied to an encoding apparatus, or an encoding device (can also be referred to as an “encoder” for short) integrating the encoding apparatus. In addition, the encoding method in embodiments of the disclosure can specifically refer to an intra prediction method, and more specifically, to a WCP post processing method.
In embodiments of the disclosure, a video picture can be partitioned into multiple coding blocks, and each coding block can include a first colour component, a second colour component, and a third colour component. The current block herein refers to a coding block on which intra prediction is currently to be performed in the video picture. In addition, assuming that a first colour component of the current block is to be predicted and the first colour component is a luma component, that is, a colour component to-be-predicted is a luma component, the current block can also be called a luma prediction block. Alternatively, assuming that a second colour component of the current block is to be predicted and the second colour component is a chroma component, that is, the colour component to-be-predicted is a chroma component, the current block can also be called a predicted chroma block.
It should be further noted that, in embodiments of the disclosure, reference information for the current block can include a value of a first-colour-component sample in a neighbouring area of the current block and a value of a second-colour-component sample in the neighbouring area of the current block, and these samples can be determined from decoded samples in the neighbouring area of the current block. In some embodiments, the neighbouring area of the current block can include at least one of: a top neighbouring area, a top-right neighbouring area, a left neighbouring area, or a bottom-left neighbouring area.
In some embodiments, the reference sample value for the first colour component of the current block can be determined as follows. The reference sample value for the first colour component of the current block is determined according to a value of a first-colour-component sample in the neighbouring area of the current block.
It should be noted that, in embodiments of the disclosure, the reference sample for the current block can refer to a reference sample neighbouring the current block, and can also be referred to as a first-colour-component sample and a second-colour-component sample in the neighbouring area of the current block, which are referred to as “neighbouring sample” or “reference sample”. In addition, in embodiments of the disclosure, the first colour component is a luma component, and the second colour component is a chroma component. In this case, the value of the first-colour-component sample in the neighbouring area of the current block refers to reference luma information corresponding to the reference sample for the current block, and a value of the second-colour-component sample in the neighbouring area of the current block refers to reference chroma information corresponding to the reference sample for the current block.
In some embodiments, in terms of determining the value of the first-colour-component sample, the method can further include the following. The value of the first-colour-component sample is determined by selecting from first-colour-component samples in the neighbouring area.
It should be noted that, among the first-colour-component samples in the neighbouring area, there can be some unimportant samples (for example, these samples have poor correlation) or some abnormal samples. To ensure accuracy of prediction, these samples need to be removed, so as to obtain a value of a valid first-colour-component sample. That is, in embodiments of the disclosure, a first sample set is formed from the first-colour-component samples in the neighbouring area of the current block. In this case, the value of the first-colour-component sample can be determined by selecting from the first sample set.
In an embodiment, the value of the first-colour-component sample can be determined by selecting from the first-colour-component samples in the neighbouring area as follows. A sample position to-be-selected is determined according to a position and/or a colour component intensity of the first-colour-component sample in the neighbouring area. The value of the first-colour-component sample is determined from the neighbouring area according to the sample position to-be-selected.
It should be noted that, in embodiments of the disclosure, the colour component intensity can be represented by colour component information, for example, reference luma information and reference chroma information. Here, a greater value of the colour component information represents a higher colour component intensity. In this way, selection from the first-colour-component samples in the neighbouring area can be performed according to the sample position or according to the colour component intensity, so as to determine a valid first-colour-component sample from the sample thus selected, thereby determining the value of the first-colour-component sample.
In some embodiments, the reference sample value for the first colour component of the current block can be further determined as follows. Second filtering is performed on the value of the first-colour-component sample to obtain a filtered neighbouring sample value for the first colour component of the current block. The reference sample value for the first colour component of the current block is determined according to the filtered neighbouring sample value for the first colour component of the current block.
In embodiments of the disclosure, the number of filtered neighbouring sample values for the first colour component of the current block is less than the number of values of the first-colour-component samples.
In embodiments of the disclosure, the second filtering can be down-sampling filtering. The first colour component is a luma component. Up-sampling filtering can be performed on the reference luma information, such that the spatial resolution of the filtered reference luma information is the same as the spatial resolution of the reference chroma information.
In some embodiments, the reference sample value for the first colour component of the current block can be further determined as follows. The reference sample value for the first colour component of the current block is determined based on a reconstructed value of a first-reference-colour-component sample in the current block.
In embodiments of the disclosure, the first reference colour component can be a luma component. In this case, the reconstructed value of the first-reference-colour-component sample in the current block is reconstructed luma information of the current block.
Further, in some embodiments, the reference sample value for the first colour component of the current block can be further determined as follows. Third filtering is performed on the reconstructed value of the first-reference-colour-component sample in the current block to obtain a filtered sample value of the first-reference-colour-component sample in the current block. The reference sample value for the first colour component of the current block is determined according to the filtered sample value of the first-reference-colour-component sample in the current block.
In embodiments of the disclosure, the number of filtered sample values of the first-reference-colour-component samples in the current block is less than the number of reconstructed values of the first-reference-colour-component samples in the current block.
In embodiments of the disclosure, the third filtering can be down-sampling filtering. The first reference colour component is a luma component, down-sampling filtering can be performed on the reconstructed luma information of the current block.
It can be understood that, in embodiments of the disclosure, the reference sample value for the first colour component of the current block can also be set to luma difference information. Therefore, in a possible implementation, the reference sample value for the first colour component of the current block is set to an absolute value of a difference between the value of the first-colour-component sample and the reconstructed value of the first-reference-colour-component sample.
In another possible implementation, the reference sample value for the first colour component of the current block is set to an absolute value of a difference between the filtered neighbouring sample value for the first colour component and the reconstructed value of the first-reference-colour-component sample.
In another possible implementation, the reference sample value for the first colour component of the current block is set to an absolute value of a difference between the filtered neighbouring sample value for the first colour component and the filtered sample value of the first-reference-colour-component sample.
In another possible implementation, the reference sample value for the first colour component of the current block is set to an absolute value of a difference between the value of the first-colour-component sample and the filtered sample value of the first-reference-colour-component sample.
That is, according to known reference information of the current block, such as the reference luma information of the neighbouring area of the current block, reconstructed luma information in the current block, filtering can be performed before weighted prediction, specifically, down-sampling filtering can be performed on reference luma information in the neighbouring area of the current block, or down-sampling filtering can be performed on the reconstructed luma information of the current block, or down-sampling filtering can be performed on both the reference luma information and the reconstructed luma information, or no down-sampling filtering is performed on the reference luma information and the reconstructed luma information. Then, the luma difference information can be determined according to different combinations of the above cases, and the luma difference information is used as the reference sample value for the first colour component of the current block.
S2002, a weighting factor is determined according to the reference sample value for the first colour component of the current block.
It should be noted that, in embodiments of the disclosure, the weighting factor can be determined according to the reference sample value for the first colour component of the current block as follows. A value corresponding to the reference sample value for the first colour component in a preset mapping is determined. The weighting factor is set to be equal to the value.
It can be understood that, in embodiments of the disclosure, the reference sample value for the first colour component can be the absolute value of the difference between the filtered neighbouring sample value for the first colour component of the current block and the filtered sample value of the first-reference-colour-component sample in the current block. The first reference colour component is the first colour component, and the first colour component is a colour component different from a second colour component to-be-predicted in embodiments of the disclosure.
It should be noted that, in embodiments of the disclosure, when predicting a chroma component of a sample to-be-predicted in the current block, at least one sample to-be-predicted in the current block can be selected, and a luma difference (represented by |ΔYk|) between reconstructed luminance thereof and reference luminance of the neighbouring area is calculated. A smaller |ΔYk| indicates higher similarity between luma values, and the corresponding weighting factor (represented by wk) can be given a greater value; on the contrary, a greater |ΔYk| indicates lower similarity between luma values, and wk can be given a smaller value. That is, in the preset mapping, wk and |ΔYk| are in approximately inverse proportion.
Further, in some embodiments, the value corresponding to the reference sample value for the first colour component in the preset mapping can be determined as follows. A first factor is determined. A first product value is determined according to the first factor and the reference sample value for the first colour component. A value corresponding to the first product value in the preset mapping is determined.
In an embodiment, the first factor can be determined as follows. The first factor is a preset constant value.
In another embodiment, the first factor can be determined as follows. A value of the first factor can be determined according to a size parameter of the current block.
Further, in some embodiments, the method can further include the following. The value of the first factor is determined according to a preset mapping look-up table between the size parameter of the current block and the value of the first factor.
Here, the size parameter of the current block can include at least one of: a width of the current block, or a height of the current block.
It should be noted that, in embodiments of the disclosure, the value of the first factor can be set by means of classification. For example, the size parameter of the current block is classified into three categories, and the value of the first factor corresponding to each category is determined. In this case, in embodiments of the disclosure, the mapping look-up table between the size parameter of the current block and the value of the first factor can also be pre-stored, and then the value of the first factor can be determined according to the look-up table. Exemplarily, the foregoing Table 1 shows a correspondence between the first factor and the size parameter of the current block.
In another embodiment, the first factor can be determined as follows. The value of the first factor is determined according to the number of reference samples for the current block.
Further, in some embodiments, the method can further include the following. The value of the first factor is determined according to a preset mapping look-up table between the number of reference samples for the current block and the value of the first factor.
It should be noted that, in embodiments of the disclosure, the number of reference samples can be classified into three categories, and the value of the first factor can also be set by means of classification. For example, the number of reference samples for the current block is classified into three categories, and the value of the first factor corresponding to each category is determined. In this case, in embodiments of the disclosure, the mapping look-up table between the number of reference samples for the current block and the value of the first factor can also be pre-stored, and then the value of the first factor can be determined according to the look-up table. Exemplarily, the foregoing Table 2 shows a correspondence between the first factor and the number of reference samples for the current block.
Further, for the first product value, the first product value can be determined according to the first factor and the reference sample value for the first colour component as follows. The first product value is set to be equal to a product of the first factor and the reference sample value for the first colour component. Alternatively, the first product value is set to be equal to a numerical value obtained by right-shifting the reference sample value for the first colour component, where the number of bits right shifted is equal to the first factor. Alternatively, the first product value is set to a value obtained by performing addition and bit shift on the reference sample value for the first colour component according to the first factor.
Exemplarily, assuming that the first factor is equal to 0.25, and the reference sample value for the first colour component is represented by Ref, then the first product value can be equal to 0.25×Ref, and 0.25×Ref can also be represented by Ref/4, that is, Ref>>2. In addition, in fixed-point calculation, a floating-point number can be converted into addition and shift operations. That is, there is no limitation on the manner for calculation of the first product value.
It can also be understood that, in embodiments of the disclosure, the first reference colour component can also be a chroma component, that is, at least one sample to-be-predicted in the current block is selected, and a chroma difference (represented by |ΔCk|) between reconstructed chrominance thereof and reference chrominance of the neighbouring area is calculated. A smaller |ΔCk| indicates higher similarity between chroma values, and the corresponding weighting factor (represented by wk) can be given a greater value; on the contrary, a greater |ΔCk| indicates lower similarity between chroma values, and wk can be given a smaller value. That is, when calculating the weighting factor, the reference sample value for the first colour component can also be |ΔCk|, and then the weighting factor can be calculated.
To summarize, in embodiments of the disclosure, the reference sample value for the first colour component can be |ΔCk|, that is, an absolute value of the chroma difference. Alternatively, the reference sample value for the first colour component can be |ΔYk|, that is, an absolute value of the luma difference. Alternatively, the reference sample value for the first colour component can be |αΔYk|, that is, a product of the absolute value of the luma difference and a preset multiplier. Here, the preset multiplier is a second factor described in embodiments of the disclosure.
Further, for the second factor, in an embodiment, the method can include the following. The second factor is determined by performing least squares calculation on a first-colour-component value of the reference sample and a second-colour-component value of the reference sample.
That is, assuming that the number of reference samples is N, the first-colour-component value of the reference sample is the reference luma information for the current block, and the second-colour-component value of the reference sample is the reference chroma information for the current block, then least squares calculation can be performed on chroma component values and luma component values of the N reference samples, so as to obtain the second factor. Exemplarily, the least squares regression calculation can be as illustrated in formula (5) above, and then the second factor can be calculated.
In addition, for the preset mapping, the preset mapping can be a preset function relationship. In some embodiments, the preset mapping can be a Softmax function, as illustrated in the foregoing formula (6) or formula (7). The Softmax function is normalized exponential function. However, in embodiments of the disclosure, normalization may not be needed, and the value thereof is not limited to the range of [0, 1].
It should be further noted that, in addition to the Softmax function, in other embodiments, the preset mapping can be a weighting function that is in inverse proportion with the reference sample value for the first colour component, as illustrated in the foregoing formula (8) or formula (9).
In this way, the preset mapping can be as illustrated in formula (4), or can be as illustrated in formula (6) or formula (7), or can be as illustrated in formula (8) or formula (9), or can even be another function model of the weighting factor that is constructed by fitting the tendency that higher similarity between the reference luma value of the reference sample and the reconstructed luma value of the sample to-be-predicted in the current block leads to higher importance of a reference chroma value of the reference sample to the sample to-be-predicted in the current block. The preset mapping can be a preset look-up table, for example, using array element look-up table to reduce some calculation operations. Embodiments of the disclosure are not limited in this regard.
In this way, the weighting factor can be determined according to the reference sample value (such as |ΔYkij|) for the first colour component, and the weighting factor can specifically include N weighting factors, namely w1, w2, . . . , wN, where N indicates the number of reference sample values for the second colour component. Here, theoretically, the sum of the N weighting factors is equal to 1, and each of the weighting factors is a value greater than or equal to 0 and less than or equal to 1. However, it should be noted that “the sum of N weighting factors equals 1” is only a theoretical concept. In the actual fixed-point implementation process, the absolute value of the weighting factor can be greater than 1.
S2003, a first prediction block for the second colour component of the current block is determined according to the weighting factor and a reference sample value for the second colour component of the current block.
It should be noted that, in embodiments of the disclosure, the first prediction block includes prediction values of at least part of the second-colour-component samples in the current block.
It should be further noted that, in embodiments of the disclosure, in terms of determining the reference sample value for the second colour component of the current block, the method can further include the following. The reference sample value for the second colour component of the current block is determined according to a value of a second-colour-component sample in the neighbouring area of the current block. Here, the neighbouring area can include at least one of: a top neighbouring area, a top-right neighbouring area, a left neighbouring area, or a bottom-left neighbouring area.
In an embodiment, the method can further include the following. Fourth filtering is performed on the value of the second-colour-component sample in the neighbouring area of the current block, to obtain a filtered neighbouring sample value for the second colour component of the current block. The reference sample value for the second colour component of the current block is determined according to the filtered neighbouring sample value for the second colour component of the current block.
In embodiments of the disclosure, the number of filtered neighbouring sample values for the second colour component of the current block is greater than the number of values of the second-colour-component samples in the neighbouring area of the current block.
In embodiments of the disclosure, the fourth filtering can be up-sampling filtering, and an up-sampling rate is a positive integer multiple of 2.
That is to say, the first colour component is a luma component, the second colour component is a chroma component, and up-sampling filtering can be performed on reference chroma information, such that the spatial resolution of the filtered reference luma information is the same as the spatial resolution of the reference chroma information. Exemplarily, if there are 2M+2N pieces of reference luma information and M+N pieces of reference chroma information, then after up-sampling filtering on the reference chroma information, there will be 2M+2N pieces of reference chroma information.
It should be further noted that, in embodiments of the disclosure, no matter whether it is the second filtering performed on the value of the first-colour-component sample in the neighbouring area, or the third filtering performed on the reconstructed value of the first-reference-colour-component sample in the current block, the two types of filtering can be down-sampling filtering. The second filtering can be performed by using a first filter, and the third filtering can be performed by using a second filter. The first filter and the second filter can all be down-sampling filters. Due to different data to-be-processed, down-sampling rates of these filters can also be different, and therefore, the first filter can be the same as or different from the second filter. The fourth filtering can be performed on the value of the second-colour-component sample in the neighbouring area. The fourth filtering can be performed by using a third filter. If the fourth filtering is up-sampling filtering, the third filter can be an up-sampling filter. In addition, the first filter, the second filter, and the third filter can all be neural-network filters, which are not limited in this regard.
It can be understood that, assuming that the first colour component is a luma component and the second colour component is a chroma component, since the spatial resolution of the value (namely, reference luma information) of the first-colour-component sample in the neighbouring area, the spatial resolution of the value (namely, reference chroma information) of the second-colour-component sample in the neighbouring area, and even the spatial resolution of the reconstructed value (namely, reconstructed luma information) of the first-reference-colour-component sample in the current block will be affected by colour format information, the second filtering, the third filtering, or the fourth filtering can also be performed according to the current colour format information. Taking the fourth filtering as an example below, in some embodiments, the method can further include the following. Based on the colour format information, the fourth filtering is performed on the value of the second-colour-component sample in the neighbouring area of the current block, to obtain the filtered neighbouring sample value for the second colour component of the current block.
In an embodiment, for the fourth filtering, the method can further include the following. If the colour format information indicates 4:2:0 sampling, up-sampling filtering is performed on the value of the second-colour-component sample in the neighbouring area of the current block, where an up-sampling rate is a positive integer multiple of 2.
It should be noted that, in embodiments of the disclosure, if the colour format information indicates that the spatial resolution of the luminance is equal to the spatial resolution of the chrominance (such as a YUV444 format), no operation needs to be performed on the reference chroma information. If the colour format information indicates that the spatial resolution of the luminance is inconsistent with the spatial resolution of the chrominance (such as a video with chroma sub-sampling characteristics such as a 4:2:2 format/4:1:1 format/4:2:0 format), and the spatial resolution of the chroma component is lower than the spatial resolution of the luma component, then up-sampling filtering needs to be performed on the reference chroma information obtained from the neighbouring area.
In this way, with regard to up-sampling filtering performed on the reference chroma information, the manner for the up-sampling filtering can be any one of linear interpolation methods, such as nearest neighbour interpolation, bilinear interpolation, bicubic interpolation, mean interpolation, median interpolation, copy interpolation, etc. Alternatively, the manner for up-sampling filtering can be any one of nonlinear interpolation methods, such as a wavelet transform-based interpolation algorithm or an edge information-based interpolation algorithm. Alternatively, up-sampling filtering can also be performed based on a convolutional neural network (CNN). Embodiments of the disclosure are not limited in this regard.
Further, after the reference sample value for the second colour component of the current block is determined, in some embodiments, for S1803, the first prediction block for the second colour component of the current block can be determined according to the weighting factor and the reference sample value for the second colour component of the current block as follows. A weighted value obtained by multiplying the reference sample value for the second colour component by a corresponding weighting factor is determined. A prediction value of a second-colour-component sample in the first prediction block is set to be equal to a sum of N weighted values, where N represents the number of reference sample values for the second colour component, and N is a positive integer.
That is, if the number of the reference sample values for the second colour component is N, a weighted value (namely wkCk) obtained by multiplying each reference sample value for the second colour component by a corresponding weighting factor is firstly determined, and then the sum of the N weighted values is used as the prediction value of the second-colour-component sample in the prediction block. Specifically, the formula for calculation is illustrated in the foregoing formula (16). It should be noted that, in this way, it is conducive to parallel processing and higher calculation speed.
In embodiments of the disclosure, it is assumed that the width of the first prediction block is predSizeW, the height of the first prediction block is predSizeH, the width of the current block is nTbW, and the height of the current block is nTbH, then predSizeH is less than or equal to nTbH, or predSizeW is less than or equal to nTbW. That is, the first prediction block includes predictions values of at least part of the second-colour-component samples in the current block.
S2004, first filtering is performed on the first prediction block to determine a second prediction block for the second colour component of the current block.
S2005, a reconstructed value of a second-colour-component sample in the current block is determined according to the second prediction block.
It should be noted that, in embodiments of the disclosure, if the first prediction block comprises prediction values of some of the second-colour-component samples in the current block, then up-sampling filtering is required for the first prediction block, to obtain the final second prediction block. Therefore, in some embodiments, “first filtering is performed on the first prediction block to determine the second prediction block for the second colour component of the current block” can include the following: up-sampling filtering is performed on the first prediction block to determine the second prediction block for the second colour component of the current block.
It should be noted that, in embodiments of the disclosure, if the number of prediction values of the second colour component in the second prediction block is the same as the second-colour-component samples in the current block, but the second prediction block does not include the prediction values of the second-colour-component samples in the current block, filtering enhancement needs to be performed on the prediction value to obtain the final second prediction block. Therefore, in some embodiments, “first filtering is performed on the first prediction block to determine the second prediction block for the second colour component of the current block” can include the following: filtering enhancement is performed on the first prediction block, to determine the second prediction block for the second colour component of the current block.
It should be noted that, in embodiments of the disclosure, if the first prediction block includes the prediction values of all the second-colour-component samples in the current block, no processing is required for the first prediction block, and the first prediction block can be used as the final second prediction block directly.
It should be noted that, in embodiments of the disclosure, the first filtering can be up-sampling filtering or can be filtering enhancement, which is not limited herein. For the second prediction block subject to the first filtering, the second prediction block includes the prediction values of all the second-colour-component samples in the current block.
Here, when the first filtering is up-sampling filtering, the up-sampling filtering can be performed on the first prediction block with a fourth filter. The fourth filter can be an up-sampling filter and can be the same as or different from the third filter. The fourth filter can be a neural network filter, which is not limited herein.
In some embodiments, the first filtering can be performed on the first prediction block to determine the second prediction block for the second colour component of the current block as follows. The first filtering includes up-sampling filtering, where an input of the up-sampling filtering is a first up-sampling input block, and an output of the up-sampling filtering is a first up-sampling output block.
Further, in some embodiments, the up-sampling filtering can be performed as follows. An up-sampling factor is determined, where the up-sampling factor includes at least one of a horizontal up-sampling factor or a vertical up-sampling factor. Up-sampling filtering is performed on the first up-sampling input block according to the up-sampling factor, to obtain the first up-sampling output block.
In a possible implementation, up-sampling filtering can be performed on the first up-sampling input block according to the up-sampling factor to obtain the first up-sampling output block as follows. If the horizontal up-sampling factor is greater than 1 or the vertical up-sampling factor is greater than 1, up-sampling filtering is performed on the first up-sampling input block to obtain the first up-sampling output block.
In embodiments of the disclosure, performing up-sampling filtering on the first up-sampling input block includes at least one of: performing up-sampling filtering on the first up-sampling input block in a horizontal direction; performing up-sampling filtering on the first up-sampling input block in a vertical direction; performing up-sampling filtering on the first up-sampling input block in a horizontal direction and then in a vertical direction; or performing up-sampling filtering on the first up-sampling input block in a vertical direction and then in a horizontal direction.
Here, the horizontal up-sampling factor can be calculated according to the width of the first up-sampling input block and the width of the first up-sampling output block, and the vertical up-sampling factor can be calculated according to the height of the first up-sampling input block and the height of the first up-sampling output block. Then up-sampling filtering is performed on the first up-sampling input block according to the horizontal up-sampling factor and the vertical up-sampling factor. Specifically, if the horizontal up-sampling factor is greater than 1 and the vertical up-sampling factor is equal to 1, only horizontal up-sampling needs to be performed on the first up-sampling input block. If the horizontal up-sampling factor is equal to 1 and the vertical up-sampling factor is greater than 1, only vertical up-sampling needs to be performed on the first up-sampling input block. If the horizontal up-sampling factor is greater than 1 and the vertical up-sampling factor is greater than 1, both horizontal up-sampling and vertical up-sampling need to be performed on the first up-sampling input block. Firstly, horizontal up-sampling and then vertical up-sampling can be performed, or firstly vertical up-sampling and then horizontal up-sampling can be performed, or the up-sampling filtering operation herein can even be replaced by a convolution operation in a neural network structure, which is not limited in embodiments of the disclosure.
In another possible implementation, up-sampling filtering is performed on the first prediction block to determine the second prediction block. In this case, the method can further include the following. The first prediction block is taken as the first up-sampling input block, and the first up-sampling output block is taken as the second prediction block for the second colour component of the current block.
In another possible implementation, firstly enhancement filtering and then up-sampling filtering are performed on the first prediction block to determine the second prediction block. In this case, the method can further include the following. Filtering enhancement is performed on the first prediction block to determine a first enhanced prediction block. The first enhanced prediction block is taken as the first up-sampling input block, and the first up-sampling output block is taken as the second prediction block for the second colour component of the current block.
In another possible implementation, firstly up-sampling filtering and then enhancement filtering are performed on the first prediction block to determine the second prediction block. In this case, the method can further include the following. The first prediction block is taken as the first up-sampling input block, and the first up-sampling output block is taken as a first up-sampling-filtered prediction block. Filtering enhancement is performed on the first up-sampling-filtered prediction block, to determine the second prediction block for the second colour component of the current block.
In another possible implementation, firstly enhancement filtering, then up-sampling filtering, and then enhancement filtering is performed on the first prediction block, to determine the second prediction block. In this case, the method can further include the following. First filtering enhancement is performed on the first prediction block to determine a second enhanced prediction block. The second enhanced prediction block is taken as the first up-sampling input block, and the first up-sampling output block is taken as a second up-sampling-filtered prediction block. Second filtering enhancement is performed on the second up-sampling-filtered prediction block, to determine the second prediction block for the second colour component of the current block.
It should be noted that, when the first filtering is up-sampling filtering, the up-sampling filtering can be performed on the first prediction block with a horizontal up-sampling factor and a vertical up-sampling factor. In some embodiments, the up-sampling filtering is performed on the first prediction block to determine the second prediction block for the second colour component of the current block as follows: a horizontal up-sampling factor and a vertical up-sampling factor are determined; the up-sampling filtering is performed on the first prediction block with the horizontal up-sampling factor and the vertical up-sampling factor, to obtain the second prediction block for the second colour component of the current block.
In some embodiments, the up-sampling filtering is performed on the first prediction block with the horizontal up-sampling factor and the vertical up-sampling factor, to obtain the second prediction block for the second colour component of the current block, as follows: if the horizontal up-sampling factor is greater than 1, or the vertical up-sampling factor is greater than 1, the up-sampling filtering is performed on the first prediction block, to obtain the second prediction block.
In embodiments of the disclosure, performing up-sampling filtering on the first up-sampling input block includes at least one of: performing up-sampling filtering on the first up-sampling input block in a horizontal direction; performing up-sampling filtering on the first up-sampling input block in a vertical direction; performing up-sampling filtering on the first up-sampling input block in a horizontal direction and then in a vertical direction; or performing up-sampling filtering on the first up-sampling input block in a vertical direction and then in a horizontal direction.
Here, the horizontal up-sampling factor can be calculated according to the width of the first prediction block and the width of the current block, and the vertical up-sampling factor can be calculated according to the height of the first prediction block and the height of the current block. Then, up-sampling filtering is performed on the first prediction block according to the horizontal up-sampling factor and the vertical up-sampling factor. Specifically, if the horizontal up-sampling factor is greater than 1 and the vertical up-sampling factor is equal to 1, only horizontal up-sampling needs to be performed on the first prediction block. If the horizontal up-sampling factor is equal to 1 and the vertical up-sampling factor is greater than 1, only vertical up-sampling needs to be performed on the first prediction block. If the horizontal up-sampling factor is greater than 1 and the vertical up-sampling factor is greater than 1, both horizontal up-sampling and vertical up-sampling need to be performed on the first prediction block. Firstly, horizontal up-sampling and then vertical up-sampling can be performed, or firstly vertical up-sampling and then horizontal up-sampling can be performed, or the up-sampling operation herein can even be replaced by a convolution operation in a neural network structure, which is not limited in embodiments of the disclosure.
In some embodiments, the up-sampling filtering is implemented by one of: linear interpolation, or convolution operation based on a preset neural network. That is, the up-sampling filtering can be implemented with different filters, such as a two-dimensional filter, a one-dimensional filter, etc. For the one-dimensional filter, the filtering order thereof can be “firstly in a vertical direction and then in a horizontal direction”, or “firstly in a horizontal direction and then in a vertical direction”. The above two orders can be fixed filtering order, or can be a flexible filtering order determined according some parameters (for example, a filtering order directly indicated by identifier information, an implicit order related to prediction mode or block size, etc.), and embodiments of the disclosure are not limited in this regard.
In another possible implementation, when the first filtering is filtering enhancement, the filtering enhancement can be implemented through bilateral filtering. Specifically, performing the first filtering on the first prediction block to determine the second prediction block for the second colour component of the current block includes: determining a first weight value for the first prediction block in a bilateral filtering mode, performing bilateral filtering on the first prediction block according to the first weight value, to obtain the second prediction block.
In embodiments of the disclosure, in addition to bilateral filtering, filtering enhancement processing can also include median filtering, Gaussian filtering, normalization filtering, and so on. That is to say, filtering enhancement processing can include at least one of the following: bilateral filtering processing, median filtering processing, Gaussian filtering processing, and normalization filtering processing, but is not specifically limited.
Further, in some embodiments, the method further includes: before performing up-sampling filtering on the first prediction block, performing filtering enhancement on the first prediction block, and using the enhanced first prediction block as the first prediction block.
Further, in some embodiments, the method further includes: after performing up-sampling filtering on the first prediction block, performing filtering enhancement on the first prediction block subject to up-sampling filtering, to obtain a second prediction block for a second colour component of the current block.
That is to say, in embodiments of the disclosure, the first filtering process can be up-sampling filtering or filtering enhancement, or the first filtering process may include both up-sampling filtering and filtering enhancement. In this case, the up-sampling filtering can be performed on the first prediction block first and then the filtering enhancement is performed, or the filtering enhancement can be performed on the first prediction block first and then the up-sampling filtering is performed, which is not limited herein.
For predSamples(i,j) obtained in formula (20), predSamples(i,j) may not be the final prediction value, but may be a prediction value subject to filtering enhancement before up-sampling (here, predSamples(i,j) is not the final prediction value), or may be a prediction value subject to up-sampling and filtering enhancement, or may be prediction value subject to filtering enhancement without up-sampling.
Further, for filtering enhancement, in some embodiments, the method further includes: determining a compensation value of a second-colour-component sample of the first prediction block, according to a reference sample value in a neighbouring area of the current block, and refining a prediction value of the second-colour-component sample of the first prediction block according to the compensation value, to determine the second prediction block.
It should be noted that, in order to further improve prediction accuracy of the WCP mode, position-related refinement can be performed on the first prediction block. For example, a chroma compensation value for each second-colour-component sample to-be-predicted is calculated by using a reference sample that is near in spatial position, the second-colour-component sample in the second prediction block is refined by using the chroma compensation value, and a final prediction value (predSamples) of the second-colour-component sample is determined according to the refined prediction value, thereby obtaining the final second prediction block.
For filtering enhancement, the method further includes: prediction is performed on the second-colour-component sample in the first prediction block according to at least one prediction mode, to determine at least one initial prediction value of the second-colour-component sample in the second prediction block. Weighted average calculation is performed on the at least one initial prediction value and the prediction value of the second-colour-component sample in the first prediction block to determine the second prediction block.
It should be noted that, in order to further improve prediction accuracy of the WCP mode, weighted average calculation can also be performed on a chroma prediction value(s) calculated in another prediction mode(s) and a chroma prediction value calculated in the WCP mode, and a final predicted chroma value is determined according to the weighted result. Alternatively, in order to improve prediction accuracy of the WCP mode, a neural network model can be used to refine the chroma prediction value calculated in WCP, and embodiments of the disclosure are not limited in this regard.
In some embodiments, as illustrated in
S2101, a prediction value of the second-colour-component sample in the current block is determined according to the second prediction block.
S2102, the residual value of the second-colour-component sample in the current block is determined according to an original value of the second-colour-component sample in the current block and the prediction value of the second-colour-component sample in the current block.
S2103, the residual value of the second-colour-component sample in the current block is encoded, and encoded bits obtained are signalled into a bitstream.
It should be noted that, in embodiments of the disclosure, the prediction value of the second-colour-component sample in the current block can be determined according to the second prediction block as follows. The prediction value of the second-colour-component sample in the current block can be set to be equal to a value of the second prediction block. Alternatively, up-sampling filtering can be performed on the value of the second prediction block, and the prediction value of the second-colour-component sample in the current block can be set to be equal to an output value after up-sampling filtering.
It should also be noted that, after the prediction value of the second-colour-component sample in the current block is determined, the residual value of the second-colour-component sample can be determined according to the original value of the second-colour-component sample and the prediction value of the second-colour-component sample. Specifically, the residual value of the second-colour-component sample can be determined by performing subtraction calculation on the original value of the second-colour-component sample and the prediction value of the second-colour-component sample. In this way, after the residual value of the second-colour-component sample is signaled into the bitstream, at a decoding end, the residual value of the second-colour-component sample can be obtained by decoding, so as to restore the reconstructed value of the second-colour-component sample in the current block.
It can be understood that, in embodiments of the disclosure, during prediction in the WCP mode, post-processing after the WCP prediction will be detailed below in four aspects. First, luma information of a reference sample and luma information of the current block are fully utilized, so as to realize calculation of a weighting factor of chrominance of the reference sample. Second, utilize the low sensitivity of human eyes to chromaticity and in order to reduce the complexity in calculation of the weighting factor of chrominance, core parameters of WCP mode is fully considered, that is, when predSizeW×predSizeH is less than or equal to nTbW×nTbH, up-sampling is performed on the chroma predication block. Third, when performing up-sampling, reference chroma information is fully utilized, and characteristics in different directions is considered; during linear interpolation, different weight values are assigned to different points to-be-interpolated between existing neighbouring points, as such, spatial correlation between the points to-be-interpolated and existing points are fully considered, which can improve the accuracy of up-sampling filtering. Fourth, consider the possibility of unstable and inaccurate prediction values caused by the chroma prediction block output by WCP prediction as well as inaccurate prediction values caused by up-sampling filtering, for the chroma prediction blocks in those cases, filtering enhancement is performed with bilateral filtering which can achieve edge preserving and denoising, so as to further improve the accuracy and subjective/objective quality of the chroma prediction block. It should be noted that, the above four aspects are not in any particular order, and can be used individually or in combination.
Embodiments of the disclosure provide an encoding method. The reference sample value for the first colour component of the current block is determined. The weighting factor is determined according to the reference sample value for the first colour component of the current block. The first prediction block for the second colour component of the current block is determined according to the weighting factor and the reference sample value for the second colour component of the current block. First filtering is performed on the first prediction block to determine the second prediction block for the second colour component of the current block, where the second prediction block comprises prediction values of all second-colour-component samples in the current block. The reconstructed value of the second-colour-component sample in the current block is determined according to the second prediction block. As such, the weighting factor can be calculated with aid of the reference sample neighbouring the current block and colour component information of the current block, correlation between the current block and neighbouring areas in terms of luma information is fully taken into consideration, and such correlation is used in chroma prediction of the current block, so as to improve accuracy of chroma prediction. Considering that human eyes have low sensitivity to chroma information and in order to reduce the complexity in calculating the weighting factor, when the size of the first prediction block is less than the size of the current block, up-sampling filtering is performed on the first prediction block. In addition, considering that the prediction value of the first prediction block is unstable, filtering enhancement can also be performed, so as to further improve accuracy as well as subjective and objective quality of chroma prediction, save bit-rate, and thus improve coding performance.
In another embodiment of the disclosure, embodiments of the disclosure further provide a bitstream. The bitstream is generated by performing bit encoding according to information to-be-encoded; The information to-be-encoded at least includes a residual value of a second-colour-component sample in a current block.
In embodiments of the disclosure, after the residual value of the second-colour-component sample in the current block is transmitted to a decoding end from encoding end, at the decoding end, the residual value of the second-colour-component sample is obtained by decoding, and then a reconstructed value of the second-colour-component sample in the current block can be restored according to a prediction value of the second-colour-component sample in the current block. Considering that human eyes have low sensitivity to chroma information and in order to reduce the complexity in calculating the weighting factor, when the size of the first prediction block is less than the size of the current block, up-sampling filtering is performed on the first prediction block. In addition, considering that the prediction value of the first prediction block is unstable, filtering enhancement can also be performed, so as to further improve accuracy as well as subjective and objective quality of chroma prediction, save bit-rate, and thus improve coding performance.
In still another embodiment of the disclosure, based on the same concept as the foregoing embodiment, referring to
In some embodiments, the first prediction block includes prediction values of at least part of the second-colour-component samples in the current block.
In some embodiments, the first determining unit 3001 is further configured to determine the reference sample value for the first colour component of the current block according to a value of a first-colour-component sample in a neighbouring area of the current block, where the neighbouring area includes at least one of: a top neighbouring area, a top-right neighbouring area, a left neighbouring area, or a bottom-left neighbouring area.
In some embodiments, the first determining unit 3001 is further configured to determine the value of the first-colour-component sample by selecting from first-colour-component samples in the neighbouring area.
In some embodiments, the first determining unit 3001 is further configured to determine a sample position to-be-selected according to a position and/or a colour component intensity of the first-colour-component sample in the neighbouring area; and determine the value of the first-colour-component sample from the neighbouring area according to the sample position to-be-selected.
In some embodiments, the first filtering unit 3003 is further configured to perform second filtering on the value of the first-colour-component sample to obtain a filtered neighbouring sample value for the first colour component of the current block; and determine the reference sample value for the first colour component of the current block according to the filtered neighbouring sample value for the first colour component of the current block.
In some embodiments, the number of filtered neighbouring sample values for the first colour component of the current block is less than the number of values of the first-colour-component samples.
In some embodiments, the first determining unit 3001 is further configured to determine the reference sample value for the first colour component of the current block based on a reconstructed value of a first-reference-colour-component sample in the current block.
In some embodiments, the reference sample value for the first colour component of the current block is set to an absolute value of a difference between the value of the first-colour-component sample and the reconstructed value of the first-reference-colour-component sample.
In some embodiments, the reference sample value for the first colour component of the current block is set to an absolute value of a difference between the filtered neighbouring sample value for the first colour component and the reconstructed value of the first-reference-colour-component sample.
In some embodiments, the first filtering unit 3003 is further configured to perform second filtering on the value of the first-colour-component sample to obtain a first colour of the current block, perform third filtering on a reconstructed value of a first-reference-colour-component sample in the current block to obtain a filtered sample value of the first-reference-colour-component sample in the current block; and determine the reference sample value for the first colour component of the current block according to the filtered sample value of the first-reference-colour-component sample in the current block.
In some embodiments, the number of filtered sample values of the first-reference-colour-component samples in the current block is less than the number of reconstructed values of the first-reference-colour-component samples in the current block.
In some embodiments, the reference sample value for the first colour component of the current block is set to an absolute value of a difference between a filtered neighbouring sample value for the first colour component and the filtered sample value of the first-reference-colour-component sample.
In some embodiments, the reference sample value for the first colour component of the current block is set to an absolute value of a difference between the value of the first-colour-component sample and the filtered sample value of the first-reference-colour-component sample.
In some embodiments, the first determining unit 3001 is further configured to determine a value corresponding to the reference sample value for the first colour component in a preset mapping; and set the weighting factor to be equal to the value.
In some embodiments, the first determining unit 3001 is further configured to determine a first factor; determine a first product value according to the first factor and the reference sample value for the first colour component; and determine a value corresponding to the first product value in the preset mapping.
In some embodiments, the first factor is a preset constant value.
In some embodiments, the first determining unit 3001 is further configured to determine a value of the first factor according to a size parameter of the current block, where the size parameter of the current block includes at least one of: a width of the current block, a height of the current block, or a product of the width and the height of the current block.
In some embodiments, the preset mapping is a Softmax function.
In some embodiments, the preset mapping is a weighting function that is in inverse proportion with the reference sample value for the first colour component.
In some embodiments, the first determining unit 3001 is further configured to determine the reference sample value for the second colour component of the current block according to a value of a second-colour-component sample in a neighbouring area of the current block.
In some embodiments, the first filtering unit 3003 is further configured to perform fourth filtering on the value of the second-colour-component sample in the neighbouring area of the current block, to obtain a filtered neighbouring sample value for the second colour component of the current block; and determine the reference sample value for the second colour component of the current block according to the filtered neighbouring sample value for the second colour component of the current block.
In some embodiments, the number of filtered neighbouring sample values for the second colour component of the current block is greater than the number of values of the second-colour-component samples in the neighbouring area of the current block.
In some embodiments, the fourth filtering is up-sampling filtering, where an up-sampling rate is a positive integer multiple of 2.
In some embodiments, the first filtering unit 3003 is further configured to perform fourth filtering on the value of the second-colour-component sample in the neighbouring area of the current block based on colour format information, to obtain the filtered neighbouring sample value for the second colour component of the current block.
In some embodiments, the first filtering unit 3003 is further configured to perform up-sampling filtering on the value of the second-colour-component sample in the neighbouring area of the current block if the colour format information indicates 4:2:0 sampling, where an up-sampling rate is a positive integer multiple of 2.
In some embodiments, the first predicting unit 3002 is further configured to determine a weighted value obtained by multiplying the reference sample value for the second colour component by a corresponding weighting factor; and set a prediction value of a second-colour-component sample in the first prediction block to be equal to a sum of N weighted values, where N represents the number of reference sample values for the second colour component, and N is a positive integer.
In some embodiments, the first filtering includes up-sampling filtering. An input of the up-sampling filtering is a first up-sampling input block, and an output of the up-sampling filtering is a first up-sampling output block. The first determining unit 3001 is further configured to determine an up-sampling factor, where the up-sampling factor comprises at least one of: a horizontal up-sampling factor, or a vertical up-sampling factor.
In some embodiments, the first filtering unit 3003 is further configured to perform up-sampling filtering on the first up-sampling input block according to the up-sampling factor, to obtain the first up-sampling output block.
In some embodiments, the first filtering unit 3003 is further configured to perform up-sampling filtering on the first up-sampling input block to obtain the first up-sampling output block, when the horizontal up-sampling factor is greater than 1 or the vertical up-sampling factor is greater than 1.
In some embodiments, the first filtering unit 3003 configured to perform up-sampling filtering on the first up-sampling input block is configured to implement at least one of the following: performing up-sampling filtering on the first up-sampling input block in a horizontal direction; performing up-sampling filtering on the first up-sampling input block in a vertical direction; performing up-sampling filtering on the first up-sampling input block in a horizontal direction and then in a vertical direction; performing up-sampling filtering on the first up-sampling input block in a vertical direction and then in a horizontal direction.
In some embodiments, the first filtering unit 3003 is further configured to use the first prediction block as the first up-sampling input block, and use the first up-sampling output block as a second prediction block for a second colour component of the current block.
In some embodiments, the first filtering unit 3003 is further configured to perform filtering enhancement on the first prediction block to obtain a first enhanced prediction block; use the first enhanced prediction block as the first up-sampling input block; and use the first up-sampling output block as a second prediction block for a second colour component of the current block.
In some embodiments, the first filtering unit 3003 is further configured to use the first enhanced prediction block as the first up-sampling input block; use the first up-sampling output block as a first up-sampling-filtering prediction block; and perform filtering enhancement on the first up-sampling-filtering prediction block, to determine a second prediction block for a second colour component of the current block.
In some embodiments, the first filtering unit 3003 is further configured to perform first filtering enhancement on the first prediction block to determine a second enhanced prediction block; use the second enhanced prediction block as the first up-sampling input block; use the first up-sampling output block as a second up-sampling-filtering prediction block; and perform second filtering enhancement on the second up-sampling-filtering prediction block, to determine a second prediction block for a second colour component of the current block.
In some embodiments, the first filtering unit 3003 is further configured to perform up-sampling filtering on the first prediction block to determine the second prediction block for the second colour component of the current block.
In some embodiments, the first filtering unit 3003 is further configured to determine the horizontal up-sampling factor and the vertical up-sampling factor, and perform up-sampling filtering on the first prediction block according to the horizontal up-sampling factor and the vertical up-sampling factor, to obtain the second prediction block for the second colour component of the current block.
In some embodiments, the first filtering unit 3003 is further configured to perform up-sampling filtering on the first up-sampling input block to obtain the first up-sampling output block, if the horizontal up-sampling factor is greater than 1 or the vertical up-sampling factor is greater than 1.
In some embodiments, the first filtering unit 3003 is further configured to perform at least one of the following up-sampling filtering process: performing up-sampling filtering on the first up-sampling input block in a horizontal direction; performing up-sampling filtering on the first up-sampling input block in a vertical direction; performing up-sampling filtering on the first up-sampling input block in a horizontal direction and then in a vertical direction; or performing up-sampling filtering on the first up-sampling input block in a vertical direction and then in a horizontal direction.
In some embodiments, the first filtering unit 3003 is further configured to perform filtering enhancement on the first prediction block before performing up-sampling filtering on the first prediction block, and use the enhanced first prediction block as the first prediction block.
In some embodiments, the first filtering unit 3003 is further configured to perform up-sampling filtering on the first prediction block and then perform filtering enhancement on the first prediction block subject to up-sampling filtering, to obtain the second prediction block for the second colour component of the current block.
In some embodiments, the up-sampling filtering is implemented by one of: linear interpolation, or convolution operation based on a preset neural network.
In some embodiments, the filtering enhancement comprises at least one of: bilateral filtering, median filtering, Gaussian filtering, normalized filtering, or neural network filtering.
In some embodiments, the first filtering unit 3003 is further configured to perform filtering enhancement on the first prediction block, to determine the second prediction block for the second colour component of the current block.
In some embodiments, the first filtering unit 3003 is further configured to determine a first weight value for the first prediction block in a bilateral filtering mode, and perform bilateral filtering on the first prediction block according to the first weight value, to obtain the second prediction block.
In some embodiments, the first predicting unit 3002 is further configured to determine a compensation value of a second-colour-component sample of the first prediction block, according to a reference sample value in a neighbouring area of the current block, and refine a prediction value of the second-colour-component sample of the first prediction block according to the compensation value, to determine the second prediction block.
In some embodiments, the first predicting unit 3002 is further configured to predict a second-colour-component sample of the first prediction block according to at least one prediction modes, to determine at least one initial prediction value of the second-colour-component sample of the first prediction block; and perform weighted average calculation on the at least one initial prediction value and the prediction value of the second-colour-component sample in the first prediction block to determine the second prediction block.
In some embodiments, the first determining unit 3001 is further configured to: determine a prediction value of the second-colour-component sample in the current block according to the second prediction block; and determine the residual value of the second-colour-component sample in the current block according to an original value of the second-colour-component sample in the current block and the prediction value of the second-colour-component sample in the current block.
In some embodiments, referring to
It can be understood that, in embodiments of the disclosure, the “unit” can be part of a circuit, part of a processor, part of a program or software, etc., or can be a module, or can be non-modular. In addition, various components in embodiments can be integrated into one processing unit or can be present as a number of physically separated units, and two or more units can be integrated into one. The integrated unit can be implemented in a form of hardware, or can be implemented in a form of software functional module.
If the integrated units are implemented as software functional modules and sold or used as standalone products, they can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of this embodiment essentially or partially contributes to the existing technology, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or processor to perform all or part of the steps of the method described in this embodiments. The aforementioned storage media include: USB flash drives, portable hard drives, read only memory (ROM), random access memory (RAM), magnetic disks or optical disks, and various other media that can store program code.
Therefore, embodiments provide a computer-readable storage medium. The computer-readable storage medium is applied to a decoding device 300. The computer-readable storage medium stores computer programs which, when executed by a first processor, are operable with the first processor to implement the method according to any one of the foregoing embodiments.
Based on the structure of the foregoing encoding apparatus 300 and the computer-readable storage medium, referring to
The first communication interface 3301 is configured for signal reception and transmission during information reception and transmission with other external network elements. The first memory 3302 is configured to store computer programs executable by the second processor 3103. The first processor 3103 is configured to execute the computer programs to implement the following steps: determining a reference sample value for a first colour component of a current block; determining a weighting factor according to the reference sample value for the first colour component of the current block; determining a first prediction block for a second colour component of the current block according to the weighting factor and a reference sample value for the second colour component of the current block; performing first filtering on the first prediction block to determine a second prediction block for the second colour component of the current block, wherein the second prediction block comprises prediction values of all second-colour-component samples in the current block; and determining a residual value of the second-colour-component sample in the current block according to the second prediction block.
It can be understood that, the first memory 3102 in embodiments of the disclosure can be a volatile memory or a non-volatile memory, or may include both the volatile memory and the non-volatile memory. The non-volatile memory can be a ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically EPROM (EEPROM), or flash memory. The volatile memory can be a RAM that acts as an external cache. By way of example but not limitation, many forms of RAM are available, such as a static RAM (SRAM), a dynamic RAM (DRAM), a synchronous DRAM (SDRAM), a double data rate SDRAM (DDR SDRAM), an enhanced SDRAM (ESDRAM), a synchlink DRAM (SLDRAM), and a direct rambus RAM (DR RAM). It should be noted that, the first memory 3102 of the systems and methods described in the disclosure is intended to include, but is not limited to, these and any other suitable types of memory.
The first processor 3103 can be an integrated circuit chip with signal processing capabilities. During implementation, each step of the foregoing method can be completed by an integrated logic circuit in hardware in the first processor 3103 or an instruction in the form of software. The first processor 3103 can 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, discrete gates or transistor logic devices, discrete hardware components. The methods, steps, and logic blocks disclosed in embodiments of the disclosure can be implemented or executed. The general-purpose processor can be a microprocessor, or the processor can be any conventional processor or the like. The steps of the method disclosed in embodiments of the disclosure can be directly implemented by a hardware decoding processor, or can be performed by hardware and software modules in the decoding processor. The software module can be located in a storage medium such as a RAM, a flash memory, a ROM, a PROM, or an electrically erasable programmable memory, registers, and the like. The storage medium is located in the first memory 3102, and the first processor 3103 reads information in the first memory 3102 and completes the steps of the foregoing with the hardware thereof.
It will be appreciated that embodiments described herein can be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit can be implemented in one or more application ASICs, DSPs, DSP devices (DSPDs), programmable logic devices (PLDs), FPGAs, general-purpose processors, controllers, micro-controllers, microprocessors, other electronic units for performing the functionality in the disclosure, or a combination thereof. For software implementation, the techniques described in the disclosure can be implemented by modules (e. g., procedures, functions, etc.) for performing the functionality in the disclosure. The software codes can be stored in the memory and executed by the processor. The memory can be implemented inside or external to the processor.
Optionally, as another embodiment, the first processor 3103 is further configured to execute the computer programs to implement the method described in any of the foregoing embodiments.
Embodiments provide an encoding device, and the encoding device can further include the encoding apparatus 300 according to any one of the foregoing embodiments. For the encoding device, considering that human eyes have low sensitivity to chroma information and in order to reduce the complexity in calculating the weighting factor, when the size of the first prediction block is less than the size of the current block, up-sampling filtering is performed on the first prediction block. In addition, considering that the prediction value of the first prediction block is unstable, filtering enhancement can also be performed, so as to further improve accuracy as well as subjective and objective quality of chroma prediction, save bit-rate, and thus improve coding performance.
Based on the same concept as the foregoing embodiment, referring to
In some embodiments, the first prediction block includes prediction values of at least part of the second-colour-component samples in the current block.
In some embodiments, the second determining unit 3201 is further configured to determine the reference sample value for the first colour component of the current block according to a value of a first-colour-component sample in a neighbouring area of the current block, where the neighbouring area includes at least one of: a top neighbouring area, a top-right neighbouring area, a left neighbouring area, or a bottom-left neighbouring area.
In some embodiments, the second determining unit 3201 is further configured to determine the value of the first-colour-component sample by selecting from first-colour-component samples in the neighbouring area.
In some embodiments, the second determining unit 3201 is further configured to determine a sample position to-be-selected according to a position and/or a colour component intensity of the first-colour-component sample in the neighbouring area; and determine the value of the first-colour-component sample from the neighbouring area according to the sample position to-be-selected.
In some embodiments, the second filtering unit 3203 is further configured to perform second filtering on the value of the first-colour-component sample to obtain a filtered neighbouring sample value for the first colour component of the current block; and determine the reference sample value for the first colour component of the current block according to the filtered neighbouring sample value for the first colour component of the current block.
In some embodiments, the number of filtered neighbouring sample values for the first colour component of the current block is less than the number of values of the first-colour-component samples.
In some embodiments, the second determining unit 3201 is further configured to determine the reference sample value for the first colour component of the current block based on a reconstructed value of a first-reference-colour-component sample in the current block.
In some embodiments, the reference sample value for the first colour component of the current block is set to an absolute value of a difference between the value of the first-colour-component sample and the reconstructed value of the first-reference-colour-component sample.
In some embodiments, the reference sample value for the first colour component of the current block is set to an absolute value of a difference between the filtered neighbouring sample value for the first colour component and the reconstructed value of the first-reference-colour-component sample.
In some embodiments, the second filtering unit 3203 is further configured to perform third filtering on a reconstructed value of a first-reference-colour-component sample in the current block to obtain a filtered sample value of the first-reference-colour-component sample in the current block; and determine the reference sample value for the first colour component of the current block according to the filtered sample value of the first-reference-colour-component sample in the current block.
In some embodiments, the number of filtered sample values of the first-reference-colour-component samples in the current block is less than the number of reconstructed values of the first-reference-colour-component samples in the current block.
In some embodiments, the reference sample value for the first colour component of the current block is set to an absolute value of a difference between a filtered neighbouring sample value for the first colour component and the filtered sample value of the first-reference-colour-component sample.
In some embodiments, the reference sample value for the first colour component of the current block is set to an absolute value of a difference between the value of the first-colour-component sample and the filtered sample value of the first-reference-colour-component sample.
In some embodiments, the second determining unit 3201 is further configured to determine a value corresponding to the reference sample value for the first colour component in a preset mapping; and set the weighting factor to be equal to the value.
In some embodiments, the second determining unit 3201 is further configured to determine a first factor; determine a first product value according to the first factor and the reference sample value for the first colour component; and determine a value corresponding to the first product value in the preset mapping.
In some embodiments, the first factor is a preset constant value.
In some embodiments, the second determining unit 3201 is further configured to determine a value of the first factor according to a size parameter of the current block, where the size parameter of the current block includes at least one of: a width of the current block, a height of the current block, or a product of the width and the height of the current block.
In some embodiments, the preset mapping is a Softmax function.
In some embodiments, the preset mapping is a weighting function that is in inverse proportion with the reference sample value for the first colour component.
In some embodiments, the second determining unit 3201 is further configured to determine the reference sample value for the second colour component of the current block according to a value of a second-colour-component sample in a neighbouring area of the current block.
In some embodiments, the second filtering unit 3203 is further configured to perform fourth filtering on the value of the second-colour-component sample in the neighbouring area of the current block, to obtain a filtered neighbouring sample value for the second colour component of the current block; and determine the reference sample value for the second colour component of the current block according to the filtered neighbouring sample value for the second colour component of the current block.
In some embodiments, the number of filtered neighbouring sample values for the second colour component of the current block is greater than the number of values of the second-colour-component samples in the neighbouring area of the current block.
In some embodiments, the fourth filtering is up-sampling filtering, where an up-sampling rate is a positive integer multiple of 2.
In some embodiments, the second filtering unit 3203 is further configured to perform fourth filtering on the value of the second-colour-component sample in the neighbouring area of the current block based on colour format information, to obtain the filtered neighbouring sample value for the second colour component of the current block.
In some embodiments, the second filtering unit 3203 is further configured to perform up-sampling filtering on the value of the second-colour-component sample in the neighbouring area of the current block if the colour format information indicates 4:2:0 sampling, where an up-sampling rate is a positive integer multiple of 2.
In some embodiments, the second predicting unit 3202 is further configured to determine a weighted value obtained by multiplying the reference sample value for the second colour component by a corresponding weighting factor; and set a prediction value of a second-colour-component sample in the first prediction block to be equal to a sum of N weighted values, where N represents the number of reference sample values for the second colour component, and N is a positive integer.
In some embodiments, the first filtering is up-sampling filtering. An input of the up-sampling filtering is a first up-sampling input block, and an output of the up-sampling filtering is a first up-sampling output block.
In some embodiments, the second determining unit 3201 is further configured to perform up-sampling filtering on the first up-sampling input block according to the up-sampling factor, to obtain the first up-sampling output block.
In some embodiments, the second filtering unit 3203 is further configured to perform up-sampling filtering on the first up-sampling input block to obtain the first up-sampling output block when the horizontal up-sampling factor is greater than 1 or the vertical up-sampling factor is greater than 1.
In some embodiments, the second filtering unit 3203 is further configured to perform up-sampling filtering on the first up-sampling input block. Perform up-sampling filtering includes at least one of: performing up-sampling filtering on the first up-sampling input block in a horizontal direction; performing up-sampling filtering on the first up-sampling input block in a vertical direction; performing up-sampling filtering on the first up-sampling input block in a horizontal direction and then in a vertical direction; or performing up-sampling filtering on the first up-sampling input block in a vertical direction and then in a horizontal direction.
In some embodiments, the second filtering unit 3203 is further configured to: use the first prediction block as the first up-sampling input block; and use the first up-sampling output block as a second prediction block for a second colour component of the current block.
In some embodiments, the second filtering unit 3203 is further configured to: perform filtering enhancement on the first prediction block to obtain a first enhanced prediction block; use the first enhanced prediction block as the first up-sampling input block; and use the first up-sampling output block as a second prediction block for a second colour component of the current block.
In some embodiments, the second filtering unit 3203 is further configured to: use the first prediction block as the first up-sampling input block; use the first up-sampling output block as a first up-sampling-filtering prediction block; and perform filtering enhancement on the first up-sampling-filtering prediction block, to determine a second prediction block for a second colour component of the current block.
In some embodiments embodiments, the second filtering unit 3203 is further configured to: perform first filtering enhancement on the first prediction block to determine a second enhanced prediction block; use the second enhanced prediction block as the first up-sampling input block; use the first up-sampling output block as a second up-sampling-filtering prediction block; and perform second filtering enhancement on the second up-sampling-filtering prediction block, to determine a second prediction block for a second colour component of the current block
In some embodiments, the second filtering unit 3203 is further configured to: perform the first filtering on the first prediction block to determine the second prediction block for the second colour component of the current block.
In some embodiments, the second filtering unit 3203 is further configured to: determine a horizontal up-sampling factor and a vertical up-sampling factor, and perform up-sampling filtering on the first up-sampling input block according to the horizontal up-sampling factor and the vertical up-sampling factor, to obtain a second prediction block for the second colour component of the current block
In some embodiments, the second filtering unit 3203 is further configured to: when the horizontal up-sampling factor is greater than 1 or the vertical up-sampling factor is greater than 1, performing up-sampling filtering on the first up-sampling input block to obtain the second prediction block.
In some embodiments, the second filtering unit 3203 is further configured to: performing up-sampling filtering on the first up-sampling input block. Performing up-sampling filtering includes at least one of: performing up-sampling filtering on the first up-sampling input block in a horizontal direction; performing up-sampling filtering on the first up-sampling input block in a vertical direction; performing up-sampling filtering on the first up-sampling input block in a horizontal direction and then in a vertical direction; or performing up-sampling filtering on the first up-sampling input block in a vertical direction and then in a horizontal direction.
In some embodiments, the second filtering unit 3203 is further configured to: before performing up-sampling filtering on the first prediction block, perform filtering enhancement on the first prediction block to obtain a first enhanced prediction block, and use the first enhanced prediction block as the first prediction block.
In some embodiments, the second filtering unit 3203 is further configured to: after performing up-sampling filtering on the first prediction block, performing filtering enhancement on the first prediction block obtained after up-sampling filtering, to obtain the second prediction block for the second colour component of the current block.
In some embodiments, the up-sampling filtering is implemented by one of: linear interpolation, or convolution operation based on a preset neural network.
In some embodiments, the filtering enhancement comprises at least one of: bilateral filtering, median filtering, Gaussian filtering, normalized filtering, or neural network filtering.
In some embodiments, the second filtering unit 3203 is further configured to: perform filtering enhancement on the first prediction block, to determine the second prediction block for the second colour component of the current block.
In some embodiments, the second filtering unit 3203 is further configured to: determine a first weight value for the first prediction block in a bilateral filtering mode, and perform bilateral filtering on the first prediction block according to the first weight value, to obtain the second prediction block.
In some embodiments, the second predicting unit 3203 is further configured to: determine a compensation value of a second-colour-component sample of the first prediction block, according to a reference sample value in a neighbouring area of the current block, and refine a prediction value of the second-colour-component sample of the first prediction block according to the compensation value, to determine the second prediction block.
In some embodiments, the second predicting unit 3202 is further configured to: predict a second-colour-component sample of the first prediction block according to at least one prediction modes, to determine at least one initial prediction value of the second-colour-component sample of the first prediction block; and perform weighted average calculation on the at least one initial prediction value and the prediction value of the second-colour-component sample in the first prediction block to determine the second prediction block.
In some embodiments, the second determining unit 3201 is further configured to: determine a residual value of the second-colour-component sample in the current block; determine a prediction value of the second-colour-component sample in the current block according to the second prediction block; and determine the reconstructed value of the second-colour-component sample in the current block according to the residual value of the second-colour-component sample in the current block and the prediction value of the second-colour-component sample in the current block.
In some embodiments, referring to
It can be understood that, in embodiments of the disclosure, the “unit” can be part of a circuit, part of a processor, part of a program or software, etc., or can be a module, or can be non-modular. In addition, various components in embodiments can be integrated into one processing unit or can be present as a number of physically separated units, and two or more units can be integrated into one. The integrated unit can be implemented in a form of hardware, or can be implemented in a form of software functional module.
If the integrated units are implemented as software functional modules and sold or used as standalone products, they can be stored in a computer-readable storage medium. Based on such an understanding, embodiments provide a computer-readable storage medium. The computer-readable storage medium is applied to a decoding device 320. The computer-readable storage medium stores computer programs which, when executed by a second processor, are operable with the second processor to implement the method according to any one of the foregoing embodiments.
Based on the structure of the foregoing decoding apparatus 320 and the computer-readable storage medium, referring to
Optionally, as another embodiment, the second processor 3303 is further configured to execute the computer programs to implement the method described in any of the foregoing embodiments.
It can be understood that the second memory 3302 has a hardware function similar to that of the first memory 3102, and the second processor 3303 has a hardware function similar to that of the first processor 3103, which are not described again herein.
Embodiments provide a decoding device, and the decoding device can further include the decoding apparatus 320 described in the foregoing embodiment. For the decoding device, considering that human eyes have low sensitivity to chroma information and in order to reduce the complexity in calculating the weighting factor, when the size of the first prediction block is less than the size of the current block, up-sampling filtering is performed on the first prediction block. In addition, considering that the prediction value of the first prediction block is unstable, filtering enhancement can also be performed, so as to further improve accuracy as well as subjective and objective quality of chroma prediction, save bit-rate, and thus improve coding performance.
In another embodiment of the disclosure, referring to
In embodiments of the disclosure, in the coding system 340, at the encoder 3401 or the decoder 3402, considering that human eyes have low sensitivity to chroma and in order to reduce the complexity in calculating the weighting factor, when the size of the first prediction block is less than the size of the current block, up-sampling filtering is performed on the first prediction block. In addition, considering that the prediction value of the first prediction block is unstable, filtering enhancement can also be performed, so as to further improve accuracy as well as subjective and objective quality of chroma prediction, save bit-rate, and thus improve coding performance.
Embodiments of the disclosure provide a coding method and apparatus, an encoding device, a decoding device, and a storage medium. At an encoding end or at a decoding end, the reference sample value for the first colour component of the current block is determined. The weighting factor is determined according to the reference sample value for the first colour component of the current block. The first prediction block for the second colour component of the current block is determined according to the weighting factor and the reference sample value for the second colour component of the current block. First filtering is performed on the first prediction block to determine the second prediction block for the second colour component of the current block, where the second prediction block comprises prediction values of all second-colour-component samples in the current block. In this way, at the encoding end, the residual value of the second-colour-component sample in the current block can be determined according to the second prediction block, such that at the decoding end, the reconstructed value of the second-colour-component sample in the current block can be determined according to the second prediction block. As such, the weighting factor can be calculated with aid of the reference sample neighbouring the current block and colour component information of the current block, correlation between the current block and neighbouring areas in terms of luma information is fully taken into consideration, and such correlation is used in chroma prediction of the current block, so as to improve accuracy of chroma prediction. Considering that human eyes have low sensitivity to chroma information and in order to reduce the complexity in calculating the weighting factor, when the size of the first prediction block is less than the size of the current block, up-sampling filtering is performed on the first prediction block. In addition, considering that the prediction value of the first prediction block is unstable, filtering enhancement can also be performed, so as to further improve accuracy as well as subjective and objective quality of chroma prediction, save bit-rate, and thus improve coding performance.
It should be noted that, in the disclosure, the terms “include”, “comprise”, and “have” as well as variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or apparatus that includes a series of elements not only includes those elements, but also includes other elements that are not explicitly listed, or further includes elements inherent to the process, method, article, or apparatus. Unless there are other limitations, an element limited by “including a . . . ” does not exclude the case where there are other same elements in the process, method, article, or apparatus that includes the element.
The sequential numbers in embodiments of the disclosure are only for illustration, and do not indicate the preference of embodiments.
The methods disclosed in the method embodiments of the disclosure can be combined arbitrarily without conflicts to obtain new method embodiments.
The features disclosed in the product embodiments of the disclosure can be combined arbitrarily without conflicts to obtain new product embodiments.
The features disclosed in the several method embodiments or device embodiments of the disclosure can be arbitrarily combined without conflicts to obtain new method embodiments or device embodiments.
The foregoing elaborations are merely implementations of the disclosure, but are not intended to limit the protection scope of the disclosure. Any variation or replacement easily thought of by those skilled in the art within the technical scope disclosed in the disclosure shall belong to the protection scope of the disclosure. Therefore, the protection scope of the disclosure shall be subject to the protection scope of the claims.
In embodiments of the disclosure, at an encoding end or at a decoding end, a reference sample value for a first colour component of a current block is determined. A weighting factor is determined according to the reference sample value for the first colour component of the current block. A first prediction block for a second colour component of the current block is determined according to the weighting factor and a reference sample value for the second colour component of the current block. First filtering is performed on the first prediction block to determine a second prediction block for the second colour component of the current block, where the second prediction block comprises prediction values of all second-colour-component samples in the current block. In this way, at the encoding end, a residual value of a second-colour-component sample in the current block can be determined according to the second prediction block and then the residual value is signaled into a bitstream, such that at the decoding end, a reconstructed value of the second-colour-component sample in the current block can be determined according to the second prediction block and the residual value obtained by decoding. As such, with aid of a reference sample neighbouring the current block and colour component information of the current block. In this way, the weighting factor can be calculated with aid of the reference sample neighbouring the current block and colour component information of the current block, correlation between the current block and neighbouring areas in terms of luma information is fully taken into consideration, and such correlation is used in chroma prediction of the current block, so as to improve accuracy of chroma prediction. Considering that human eyes have low sensitivity to chroma and in order to reduce the complexity in calculating the weighting factor, when the size of the first prediction block is less than the size of the current block, up-sampling filtering is performed on the first prediction block. In addition, considering that the prediction value of the first prediction block is unstable, filtering enhancement can also be performed, so as to further improve accuracy as well as subjective and objective quality of chroma prediction, save bit-rate, improve coding efficiency, and thus improve coding performance.
This application is a continuation of International Application No. PCT/CN2022/086467, filed Apr. 12, 2022, the entire disclosure of which is incorporated herein by reference.
Number | Date | Country | |
---|---|---|---|
Parent | PCT/CN2022/086467 | Apr 2022 | WO |
Child | 18909593 | US |