Encoding and decoding method and device, encoding equipment, decoding equipment and storage medium

CN119013981APending Publication Date: 2024-11-22GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202280094570.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2022-04-12
Publication Date
2024-11-22

AI Technical Summary

Technical Problem

There is a large deviation between the coding block prediction value calculated by H.266/VVC's inter-color component prediction technology and the original value, resulting in low prediction accuracy and affecting decoded video quality and encoding performance.

Method used

By determining the reference sample value of the first color component of the current block, calculating the weighting coefficient, and determining the prediction block of the second color component based on the weighting coefficient and the reference sample value of the second color component, filtering is performed to improve the accuracy of chroma prediction. performance and subjective and objective quality, save bit rate, and improve encoding and decoding performance.

Benefits of technology

It improves the accuracy of chroma prediction and encoding and decoding performance, reduces the bit rate, and enhances video decoding quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119013981A_ABST
    Figure CN119013981A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a coding and decoding method and device, coding equipment, decoding equipment and a storage medium. The method comprises the following steps: determining a reference sample value of a first color component of a current block; determining a weighting coefficient according to the reference sample value of the first color component of the current block; determining a first prediction block of a second color component of the current block according to the weighting coefficient and a reference sample value of the second color component of the current block; performing first filtering processing on the first prediction block, and determining a second prediction block of a second color component of the current block; wherein the second prediction block comprises prediction values of all second color component sampling points in the current block; and determining a reconstruction value of a second color component sampling point of the current block according to the second prediction block. Therefore, the chroma prediction accuracy can be improved, the code rate can be saved, and the coding and decoding performance can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Coding and decoding method, device, encoding device, decoding device and storage medium Technical Field

[0001] The embodiments of the present application relate to the field of video coding and decoding technology, and in particular to a coding and decoding method, apparatus, encoding device, decoding device, and storage medium. Background Art

[0002] As demand for video display quality increases, new video applications such as high-definition and ultra-high-definition video are emerging. The Joint Video Exploration Team (JVET) of the international standards organizations ISO / IEC and ITU-T has developed the next-generation video coding standard H.266 / Versatile Video Coding (VVC).

[0003] H.266 / VVC includes inter-color prediction technology. However, the predicted values ​​of coding blocks calculated by this technology deviate significantly from the original values. This results in low prediction accuracy, degraded decoded video quality, and reduced encoding performance.

[0004] Summary of the Invention

[0005] The embodiments of the present application provide a coding and decoding method, apparatus, coding device, decoding device, and storage medium, which can not only improve the accuracy of chrominance prediction and save bit rate, but also improve coding and decoding performance.

[0006] The technical solution of the embodiment of the present application can be implemented as follows:

[0007] In a first aspect, an embodiment of the present application provides a decoding method, comprising:

[0008] Determining a reference sample value of a first color component of a current block;

[0009] Determining a weighting coefficient according to a reference sample value of a first color component of a current block;

[0010] Determining a first prediction block of the second color component of the current block according to the weighting coefficient and the reference sample value of the second color component of the current block;

[0011] Performing a first filtering process on the first prediction block to determine a second prediction block of the second color component of the current block; wherein the second prediction block includes prediction values ​​of all second color component sampling points in the current block;

[0012] Determine a reconstructed value of a second color component sampling point of the current block according to the second prediction block.

[0013] In a second aspect, an embodiment of the present application provides an encoding method, including:

[0014] Determining a reference sample value of a first color component of a current block;

[0015] Determining a weighting coefficient according to a reference sample value of a first color component of a current block;

[0016] Determining a first prediction block of the second color component of the current block according to the weighting coefficient and the reference sample value of the second color component of the current block;

[0017] Performing a first filtering process on the first prediction block to determine a second prediction block of the second color component of the current block; wherein the second prediction block includes prediction values ​​of all second color component sampling points in the current block;

[0018] Determine a prediction difference value of a second color component sampling point of the current block according to the second prediction block.

[0019] In a third aspect, an embodiment of the present application provides an encoding device, comprising a first determining unit, a first predicting unit, and a first filtering unit; wherein,

[0020] A first determining unit is configured to determine a reference sample value of a first color component of a current block; and determine a weighting coefficient according to the reference sample value of the first color component of the current block;

[0021] a first prediction unit configured to determine a first prediction block of the second color component of the current block according to the weighting coefficient and the reference sample value of the second color component of the current block;

[0022] a first filtering unit configured to perform a first filtering process on the first prediction block to determine a second prediction block of the second color component of the current block; wherein the second prediction block includes prediction values ​​of all second color component sampling points in the current block;

[0023] The first determining unit is further configured to determine a prediction difference value of a second color component sampling point of the current block according to the second prediction block.

[0024] In a fourth aspect, an embodiment of the present application provides an encoding device, comprising a first memory and a first processor; wherein,

[0025] a first memory for storing a computer program capable of running on the first processor;

[0026] The first processor is configured to execute the method according to the second aspect when running a computer program.

[0027] In a fifth aspect, an embodiment of the present application provides a decoding device, comprising a second determining unit, a second predicting unit, and a second filtering unit; wherein,

[0028] a second determining unit configured to determine a reference sample value of the first color component of the current block; and determine a weighting coefficient according to the reference sample value of the first color component of the current block;

[0029] a second prediction unit configured to determine a first prediction block of the second color component of the current block according to the weighting coefficient and a reference sample value of the second color component of the current block;

[0030] a second filtering unit configured to perform a first filtering process on the first prediction block to determine a second prediction block of the second color component of the current block; wherein the second prediction block includes prediction values ​​of all second color component sampling points in the current block;

[0031] The second determining unit is further configured to determine the reconstructed value of the second color component sampling point of the current block according to the second prediction block.

[0032] In a sixth aspect, an embodiment of the present application provides a decoding device, including a second memory and a second processor; wherein,

[0033] a second memory for storing a computer program capable of running on the second processor;

[0034] The second processor is configured to execute the method according to the first aspect when running a computer program.

[0035] In a seventh aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed, it implements the method described in the first aspect or the method described in the second aspect.

[0036] The embodiments of the present application provide a coding and decoding method, apparatus, coding device, decoding device, and storage medium. Whether at the coding end or the decoding end, the method determines the reference sample value of the first color component of the current block; determines a weighting coefficient based on the reference sample value of the first color component of the current block; determines a first prediction block of the second color component of the current block based on the weighting coefficient and the reference sample value of the second color component of the current block; performs a first filtering process on the first prediction block to determine a second prediction block of the second color component of the current block; wherein the second prediction block includes the prediction values ​​of all the second color component sampling points in the current block. In this way, the coding end can determine the prediction difference of the second color component sampling points of the current block based on the second prediction block; so that at the decoding end, the reconstructed value of the second color component sampling points of the current block can be determined based on the second prediction block. In this way, the weighting coefficients are calculated using the reference pixels adjacent to the current block and the color component information of the current block, which fully exploits the correlation between the brightness information of the current block and the adjacent areas, and involves this correlation in the chrominance prediction of the current block, thereby improving the accuracy of the chrominance prediction; in addition, the human eye has a low sensitivity to chrominance, and in order to reduce the calculation complexity of the weighting coefficients, the first prediction block is upsampled and filtered when the first prediction block is smaller than the size of the current block; even considering the instability of the predicted value of the first prediction block, it can also be filtered and enhanced, thereby further improving the accuracy and subjective and objective quality of the chrominance prediction, saving bit rate, and improving the encoding and decoding performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] FIG1 is a schematic diagram showing the distribution of effective adjacent areas;

[0038] FIG2 is a schematic diagram showing the distribution of selected areas under different prediction modes;

[0039] FIG3 is a flow chart of a model parameter derivation scheme;

[0040] FIG4A is a schematic block diagram of an encoder provided in an embodiment of the present application;

[0041] FIG4B is a schematic block diagram of a decoder according to an embodiment of the present application;

[0042] FIG5 is a flowchart of a decoding method according to an embodiment of the present application;

[0043] FIG6A is a schematic diagram of a reference area of ​​a current block provided by an embodiment of the present application;

[0044] FIG6B is a schematic diagram of upsampling and interpolation of reference chrominance information provided in an embodiment of the present application;

[0045] FIG7 is a schematic diagram of a filter position provided in an embodiment of the present application;

[0046] FIG8 is a schematic diagram of weighted prediction of a WCP mode and other prediction modes provided in an embodiment of the present application;

[0047] FIG9 is a schematic diagram of a framework of weighted chrominance prediction provided by an embodiment of the present application;

[0048] FIG10 is a second flow chart of a decoding method provided in an embodiment of the present application;

[0049] FIG11 is a third flow chart of a decoding method provided in an embodiment of the present application;

[0050] FIG12 is a fourth flow chart of a decoding method provided in an embodiment of the present application;

[0051] FIG13 is a first schematic diagram of an upsampling interpolation processing process provided by an embodiment of the present application;

[0052] FIG14 is a second schematic diagram of an upsampling interpolation processing process provided by an embodiment of the present application;

[0053] FIG15 is a schematic diagram of weight values ​​for upsampling interpolation provided in an embodiment of the present application;

[0054] FIG16 is a third schematic diagram of an upsampling interpolation processing process provided by an embodiment of the present application;

[0055] FIG17 is a first schematic diagram of another upsampling interpolation processing process provided by an embodiment of the present application;

[0056] FIG18 is a schematic diagram of another weight value for upsampling interpolation provided in an embodiment of the present application;

[0057] FIG19 is a second schematic diagram of another upsampling interpolation processing process provided by an embodiment of the present application;

[0058] FIG20 is a flowchart diagram 1 of an encoding method provided in an embodiment of the present application;

[0059] FIG21 is a second flow chart of an encoding method provided in an embodiment of the present application;

[0060] FIG22 is a schematic diagram of the composition structure of an encoding device provided in an embodiment of the present application;

[0061] FIG23 is a schematic diagram of a specific hardware structure of an encoding device provided in an embodiment of the present application;

[0062] FIG24 is a schematic diagram of the structure of a decoding device provided in an embodiment of the present application;

[0063] FIG25 is a schematic diagram of a specific hardware structure of a decoding device provided in an embodiment of the present application;

[0064] FIG26 is a schematic diagram of the composition structure of a coding and decoding system provided in an embodiment of the present application. DETAILED DESCRIPTION

[0065] In order to enable a more detailed understanding of the features and technical contents of the embodiments of the present application, the implementation of the embodiments of the present application is described in detail below with reference to the accompanying drawings. The attached drawings are for reference only and are not used to limit the embodiments of the present application.

[0066] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this application pertains. The terms used herein are for the purpose of describing the embodiments of this application only and are not intended to limit this application.

[0067] In the following description, reference is made to "some embodiments," which describe a subset of all possible embodiments. However, it is understood that "some embodiments" may be the same subset or different subsets of all possible embodiments, and may be combined with each other without conflict. It should also be noted that the terms "first, second, and third" in the embodiments of the present application are only used to distinguish similar objects and do not represent a specific ordering of the objects. It is understood that "first, second, and third" may be interchanged in a specific order or sequential order where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.

[0068] In a video image, a first color component, a second color component, and a third color component are generally used to represent a coding block (CB); wherein the three color components are a luminance component, a blue chrominance component, and a red chrominance component. For example, the luminance component is usually represented by the symbol Y, the blue chrominance component is usually represented by the symbol Cb or U, and the red chrominance component is usually represented by the symbol Cr or V; thus, the video image can be represented in YCbCr format or YUV format. In addition, the video image can also be in RGB format, YCgCo format, etc., which is not limited in the embodiments of the present application.

[0069] It can be understood that in the current video image or video encoding and decoding process, the cross-component prediction technology mainly includes the cross-component linear model (CCLM) prediction mode and the multi-directional linear model (MDLM) prediction mode. Regardless of the model parameters derived according to the CCLM prediction mode or the model parameters derived according to the MDLM prediction mode, the corresponding prediction models can realize the prediction between color components such as the first color component to the second color component, the second color component to the first color component, the first color component to the third color component, the third color component to the first color component, the second color component to the third color component, or the third color component to the second color component.

[0070] Taking the prediction from the first color component to the second color component as an example, assuming that the first color component is the luminance component and the second color component is the chrominance component, in order to reduce the redundancy between the luminance component and the chrominance component, the CCLM prediction mode is used in VVC, that is, the chrominance prediction value is constructed according to the luminance reconstruction value of the same coding block, such as: Pred C (i, j) = α·Rec L (i,j)+β.

[0071] Among them, i, j represent the position coordinates of the pixel to be predicted in the coding block, i represents the horizontal direction, and j represents the vertical direction; Pred C (i, j) represents the chroma prediction value corresponding to the pixel to be predicted at the position coordinate (i, j) in the coding block, Rec L (i, j) represents the reconstructed brightness value of the pixel to be predicted at position (i, j) in the same coding block (after downsampling). In addition, α and β represent model parameters, which can be derived from the reference pixels.

[0072] For a coding block, its adjacent areas can be divided into five parts: the left adjacent area, the upper adjacent area, the lower left adjacent area, the upper left adjacent area, and the upper right adjacent area. H.266 / VVC includes three cross-component linear model prediction modes, namely: the left and upper adjacent intra-frame CCLM prediction mode (which can be represented by INTRA_LT_CCLM), the left and lower left adjacent intra-frame CCLM prediction mode (which can be represented by INTRA_L_CCLM), and the upper and upper right adjacent intra-frame CCLM prediction mode (which can be represented by INTRA_T_CCLM). In these three prediction modes, each prediction mode can select a preset number (for example, 4) of reference pixels for the derivation of model parameters α and β. The biggest difference between these three prediction modes is that the selected areas corresponding to the reference pixels used to derive the model parameters α and β are different.

[0073] Specifically, for the coding block size corresponding to the chrominance component is W×H, assuming that the upper selection area corresponding to the reference pixel is W′, and the left selection area corresponding to the reference pixel is H′; thus,

[0074] For INTRA_LT_CCLM mode, the reference pixels can be selected from the upper adjacent area and the left adjacent area, that is, W′=W, H′=H;

[0075] For INTRA_L_CCLM mode, the reference pixel can be selected from the left adjacent area and the lower left adjacent area, that is, H′=W+H, and set W′=0;

[0076] For the INTRA_T_CCLM mode, reference pixels may be selected from the upper adjacent area and the upper right adjacent area, ie, W′=W+H, and H′=0.

[0077] It should be noted that in VTM, only pixels in the W range are stored in the upper right adjacent area, and only pixels in the H range are stored in the lower left adjacent area. Although the selection area of ​​INTRA_L_CCLM mode and INTRA_T_CCLM mode is defined as W+H, in actual application, the selection area of ​​INTRA_L_CCLM mode will be limited to H+H, and the selection area of ​​INTRA_T_CCLM mode will be limited to W+W; thus,

[0078] For INTRA_L_CCLM mode, the reference pixels can be selected from the left adjacent area and the lower left adjacent area, H′=min{W+H,H+H};

[0079] For the INTRA_T_CCLM mode, reference pixels can be selected from the upper adjacent area and the upper right adjacent area, where W′=min{W+H,W+W}.

[0080] See Figure 1, which shows a schematic diagram of the distribution of valid adjacent regions. In Figure 1, the left adjacent region, the lower left adjacent region, the upper adjacent region, and the upper right adjacent region are all valid; in addition, the gray-filled block is the pixel to be predicted at position (i, j) in the coding block.

[0081] Thus, based on Figure 1, the selection areas for the three prediction modes are shown in Figure 2. In Figure 2, (a) represents the selection area for the INTRA_LT_CCLM mode, including the left adjacent area and the upper adjacent area; (b) represents the selection area for the INTRA_L_CCLM mode, including the left adjacent area and the lower left adjacent area; (c) represents the selection area for the INTRA_T_CCLM mode, including the upper adjacent area and the upper right adjacent area. In this way, after determining the selection areas for the three prediction modes, pixels for model parameter derivation can be selected within the selection areas. The pixels selected in this way can be called reference pixels, and the number of reference pixels is usually 4; and for a W×H coding block of a certain size, the positions of its reference pixels are generally fixed.

[0082] After obtaining a preset number of reference pixels, chrominance prediction is currently performed according to the flow diagram of the model parameter derivation scheme shown in Figure 3. According to the process shown in Figure 3, assuming that the preset number is 4, the process may include:

[0083] S301: Acquire reference pixels in a selected area.

[0084] S302: Determine the number of valid reference pixels.

[0085] S303: If the number of valid reference pixels is 0, the model parameter α is set to 0 and β is set to a default value.

[0086] S304: The chroma prediction value is filled with a default value.

[0087] S305: If the number of valid reference pixels is 4, two reference pixels with larger values ​​and two reference pixels with smaller values ​​in the luminance component are obtained through comparison.

[0088] S306: Calculate the mean point corresponding to the larger value and the mean point corresponding to the smaller value.

[0089] S307: Derivation of model parameters α and β based on the two mean points.

[0090] S308: Perform chroma prediction using the prediction model constructed using α and β.

[0091] It should be noted that in VVC, the step of valid reference pixels being 0 is judged based on the validity of adjacent areas.

[0092] It should also be noted that the prediction model is constructed using the principle of "two points determine a straight line". The two points here can be called fitting points. In the current technical solution, after obtaining 4 reference pixels, the two reference pixels with larger values ​​and the two reference pixels with smaller values ​​in the brightness component are obtained through comparison; then, a mean point (which can be used as mean) is obtained based on the two reference pixels with larger values. max According to the two reference pixels with smaller values, another mean point is obtained (mean can be used min Represents), we can get two mean points mean max and mean min ; Then mean max and mean min As two fitting points, model parameters (represented by α and β) can be derived; finally, a prediction model is constructed based on α and β, and prediction processing of the chrominance component is performed based on the prediction model.

[0093] However, in the related art, a simple linear model Pred is used for each coding block. C (i, j) = α·Rec L (i, j) + β to predict the chrominance component, and the same model parameters α and β are used for all pixels at any position in each coding block. This leads to the following drawbacks: First, coding blocks with different content characteristics all use a simple linear model to map luminance to chrominance to achieve chrominance prediction. However, not every luminance-to-chrominance mapping function within a coding block can be accurately fitted by this simple linear model, resulting in inaccurate prediction for some coding blocks. Second, during the prediction process, the same model parameters α and β are used for pixels at different positions within the coding block, resulting in significant variation in prediction accuracy. Third, if the linear model is not properly established, directly using the inaccurate chrominance prediction block as the final chrominance prediction block will affect the subjective and objective quality of the reconstructed block. Third, in CCLM technology, the same linear mapping function is used to predict chrominance values ​​for all pixels in the coding block. However, the color components within the same coding block are generally flat and have similar content characteristics. In this case, if prediction is still performed for all points in the coding block, the prediction complexity increases and the prediction efficiency is significantly reduced. Simply put, under the current CCLM technology, there is a large deviation between the predicted values ​​and the original values ​​of some coding blocks, resulting in low prediction accuracy and quality degradation.

[0094] Based on this, an embodiment of the present application provides an encoding method, which determines a reference sample value of the first color component of the current block; determines a weighting coefficient based on the reference sample value of the first color component of the current block; determines a first prediction block of the second color component of the current block based on the weighting coefficient and the reference sample value of the second color component of the current block; performs a first filtering process on the first prediction block to determine a second prediction block of the second color component of the current block; wherein the second prediction block includes the prediction values ​​of all the second color component sampling points in the current block; and determines the prediction difference values ​​of the second color component sampling points of the current block based on the second prediction block.

[0095] An embodiment of the present application also provides a decoding method, which determines a reference sample value of a first color component of a current block; determines a weighting coefficient based on the reference sample value of the first color component of the current block; determines a first prediction block of a second color component of the current block based on the weighting coefficient and the reference sample value of the second color component of the current block; performs a first filtering process on the first prediction block to determine a second prediction block of the second color component of the current block; wherein the second prediction block includes the prediction values ​​of all the second color component sampling points in the current block; and determines the reconstructed values ​​of the second color component sampling points of the current block based on the second prediction block.

[0096] In this way, the weighting coefficients are calculated using the reference pixels adjacent to the current block and the color component information of the current block, which fully exploits the correlation between the current block and the adjacent areas in brightness information, and involves this correlation in the chrominance prediction of the current block, thereby improving the accuracy of the chrominance prediction; in addition, utilizing the characteristics of the human eye's low sensitivity to chrominance, and in order to reduce the calculation complexity of the weighting coefficients, the first prediction block is upsampled and filtered when the first prediction block is smaller than the size of the current block; even considering the instability of the predicted value of the first prediction block, it can also be filtered and enhanced, thereby further improving the accuracy and subjective and objective quality of the chrominance prediction, saving bit rate, improving encoding and decoding efficiency, and thus improving encoding and decoding performance.

[0097] The embodiments of the present application will be described in detail below with reference to the accompanying drawings.

[0098] Referring to FIG4A , which shows a schematic block diagram of the composition of an encoder provided in an embodiment of the present application. As shown in FIG4A , the encoder (specifically, a “video encoder”) 100 may include a transform and quantization unit 101, an intra-frame estimation unit 102, an intra-frame prediction unit 103, a motion compensation unit 104, a motion estimation unit 105, an inverse transform and inverse quantization unit 106, a filter control analysis unit 107, a filtering unit 108, an encoding unit 109, and a decoded image cache unit 110, etc., wherein the filtering unit 108 can implement deblocking filtering and sample adaptive offset (SAO) filtering, and the encoding unit 109 can implement header information encoding and context-based adaptive binary arithmetic coding (CABAC).For the input original video signal, a video coding block can be obtained by dividing it into coding tree units (CTUs). Then, the residual pixel information obtained after intra-frame or inter-frame prediction is transformed by the transform and quantization unit 101, including transforming the residual information from the pixel domain to the transform domain and quantizing the obtained transform coefficients to further reduce the bit rate; the intra-frame estimation unit 102 and the intra-frame prediction unit 103 are used to perform intra-frame prediction on the video coding block; specifically, the intra-frame estimation unit 102 and the intra-frame prediction unit 103 are used to determine the intra-frame prediction mode to be used to encode the video coding block; the motion compensation unit 104 and the motion estimation unit 105 are used to perform inter-frame prediction coding on the received video coding block relative to one or more blocks in one or more reference frames to provide temporal prediction information; the motion estimation performed by the motion estimation unit 105 is the process of generating a motion vector, which can estimate the motion of the video coding block, and the motion compensation unit 104 then calculates the motion vector based on the motion vector determined by the motion estimation unit 105. After determining the intra-frame prediction mode, the intra-frame prediction unit 103 is further configured to provide the selected intra-frame prediction data to the encoding unit 109, and the motion estimation unit 105 also sends the calculated motion vector data to the encoding unit 109. In addition, the inverse transform and inverse quantization unit 106 is configured to reconstruct the video coding block and reconstruct a residual block in the pixel domain. The reconstructed residual block is subjected to the filter control analysis unit 107 and the filtering unit 108 to remove the block effect artifacts. The reconstructed residual block is then added to a predictive block in the frame of the decoded image buffer unit 110 to generate a reconstructed video coding block. The encoding unit 109 is configured to encode various coding parameters and quantized transform coefficients. In the CABAC-based coding algorithm, the context content can be based on adjacent coding blocks and can be used to encode information indicating the determined intra-frame prediction mode, and output the code stream of the video signal. The decoded image buffer unit 110 is configured to store the reconstructed video coding block for prediction reference. As the video image encoding proceeds, new reconstructed video encoding blocks are continuously generated, and these reconstructed video encoding blocks are stored in the decoded image buffer unit 110 .

[0099] Referring to FIG4B , which shows a block diagram of a decoder provided in an embodiment of the present application, as shown in FIG4B , the decoder (specifically, a "video decoder") 200 includes a decoding unit 201, an inverse transform and inverse quantization unit 202, an intra-frame prediction unit 203, a motion compensation unit 204, a filtering unit 205, and a decoded image buffer unit 206. The decoding unit 201 can implement header information decoding and CABAC decoding, and the filtering unit 205 can implement deblocking filtering and SAO filtering. After the input video signal is encoded as shown in FIG4A , a code stream of the video signal is output; the code stream is input to the decoder 200 and first passes through the decoding unit 201 to obtain decoded transform coefficients; the transform coefficients are processed by the inverse transform and inverse quantization unit 202 to generate a residual block in the pixel domain; the intra-frame prediction unit 203 can be used to generate prediction data for the current video decoding block based on the determined intra-frame prediction mode and data from the previously decoded block of the current frame or picture; the motion compensation unit 204 determines the prediction information for the video decoding block by analyzing the motion vector and other associated syntax elements, and uses The prediction information is used to generate a predictive block for the video decoding block being decoded; a decoded video block is formed by summing the residual block from the inverse transform and inverse quantization unit 202 with the corresponding predictive block generated by the intra-frame prediction unit 203 or the motion compensation unit 204; the decoded video signal passes through the filtering unit 205 to remove blocking artifacts, thereby improving video quality; the decoded video block is then stored in the decoded image buffer unit 206, which stores reference images used for subsequent intra-frame prediction or motion compensation, and is also used for outputting the video signal, thereby obtaining the restored original video signal.

[0100] It should be noted that the method of the embodiment of the present application is mainly applied to the intra-frame prediction unit 103 shown in Figure 4A and the intra-frame prediction unit 203 shown in Figure 4B. In other words, the embodiment of the present application can be applied to both the encoder and the decoder, or even to both the encoder and the decoder at the same time, but the embodiment of the present application is not specifically limited thereto.

[0101] It should also be noted that, when applied to the intra-frame prediction unit 103, the "current block" specifically refers to the coding block currently to be intra-frame predicted; when applied to the intra-frame prediction unit 203, the "current block" specifically refers to the decoding block currently to be intra-frame predicted.

[0102] In one embodiment of the present application, referring to FIG5 , a flowchart of a decoding method provided by an embodiment of the present application is shown. As shown in FIG5 , the method may include:

[0103] S501: Determine a reference sample value of a first color component of a current block.

[0104] It should be noted that the decoding method of the embodiment of the present application is applied to a decoding device, or a decoding device integrated with the decoding device (also referred to as a "decoder"). In addition, the decoding method of the embodiment of the present application can specifically refer to an intra-frame prediction method, more specifically, a post-processing operation method of weighted chroma prediction (WCP).

[0105] In an embodiment of the present application, a video image can be divided into a plurality of decoding blocks, each of which can include a first color component, a second color component, and a third color component. The current block herein refers to a decoding block in the video image that is currently to be intra-frame predicted. In addition, assuming that the current block predicts the first color component, and the first color component is a luminance component, that is, the component to be predicted is a luminance component, then the current block can also be referred to as a luminance prediction block; or, assuming that the current block predicts the second color component, and the second color component is a chrominance component, that is, the component to be predicted is a chrominance component, then the current block can also be referred to as a chrominance prediction block.

[0106] It should also be noted that, in an embodiment of the present application, the reference information of the current block may include the values ​​of the first color component sampling points in the adjacent areas of the current block and the values ​​of the second color component sampling points in the adjacent areas of the current block. These sampling points (Samples) may be determined based on decoded pixels in the adjacent areas of the current block. In some embodiments, the adjacent areas of the current block may include at least one of the following: an upper adjacent area, an upper right adjacent area, a left adjacent area, and a lower left adjacent area.

[0107] Here, the upper adjacent region and the upper right adjacent region as a whole can be considered as the upper region, and the left adjacent region and the lower left adjacent region as a whole can be considered as the left region. In addition, the adjacent region may also include the upper left region, as shown in Figure 6A. When predicting the second color component of the current block, the upper region, left region, and upper left region of the current block as adjacent regions can all be referred to as reference regions of the current block, and the pixels in the reference regions are all decoded reference pixels.

[0108] It should also be noted that, in the embodiments of the present application, the adjacent area of ​​the current block may include multiple rows or columns adjacent to the current block. For example, the left area may include one or more columns, and the upper area may include one or more rows. Even if the number of rows or columns increases or decreases, the embodiments of the present application do not impose any restrictions.

[0109] In some embodiments, determining the reference sample value of the first color component of the current block may include: determining the reference sample value of the first color component of the current block according to the values ​​of the first color component sampling points in the adjacent area of ​​the current block.

[0110] It should be noted that, in the embodiment of the present application, the reference pixel of the current block may refer to a reference pixel point adjacent to the current block, or may be referred to as a first color component sampling point or a second color component sampling point in an adjacent area of ​​the current block, and may be represented by Neighboring Sample or Reference Sample. The term "adjacent" here may refer to spatial proximity, but is not limited thereto. For example, "adjacent" may refer to temporal proximity, spatial and temporal proximity, or even a reference pixel of the current block obtained by performing some processing on spatially adjacent, temporally adjacent, or spatially and temporally adjacent reference pixels, and the embodiment of the present application does not impose any limitation thereto.

[0111] It should also be noted that in the embodiment of the present application, the first color component is the luminance component, and the second color component is the chrominance component. Therefore, the value of the first color component sampling point in the adjacent area of ​​the current block represents the reference luminance information corresponding to the reference pixel of the current block, and the value of the second color component sampling point in the adjacent area of ​​the current block represents the reference chrominance information corresponding to the reference pixel of the current block.

[0112] It should also be noted that, in the embodiment of the present application, the value of the first color component sampling point is determined from the adjacent area of ​​the current block. The adjacent area here may include only the upper adjacent area, or only the left adjacent area, or the upper adjacent area and the upper right adjacent area, or the left adjacent area and the lower left adjacent area, or the upper adjacent area and the left adjacent area, or even the upper adjacent area, the upper right adjacent area and the left adjacent area, etc., and the embodiment of the present application does not impose any limitation.

[0113] It should also be noted that, in the embodiment of the present application, the adjacent area can also be determined based on the prediction mode of the current block. In a specific embodiment, it can include:

[0114] If the prediction mode of the current block is the horizontal mode, the reference pixel is determined according to the pixels in the upper adjacent area and / or the upper right adjacent area;

[0115] If the prediction mode of the current block is the vertical mode, the reference pixel is determined according to the pixels in the left adjacent area and / or the lower left adjacent area.

[0116] Exemplarily, if the prediction mode of the current block is a horizontal mode, then the adjacent areas in the prediction of the chrominance component can only select the upper adjacent areas and / or the upper right adjacent areas; if the prediction mode of the current block is a vertical mode, then the adjacent areas in the prediction of the chrominance component can only select the left adjacent areas and / or the lower left adjacent areas.

[0117] Furthermore, in some embodiments, for determining the value of the first color component sampling point, the method may further include: screening the first color component sampling points in adjacent areas to determine the value of the first color component sampling point.

[0118] It should be noted that among the first color component sampling points in the adjacent regions, there may be some unimportant sampling points (for example, these sampling points have poor correlation) or some abnormal sampling points. To ensure the accuracy of the prediction, these sampling points need to be eliminated to obtain valid values ​​of the first color component sampling points. In other words, in this embodiment of the present application, a first sampling point set is formed based on the first color component sampling points in the adjacent regions of the current block; then, the first sampling point set can be screened to determine the values ​​of the first color component sampling points.

[0119] In a specific embodiment, the screening process of the first color component sampling points in the adjacent areas to determine the values ​​of the first color component sampling points may include:

[0120] Determining a position of a sampling point to be selected based on a position and / or a color component intensity of a first color component sampling point in an adjacent area;

[0121] According to the position of the sampling point to be selected, the value of the first color component sampling point is determined from the adjacent area.

[0122] It should be noted that in the embodiments of the present application, color component intensity can be represented by color component information, such as reference luminance information, reference chrominance information, etc. Here, a larger value of the color component information indicates a higher color component intensity. Thus, the first color component sampling points in the adjacent area can be screened based on their positions or color component intensities, thereby determining valid first color component sampling points based on the screened sampling points, and further determining the values ​​of the first color component sampling points.

[0123] In some embodiments, determining the reference sample value of the first color component of the current block may further include:

[0124] Performing a second filtering process on the values ​​of the first color component sampling points to obtain filtered adjacent samples of the first color component of the current block;

[0125] A reference sample value of the first color component of the current block is determined according to the filtered adjacent sample values ​​of the first color component of the current block.

[0126] In the embodiment of the present application, the number of filtered adjacent sample values ​​of the first color component of the current block is less than the number of values ​​of the first color component sampling points.

[0127] In an embodiment of the present application, the second filtering process may be a downsampling filtering process. Where the first color component is a luminance component, the reference luminance information may be downsampled and filtered so that the spatial resolution of the filtered reference luminance information is the same as the spatial resolution of the reference chrominance information. For example, if the current block size is 2M×2N and the reference luminance information is 2M+2N, then after downsampling filtering, the number may be converted to M+N.

[0128] In some embodiments, determining the reference sample value of the first color component of the current block may further include: determining the reference sample value of the first color component of the current block based on a reconstructed value of a sampling point of the first reference color component in the current block.

[0129] It should be noted that, in the embodiment of the present application, the first reference color component may be a brightness component; then, the reconstructed value of the first reference color component sampling point in the current block is the reconstructed brightness information of the current block.

[0130] Furthermore, in some embodiments, determining the reference sample value of the first color component of the current block may further include:

[0131] Performing a third filtering process on the reconstructed value of the first reference color component sampling point in the current block to obtain a filtered sample value of the first reference color component sampling point in the current block;

[0132] The reference sample value of the first color component of the current block is determined according to the filtered sample value of the first reference color component sampling point in the current block.

[0133] In the embodiment of the present application, the number of filtered sample values ​​of the first reference color component sampling point in the current block is less than the number of reconstructed values ​​of the first reference color component sampling point in the current block.

[0134] In an embodiment of the present application, the third filtering process may be a downsampling filtering process. Where the first reference color component is a luminance component, downsampling filtering may also be performed on the reconstructed luminance information within the current block. For example, if the amount of reconstructed luminance information within the current block is 2M×2N, then after downsampling filtering, it may be transformed to M×N.

[0135] It should be noted that in the embodiment of the present application, considering that the filtering processing of the reference information before weighted prediction can be performed on only the reference luminance information, only the reconstructed luminance information, or both the reference luminance information and the reconstructed luminance information, there is no limitation here. Then, for the calculation of the luminance difference, it can be the absolute value of the difference between the reference luminance information and the reconstructed luminance information, the absolute value of the difference between the reference luminance information after filtering and the reconstructed luminance information, the absolute value of the difference between the reference luminance information and the reconstructed luminance information after filtering, or even the absolute value of the difference between the reference luminance information after filtering and the reconstructed luminance information after filtering.

[0136] It should also be noted that, in this embodiment of the present application, the reference sample value of the first color component of the current block may also be set to luminance difference information. Therefore, in one possible implementation, the reference sample value of the first color component of the current block is set to the absolute value of the difference between the value of the first color component sampling point and the reconstructed value of the first reference color component sampling point.

[0137] In another possible implementation, the reference sample value of the first color component of the current block is set to the absolute value of the difference between the filtered adjacent sample value of the first color component and the reconstructed value of the first reference color component sampling point.

[0138] In yet another possible implementation, the reference sample value of the first color component of the current block is set to the absolute value of the difference between the filtered adjacent sample value of the first color component and the filtered sample value of the first reference color component sampling point.

[0139] In yet another possible implementation, the reference sample value of the first color component of the current block is set to the absolute value of the difference between the value of the first color component sampling point and the filtered sample value of the first reference color component sampling point.

[0140] That is to say, based on the known reference information of the current block, such as the reference luminance information in the adjacent areas of the current block, the reconstructed luminance information in the current block, etc., you can choose to filter it before performing weighted prediction. Specifically, you can downsample and filter the reference luminance information in the adjacent areas of the current block, or you can downsample and filter the reconstructed luminance information in the current block. You can also downsample and filter both, or even not downsample and filter both. Then, the luminance difference information is determined according to different combinations, and the luminance difference information can be used as the reference sample value of the first color component of the current block.

[0141] S502: Determine a weighting coefficient according to a reference sample value of a first color component of a current block.

[0142] It should be noted that, in the embodiment of the present application, determining the weighting coefficient according to the reference sample value of the first color component of the current block may include:

[0143] Determining a value corresponding to the reference sample value of the first color component under a preset mapping relationship;

[0144] Set the weighting factor equal to the value.

[0145] It is understood that in this embodiment of the present application, the reference sample value of the first color component may be the absolute value of the difference between the filtered adjacent sample value of the first color component of the current block and the filtered sample value of the first reference color component sampling point in the current block. The first reference color component is the first color component, and the first color component is a color component different from the second color component to be predicted in this embodiment of the present application.

[0146] For example, assuming that the first color component is the chrominance component and the second color component is the luminance component, the embodiment of the present application mainly predicts the chrominance component of the pixel to be predicted in the current block. First, at least one pixel to be predicted in the current block is selected, and the luminance difference between its reconstructed chrominance and the reference chrominance in the adjacent area is calculated (using |ΔC k | indicates); the chroma difference of the pixels to be predicted at different positions in adjacent areas is different. The reference pixel position with the smallest chroma difference will follow the changes of the pixels to be predicted in the current block. Usually, the size of the chroma difference represents the degree of similarity between the chroma. If |ΔC k | is small, indicating that the similarity of chromaticity values ​​is relatively strong, and the corresponding weighting coefficient (using w k ) can be given a larger weight; on the contrary, if |ΔC k | is larger, indicating that the similarity of chromaticity values ​​is weaker, w k A smaller weight can be assigned. That is, w k and |ΔC k | is approximately inversely proportional. Thus, according to |ΔC k |You can create a preset mapping relationship as shown below,

[0147] w k =f(|ΔC k |) (1)

[0148] Here, taking formula (1) as an example, |ΔC k | represents the reference sample value of the first color component, f(|ΔC k |) represents the value corresponding to the reference sample value of the first color component under the preset mapping relationship, w k Represents the weighting coefficient, that is, w k Set to be equal to f(|ΔC k |).

[0149] It should also be noted that, in the embodiment of the present application, if the number of reference samples of the second color component is N, then the number of weighting coefficients is also N; wherein the sum of the N weighting coefficients is equal to 1, and each weighting coefficient is a value greater than or equal to 0 and less than or equal to 1, that is, 0≤w k ≤1. However, it should be noted that "the sum of N weighting coefficients equals 1" is only a theoretical concept; in actual fixed-point implementation, the absolute value of the weighting coefficient can be greater than 1.

[0150] Understandably, in probability theory and related fields, the normalized exponential function, or Softmax function, is a generalization of the logistic function. It can "compress" an N-dimensional vector z containing arbitrary real numbers into another N-dimensional vector σ(z), so that each element ranges between (0, 1) and the sum of all elements is 1. It is often used as a nonlinear activation function for multi-class neural networks. The Softmax function is shown below.

[0151]

[0152] However, the Softmax function can satisfy w k However, its function value increases with the increase of vector elements, which does not meet the condition of w k and |ΔC k | Approximately inversely proportional relationship. Therefore, in order to adapt to w k The design and meet the requirements of w k For nonlinear expectations, the f function of formula (1) can be realized by using the Softmax function with parameter γ, as shown below:

[0153]

[0154] Among them, in order to achieve w k and |ΔC k | is approximately inversely proportional, γ can be limited to a negative number. That is, when the first reference color component parameter is |ΔC k |ΔC k |with w k The mapping relationship between them can be expressed as:

[0155]

[0156] According to formula (4), in some embodiments, determining the value corresponding to the reference sample value of the first color component under the preset mapping relationship may include:

[0157] Determine the first factor;

[0158] determining a first product value according to the first factor and the reference sample value of the first color component;

[0159] Determine the value of the first product value corresponding to the preset mapping relationship.

[0160] It should be noted that, in the embodiment of the present application, the first factor is a constant value less than zero. Taking the Softmax function as an example, in formula (4), γ represents the first factor, |ΔC k | represents the first reference color component parameter, γ|ΔC k | represents the first product value, w k Represents the weighting coefficient; k = 1, 2,…, N.

[0161] In a specific embodiment, determining the first factor may include: the first factor is a preset constant value.

[0162] It should be noted that, in this case, for γ, the weighted coefficient distribution of the adjacent chromaticity can be adjusted according to the relatively flat characteristics of chromaticity, so as to capture the weighted coefficient distribution suitable for natural image chromaticity prediction. In order to determine the parameter γ suitable for natural image chromaticity prediction, the given γ set is traversed, and the difference between the predicted chromaticity and the original chromaticity under different γ is used to measure whether γ is suitable or not. For example, γ can be -2 ε , where ε∈{1,0,-1,-2,-3}. Experiments have shown that the optimal value of γ in this γ set is -0.25. Therefore, in a specific embodiment, γ can be set to -0.25, but this embodiment is not specifically limited thereto.

[0163] In another specific embodiment, determining the first factor may include: determining a value of the first factor according to a size parameter of the current block.

[0164] Furthermore, in some embodiments, the method may further include: determining the value of the first factor according to a preset mapping lookup table between the size parameter of the current block and the value of the first factor.

[0165] Here, the size parameter of the current block may include at least one of the following parameters: the width of the current block, and the height of the current block.

[0166] It should be noted that the embodiment of the present application can fix the value of the first factor in a classification manner. For example, the size parameters of the current block are divided into three categories, and the value of the first factor corresponding to each category is determined. In view of this situation, the embodiment of the present application can also pre-store a lookup table mapping the size parameters of the current block and the values ​​of the first factor, and then determine the value of the first factor based on the lookup table. For example, Table 1 shows a correspondence between a first factor and the size parameters of the current block provided by the embodiment of the present application. It should be noted that Table 1 is only an exemplary lookup table and is not a specific limitation.

[0167] Table 1

[0168] The first factor of the size parameter of the current block Min(W,H)<=4-0.125Min(W,H)>4&&Min(W,H)<=16-0.0833Min(W,H)>16-0.0625

[0169] In another specific embodiment, determining the first factor may include: determining a value of the first factor according to the number of reference pixels of the current block.

[0170] Furthermore, in some embodiments, the method may further include: determining the value of the first factor according to a preset mapping lookup table between the number of reference pixels of the current block and the value of the first factor.

[0171] It should be noted that the embodiment of the present application can divide the number of reference pixels into three categories, and still use the classification method to fix the value of the first factor. For example, the number of reference pixels of the current block can be divided into three categories, and the value of the first factor corresponding to each category is determined. In view of this situation, the embodiment of the present application can also pre-store a lookup table mapping the number of reference pixels of the current block and the value of the first factor, and then determine the value of the first factor based on the lookup table. For example, Table 2 shows a correspondence between a first factor and the number of reference pixels of the current block provided by the embodiment of the present application. It should be noted that Table 2 is only an exemplary lookup table and is not specifically limited.

[0172] Table 2

[0173] The first factor of the number of reference pixels is 0 <R<16-0.111316<=R<32-0.0773R> =32-0.0507

[0174] Furthermore, for the first product value, determining the first product value according to the first factor and the reference sample value of the first color component may include:

[0175] Setting a first product value equal to a product of the first factor and a reference sample value of the first color component;

[0176] or,

[0177] Setting the first product value to be equal to a value obtained by right-shifting the reference sample value of the first color component, wherein the number of bits of the right-shift is equal to the first factor;

[0178] or,

[0179] The first product value is set to a value obtained by performing addition and bit shift operations on the reference sample value of the first color component according to the first factor.

[0180] For example, assuming the first factor is 0.25 and the reference sample value of the first color component is denoted by Ref, the first product value can be equal to 0.25×Ref. 0.25×Ref can be expressed as Ref / 4, that is, Ref>>2. Furthermore, during the fixed-point calculation process, floating-point numbers may be converted to addition and shift operations; that is, there is no restriction on the calculation method for the first product value.

[0181] It can also be understood that in the embodiment of the present application, the first color component can also be a luminance component, and the second color component can be a chrominance component. In this case, at least one pixel to be predicted in the current block is selected, and the luminance difference between its reconstructed luminance and the reference luminance in the adjacent area is calculated (using |ΔY k | represents). Where, if |ΔY k | is small, indicating that the similarity of the brightness values ​​is relatively strong, and the corresponding weighting coefficient (using w k ) can be given a larger weight; on the contrary, if |ΔY k | is larger, indicating that the similarity of brightness values ​​is weaker, w k A smaller weight can be assigned, that is, when calculating the weighting coefficient, the reference sample value of the first color component can also be |ΔY k |, and then calculate the weighting coefficient.

[0182] It should be noted that when predicting the chrominance component of the pixel to be predicted in the current block, since the chrominance component value of the pixel to be predicted cannot be directly determined, the chrominance difference |ΔC between the reference pixel and the pixel to be predicted is k | cannot be obtained directly; however, there is a strong correlation between the components in the local area of ​​the current block. At this time, the brightness difference |ΔY between the reference pixel and the pixel to be predicted can be used to calculate the value of |ΔY. k | to derive |ΔC k |; That is, according to |ΔY k | and the product of the second factor, we can get |ΔC k |; Thus, the first product value is equal to the product of the first factor and |ΔYk|.

[0183] That is, in the embodiment of the present application, for the reference sample value of the first color component, it can be |ΔC k |, the absolute value of the chromaticity difference; or |ΔY k |, that is, the absolute value of the brightness difference; or it can be |αΔY k |, that is, the product of the absolute value of the brightness difference and a preset multiplier, etc. The preset multiplier here is the second factor described in the embodiment of the present application.

[0184] Furthermore, with respect to the second factor, in a specific embodiment, the method may further include: performing a least squares calculation based on the first color component value of the reference pixel and the second color component value of the reference pixel to determine the second factor.

[0185] That is, assuming that the number of reference pixels is N, the first color component value of the reference pixel is the reference brightness information of the current block, and the second color component value of the reference pixel is the reference chrominance information of the current block, then the least squares method can be used to calculate the chrominance component values ​​and the brightness component values ​​of the N reference pixels to obtain the second factor. For example, the least squares regression calculation is as follows:

[0186]

[0187] Among them, L k represents the brightness component value of the kth reference pixel, C k represents the chrominance component value of the kth reference pixel, N represents the number of reference pixels, and α represents the second factor, which can be calculated using least squares regression. It should be noted that the second factor can also be a fixed value or fine-tuned based on a fixed value, etc., and this embodiment of the application is not specifically limited to this.

[0188] In addition, for the preset mapping relationship, the preset mapping relationship can be a preset function relationship. In some embodiments, the preset mapping relationship can be a Softmax function. The Softmax function is a normalized exponential function, but the embodiments of the present application do not require normalization, and its value is not limited to the range of [0, 1].

[0189] For example, |ΔY k Taking the reference sample value of the first color component as an example, the weighting coefficient w corresponding to the kth reference pixel is k It can be calculated by formula (4) or replaced as follows:

[0190]

[0191]

[0192] Where S represents the control parameter, and the relationship between S and the first factor (γ) is:

[0193] Exemplarily, the value of S is related to the size parameters of the current block. The size parameters of the current block include the width and height of the current block. In one possible implementation, if the minimum value of the width and height is less than or equal to 4, the value of S is equal to 8; if the minimum value of the width and height is greater than 4 and less than or equal to 16, the value of S is equal to 12; if the minimum value of the width and height is greater than 16, the value of S is equal to 16. In another possible implementation, if the minimum value of the width and height is less than or equal to 4, the value of S is equal to 7; if the minimum value of the width and height is greater than 4 and less than or equal to 16, the value of S is equal to 11; if the minimum value of the width and height is greater than 16, the value of S is equal to 15. Alternatively, the value of S is related to the number of reference pixels (R) of the current block. In one possible implementation, if R is less than 16, then the value of S is equal to 8; if R is greater than or equal to 16 and less than 32, then the value of S is equal to 12; if R is greater than or equal to 16, then the value of S is equal to 16; the embodiments of the present application do not impose any limitations on this.

[0194] It should also be noted that, in addition to the Softmax function, in other embodiments, the preset mapping relationship may be a weighting function that has an inversely proportional relationship with the reference sample value of the first color component.

[0195] For example, still with |ΔY k Taking the reference sample value of the first color component as an example, the Softmax function in equation (4) can also be replaced as follows:

[0196]

[0197]

[0198] Wherein, k=1, 2, ... N, offset=1 or 2 or 0.5 or 0.25.

[0199] In this way, when the preset mapping relationship is a preset functional relationship, it can be as shown in formula (4), or as shown in formula (6) or formula (7), or as shown in formula (8) or formula (9), or even other functional models that can fit the trend that the closer the reference luminance value of the reference pixel is to the luminance reconstruction value of the pixel to be predicted in the current block, the higher the importance of the reference chrominance value of the reference pixel to the pixel to be predicted in the current block, and the weighted coefficient is constructed, etc., and the embodiments of the present application do not make specific limitations.

[0200] In addition, in some embodiments, the preset mapping relationship may be a preset lookup table. That is, embodiments of the present application may further simplify operations, for example, by using an array element lookup table to reduce some computational operations. The preset mapping relationship may include: determining an array element value based on a preset lookup table mapping a reference sample value of the first color component, a first factor, and array elements; then determining the value corresponding to the array element value under the preset mapping relationship; and then setting the weighting coefficient equal to the value.

[0201] Specifically, the f model for calculating the weighted coefficients can be implemented by simplifying operations, such as table lookup. k |, you can also use |ΔY kij | indicates that; in this way, the weighted coefficient w is calculated by the f model kij =f(|ΔY kij |). Here, the numerator in the f model can be expressed as the independent variable |ΔY kij | and the number of S types are stored as array indices. Subsequent operations in the f model that are the same as the numerator calculation are obtained by looking up the table, thus avoiding the calculation operations of the numerator and denominator.

[0202] It should be noted that, in the embodiment of the present application, the storage here can be divided into complete storage or partial storage.

[0203] In a specific embodiment, full storage is to store |ΔY kij |The range of values ​​and the number of S types of molecules are all stored. Under full storage, it is necessary to open (|ΔY kij |value range multiplied by the number of S types) of array space. Among them, the required storage array size is |ΔY kij |The value range size, the performance remains unchanged.

[0204] For example, taking 10-bit pixels and formula (7) as an example, the variable |ΔY kij The value range is an integer between 0 and 1023, the number of S types is 3, and the value of |ΔY kij | and the number of species S as indices into the two-dimensional array storMole to fully store the molecule:

[0205]

[0206] At this time, the calculation of the weighted coefficient of formula (7) can be simplified as follows:

[0207]

[0208] Thus, the elements of the two-dimensional array storMole[index 1][index 2] are shown in Table 3.

[0209] Table 3

[0210]

[0211] Furthermore, the complete storage can also set the corresponding array offset according to the classification of S, and then according to (|ΔY kij | plus offset) as the index of the one-dimensional array ostorMole to fully store the molecule, as shown below:

[0212]

[0213] At this time, the calculation of the weighted coefficient of formula (7) can be simplified as follows:

[0214]

[0215] Thus, the elements of the one-dimensional array ostorMole[index] are shown in Table 4.

[0216] Table 4

[0217]

[0218] In another specific embodiment, partial storage is to select and store part of all numerator values ​​in the calculation weight coefficients, and |ΔY kij |Part of the range and / or the molecular values ​​of some species of S are stored. The f model value outside the selected range defaults to 0. The required storage array size is (selected |ΔY kij |The value range is multiplied by the number of selected types of S).

[0219] For example, taking 10-bit pixels and formula (7) as an example, assuming that |ΔY kij The range of the value is 0 to 99 integers, and the numerator value of three S is partially stored, then |ΔY kij The value range is an integer between 0 and 99, and the number of S types is 3. kij | and the number of species S as indices into the two-dimensional array partstorMole to store molecules:

[0220]

[0221] At this time, the calculation of the weighted coefficient of formula (7) can be simplified as follows:

[0222]

[0223] Thus, the elements of the two-dimensional array partstorMole[index 1][index 2] are shown in Table 5.

[0224] Table 5

[0225]

[0226] That is to say, the storage range of some storage can be stored according to actual needs, not limited to the |ΔY in the example kij Within 100 integers, three S types; partial storage can also set corresponding offsets for selected S types to create one-dimensional storage space, which is not limited in this embodiment of the present application. Furthermore, for Tables 3-5, for fixed-point calculations, amplified integer values ​​can also be stored; this allows subsequent reduction operations after the predicted value is determined.

[0227] In this way, according to the reference sample value of the first color component (eg |ΔY kij |), the weighting coefficients can be determined, which can include: w1, w2, ..., w N N weighting coefficients are used, where N represents the number of reference samples of the second color component. Theoretically, the sum of these N weighting coefficients is equal to 1, and each weighting coefficient 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 coefficients is equal to 1" is only a theoretical concept; in actual fixed-point implementation, the absolute value of the weighting coefficient can be greater than 1.

[0228] S503: Determine a first prediction block of the second color component of the current block according to the weighting coefficient and the reference sample value of the second color component of the current block.

[0229] It should be noted that, in this embodiment of the present application, the first prediction block includes the predicted values ​​of at least part of the second color component sampling points in the current block.

[0230] It should also be noted that, in an embodiment of the present application, for determining the reference sample value of the second color component of the current block, the method may further include: determining the reference sample value of the second color component of the current block based on the value of the second color component sampling point in the adjacent area of ​​the current block.

[0231] Here, the adjacent region may include at least one of the following: an upper adjacent region, an upper right adjacent region, a left adjacent region, and a lower left adjacent region.

[0232] In a specific embodiment, the method may further include:

[0233] Performing a fourth filtering process on the values ​​of the second color component sampling points in the adjacent area of ​​the current block to obtain filtered adjacent sample values ​​of the second color component of the current block;

[0234] A reference sample value of the second color component of the current block is determined according to the filtered adjacent sample values ​​of the second color component of the current block.

[0235] In an embodiment of the present application, the number of filtered adjacent sample values ​​of the second color component of the current block is greater than the number of values ​​of the second color component sampling points in the adjacent area of ​​the current block.

[0236] In an embodiment of the present application, the fourth filtering process may be upsampling filtering; wherein the upsampling rate is a positive integer multiple of 2.

[0237] That is, the first color component is a luminance component, and the second color component is a chrominance component. In embodiments of the present application, the reference chrominance information may be upsampled and filtered so that the spatial resolution of the filtered reference chrominance information is the same as the spatial resolution of the reference luminance. For example, if the reference luminance information is 2M+2N and the reference chrominance information is M+N, then after upsampling and filtering the reference chrominance information, the number of components can be converted to 2M+2N.

[0238] It should also be noted that in the embodiment of the present application, whether it is the second filtering process performed on the values ​​of the first color component sampling points in the adjacent area, or the third filtering process performed on the reconstructed values ​​of the first reference color component sampling points in the current block, both filtering processes can be downsampling filtering processes; wherein, the second filtering process can use the first filter, and the third filtering process can use the second filter. Here, the first filter and the second filter can both be downsampling filters. Since the downsampling rates of the filters may be different due to the different data processed, the first filter and the second filter can be the same or different. In addition, the fourth filtering process performed on the values ​​of the second color component sampling points in the adjacent area can use the third filter. wherein, the fourth filtering process is an upsampling filtering process, then the third filter can be an upsampling filter. further, for the first filter, the second filter and the third filter, all three filters can be neural network filters, without any limitation here.

[0239] It can be understood that, assuming that the first color component is a luminance component and the second color component is a chrominance component, then since the spatial resolution of the values ​​of the first color component sampling points in the adjacent areas (i.e., reference luminance information), the spatial resolution of the values ​​of the second color component sampling points in the adjacent areas (i.e., reference chrominance information), and even the spatial resolution of the reconstructed values ​​of the first reference color component sampling points in the current block (i.e., reconstructed luminance information) are all affected by the color format information, a second filtering process, a third filtering process, or a fourth filtering process can also be performed based on the current color format information. Taking the fourth filtering process as an example, in some embodiments, the method can further include: performing a fourth filtering process on the values ​​of the second color component sampling points in the adjacent areas of the current block based on the color format information to obtain filtered adjacent samples of the second color component of the current block.

[0240] In a specific embodiment, the fourth filtering process may also include: if the color format information indicates 4:2:0 sampling, then upsampling filtering is performed on the values ​​of the second color component sampling points in the adjacent area of ​​the current block; wherein the upsampling rate is a positive integer multiple of 2.

[0241] It should be noted that, in the embodiment of the present application, the color format information may include 4:4:4 sampling, 4:2:2 sampling, 4:1:1 sampling, 4:2:0 sampling, etc. Among them, if the color format information indicates a video with 4:4:4 sampling (also expressed as YUV444), that is, the spatial resolutions of luminance and chrominance are equal, then no processing is required on the reference chrominance information; if the color format information indicates a video with chrominance subsampling characteristics such as 4:2:2 sampling (also expressed as YUV422), or 4:1:1 sampling (also expressed as YUV411), or 4:2:0 sampling (also expressed as YUV420), that is, the spatial resolutions of luminance and chrominance are inconsistent, and the spatial resolution of the chrominance component is smaller than the spatial resolution of the luminance component, then upsampling filtering is required for the reference chrominance information obtained from the adjacent area.

[0242] In this way, for the upsampling filtering of the reference chroma information, the upsampling filtering method can be any linear interpolation method, such as nearest neighbor interpolation, bilinear interpolation, bicubic interpolation, mean interpolation, median interpolation, copy interpolation, etc.; it can also be any nonlinear interpolation method, such as an interpolation algorithm based on wavelet transform, an interpolation algorithm based on edge information, etc.; it can also be based on a convolutional neural network for upsampling filtering, and the embodiments of the present application do not impose any restrictions. For example, referring to Figure 6B, taking the YUV420 video format and copy interpolation as an example, an example of 4×1 reference chroma information and 8×2 reference luminance information is shown here. Among them, the 8×2 diagonal filling block is the reference luminance information, and the 4×1 grid filling block is the co-located reference chroma information. Each pixel in the 4×1 grid filling block is equivalent to the upper left corner pixel of each 2×2 sub-block in the 8×2 chroma block after upsampling filtering, that is, the pixel value of each chroma pixel in the 2×2 sub-block after copy interpolation is the same. Specifically, for a 2×2 sub-block, the other three chrominance pixels (filling the block with dots) are all obtained by copying the upper left corner pixel (filling the block with grids).

[0243] Furthermore, after determining the reference sample value of the second color component of the current block, in some embodiments, for S503, determining the first predicted block of the second color component of the current block according to the weighting coefficient and the reference sample value of the second color component of the current block may include:

[0244] Determining a weighted value of a reference sample value of a second color component and a corresponding weighting coefficient;

[0245] The predicted value of the second color component sampling point in the first prediction block is set to be equal to the sum of N weighted values; wherein N represents the number of reference sample values ​​of the second color component, and N is a positive integer.

[0246] That is, if the number of reference samples of the second color component is N, then first determine the weighted value of each reference sample of the second color component and the corresponding weighting coefficient (ie, w k C k ), and then the sum of these N weighted values ​​is used as the predicted value of the second color component sampling point in the prediction block. Specifically, its calculation formula is as follows:

[0247]

[0248] For example, the absolute luminance difference is first calculated based on the reconstructed luminance information at position (i, j) in the current block and the reference luminance information in the adjacent area. The weighting coefficient is then calculated using the Softmax function, and the predicted value of the chrominance component at position (i, j) in the prediction block can be obtained using Equation (16). In particular, it should be noted that this method facilitates parallel processing and can speed up the calculation.

[0249] It should be noted that, in the embodiment of the present application, it is assumed that the width of the first prediction block is predSizeW, and the height of the first prediction block is predSize H; 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 contains the predicted values ​​of at least part of the second color component sampling points in the current block.

[0250] S504: Perform a first filtering process on the first prediction block to determine a second prediction block of the second color component of the current block.

[0251] S505: Determine, according to the second prediction block, a reconstructed value of a second color component sampling point of the current block.

[0252] It should be noted that, in embodiments of the present application, if the first prediction block includes predicted values ​​of some sampling points of the second color component in the current block, it is necessary to perform upsampling filtering on the first prediction block to obtain a final second prediction block. Therefore, in some embodiments, performing the first filtering process on the first prediction block to determine the second prediction block for the second color component of the current block may include: performing upsampling filtering on the first prediction block to determine the second prediction block for the second color component of the current block.

[0253] It should also be noted that, in an embodiment of the present application, if the number of predicted values ​​of the second color component included in the second prediction block is the same as the number of second color component sampling points included in the current block, but the predicted values ​​of the second color component sampling points of the current block are not included, then filtering is required to enhance the predicted values ​​to obtain the final second prediction block. Therefore, in some embodiments, performing a first filtering process on the first prediction block to determine the second prediction block for the second color component of the current block may include: performing a filtering enhancement process on the first prediction block to determine the second prediction block for the second color component of the current block.

[0254] It should also be noted that, in an embodiment of the present application, if the first prediction block includes the predicted values ​​of all the second color component sampling points in the current block, then there is no need to perform any processing on the first prediction block, and the first prediction block can be directly used as the final second prediction block.

[0255] It is understandable that, in the embodiment of the present application, the first filtering process may be an upsampling filtering process, a filtering enhancement process, or the like, without any limitation herein. However, for the second prediction block after the first filtering process, the second prediction block includes the predicted values ​​of all second color component sampling points in the current block.

[0256] Here, when the first filtering process is an upsampling filtering process, the first prediction block may be subjected to an upsampling filtering process using a fourth filter. The fourth filter may be an upsampling filter, but the fourth filter may be the same as or different from the aforementioned third filter. The fourth filter may also be a neural network filter, which is not limited in this embodiment of the present application.

[0257] In some embodiments, the performing of a first filtering process on the first prediction block to determine a second prediction block of the second color component of the current block may include: the first filtering process includes an upsampling filtering process; wherein the input of the upsampling filtering process is a first upsampling input block; and the output of the upsampling filtering process is a first upsampling output block.

[0258] Furthermore, in some embodiments, the upsampling filtering process may include:

[0259] Determine an upsampling factor, wherein the upsampling factor includes at least one of the following: a horizontal upsampling factor and a vertical upsampling factor;

[0260] An upsampling filtering process is performed on the first upsampling input block according to the upsampling factor to obtain a first upsampling output block.

[0261] In one possible implementation, performing upsampling filtering on the first upsampling input block according to the upsampling factor to obtain the first upsampling output block may include: if the horizontal upsampling factor is greater than 1, or the vertical upsampling factor is greater than 1, performing upsampling filtering on the first upsampling input block to obtain the first upsampling output block.

[0262] In an embodiment of the present application, performing upsampling filtering on the first upsampling input block includes at least one of the following:

[0263] Performing upsampling filtering on the first upsampled input block in the horizontal direction;

[0264] Performing upsampling filtering on the first upsampled input block in a vertical direction;

[0265] Performing upsampling filtering processing on the first upsampled input block in the horizontal direction and then performing upsampling filtering processing in the vertical direction;

[0266] The first up-sampled input block is subjected to up-sampling filtering in the vertical direction and then to up-sampling filtering in the horizontal direction.

[0267] Here, first, a horizontal upsampling factor can be calculated based on the width of the first upsampling input block and the width of the first upsampling output block, and a vertical upsampling factor can be calculated based on the height of the first upsampling input block and the height of the first upsampling output block; then, the first upsampling input block is upsampled and filtered according to the horizontal upsampling factor and the vertical upsampling factor. Specifically, if the horizontal upsampling factor is greater than 1 and the vertical upsampling factor is equal to 1, then only the first upsampling input block needs to be upsampled in the horizontal direction; if the horizontal upsampling factor is equal to 1 and the vertical upsampling factor is greater than 1, then only the first upsampling input block needs to be upsampled in the vertical direction; if the horizontal upsampling factor is greater than 1 and the vertical upsampling factor is greater than 1, then the first upsampling input block needs to be upsampled in both the horizontal and vertical directions, wherein upsampling can be performed first in the horizontal direction and then in the vertical direction, or first in the vertical direction and then in the horizontal direction, and even the convolution operation in the neural network structure can be used to replace the upsampling filtering operation here, and the embodiments of the present application do not impose any restrictions.

[0268] In another possible implementation, upsampling and filtering are performed on the first prediction block to determine the second prediction block. In this case, the method may further include:

[0269] Using the first predicted block as a first upsampled input block;

[0270] The first up-sampled output block is used as a second prediction block for a second color component of the current block.

[0271] In another possible implementation, the first prediction block is first enhanced and filtered, and then up-sampled and filtered to determine the second prediction block. In this case, the method may further include:

[0272] Performing filtering enhancement processing on the first prediction block to determine a first enhanced prediction block;

[0273] Using the first enhanced prediction block as a first up-sampled input block;

[0274] The first up-sampled output block is used as a second prediction block for a second color component of the current block.

[0275] In another possible implementation, upsampling filtering is first performed on the first prediction block, and then enhancement filtering is performed to determine the second prediction block. In this case, the method may further include:

[0276] Using the first predicted block as a first upsampled input block;

[0277] Using the first up-sampled output block as a first up-sampled filtered prediction block;

[0278] Perform filtering enhancement processing on the first up-sampled filtered prediction block to determine a second prediction block of the second color component of the current block.

[0279] In another possible implementation, the first prediction block is first subjected to enhancement filtering, then subjected to upsampling filtering, and then subjected to enhancement filtering again to determine the second prediction block. In this case, the method may further include:

[0280] Performing a first filtering enhancement process on the first prediction block to determine a second enhanced prediction block;

[0281] Using the second enhanced prediction block as the first up-sampled input block;

[0282] Using the first up-sampled output block as the second up-sampled filtered prediction block;

[0283] A second filtering enhancement process is performed on the second up-sampled filtered prediction block to determine a second prediction block of the second color component of the current block.

[0284] It should also be noted that when the first filtering process is an upsampling filtering process, the upsampling filtering process may be performed on the first prediction block using a horizontal upsampling factor and a vertical upsampling factor. Specifically, in some embodiments, performing the upsampling filtering process on the first prediction block to determine the second prediction block for the second color component of the current block may include:

[0285] Determine the horizontal upsampling factor and the vertical upsampling factor;

[0286] An upsampling filtering process is performed on the first prediction block according to the horizontal upsampling factor and the vertical upsampling factor to obtain a second prediction block for the second color component of the current block.

[0287] In a specific embodiment, performing upsampling filtering on the first prediction block according to the horizontal upsampling factor and the vertical upsampling factor to obtain a second prediction block for the second color component of the current block may include:

[0288] If the horizontal upsampling factor is greater than 1, or the vertical upsampling factor is greater than 1, upsampling filtering is performed on the first prediction block to obtain a second prediction block.

[0289] In the embodiment of the present application, performing upsampling filtering on the first prediction block may include at least one of the following:

[0290] Performing upsampling filtering on the first prediction block in the horizontal direction;

[0291] Performing upsampling filtering on the first prediction block in a vertical direction;

[0292] Performing upsampling filtering processing on the first prediction block in the horizontal direction and then performing upsampling filtering processing in the vertical direction;

[0293] The first prediction block is subjected to upsampling filtering in the vertical direction and then to upsampling filtering in the horizontal direction.

[0294] Here, first, the horizontal upsampling factor can be calculated based on the width of the first prediction block and the width of the current block, and the vertical upsampling factor can be calculated based on the height of the first prediction block and the height of the current block; then, the first prediction block is upsampled and filtered according to the horizontal upsampling factor and the vertical upsampling factor. Specifically, if the horizontal upsampling factor is greater than 1 and the vertical upsampling factor is equal to 1, then the first prediction block only needs to be upsampled in the horizontal direction; if the horizontal upsampling factor is equal to 1 and the vertical upsampling factor is greater than 1, then the first prediction block only needs to be upsampled in the vertical direction; if the horizontal upsampling factor is greater than 1 and the vertical upsampling factor is greater than 1, then the first prediction block needs to be upsampled in both the horizontal and vertical directions, wherein upsampling can be performed first in the horizontal direction and then in the vertical direction, or first in the vertical direction and then in the horizontal direction, and even the convolution operation in the neural network structure can be used to replace the upsampling operation here, and the embodiments of the present application do not impose any restrictions.

[0295] In some embodiments, the implementation method of upsampling filtering processing includes at least one of the following: a linear interpolation method, a convolution operation method based on a preset neural network. That is to say, for upsampling filtering processing, there can also be different filters, such as two-dimensional filters, one-dimensional filters, and so on. Among them, for a one-dimensional filter, the filtering order can be "vertical direction first and then horizontal direction" or "horizontal direction first and then vertical direction". These two orders can be fixed orders in use, or they can be adaptive orders determined according to a certain parameter (such as an order directly indicated by identification information; an order implicitly bound to factors such as prediction mode and block size, etc.). The embodiments of the present application do not impose any restrictions on this.

[0296] In another possible implementation, when the first filtering process is a filtering enhancement process, the filtering enhancement may be achieved by bilateral filtering. Specifically, performing the first filtering process on the first prediction block to determine the second prediction block of the second color component of the current block may include:

[0297] Determining a first weight value of a first prediction block in a bilateral filtering mode;

[0298] Performing bilateral filtering on the first prediction block according to the first weight value to obtain a second prediction block.

[0299] It should be noted that bilateral filtering is a nonlinear filter for edge-preserving denoising. This filtering method takes into account both spatial proximity information and color similarity information, and while filtering out noise and smoothing the image, it also preserves the image edge. Among them, bilateral filtering uses a combination of two Gaussian filters. One is responsible for calculating the weight value of spatial proximity, which is the commonly used Gaussian filter principle, and the other is responsible for calculating the weight value of pixel value similarity. Under the simultaneous action of two Gaussian filters, it is bilateral filtering. The weight value optimized in the bilateral filtering process is then convolved with the image to achieve the effect of edge-preserving denoising. See Figure 7, which shows a filter position diagram provided by an embodiment of the present application. Among them, the center position of the current filter is (i, j), and the neighboring points of the center point are (k, l), and their weight values ​​are filled with gray. In this way, the weight values ​​of the two Gaussian filters are obtained as follows:

[0300]

[0301]

[0302]

[0303] Among them, ws is the spatial proximity Gaussian filter function, wr is the pixel value similarity Gaussian filter function, and w(i,j,k,l) ​​is the product of the two Gaussian filter functions, that is, the weight value of the neighboring points around the center point of the filter. In formula (19), (ik) 2 +(jl) 2 Used to measure spatial distance, σ d is determined by the size of the current block; ||I(i,j)-I(k,l)|| 2 Used to measure the pixel intensity difference, σ r It is determined by the quantizer parameter (QP).

[0304] Furthermore, the optimized weight value w(i,j,k,l) ​​is convolved with the image to obtain the filtered prediction value as shown below:

[0305]

[0306] It should also be noted that, in the embodiment of the present application, the filter enhancement processing may include, in addition to the bilateral filter processing, median filter processing, Gaussian filter processing, normalized filter processing, etc. In other words, the filter enhancement processing may include at least one of the following: bilateral filter processing, median filter processing, Gaussian filter processing, normalized filter processing, and neural network filter processing, but is not specifically limited thereto.

[0307] Furthermore, in some embodiments, the method may further include: before performing upsampling filtering processing on the first prediction block, performing filtering enhancement processing on the first prediction block, and using the enhanced first prediction block as the first prediction block.

[0308] Furthermore, in some embodiments, the method may further include: after performing upsampling filtering on the first prediction block, performing filtering enhancement processing on the first prediction block obtained after upsampling filtering to obtain a second prediction block of the second color component of the current block.

[0309] That is, in the embodiment of the present application, the first filtering process may be an upsampling filtering process or a filtering enhancement process, or may include both upsampling filtering process and filtering enhancement process. In this case, the upsampling filtering process may be performed on the first prediction block first and then the filtering enhancement process, or the filtering enhancement process may be performed on the first prediction block first and then the upsampling filtering process, and the embodiment of the present application does not specifically limit this.

[0310] Thus, for predSamples(i, j) obtained by formula (20), predSamples(i, j) is not necessarily the final predicted value. It may be the predicted value after filtering and enhancement before upsampling (in this case, predSamples(i, j) is not the final predicted value), it may be the predicted value after filtering and enhancement after upsampling, or it may be the predicted value after filtering and enhancement without upsampling.

[0311] Furthermore, for the filtering enhancement process, in some embodiments, the method further includes:

[0312] Determining, based on reference sample values ​​in an adjacent area of ​​the current block, a compensation value for a second color component sampling point of the first prediction block;

[0313] The predicted value of the second color component sampling point of the first prediction block is corrected according to the compensation value to determine the second prediction block.

[0314] It should be noted that to further improve the prediction accuracy of the WCP mode, a position-dependent correction process can be performed on the first prediction block. For example, a chroma compensation value can be calculated for each second color component sampling point to be predicted using spatially close reference pixels. This chroma compensation value is then used to correct the second color component sampling points in the second prediction block. The final prediction value (predSamples) of the second color component sampling points is determined based on the corrected prediction value, thereby obtaining the final second prediction block.

[0315] Furthermore, for the filtering enhancement process, in some embodiments, the method further includes:

[0316] Performing prediction processing on the second color component sampling point of the first prediction block according to at least one prediction mode to determine at least one initial prediction value of the second color component sampling point of the first prediction block;

[0317] A second prediction block is determined by performing weighted fusion processing on at least one initial prediction value and a prediction value of a second color component sampling point in the first prediction block.

[0318] It should be noted that, in order to further improve the prediction accuracy of the WCP mode, the chroma prediction values ​​calculated in other prediction modes can be weighted and fused with the chroma prediction values ​​calculated in the WCP mode, and the final chroma prediction value can be determined based on this fusion result. For example, as shown in FIG8 , other prediction modes may include: planar mode, direct current (DC) mode, vertical mode, horizontal mode, and CCLM mode, and each prediction mode is connected to a switch that controls whether the chroma prediction value in this prediction mode participates in the weighted fusion process. Assume that the weight value corresponding to the Planar mode is W_Planar, the weight value corresponding to the DC mode is W_DC, the weight value corresponding to the vertical mode is W_Ver, the weight value corresponding to the horizontal mode is W_Hor, the weight value corresponding to the CCLM mode is W_CCLM, and the weight value corresponding to the WCP mode is W_Wcp; for the chroma prediction value in the Planar mode, the chroma prediction value in the DC mode, the chroma prediction value in the vertical mode, the chroma prediction value in the horizontal mode, and the chroma prediction value in the CCLM mode, if only the switch connected to the CCLM mode is in the closed state, then the chroma prediction value in the CCLM mode and the chroma prediction value in the WCP mode can be weightedly fused according to W_CCLM and W_Wcp, and the values ​​of W_CCLM and W_Wcp can determine whether to perform equal-weighted or unequal-weighted weighted fusion, and the weighted result is the final chroma prediction value of the second color component sampling point, thereby obtaining the final second prediction block.

[0319] In some embodiments, after determining the second prediction block, determining the reconstructed value of the second color component sampling point of the current block according to the second prediction block may include:

[0320] Determine a predicted difference value of a second color component sampling point of the current block;

[0321] Determining a predicted value of a second color component sampling point of the current block according to the second prediction block;

[0322] Determine a reconstructed value of the second color component sampling point of the current block according to the predicted difference value of the second color component sampling point of the current block and the predicted value of the second color component sampling point of the current block.

[0323] It should be noted that, in the embodiment of the present application, the predicted residual value of the second color component sampling point of the current block may be determined by parsing the bitstream.

[0324] It should also be noted that, in an embodiment of the present application, determining the predicted value of the second color component sampling point of the current block based on the second prediction block may be performed by setting the predicted value of the second color component sampling point of the current block equal to the value of the second prediction block; or, upsampling filtering may be performed on the value of the second prediction block, and the predicted value of the second color component sampling point of the current block may be set equal to the output value after the upsampling filtering.

[0325] In this way, taking the chroma component as an example, by parsing the code stream, the chroma prediction difference value of the current block can be determined; then, based on the second prediction block, the chroma prediction value of the current block can be determined; then, the chroma prediction value and the chroma prediction difference value are added together to obtain the chroma reconstruction value of the current block.

[0326] It can be understood that the embodiment of the present application is a detailed description of the post-processing operation process after the WCP prediction in the prediction process of the WCP mode, which mainly includes four aspects: on the one hand, the luminance information of the reference pixel and the current block is fully utilized to realize the calculation of the chrominance weighting coefficient of the reference pixel; on the other hand, the characteristic of the human eye being low in sensitivity to chrominance and in order to reduce the complexity of the chrominance weighting calculation, the core parameters of the WCP mode are fully considered, that is, when predSizeW×predSizeH is less than or equal to nTbW×nTbH, the chrominance prediction block is up-sampled; on the other hand, when up-sampling is performed, full consideration is given to the chrominance prediction block. The reference chroma information is utilized separately, and the characteristics in different directions are taken into account; and different weights are assigned to different points to be interpolated between existing adjacent points during the linear interpolation process, fully considering the spatial correlation between the points to be interpolated and the existing points, thereby improving the accuracy of upsampling filtering; on the other hand, the chroma prediction block output by the WCP prediction may cause unstable and inaccurate prediction values, as well as the inaccurate prediction values ​​that may be caused by upsampling filtering in the embodiment of the present application, and the chroma prediction blocks in these cases are filtered and enhanced using a bilateral filtering method with edge-preserving denoising, thereby further improving the accuracy and subjective and objective quality of the chroma prediction blocks. Here, it should be noted that the four aspects described here do not have a sequential relationship, and can be used individually or in combination.

[0327] In short, the embodiment of the present application also provides a framework for weighted chrominance prediction, as shown in FIG9 . For each sampling point recY[i][j] in the reconstructed luminance information (i.e., the downsampled luminance block) in the current block, the luminance difference vector diffY[i][j] is first obtained based on the absolute value of the difference between recY[i][j] and the adjacent luminance vector refY[k]. Secondly, the normalized weight vector cWeight[i][j] is derived based on the nonlinear mapping model related to diffY[i][j]. Thirdly, the weight vector is used to perform vector multiplication on the weight vector and the adjacent chrominance vector of the current block to obtain the predicted chrominance prediction value.

[0328] This embodiment provides a decoding method, which includes determining a reference sample value of a first color component of a current block; determining a weighting coefficient based on the reference sample value of the first color component of the current block; determining a first prediction block of the second color component of the current block based on the weighting coefficient and the reference sample value of the second color component of the current block; performing a first filtering process on the first prediction block to determine a second prediction block of the second color component of the current block; wherein the second prediction block includes prediction values ​​of all second color component sampling points in the current block; and determining, based on the second prediction block, reconstructed values ​​of the second color component sampling points of the current block. In this way, the weighting coefficients are calculated using the reference pixels adjacent to the current block and the color component information of the current block, which fully exploits the correlation between the current block and the adjacent areas in brightness information, and involves this correlation in the chrominance prediction of the current block, thereby improving the accuracy of the chrominance prediction; in addition, utilizing the characteristics of the human eye's low sensitivity to chrominance, and in order to reduce the calculation complexity of the weighting coefficients, the first prediction block is upsampled and filtered when the first prediction block is smaller than the size of the current block; even considering the instability of the predicted value of the first prediction block, it can also be filtered and enhanced, thereby further improving the accuracy and subjective and objective quality of the chrominance prediction, saving bit rate, improving encoding and decoding efficiency, and thus improving encoding and decoding performance.

[0329] In another embodiment of the present application, based on the decoding method described in the previous embodiment, taking the chroma prediction of the current block as an example, in this embodiment, the reconstructed luminance information of the current block, the reference luminance information of the adjacent area, and the reference chroma information are all decoded reference information. Therefore, this embodiment of the present application proposes a weighted chroma prediction technology that utilizes the above information, and on this basis, performs post-processing operations on the chroma prediction block obtained by WCP, further improving the accuracy of chroma prediction. Here, the detailed steps of the chroma prediction process in the WCP mode are as follows:

[0330] Input of WCP mode: the position of the current block (xTbCmp, yTbCmp), the width of the current block nTbW and the height of the current block nTbH.

[0331] Output of the WCP mode: predicted value predSamples[x][y] of the current block, where the upper left corner of the current block is the coordinate origin, x=0,...,nTbW-1, y=0,...,nTbH-1.

[0332] The prediction process of the WCP mode may include steps such as determining core parameters, obtaining target information, weighted chrominance prediction, and post-processing. After these steps, the chrominance prediction value of the current block may be obtained.

[0333] In a specific embodiment, referring to FIG10 , which shows a second flow chart of a decoding method provided by an embodiment of the present application, the method may include:

[0334] S1001: Determine the core parameters of the WCP mode.

[0335] It should be noted that, for S1001, the core parameters involved in the WCP mode are determined, that is, the core parameters of the WCP mode can be obtained or inferred through configuration or in some way, such as obtaining the core parameters from the bitstream at the decoding end.

[0336] Here, the core parameters of the WCP mode include but are not limited to a control parameter (S), the number of weighted chroma prediction inputs (inSize), and the number of weighted chroma prediction outputs (arranged as predSizeW×predSizeH). The first prediction block of the weighted chroma prediction output can be represented by predWcp, and the number of weighted chroma prediction outputs can be set to the same value (e.g., predSizeW=predSizeH=T / 4) or related to the size parameter of the current block (e.g., predSizeW=nTbW, predSizeH=nTbH). The control parameter (S) can be used to adjust the nonlinear function in subsequent steps or to adjust the data involved in subsequent steps.

[0337] The determination of core parameters is affected by block size, block content, or the number of pixels in a block under certain conditions. For example:

[0338] If there are many types of block sizes applied in the WCP mode, or there are large differences between block sizes, or there are significant differences in block content, or there are large differences in the number of pixels within a block, the current block can be classified according to its block size, block content, or the number of pixels within the block, and the same or different core parameters can be determined according to different categories. That is, the control parameter (S) corresponding to different categories, or the number of inputs inSize of the weighted chrominance prediction, or the number of outputs of the weighted chrominance prediction (arranged as predSizeW×predSizeH) can be the same or different. Note that predSizeW and predSizeH can also be the same or different.

[0339] To better illustrate the determination of the core parameters below, two simple classification examples are used for illustration:

[0340] Classification example 1: The WCP mode can classify the current block according to the width and height of the current block, and use wcpSizeId to represent the type of the block. For different types of blocks, the control parameter (S), the number of inputs inSize of the weighted chrominance prediction, and the number of outputs of the weighted chrominance prediction (arranged as predSizeW×predSizeH) can be the same or different. Here, an example of dividing into 3 categories is used for illustration:

[0341] The current block is divided into 3 categories according to the width and height of the current block. The control parameter (S) of different categories can be set differently, and the inSize and the number of outputs of the weighted chrominance prediction (arranged as predSizeW×predSizeH) of different categories can be set to be the same. nTbW is the width of the current block, nTbH is the height of the current block, and the definition of the block type wcpSizeId is as follows:

[0342] wcpSizeId = 0: Represents the current block where min(nTbW, nTbH) <= 4. Among them, the control parameter (S) is 8, inSize is (2×nTbH + 2×nTbW), and the weighted chrominance prediction outputs nTbH×nTbW chrominance prediction values;

[0343] wcpSizeId = 1: Represents the current block where 4 < min(nTbW, nTbH) <= 16. Among them, the control parameter (S) is 12, inSize is (2×nTbH + 2×nTbW), and the weighted chrominance prediction outputs nTbH×nTbW chrominance prediction values;

[0344] wcpSizeId = 2: Represents the current block where min(nTbW, nTbH) > 16. Among them, the control parameter (S) is 16, inSize is (2×nTbH + 2×nTbW), and the weighted chrominance prediction outputs nTbH×nTbW chrominance prediction values;

[0345] The quantitative relationships of the above core parameters are shown in Table 6 in tabular form.

[0346] Table 6

[0347] wcpSizeIdSinSizepredSizeHpredSizeW082×nTbH+2×nTbWnTbHnTbW1122×nTbH+2×nTbWnTbHnTbW2162×nTbH+2×nTbWnTbHnTbW

[0348] Another example can be used to illustrate the classification into three categories:

[0349] The current block is divided into three categories according to the width and height of the current block. The control parameters (S) for different categories can be set differently, and the inSize and the number of chrominance prediction outputs based on weights (arranged as predSizeW × predSizeH) for different categories can be set to be the same. nTbW is the width of the current block, nTbH is the height of the current block, and the definition of the block type wcpSizeId is as follows:

[0350] wcpSizeId = 0: indicates the current block where min(nTbW, nTbH) <= 4. Among them, the control parameter (S) is 8, inSize is (2 × nTbH + 2 × nTbW), and the chrominance prediction outputs based on weights are nTbH × nTbW chrominance prediction values;

[0351] wcpSizeId = 1: indicates the current block where 4 < min(nTbW, nTbH) <= 16. Among them, the control parameter (S) is 12, inSize is (1.5 × nTbH + 1.5 × nTbW), and the chrominance prediction outputs based on weights are nTbH / 2 × nTbW / 2 chrominance prediction values;

[0352] wcpSizeId = 2: indicates the current block where min(nTbW, nTbH) > 1十六. Among them, the WCP control parameter (S) is 16, inSize is (nTbH + nTbW), and the chrominance prediction outputs based on weights are nTbH / 4 × nTbW / 4 chrominance prediction values;

[0353] The quantitative relationships of the above core parameters are shown in Table 7 in tabular form. <映

[0354] Table 7

[0355] wcpSizeIdSinSizepredSizeHpredSizeW082×nTbH+2×nTbWnTbHnTbW

[0356] 1121.5×nTbH+1.5×nTbWnTbH / 2nTbW / 2216nTbH+nTbWnTbH / 4nTbW / 4

[0357] Classification Example 2: WCP mode can also classify the current block according to its width and height, using wcpSizeId to indicate the block type. For different types of blocks, the control parameter (S), the number of weighted chroma prediction inputs inSize, and the number of weighted chroma prediction outputs (arranged as predSizeW × predSizeH) can be the same or different. Here is an example of three categories:

[0358] The current block is divided into three categories based on its width and height. The control parameter (S) of different categories can be set to different values. The inSize and the number of weighted chroma prediction outputs (arranged as predSizeW×predSizeH) of different categories can be set to the same. nTbW is the width of the current block, nTbH is the height of the current block, and nTbW×nTbH represents the number of pixels in the current block. The block type wcpSizeId is defined as follows:

[0359] wcpSizeId=0: indicates a current block with (nTbW×nTbH)<128. Here, the control parameter (S) is 10, inSize is (2×nTbH+2×nTbW), and the weighted chroma prediction outputs nTbH×nTbW chroma prediction values.

[0360] wcpSizeId=1: indicates a current block with size 128<=(nTbW×nTbH)<=256. The control parameter (S) is 8, inSize is (2×nTbH+2×nTbW), and weighted chroma prediction outputs nTbH×nTbW chroma prediction values.

[0361] wcpSizeId=2: indicates that (nTbW×nTbH)>256 current blocks. In this case, the control parameter (S) is 1, inSize is (2×nTbH+2×nTbW), and the weighted chroma prediction outputs nTbH×nTbW chroma prediction values.

[0362] The quantitative relationship of the above core parameters is expressed in tabular form, as shown in Table 8.

[0363] Table 8

[0364] wcpSizeIdSinSizepredSizeHpredSizeW0102×nTbH+2×nTbWnTbHnTbW182×nTbH+2×nTbWnTbHnTbW212×nTbH+2×nTbWnTbHnTbW

[0365] The three categories can also be explained with another example:

[0366] The current block is divided into three categories based on its width and height. The control parameter (S) of different categories can be set to different values. The inSize and the number of weighted chroma prediction outputs (arranged as predSizeW×predSizeH) of different categories can be set to the same. nTbW is the width of the current block, nTbH is the height of the current block, and nTbW×nTbH represents the number of pixels in the current block. The block type wcpSizeId is defined as follows:

[0367] wcpSizeId=0: indicates a current block with (nTbW×nTbH)<64. Here, the control parameter (S) is 16, inSize is (2×nTbH+2×nTbW), and the weighted chroma prediction outputs nTbH×nTbW chroma prediction values.

[0368] wcpSizeId=1: indicates a current block of 64<=(nTbW×nTbH)<=512. Here, the control parameter (S) is 4, inSize is (1.5×nTbH+1.5×nTbW), and the weighted chroma prediction outputs nTbH / 2×nTbW / 2 chroma prediction values.

[0369] wcpSizeId=2: indicates a current block with (nTbW×nTbH)>512. Here, the control parameter (S) is 1, inSize is (nTbH+nTbW), and the weighted chroma prediction outputs nTbH / 4×nTbW / 4 chroma prediction values.

[0370] The quantitative relationship of the above core parameters is expressed in tabular form, as shown in Table 9.

[0371] Table 9

[0372] wcpSizeIdSinSizepredSizeHpredSizeW0162×nTbH+2×nTbWnTbHnTbW141.5×nTbH+1.5×nTbWnTbH / 2nTbW / 221nTbH+nTbWnTbH / 4nTbW / 4

[0373] S1002: Determine target information of the current block according to the core parameters.

[0374] It should be noted that, for S1002, when predicting the current block, the upper area, the upper left area and the left area of ​​the current block are used as adjacent areas of the current block (also referred to as "reference areas"). As shown in the aforementioned Figure 6A, the pixels in the adjacent areas are all decoded reference pixels.

[0375] Here, reference chroma information refC and reference luminance information refY are obtained from adjacent regions. The obtained reference chroma information includes, but is not limited to, selecting a reference chroma reconstruction value for the region above the current block and / or a reference chroma reconstruction value for the region to the left. The obtained reference luminance information includes, but is not limited to, obtaining corresponding reference luminance information based on the position of the reference chroma information.

[0376] The luminance reconstruction information recY of the current prediction block is obtained, and the obtaining method includes but is not limited to obtaining the corresponding reconstructed luminance information according to the position of the chrominance information in the current block as the reconstructed luminance information of the current block.

[0377] It should be noted that, in the embodiment of the present application, refC or refY or recY can be pre-processed under certain conditions and used as target information for weighted chrominance prediction input.

[0378] For example, to reduce the computational complexity of WCP prediction, a point selection operation or a downsampling filtering operation may be performed on refC, refY, or recY.

[0379] Exemplarily, different filtering operations may be performed on refC or refY or recY for current blocks of different sizes;

[0380] For example, under the condition that the spatial resolutions of the chrominance component and the luminance component of the video are inconsistent, upsampling and downsampling filtering operations may be performed on refC or refY or recY to facilitate subsequent chrominance prediction calculations.

[0381] For example, under the condition that the spatial resolution of the video chrominance component and the luminance component are consistent, multiple rows / columns of reference pixels can be used. At this time, upsampling and downsampling filtering operations can also be performed on refC, refY or recY to facilitate subsequent chrominance prediction calculations.

[0382] For example, when the number of refC or refY obtained is different from the number of inSize in the core parameter, it is necessary to perform point selection or upsampling or downsampling filtering operations on refC or refY.

[0383] That is to say, the target information obtained may include: obtaining inSize amount of reference chromaticity information refC (if pre-processing operation is required, it is after the pre-processing operation), obtaining inSize amount of reference luminance information refY (if pre-processing operation is required, it is after the pre-processing operation), and obtaining the reconstructed luminance information recY in the current block (if pre-processing operation is required, it is after the pre-processing operation).

[0384] S1003: Perform a weighted chrominance prediction calculation according to the target information to obtain a first prediction block of the current block.

[0385] It should be noted that, for S1003, the chromaticity prediction value within the size specified by the core parameter is expressed as C pred [i][j] represents, where i=0,…,predSizeW-1, j=0,…,predSizeH-1, and the calculation is performed one by one. Note that predSizeH and predSizeW are core parameters. In this embodiment of the application, predSizeH is greater than or equal to the height nTbH of the current block or predSizeW is greater than or equal to the width nTbW of the current block, and they are the same or different. In this way, under certain conditions, the following calculation can also be performed on only some of the pixels to be predicted in the current block.

[0386] It can be understood that weighted chrominance prediction includes the following operations: obtaining weights and performing weighted prediction based on the weights to obtain weighted chrominance prediction values. The weight acquisition process includes constructing a luminance difference vector and calculating the weights. The detailed calculation process is as follows:

[0387] For i=0,…,predSizeW-1, j=0,…,predSizeH-1

[0388] For k = 0, 1..., inSize-1

[0389] Construct each element diffY[i][j][k] in the brightness difference vector

[0390] Calculate each element cWeight[i][j][k] (or cWeightFloat[i][j][k]) in the weight vector, and then calculate the chrominance prediction value C by cWeight[i][j] (or cWeightFloat[i][j][k]) and refC pred [i][j].

[0391] In a specific embodiment, after acquiring the target information, as shown in FIG11 , the method may include:

[0392] S1101: For each pixel to be predicted, a luminance difference vector is constructed using the reference chrominance information, the reference luminance information included in the target information, and the reconstructed luminance information of the current block.

[0393] It should be noted that for each pixel to be predicted C within the size specified by the core parameter pred[i][j], subtract the corresponding reconstructed brightness information recY[i][j] from the reference brightness information refY of inSize and take the absolute value to get the brightness difference vector diffY[i][j][k]. The specific calculation formula is as follows:

[0394] diffY[i][j][k]=abs(refY[k]-recY[i][j]) (21)

[0395] in, abs(x) represents the absolute value of x.

[0396] It should also be noted that under certain conditions, the brightness difference vector of the pixel to be predicted can be subjected to linear or nonlinear numerical processing. For example, the value of the brightness difference vector of the pixel to be predicted can be scaled according to the control parameter S in the core parameters.

[0397] S1102: For each pixel to be predicted, calculate a weight vector using a nonlinear function according to the brightness difference vector.

[0398] It should be noted that, in the embodiment of the present application, a weight model is used to predict each pixel C pred The corresponding luminance difference vector diffY[i][j] is processed to obtain the corresponding floating-point weight vector cWeightFloat[i][j]. The weight model here includes but is not limited to nonlinear normalization functions, nonlinear exponential normalization functions, and other nonlinear functions, and is not limited to any other nonlinear functions.

[0399] For example, a nonlinear Softmax function can be used as a weight model, and the brightness difference vector diffY[i][j] corresponding to each pixel to be predicted is used as the input of the weight model. The weight model outputs a floating-point weight vector cWeightFloat[i][j] corresponding to each pixel to be predicted. The calculation formula is as follows:

[0400]

[0401] Under certain conditions, the weight model can also be adjusted according to the control parameter (S) in the core parameters. For example, if the size of the current block is flexible, the weight model can be adjusted according to the control parameter (S). Taking the nonlinear Softmax function as an example, different control parameters can be selected to adjust the function according to the block classification category to which the current block belongs. In this case, the weight vector calculation formula corresponding to each pixel to be predicted is as follows:

[0402]

[0403] In the embodiment of the present application, the weighting coefficients may also be processed as fixed-point. Therefore, in some embodiments, the method further includes: if the weighting coefficients are floating-point weighting coefficients, then the floating-point weighting coefficients are processed as fixed-point to obtain fixed-point weighting coefficients.

[0404] Thus, after the calculation of the above formula (22) or formula (23) is completed, cWeightFloat can be fixed-point processed as follows:

[0405] cWeight[i][j][k]=round(cWeightFloat[i][j][k]×2 Shift ) (twenty four)

[0406] Where round(x) = Sign(x) × Floor(abs(x) + 0.5). Here, Floor(x) represents the largest integer less than or equal to x. abs(x) represents the absolute value of x. Shift is the amount of shift set in the fixed-point operation to improve accuracy.

[0407] S1103: For each pixel to be predicted, perform weighted calculation according to the weight vector and the reference chrominance information included in the target information to obtain a chrominance prediction value.

[0408] It should be noted that the chrominance prediction value of the pixel to be predicted is calculated based on the weight vector cWeight[i][j] (or cWeightFloat[i][j]) corresponding to each pixel to be predicted and the reference chrominance information refC. Specifically, each pixel to be predicted C pred The reference chroma information refC of [i][j] is multiplied one by one with the weight vector elements corresponding to each pixel to be predicted to obtain subC[i][j] (or subCFloat[i][j]), and the multiplication results are accumulated to obtain the chroma prediction value C of each pixel to be predicted. pred [i][j], that is, to achieve weighted prediction of chrominance components.

[0409] In a possible implementation, it may include: performing weighted calculation according to floating-point weighting coefficients and reference chrominance information to obtain an initial prediction value of the pixel to be predicted; and performing fixed-point processing on the initial prediction value to obtain a target prediction value of the pixel to be predicted.

[0410] For example, the calculation formula is as follows:

[0411] For k = 0, 1, ..., inSize-1

[0412] subCFloat[i][j][k]=(cWeightFloat[i][j][k]×refC[k]) (25)

[0413] After the calculation is completed, subCFloat[i][j][k] can also be fixed-point processed. In order to retain a certain calculation accuracy during the fixed-point process, a coefficient can be multiplied here, as shown below:

[0414] subC[i][j][k]=round(subCFloat[i][j][k]×2 Shift ) (26)

[0415] or:

[0416] For i=0,…,predSizeW-1, j=0,…,predSizeH-1

[0417]

[0418] After the calculation is completed, pred Float[i][j] is fixed-point, such as:

[0419] C pred [i][j]=round(C pred Float[i][j]) (28)

[0420] In another possible implementation, weighted calculation may be performed based on fixed-point weighting coefficients and reference chrominance information to obtain an initial prediction value of the pixel to be predicted; and fixed-point compensation processing may be performed on the initial prediction value to obtain a target prediction value of the pixel to be predicted.

[0421] For example, the calculation formula is as follows:

[0422] For k = 0, 1, ..., inSize-1

[0423] subC[i][j][k]=(cWeight[i][j][k]×refC[k]) (29)

[0424] Then use the fixed-point subC[i][j][k] to calculate as follows:

[0425] For i=0,…,predSizeW-1, j=0,…,predSizeH-1

[0426]

[0427] Among them, Offset = 1 << (Shift1 - 1), where Shift1 is the shift amount required in the fixed-point operation taken to improve accuracy during the calculation of cWeight[i][j][k] or subC[i][j][k] (Shift1 = Shift), or in other steps.

[0428] S1104: For each pixel to be predicted, perform a correction operation on the calculated chrominance prediction value to determine the first prediction block of the current block.

[0429] It should be noted that the chrominance prediction value should be limited within a preset range. If it exceeds this preset range, corresponding correction operations need to be performed. Exemplarily, in one possible implementation, a clamping operation can be performed on the chrominance prediction value of C pred [i][j] as follows:

[0430] ● When the value of C pred [i][j] is less than 0, set it to 0;

[0431] ● When the value of C pred [i][j] is greater than (1 << BitDepth) - 1, set it to (1 << BitDepth) - 1.

[0432] Among them, BitDepth is the bit depth required for chrominance pixel values, to ensure that all chrominance prediction values in the prediction block are between 0 and (1 << BitDepth) - 1.

[0433] That is:

[0434] C pred [i][j] = Clip3(0, (1 << BitDepth) - 1, C pred [i][j]) (31)

[0435] Among them,

[0436]

[0437] Or, by combining formula (31) and formula (32), the following formula is obtained:

[0438]

[0439] S1004: Perform a post-processing operation on the chrominance prediction value of the first prediction block to determine the second prediction block of the current block.

[0440] It should be noted that, for S1004, the output chrominance prediction value is further post-processed based on the chrominance prediction value derived based on the weight using the reconstructed luminance information, thereby further improving the accuracy of the chrominance prediction.

[0441] Because the human eye is less sensitive to partial removal of chroma information, embodiments of the present application can perform chroma prediction on only a portion of the points in the current block. In this case, the size of the resulting first prediction block, predSizeW × predSizeH, is less than or equal to the size of the current block (i.e., the original chroma block), nTbW × nTbH. The solution of embodiments of the present application primarily determines whether to perform chroma upsampling filtering based on the output size of the first prediction block obtained after WCP prediction, and simultaneously performs filtering enhancement on the chroma prediction value.

[0442] In a specific embodiment, for performing a post-processing operation on the chrominance prediction value of the first prediction block, as shown in FIG12 , the method may include:

[0443] S1201: Determine the output size of the first prediction block.

[0444] S1202: If the output size of the first prediction block is equal to the size of the current block, directly perform filtering enhancement on the first prediction block to obtain a second prediction block.

[0445] S1203: If the output size of the first prediction block is smaller than the size of the current block, determine the execution order of the first prediction block.

[0446] S1204: first perform upsampling filtering on the first prediction block to obtain an upsampled prediction block, and restore it to a size consistent with the current block.

[0447] S1205: Filter and enhance the upsampled prediction block to obtain a second prediction block.

[0448] S1206: First, perform filtering enhancement on the prediction block after upsampling and filtering to obtain an enhanced prediction block.

[0449] S1207: Upsampling and filtering are performed on the enhanced prediction block to obtain a second prediction block, and the size of the second prediction block is restored to be consistent with that of the current block.

[0450] It should be noted that the execution order of the first prediction block may include a first execution order and a second execution order. The first execution order is: first upsampling and filtering the first prediction block, and then filtering and enhancing the upsampled prediction block; the second execution order is: first filtering and enhancing the first prediction block, and then upsampling and filtering the enhanced prediction block.

[0451] Here, it is assumed that the execution order of the first prediction block is the first execution order: first, up-sampling and filtering are performed on the first prediction block, and then filtering and enhancing are performed on the up-sampled prediction block.

[0452] In actual encoding, chroma subsampling exploits the human eye's lower sensitivity to chroma signals compared to luminance signals to remove some color information from the image without being noticed. This means that chroma signals can be sampled at a lower spatial frequency. Furthermore, the chroma components within the same block are relatively flat and have similar content characteristics. For video content with these two characteristics, performing point-by-point prediction for all points in the same image block introduces high computational complexity in calculating the weight vector and the weighted chroma prediction values, significantly reducing prediction efficiency. Given these two video characteristics and the high computational complexity associated with calculating chroma prediction values ​​for all points, it is advisable to consider predicting only a subset of points in the current block. Specifically, in the WCP mode, the core parameters predSizeW should be smaller than the current block width nTbW or predSizeH should be smaller than the current block height nTbH. In this case, upsampling filtering of predWcp is required to obtain the final chroma prediction value predSamples.

[0453] In the embodiment of the present application, first, the horizontal upsampling factor upHor is calculated based on the output width predSizeW of the first predicted block and the width nTbW of the current block; similarly, the vertical upsampling factor upVer is calculated based on the output height predSizeH of the first predicted block and the height nTbH of the current block. The calculation method is as follows:

[0454] upHor=nTbW / predSizeW (34)

[0455] upVer=nTbH / predSizeH (35)

[0456] Next, the first prediction block predWcp is filled into the current second prediction block predSamples in the following manner:

[0457] predSamples[(x+1)×upHor-1][(y+1)×upVer-1]=predWcp[x][y] (36)

[0458] Specifically, the upper reference reconstructed chroma pixel refC_T is first added to the upper row predSamples[x][-1] of the second prediction block, and the left reference reconstructed chroma pixel refC_L is added to the left column predSamples[-1][y] of the second prediction block, where x = 0, ..., nTbW-1, and y = 0, ..., nTbH-1.

[0459] At this time, predWcp is placed in the corresponding position ((x+1)×upHor-1, (y+1)×upVer-1) in the second prediction block predSamples through equation (36). It can be understood that the second prediction block is evenly divided into predSizeW×predSizeH sub-blocks, and the placement position is the lower right corner position of each sub-block. See Figure 13 for details, taking a 32×32 block as an example, where the points filled with grid are the upper reference reconstructed chroma pixels refC_T, the points filled with diagonal stripes are the left reference reconstructed chroma pixels refC_L, and the points filled with black are the positions filled with chroma prediction samples predWcp.

[0460] When the horizontal upsampling factor upHor is greater than 1, the horizontal upsampling filter is performed first. The upsampling process is shown in the following formula:

[0461] sum=(upHor-dX)×predSamples[xHor][yHor]+dX×predSamples[xHor+upHor][yHor](37)

[0462] predSamples[xHor+dX][yHor]=(sum+upHor / 2) / upHor (38)

[0463] Among them, (xHor, yHor)=(m×upHor-1, n×upVer-1), m=0,…,predSizeW-1, n=1,…,predSizeW, dX=1,…,upHor-1.

[0464] This process is detailed in Figure 14. Taking a 32×32 block as an example, during horizontal upsampling, the points in the left reference chroma pixel refC_L corresponding to the horizontal position filled with predWcp are also used as reference points for upsampling and are also filled with black. In this case, all black-filled points are reference points for upsampling, and the predicted points obtained by linear interpolation between every two black-filled points in the horizontal direction are filled with gray.

[0465] The upsampling method uses linear interpolation, that is, the value of each interpolated point (filled with gray) between two upsampled chroma reference points (filled with black) is the weighted average of the two upsampled reference chroma points. According to equations (37) and (38), the weight of the left upsampled 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, when interpolating horizontally, the weight is only related to the horizontal upsampling factor upHor. Figure 15 shows an example of weights. In this example, upHor=4. Among them, for the first interpolation point in Figure 15, the weight of the left upsampled reference chroma point is 3 / 4, and the weight of the right upsampled reference chroma point is 1 / 4; for the second interpolation point in Figure 15, the weight of the left upsampled reference chroma point is 2 / 4, and the weight of the right upsampled reference chroma point is 2 / 4; for the third interpolation point in Figure 15, the weight of the left upsampled reference chroma point is 1 / 4, and the weight of the right upsampled reference chroma point is 3 / 4.

[0466] ●When the vertical upsampling factor upVer is greater than 1, vertical upsampling filtering is required. The process is similar to the horizontal upsampling process. The specific process is shown in the following formula:

[0467] sum=(upVer-dY)×predSamples[xVer][yVer]+dY×predSamples[xVer][yVer+upVer] (39)

[0468] predSamples[xVer][yVer+dY]=(sum+upVer / 2) / upVer (40)

[0469] Among them, (xVer, yVer)=(m,n×upVer-1), m=0,...,predSizeH-1, n=0,...,predSizeH-1, dY=1,...,upVer-1.

[0470] This process is detailed in Figure 16. Taking a 32×32 block as an example, after the horizontal upsampling filter shown in Figure 14 is completed, the upper reference chroma pixel refC_T and all existing points in the second prediction block are used as reference points for vertical upsampling, and are filled with black. At this point, all black-filled points are upsampling reference points, and the predicted points obtained by linear interpolation between every two black-filled points in the vertical direction are filled with gray.

[0471] The upsampling method also uses linear interpolation. According to equations (39) and (40), the weight of the upper upsampling reference point is (upVer-dY) / upVer, and the weight of the lower reference point is dY / upVer, where dY = 1,…,upVer-1 (i.e., the distance between the current interpolation point and the upper reference point). That is, during vertical interpolation, the weight is only related to the vertical upsampling factor upVer.

[0472] Thus, according to the above process, the predSamples obtained after interpolation is the predicted value of the final chroma prediction block of the current WCP technology.

[0473] Furthermore, in order to compensate for the inaccurate nonlinear weight mapping model of the WCP technology and the instability caused by independent point-by-point prediction of each point, the embodiment of the present application can also consider filtering and enhancing the output prediction block. The prediction block to be filtered and enhanced may include the first prediction block before upsampling filtering, may include the second prediction block after upsampling filtering, and may also include the first prediction block that does not require upsampling filtering (when upHor=upVer=1).

[0474] Here, the filtering enhancement method used in the embodiment of the present application is bilateral filtering. Bilateral filtering is a nonlinear filter that preserves edge-preserving noise and considers both spatial proximity information and color similarity information. It filters out noise, smoothes the image, and preserves image edges.

[0475] Specifically, bilateral filtering uses a combination of two Gaussian filters. One is responsible for calculating the weight value of spatial proximity, which is the commonly used Gaussian filter principle, and the other is responsible for calculating the weight value of pixel value similarity. Under the simultaneous action of two Gaussian filters, it is bilateral filtering. The weight value optimized in the bilateral filtering process is then convolved with the image to achieve the effect of edge-preserving denoising. The weight value of the two Gaussian filters is obtained as shown in the above equations (17) to (19). The optimized weight value w(i,j,k,l) ​​is then convolved with the image to obtain the filtered prediction value shown in the above equation (20). It should be noted that predSamples(i,j) is the filtered prediction value. However, the predSamples(i,j) here is not necessarily the final prediction value. It may be the filtered prediction value before upsampling (in this case, predSamples(i,j) is not the final prediction value), it may be the filtered prediction value after upsampling, or it may be the filtered chrominance prediction value that does not require upsampling.

[0476] It is understood that in the embodiments of the present application, in addition to using a bilateral filter as a filtering method, a median filter can also be used to replace each pixel of the image with the median value of the pixels in the neighborhood (a square area centered on the current pixel); a Gaussian filter can also be used; a normalized block filter can also be used, and the like, without any limitation here. For example, for a normalized filter, the output pixel value is the mean of the pixel values ​​within the kernel window (all pixels have equal weighting coefficients), where the kernel is as follows:

[0477]

[0478] In addition, in order to improve the WCP prediction performance, in addition to adopting traditional filtering algorithms, neural networks can also be used to filter and enhance the WCP prediction output predWcp.

[0479] It can also be understood that in the embodiment of the present application, the traditional correction implementation method for performing post-processing enhancement on the output first prediction block may also include:

[0480] (1) To further improve the accuracy of the WCP prediction value, a position-dependent correction process can be performed on predWcp. For example, a chroma compensation value is calculated for each pixel to be predicted using a reference pixel with a similar spatial position. This chroma compensation value is used to correct predWcp, and the corrected prediction value is used as the final chroma prediction value predSamples.

[0481] (2) Alternatively, the chroma prediction values ​​calculated by one or more other chroma prediction techniques may be weightedly fused with the chroma prediction value predWcp calculated by WCP, and the fused result may be used as the final chroma prediction value predSamples. The weighted fusion scheme may be shown in FIG8 .

[0482] It is also understandable that in the embodiments of the present application, in addition to adopting the "horizontal-first, vertical-second" upsampling method, a "vertical-first, horizontal-second" upsampling method may also be adopted for upsampling filtering. For example, as shown in FIG17 , taking a 32×32 block as an example, the points filled with a grid are the upper reference reconstructed chroma pixels refC_T, and the points filled with a diagonal stripe are the left reference reconstructed chroma pixels refC_L.

[0483] When the vertical upsampling factor upVer is greater than 1, upsampling in the vertical direction is performed first. The upsampling process is as follows:

[0484] sum=(upVer-dY)×predSamples[xVer][yVer]+dY×predSamples[xVer][yVer+upVer] (42)

[0485] predSamples[xVer][yVer+dY]=(sum+upVer / 2) / upVer (43)

[0486] Among them, (xVer, yVer) = (m, n × upVer-1), m = 0,..., predSizeH-1, n = 0,..., predSizeH-1, dY = 1,..., upVer-1.

[0487] This process is detailed in Figure 17. Taking a 32×32 block as an example, during vertical upsampling, the points in the upper reference chroma pixel refC_T corresponding to the vertical position filled with predWcp are also used as reference points for upsampling and are also filled with black. In this case, all the black-filled points are reference points for upsampling, and the predicted points obtained by linear interpolation between every two black-filled points in the vertical direction are filled with gray.

[0488] The upsampling method uses linear interpolation upsampling. According to equations (42) and (43), the weight of the upper upsampling reference point is (upVer-dY) / upVer, and the weight of the lower reference point is dY / upVer, where dY = 1,…, upVer-1 (i.e., the distance between the current interpolation point and the upper reference point). That is, during vertical interpolation, the weight is only related to the vertical upsampling factor upVer. Figure 18 shows an example of weights. In this example, upVer = 4. For the first interpolation point in Figure 18, the weight of the upper upsampling reference chroma point is 5 / 8, and the weight of the lower upsampling reference chroma point is 3 / 8; for the second interpolation point in Figure 18, the weight of the upper upsampling reference chroma point is 4 / 8, and the weight of the lower upsampling reference chroma point is 4 / 8; for the third interpolation point in Figure 18, the weight of the upper upsampling reference chroma point is 3 / 8, and the weight of the lower upsampling reference chroma point is 5 / 8.

[0489] ●When the horizontal upsampling factor upHor is greater than 1, horizontal upsampling is required, and the process is similar to the vertical upsampling process. The specific process is as follows:

[0490] sum=(upHor-dX)×predSamples[xHor][yHor]+dX×predSamples[xHor+upHor][yHor] (44)

[0491] predSamples[xHor+dX][yHor]=(sum+upHor / 2) / upHor (45)

[0492] Among them, (xHor, yHor)=(m×upHor-1, n×upVer-1), m=0,…,predSizeW-1, n=1,…,predSizeW, dX=1,…,upHor-1.

[0493] This process is detailed in Figure 19. Taking a 32×32 block as an example, after completing the vertical upsampling shown in Figure 17, the left reference chroma pixel refC_L and all existing points in the second prediction block will be used as reference points for horizontal upsampling, and are marked with black fill. At this point, the black-filled points are all upsampling reference points, and the predicted points obtained by linear interpolation between every two black-filled points in the horizontal direction are filled with gray.

[0494] The upsampling method also uses linear interpolation, that is, the value of each interpolated point (filled with gray) between two upsampled chroma reference points (filled with black) is the weighted average of the two upsampled reference chroma points. According to equations (44) and (45), the weight of the left upsampled reference chroma point is (upHor-dX) / upHor, and the weight of the right reference chroma point is dX / upHor, where dX = 1,…,upHor-1 (i.e., the distance between the current interpolation point and the left reference point). That is, when performing horizontal interpolation, the weight is only related to the horizontal upsampling factor upHor.

[0495] Thus, according to the above process, the predSamples obtained after interpolation is the predicted value of the final chroma prediction block of the current WCP technology.

[0496] It can also be understood that in the embodiment of the present application, the chroma prediction value after upsampling in the “horizontal direction first and then vertical direction” and the chroma prediction value after upsampling in the “vertical direction first and then horizontal method” can be averaged to obtain the final chroma prediction value. Alternatively, when linear interpolation upsampling is used, the value of each interpolated point (filled with gray) between two upsampled chroma reference points (filled with black) can also be the average value of the two upsampled reference chroma points, that is, the weights are all 1 / 2. Alternatively, in addition to the above-mentioned traditional upsampling method, the convolution operation in the neural network structure can also be used instead of the upsampling operation, and there is no limitation on this here.

[0497] This embodiment provides a decoding method. This embodiment details the specific implementation of the aforementioned embodiment. It can be seen that the technical solutions of the aforementioned embodiments can improve the accuracy of chrominance prediction values ​​using WCP prediction technology. Specifically, a weighting coefficient is calculated using reference information from adjacent regions and the luminance information of the current block. This weighting coefficient is then used in the chrominance prediction of the current block. This fully exploits the correlation in luminance information between the current block and adjacent regions, and incorporates this correlation into the chrominance prediction of the current block, thereby improving the accuracy of chrominance prediction. For example, when tested on the ECM3.1 test software at 48-frame intervals under all-intra conditions, this decoding method achieved BD-rate changes (i.e., average bitrate changes at equivalent peak signal-to-noise ratios (PSNRs)) of -0.10%, -0.74%, and -0.61% for Y, Cb, and Cr, respectively. The method exhibits particularly good performance on high-resolution sequences, achieving a BD-rate change of -0.24% for Y on a Class A1 test sequence. In addition, in the embodiment of the present application, the process of post-processing the WCP output chroma prediction block can utilize the low sensitivity of the human eye to chroma, and in order to reduce the complexity of the chroma weighted calculation, fully consider the situation when the core parameter predSizeW×predSizeH of the WCP mode is less than or equal to nTbW×nTbH. When predSizeW×predSizeH is less than nTbW×nTbH, upsampling filtering is required. The method of "horizontally first and then vertically" is used to assign different weights to different interpolation points between existing adjacent points, fully considering the spatial correlation between the interpolation points and the existing points; at the same time, the reference chroma refC_T and refC_L are used as references for upsampling filtering, fully considering the characteristics in different directions, so as to obtain the final upsampled prediction value; in addition, the chroma prediction blocks output by WCP that have undergone upsampling filtering and do not require upsampling filtering (when predSizeW×predSizeH is equal to nTbW×nTbH) can also be filtered and enhanced. The bilateral filtering method used has edge-preserving denoising characteristics, which can also further improve the accuracy of chroma prediction.

[0498] In another embodiment of the present application, referring to FIG20 , which shows a flow chart of a coding method provided by an embodiment of the present application. As shown in FIG20 , the method may include:

[0499] S2001: Determine a reference sample value of a first color component of a current block.

[0500] It should be noted that the encoding method of the embodiment of the present application is applied to an encoding device, or an encoding device integrated with the encoding device (also referred to as "encoder"). In addition, the encoding method of the embodiment of the present application can specifically refer to an intra-frame prediction method, more specifically, a post-processing operation method of weighted chrominance prediction.

[0501] In an embodiment of the present application, a video image may be divided into a plurality of coding blocks, each of which may include a first color component, a second color component, and a third color component, and the current block herein refers to a coding block in the video image that is currently to be intra-frame predicted. In addition, assuming that the current block predicts the first color component, and the first color component is a luminance component, that is, the component to be predicted is a luminance component, then the current block may also be referred to as a luminance prediction block; or, assuming that the current block predicts the second color component, and the second color component is a chrominance component, that is, the component to be predicted is a chrominance component, then the current block may also be referred to as a chrominance prediction block.

[0502] It should also be noted that, in an embodiment of the present application, the reference information of the current block may include the values ​​of the first color component sampling points in the adjacent areas of the current block and the values ​​of the second color component sampling points in the adjacent areas of the current block. These sampling points are determined based on the encoded pixels in the adjacent areas of the current block. In some embodiments, the adjacent areas of the current block may include at least one of the following: an upper adjacent area, an upper right adjacent area, a left adjacent area, and a lower left adjacent area.

[0503] In some embodiments, determining the reference sample value of the first color component of the current block may include: determining the reference sample value of the first color component of the current block according to the values ​​of the first color component sampling points in the adjacent area of ​​the current block.

[0504] It should be noted that, in the embodiment of the present application, the reference pixel of the current block may refer to the reference pixel point adjacent to the current block, and may also be referred to as the first color component sampling point and the second color component sampling point in the adjacent area of ​​the current block, and is represented by Neighboring Sample or Reference Sample. In addition, in the embodiment of the present application, the first color component is the luminance component, and the second color component is the chrominance component. At this time, the value of the first color component sampling point in the adjacent area of ​​the current block is represented as the reference luminance information corresponding to the reference pixel of the current block, and the value of the second color component sampling point in the adjacent area of ​​the current block is represented as the reference chrominance information corresponding to the reference pixel of the current block.

[0505] In some embodiments, for determining the value of the first color component sampling point, the method may further include: screening the first color component sampling points in the adjacent area to determine the value of the first color component sampling point.

[0506] It should be noted that among the first color component sampling points in the adjacent regions, there may be some unimportant sampling points (for example, these sampling points have poor correlation) or some abnormal sampling points. To ensure the accuracy of the prediction, these sampling points need to be eliminated to obtain valid values ​​of the first color component sampling points. In other words, in this embodiment of the present application, a first sampling point set is formed based on the first color component sampling points in the adjacent regions of the current block; then, the first sampling point set can be screened to determine the values ​​of the first color component sampling points.

[0507] In a specific embodiment, the screening process of the first color component sampling points in the adjacent areas to determine the values ​​of the first color component sampling points may include:

[0508] Based on the position and / or color component intensity of the first color component sampling point in the adjacent area, the position of the sampling point to be selected is determined; and according to the position of the sampling point to be selected, the value of the first color component sampling point is determined from the adjacent area.

[0509] It should be noted that in the embodiments of the present application, color component intensity can be represented by color component information, such as reference luminance information, reference chrominance information, etc. Here, a larger value of the color component information indicates a higher color component intensity. Thus, the first color component sampling points in the adjacent area can be screened based on their positions or color component intensities, thereby determining valid first color component sampling points based on the screened sampling points, and further determining the values ​​of the first color component sampling points.

[0510] In some embodiments, determining the reference sample value of the first color component of the current block may also include: performing a second filtering process on the value of the first color component sampling point to obtain the filtered adjacent sample value of the first color component of the current block; and determining the reference sample value of the first color component of the current block based on the filtered adjacent sample value of the first color component of the current block.

[0511] In the embodiment of the present application, the number of filtered adjacent sample values ​​of the first color component of the current block is less than the number of values ​​of the first color component sampling points.

[0512] In an embodiment of the present application, the second filtering process may be a downsampling filtering process, wherein the first color component is a luminance component, and in this case, the reference luminance information may be downsampled and filtered so that the spatial resolution of the filtered reference luminance information is the same as that of the reference chrominance information.

[0513] In some embodiments, determining the reference sample value of the first color component of the current block may further include: determining the reference sample value of the first color component of the current block based on a reconstructed value of a sampling point of the first reference color component in the current block.

[0514] In the embodiment of the present application, the first reference color component may be a brightness component; then, the reconstructed value of the first reference color component sampling point in the current block is the reconstructed brightness information of the current block.

[0515] Furthermore, in some embodiments, determining the reference sample value of the first color component of the current block may also include: performing a third filtering process on the reconstructed value of the first reference color component sampling point in the current block to obtain the filtered sample value of the first reference color component sampling point in the current block; and determining the reference sample value of the first color component of the current block based on the filtered sample value of the first reference color component sampling point in the current block.

[0516] In the embodiment of the present application, the number of filtered sample values ​​of the first reference color component sampling point in the current block is less than the number of reconstructed values ​​of the first reference color component sampling point in the current block.

[0517] In the embodiment of the present application, the third filtering process may be a downsampling filtering process, wherein the first reference color component is a luminance component, and in this case, the reconstructed luminance information in the current block may also be subjected to a downsampling filtering process.

[0518] It is understandable that in this embodiment of the present application, the reference sample value of the first color component of the current block can also be set as luminance difference information. Therefore, in one possible implementation, the reference sample value of the first color component of the current block is set to the absolute value of the difference between the value of the first color component sampling point and the reconstructed value of the first reference color component sampling point.

[0519] In another possible implementation, the reference sample value of the first color component of the current block is set to the absolute value of the difference between the filtered adjacent sample value of the first color component and the reconstructed value of the first reference color component sampling point.

[0520] In yet another possible implementation, the reference sample value of the first color component of the current block is set to the absolute value of the difference between the filtered adjacent sample value of the first color component and the filtered sample value of the first reference color component sampling point.

[0521] In yet another possible implementation, the reference sample value of the first color component of the current block is set to the absolute value of the difference between the value of the first color component sampling point and the filtered sample value of the first reference color component sampling point.

[0522] That is to say, based on the known reference information of the current block, such as the reference luminance information in the adjacent areas of the current block, the reconstructed luminance information in the current block, etc., you can choose to filter it before performing weighted prediction. Specifically, you can downsample and filter the reference luminance information in the adjacent areas of the current block, or you can downsample and filter the reconstructed luminance information in the current block. You can also downsample and filter both, or even not downsample and filter both. Then, the luminance difference information is determined according to different combinations, and the luminance difference information can be used as the reference sample value of the first color component of the current block.

[0523] S2002: Determine a weighting coefficient according to a reference sample value of the first color component of the current block.

[0524] It should be noted that, in an embodiment of the present application, determining the weighting coefficient based on the reference sample value of the first color component of the current block may include: determining the value corresponding to the reference sample value of the first color component under a preset mapping relationship; and setting the weighting coefficient to be equal to the value.

[0525] It is understood that in this embodiment of the present application, the reference sample value of the first color component may be the absolute value of the difference between the filtered adjacent sample value of the first color component of the current block and the filtered sample value of the first reference color component sampling point in the current block. The first reference color component is the first color component, and the first color component is a color component different from the second color component to be predicted in this embodiment of the present application.

[0526] It should be noted that, in the embodiment of the present application, the chrominance component of the pixel to be predicted in the current block is predicted, and at least one pixel to be predicted in the current block is selected, and the brightness difference between its reconstructed brightness and the reference brightness in the adjacent area is calculated (using |ΔY k | represents). Where, if |ΔY k | is small, indicating that the similarity of the brightness values ​​is relatively strong, and the corresponding weighting coefficient (using w k On the contrary, if |ΔYk| is large, it means that the similarity of the brightness value is relatively weak, w k Assign a smaller weight. That is, under the preset mapping relationship, w k and|ΔY k | are approximately inversely proportional.

[0527] Further, in some embodiments, determining the value corresponding to the reference sample value of the first color component under a preset mapping relationship may include: determining a first factor; determining a first product value based on the first factor and the reference sample value of the first color component; and determining the value corresponding to the first product value under the preset mapping relationship.

[0528] In a specific embodiment, determining the first factor may include: the first factor is a preset constant value.

[0529] In another specific embodiment, determining the first factor may include: determining a value of the first factor according to a size parameter of the current block.

[0530] Furthermore, in some embodiments, the method may further include: determining the value of the first factor according to a preset mapping lookup table between the size parameter of the current block and the value of the first factor.

[0531] Here, the size parameter of the current block may include at least one of the following parameters: the width of the current block, and the height of the current block.

[0532] It should be noted that embodiments of the present application can use a categorized approach to fix the value of the first factor. For example, the current block size parameters can be categorized into three categories, and the corresponding first factor value can be determined for each category. In this case, embodiments of the present application can also pre-store a lookup table mapping the current block size parameters to the values ​​of the first factor, and then determine the value of the first factor based on this lookup table. For example, Table 1 above illustrates a corresponding relationship between the first factor and the current block size parameters.

[0533] In another specific embodiment, determining the first factor may include: determining a value of the first factor according to the number of reference pixels of the current block.

[0534] Furthermore, in some embodiments, the method may further include: determining the value of the first factor according to a preset mapping lookup table between the number of reference pixels of the current block and the value of the first factor.

[0535] It should be noted that the embodiment of the present application can divide the number of reference pixels into three categories, and still use the classification method to fix the value of the first factor. For example, the number of reference pixels of the current block can be divided into three categories, and the value of the first factor corresponding to each category is determined. In view of this situation, the embodiment of the present application can also pre-store a lookup table mapping the number of reference pixels of the current block to the value of the first factor, and then determine the value of the first factor based on the lookup table. For example, the aforementioned Table 2 shows a schematic diagram of the corresponding relationship between the first factor and the number of reference pixels of the current block.

[0536] Furthermore, for the first product value, determining the first product value according to the first factor and the reference sample value of the first color component may include:

[0537] Setting the first product value equal to the product of the first factor and the reference sample value of the first color component; or,

[0538] The first product value is set to be equal to a value obtained by right-shifting the reference sample value of the first color component, wherein the number of bits of the right-shift is equal to the first factor; or

[0539] The first product value is set to a value obtained by performing addition and bit shift operations on the reference sample value of the first color component according to the first factor.

[0540] For example, assuming the first factor is 0.25 and the reference sample value of the first color component is denoted by Ref, the first product value can be equal to 0.25×Ref. 0.25×Ref can be expressed as Ref / 4, that is, Ref>>2. Furthermore, during the fixed-point calculation process, floating-point numbers may be converted to addition and shift operations; that is, there is no restriction on the calculation method for the first product value.

[0541] It can also be understood that in the embodiment of the present application, the first reference color component can also be a chroma component, that is, at least one pixel to be predicted in the current block is selected, and the chroma difference between its reconstructed chroma and the reference chroma in the adjacent area is calculated (using |ΔC k | represents). Where, if |ΔC k | is small, indicating that the similarity of chromaticity values ​​is relatively strong, and the corresponding weighting coefficient (using w k ) can be given a larger weight; on the contrary, if |ΔC k | is larger, indicating that the similarity of chromaticity values ​​is weaker, w k A smaller weight can be assigned, that is, when calculating the weighting coefficient, the reference sample value of the first color component can also be |ΔC k |, and then calculate the weighting coefficient.

[0542] In short, in the embodiment of the present application, for the reference sample value of the first color component, it can be |ΔC k |, the absolute value of the chromaticity difference; or |ΔY k |, that is, the absolute value of the brightness difference; or it can be |αΔY k |, that is, the product of the absolute value of the brightness difference and a preset multiplier, etc. The preset multiplier here is the second factor described in the embodiment of the present application.

[0543] Furthermore, with respect to the second factor, in a specific embodiment, the method may further include: performing a least squares calculation based on the first color component value of the reference pixel and the second color component value of the reference pixel to determine the second factor.

[0544] That is, assuming that the number of reference pixels is N, the first color component value of the reference pixel is the reference luminance information of the current block, and the second color component value of the reference pixel is the reference chrominance information of the current block, then the chrominance component values ​​and luminance component values ​​of the N reference pixels can be calculated using the least squares method to obtain the second factor. For example, the least squares regression calculation is shown in the aforementioned formula (5), and the second factor can be calculated.

[0545] In addition, for the preset mapping relationship, the preset mapping relationship can be a preset function relationship. In some embodiments, the preset mapping relationship can be a Softmax function, as shown in the aforementioned formula (6) or formula (7). Wherein, the Softmax function is a normalized exponential function, but the embodiment of the present application can also be normalized, and its value is not limited to the range of [0,1].

[0546] It should also be noted that, in addition to the Softmax function, in other embodiments, the preset mapping relationship can be a weighted function that has an inverse relationship with the reference sample value of the first color component, as shown in the aforementioned formula (8) or formula (9).

[0547] In this way, the preset mapping relationship can be as shown in formula (4), or as shown in formula (6) or formula (7), or as shown in formula (8) or formula (9), or even other function models that can fit the trend that the closer the reference luminance value of the reference pixel is to the luminance reconstruction value of the pixel to be predicted in the current block, the higher the importance of the reference chrominance value of the reference pixel to the pixel to be predicted in the current block is to construct a weighted coefficient; in addition, the preset mapping relationship can also be a preset look-up table method, such as using an array element look-up table method to reduce some calculation operations, etc., which is not specifically limited in the embodiments of the present application.

[0548] Thus, according to the reference sample value of the first color component (eg |ΔY kij |), the weighting coefficients can be determined, which can include: w1, w2, ..., w N N weighting coefficients are used, where N represents the number of reference samples of the second color component. Theoretically, the sum of these N weighting coefficients is equal to 1, and each weighting coefficient 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 coefficients is equal to 1" is only a theoretical concept; in actual fixed-point implementation, the absolute value of the weighting coefficient can be greater than 1.

[0549] S2003: Determine a first prediction block of the second color component of the current block according to the weighting coefficient and the reference sample value of the second color component of the current block.

[0550] It should be noted that, in this embodiment of the present application, the first prediction block includes the predicted values ​​of at least part of the second color component sampling points in the current block.

[0551] It should also be noted that, in an embodiment of the present application, for determining the reference sample value of the second color component of the current block, the method may further include: determining the reference sample value of the second color component of the current block based on the value of the second color component sampling point in the adjacent area of ​​the current block.

[0552] Here, the adjacent region may include at least one of the following: an upper adjacent region, an upper right adjacent region, a left adjacent region, and a lower left adjacent region.

[0553] In a specific embodiment, the method may further include: performing a fourth filtering process on the values ​​of the second color component sampling points in the adjacent area of ​​the current block to obtain filtered adjacent sample values ​​of the second color component of the current block; and determining a reference sample value of the second color component of the current block based on the filtered adjacent sample values ​​of the second color component of the current block.

[0554] In an embodiment of the present application, the number of filtered adjacent sample values ​​of the second color component of the current block is greater than the number of values ​​of the second color component sampling points in the adjacent area of ​​the current block.

[0555] In an embodiment of the present application, the fourth filtering process may be upsampling filtering; wherein the upsampling rate is a positive integer multiple of 2.

[0556] That is, the first color component is a luminance component, and the second color component is a chrominance component. In embodiments of the present application, the reference chrominance information may be upsampled and filtered so that the spatial resolution of the filtered reference chrominance information is the same as the spatial resolution of the reference luminance. For example, if the reference luminance information is 2M+2N and the reference chrominance information is M+N, then after upsampling and filtering the reference chrominance information, the number of components can be converted to 2M+2N.

[0557] It should also be noted that in the embodiment of the present application, whether it is the second filtering process performed on the values ​​of the first color component sampling points in the adjacent area, or the third filtering process performed on the reconstructed values ​​of the first reference color component sampling points in the current block, both filtering processes can be downsampling filtering processes; wherein, the second filtering process can use the first filter, and the third filtering process can use the second filter. Here, the first filter and the second filter can both be downsampling filters. Since the downsampling rates of the filters may be different due to the different data processed, the first filter and the second filter can be the same or different. In addition, the fourth filtering process performed on the values ​​of the second color component sampling points in the adjacent area can use the third filter. wherein, the fourth filtering process is an upsampling filtering process, then the third filter can be an upsampling filter. further, for the first filter, the second filter and the third filter, all three filters can be neural network filters, without any limitation here.

[0558] It can be understood that, assuming that the first color component is a luminance component and the second color component is a chrominance component, then since the spatial resolution of the values ​​of the first color component sampling points in the adjacent areas (i.e., reference luminance information), the spatial resolution of the values ​​of the second color component sampling points in the adjacent areas (i.e., reference chrominance information), and even the spatial resolution of the reconstructed values ​​of the first reference color component sampling points in the current block (i.e., reconstructed luminance information) are all affected by the color format information, a second filtering process, a third filtering process, or a fourth filtering process can also be performed based on the current color format information. Taking the fourth filtering process as an example, in some embodiments, the method can further include: performing a fourth filtering process on the values ​​of the second color component sampling points in the adjacent areas of the current block based on the color format information to obtain filtered adjacent samples of the second color component of the current block.

[0559] In a specific embodiment, the fourth filtering process may also include: if the color format information indicates 4:2:0 sampling, then upsampling filtering is performed on the values ​​of the second color component sampling points in the adjacent area of ​​the current block; wherein the upsampling rate is a positive integer multiple of 2.

[0560] It should be noted that in the embodiment of the present application, if the color format information indicates that the spatial resolutions of luminance and chrominance are equal (such as YUV444 format), then no processing is required on the reference chrominance information; if the color format information indicates that the spatial resolutions of luminance and chrominance are inconsistent (such as YUV422 format / YUV411 format / YUV420 format, etc., which have chrominance subsampling characteristics), and the spatial resolution of the chrominance component is smaller than the spatial resolution of the luminance component, then the reference chrominance information obtained from the adjacent area needs to be upsampled and filtered.

[0561] In this way, for the upsampling filtering performed on the reference chroma information, the upsampling filtering method can be any linear interpolation method, such as nearest neighbor interpolation, bilinear interpolation, bicubic interpolation, mean interpolation, median interpolation, copy interpolation, etc.; it can also be any nonlinear interpolation method, such as an interpolation algorithm based on wavelet transform, an interpolation algorithm based on edge information, etc.; upsampling filtering can also be performed based on a convolutional neural network, and the embodiments of the present application do not impose any restrictions.

[0562] Furthermore, after determining the reference sample value of the second color component of the current block, in some embodiments, for S2003, determining the first predicted block of the second color component of the current block according to the weighting coefficient and the reference sample value of the second color component of the current block may include:

[0563] Determining a weighted value of a reference sample value of a second color component and a corresponding weighting coefficient;

[0564] The predicted value of the second color component sampling point in the first prediction block is set to be equal to the sum of N weighted values; wherein N represents the number of reference sample values ​​of the second color component, and N is a positive integer.

[0565] That is, if the number of reference samples of the second color component is N, then first determine the weighted value of each reference sample of the second color component and the corresponding weighting coefficient (ie, w k C k ), and then the sum of these N weighted values ​​is used as the predicted value of the second color component sampling point in the prediction block. Specifically, its calculation formula is shown in the aforementioned formula (16). It should be noted that this method is conducive to parallel processing and can speed up the calculation speed.

[0566] It should be noted that, in the embodiment of the present application, it is assumed that the width of the first prediction block is predSizeW, and 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 contains the predicted values ​​of at least part of the second color component sampling points in the current block.

[0567] S2004: Perform a first filtering process on the first prediction block to determine a second prediction block of the second color component of the current block.

[0568] S2005: Determine a prediction difference value of a second color component sampling point of the current block according to the second prediction block.

[0569] It should be noted that, in embodiments of the present application, if the first prediction block includes predicted values ​​of some sampling points of the second color component in the current block, it is necessary to perform upsampling filtering on the first prediction block to obtain a final second prediction block. Therefore, in some embodiments, performing the first filtering process on the first prediction block to determine the second prediction block for the second color component of the current block may include: performing upsampling filtering on the first prediction block to determine the second prediction block for the second color component of the current block.

[0570] It should also be noted that, in an embodiment of the present application, if the number of predicted values ​​of the second color component included in the second prediction block is the same as the number of second color component sampling points included in the current block, but the predicted values ​​of the second color component sampling points of the current block are not included, then filtering is required to enhance the predicted values ​​to obtain the final second prediction block. Therefore, in some embodiments, performing a first filtering process on the first prediction block to determine the second prediction block for the second color component of the current block may include: performing a filtering enhancement process on the first prediction block to determine the second prediction block for the second color component of the current block.

[0571] It should also be noted that, in an embodiment of the present application, if the first prediction block includes the predicted values ​​of all the second color component sampling points in the current block, then there is no need to perform any processing on the first prediction block, and the first prediction block can be directly used as the final second prediction block.

[0572] It is understandable that, in the embodiment of the present application, the first filtering process may be an upsampling filtering process, a filtering enhancement process, or the like, without any limitation herein. However, for the second prediction block after the first filtering process, the second prediction block includes the predicted values ​​of all second color component sampling points in the current block.

[0573] Here, when the first filtering process is an upsampling filtering process, the first prediction block may be subjected to an upsampling filtering process using a fourth filter. The fourth filter may be an upsampling filter, but the fourth filter may be the same as or different from the aforementioned third filter. The fourth filter may also be a neural network filter, which is not limited in this embodiment of the present application.

[0574] In some embodiments, the performing of a first filtering process on the first prediction block to determine a second prediction block of the second color component of the current block may include: the first filtering process includes an upsampling filtering process; wherein the input of the upsampling filtering process is a first upsampling input block; and the output of the upsampling filtering process is a first upsampling output block.

[0575] Furthermore, in some embodiments, the upsampling filtering process may include:

[0576] Determine an upsampling factor, wherein the upsampling factor includes at least one of the following: a horizontal upsampling factor and a vertical upsampling factor;

[0577] An upsampling filtering process is performed on the first upsampling input block according to the upsampling factor to obtain a first upsampling output block.

[0578] In one possible implementation, performing upsampling filtering on the first upsampling input block according to the upsampling factor to obtain the first upsampling output block may include: if the horizontal upsampling factor is greater than 1, or the vertical upsampling factor is greater than 1, performing upsampling filtering on the first upsampling input block to obtain the first upsampling output block.

[0579] In an embodiment of the present application, performing upsampling filtering on the first upsampling input block includes at least one of the following:

[0580] Performing upsampling filtering on the first upsampled input block in the horizontal direction;

[0581] Performing upsampling filtering on the first upsampled input block in a vertical direction;

[0582] Performing upsampling filtering processing on the first upsampled input block in the horizontal direction and then performing upsampling filtering processing in the vertical direction;

[0583] The first up-sampled input block is subjected to up-sampling filtering in the vertical direction and then to up-sampling filtering in the horizontal direction.

[0584] Here, first, a horizontal upsampling factor can be calculated based on the width of the first upsampling input block and the width of the first upsampling output block, and a vertical upsampling factor can be calculated based on the height of the first upsampling input block and the height of the first upsampling output block; then, the first upsampling input block is upsampled and filtered according to the horizontal upsampling factor and the vertical upsampling factor. Specifically, if the horizontal upsampling factor is greater than 1 and the vertical upsampling factor is equal to 1, then only the first upsampling input block needs to be upsampled in the horizontal direction; if the horizontal upsampling factor is equal to 1 and the vertical upsampling factor is greater than 1, then only the first upsampling input block needs to be upsampled in the vertical direction; if the horizontal upsampling factor is greater than 1 and the vertical upsampling factor is greater than 1, then the first upsampling input block needs to be upsampled in both the horizontal and vertical directions, wherein upsampling can be performed first in the horizontal direction and then in the vertical direction, or first in the vertical direction and then in the horizontal direction, and even the convolution operation in the neural network structure can be used to replace the upsampling filtering operation here, and the embodiments of the present application do not impose any restrictions.

[0585] In another possible implementation, upsampling and filtering are performed on the first prediction block to determine the second prediction block. In this case, the method may further include:

[0586] Using the first predicted block as a first upsampled input block;

[0587] The first up-sampled output block is used as a second prediction block for a second color component of the current block.

[0588] In another possible implementation, the first prediction block is first enhanced and filtered, and then up-sampled and filtered to determine the second prediction block. In this case, the method may further include:

[0589] Performing filtering enhancement processing on the first prediction block to determine a first enhanced prediction block;

[0590] Using the first enhanced prediction block as a first up-sampled input block;

[0591] The first up-sampled output block is used as a second prediction block for a second color component of the current block.

[0592] In another possible implementation, upsampling filtering is first performed on the first prediction block, and then enhancement filtering is performed to determine the second prediction block. In this case, the method may further include:

[0593] Using the first predicted block as a first upsampled input block;

[0594] Using the first up-sampled output block as a first up-sampled filtered prediction block;

[0595] Perform filtering enhancement processing on the first up-sampled filtered prediction block to determine a second prediction block of the second color component of the current block.

[0596] In another possible implementation, the first prediction block is first subjected to enhancement filtering, then subjected to upsampling filtering, and then subjected to enhancement filtering again to determine the second prediction block. In this case, the method may further include:

[0597] Performing a first filtering enhancement process on the first prediction block to determine a second enhanced prediction block;

[0598] Using the second enhanced prediction block as the first up-sampled input block;

[0599] Using the first upsampled output block as the second upsampled filtered prediction block;

[0600] A second filtering enhancement process is performed on the second up-sampled filtered prediction block to determine a second prediction block of the second color component of the current block.

[0601] It should also be noted that, when the first filtering process is an upsampling filtering process, the upsampling filtering process may be performed on the first prediction block using a horizontal upsampling factor and a vertical upsampling factor. Specifically, performing the upsampling filtering process on the first prediction block to determine a second prediction block for the second color component of the current block may include:

[0602] Determine the horizontal upsampling factor and the vertical upsampling factor;

[0603] An upsampling filtering process is performed on the first prediction block according to the horizontal upsampling factor and the vertical upsampling factor to obtain a second prediction block for the second color component of the current block.

[0604] In a specific embodiment, performing upsampling filtering on the first prediction block according to the horizontal upsampling factor and the vertical upsampling factor to obtain a second prediction block for the second color component of the current block may include:

[0605] If the horizontal upsampling factor is greater than 1, or the vertical upsampling factor is greater than 1, upsampling filtering is performed on the first prediction block to obtain a second prediction block.

[0606] In the embodiment of the present application, performing upsampling filtering on the first prediction block may include at least one of the following:

[0607] Performing upsampling filtering on the first prediction block in the horizontal direction;

[0608] Performing upsampling filtering on the first prediction block in a vertical direction;

[0609] Performing upsampling filtering processing on the first prediction block in the horizontal direction and then performing upsampling filtering processing in the vertical direction;

[0610] The first prediction block is subjected to upsampling filtering in the vertical direction and then to upsampling filtering in the horizontal direction.

[0611] Here, first, the horizontal upsampling factor can be calculated based on the width of the first prediction block and the width of the current block, and the vertical upsampling factor can be calculated based on the height of the first prediction block and the height of the current block; then, the first prediction block is upsampled and filtered according to the horizontal upsampling factor and the vertical upsampling factor. Specifically, if the horizontal upsampling factor is greater than 1 and the vertical upsampling factor is equal to 1, then the first prediction block only needs to be upsampled in the horizontal direction; if the horizontal upsampling factor is equal to 1 and the vertical upsampling factor is greater than 1, then the first prediction block only needs to be upsampled in the vertical direction; if the horizontal upsampling factor is greater than 1 and the vertical upsampling factor is greater than 1, then the first prediction block needs to be upsampled in both the horizontal and vertical directions, wherein upsampling can be performed first in the horizontal direction and then in the vertical direction, or first in the vertical direction and then in the horizontal direction, and even the convolution operation in the neural network structure can be used to replace the upsampling operation here, and the embodiments of the present application do not impose any restrictions.

[0612] In some embodiments, the implementation method of upsampling filtering processing includes at least one of the following: a linear interpolation method, a convolution operation method based on a preset neural network. That is to say, for upsampling filtering processing, there can also be different filters, such as two-dimensional filters, one-dimensional filters, and so on. Among them, for a one-dimensional filter, the filtering order can be "vertical direction first and then horizontal direction" or "horizontal direction first and then vertical direction". These two orders can be fixed orders in use, or they can be adaptive orders determined according to a certain parameter (such as an order directly indicated by identification information; an order implicitly bound to factors such as prediction mode and block size, etc.). The embodiments of the present application do not impose any restrictions on this.

[0613] In another possible implementation, when the first filtering process is a filtering enhancement process, the filtering enhancement may be achieved by bilateral filtering. Specifically, performing the first filtering process on the first prediction block to determine the second prediction block of the second color component of the current block may include:

[0614] Determining a first weight value of a first prediction block in a bilateral filtering mode;

[0615] Performing bilateral filtering on the first prediction block according to the first weight value to obtain a second prediction block.

[0616] In the embodiment of the present application, the filter enhancement processing may be, in addition to the bilateral filter processing, a median filter processing, a Gaussian filter processing, a normalized filter processing, and the like. In other words, the filter enhancement processing may include at least one of the following: bilateral filter processing, median filter processing, Gaussian filter processing, and normalized filter processing, but is not specifically limited thereto.

[0617] Furthermore, in some embodiments, the method may further include: before performing upsampling filtering processing on the first prediction block, performing filtering enhancement processing on the first prediction block, and using the enhanced first prediction block as the first prediction block.

[0618] Furthermore, in some embodiments, the method may further include: after performing upsampling filtering on the first prediction block, performing filtering enhancement processing on the first prediction block obtained after upsampling filtering to obtain a second prediction block of the second color component of the current block.

[0619] That is, in the embodiment of the present application, the first filtering process may be an upsampling filtering process or a filtering enhancement process, or may include both upsampling filtering process and filtering enhancement process. In this case, the upsampling filtering process may be performed on the first prediction block first and then the filtering enhancement process, or the filtering enhancement process may be performed on the first prediction block first and then the upsampling filtering process, and the embodiment of the present application does not specifically limit this.

[0620] In this way, for predSamples(i,j) obtained by the above formula (20), predSamples(i,j) is not necessarily the final prediction value. It may be the prediction value after filtering and enhancement before upsampling (in this case, predSamples(i,j) is not the final prediction value), it may be the prediction value after filtering and enhancement after upsampling, or it may be the prediction value after filtering and enhancement without upsampling.

[0621] Furthermore, for the filtering enhancement process, in some embodiments, the method further includes:

[0622] Determining, based on reference sample values ​​in an adjacent area of ​​the current block, a compensation value for a second color component sampling point of the first prediction block;

[0623] The predicted value of the second color component sampling point of the first prediction block is corrected according to the compensation value to determine the second prediction block.

[0624] It should be noted that to further improve the prediction accuracy of the WCP mode, a position-dependent correction process can be performed on the first prediction block. For example, a chroma compensation value can be calculated for each second color component sampling point to be predicted using spatially close reference pixels. This chroma compensation value is then used to correct the second color component sampling points in the second prediction block. The final prediction value (predSamples) of the second color component sampling points is determined based on the corrected prediction value, thereby obtaining the final second prediction block.

[0625] Furthermore, for the filtering enhancement process, in some embodiments, the method further includes:

[0626] Performing prediction processing on the second color component sampling point of the first prediction block according to at least one prediction mode to determine at least one initial prediction value of the second color component sampling point of the first prediction block;

[0627] A second prediction block is determined by performing weighted fusion processing on at least one initial prediction value and a prediction value of a second color component sampling point in the first prediction block.

[0628] It should be noted that to further improve the prediction accuracy of the WCP mode, the chroma prediction values ​​calculated in other prediction modes can be weighted and fused with the chroma prediction values ​​calculated in the WCP mode, and the final chroma prediction block can be determined based on this fusion result. Alternatively, to improve WCP prediction performance, a neural network model can be used to correct the chroma prediction values ​​calculated by the WCP, etc., which is not limited in this embodiment of the present application.

[0629] In some embodiments, after the second prediction block is determined, as shown in FIG21 , after S2004 , the following steps may be further included:

[0630] S2101: Determine a predicted value of a second color component sampling point of a current block according to a second prediction block.

[0631] S2102: Determine a predicted difference value of the second color component sampling point of the current block according to the original value of the second color component sampling point of the current block and the predicted value of the second color component sampling point of the current block.

[0632] S2103: Encode the predicted difference value of the second color component sampling point of the current block, and write the obtained coded bits into the bitstream.

[0633] It should be noted that, in an embodiment of the present application, the predicted value of the second color component sampling point of the current block is determined based on the second prediction block, which may be to set the predicted value of the second color component sampling point of the current block equal to the value of the second prediction block; or it may be to perform upsampling filtering on the value of the second prediction block, and set the predicted value of the second color component sampling point of the current block equal to the output value after the upsampling filtering.

[0634] It should also be noted that after determining the predicted value of the second color component sampling point of the current block, a predicted difference value of the second color component sampling point can be determined based on the original value of the second color component sampling point and the predicted value of the second color component sampling point. Specifically, the predicted difference value of the second color component sampling point can be determined by subtracting the original value of the second color component sampling point from the predicted value of the second color component sampling point. In this way, after the predicted difference value of the second color component sampling point is written into the bitstream, the predicted difference value of the second color component sampling point can be obtained through decoding at the decoding end, so as to restore the reconstructed value of the second color component sampling point of the current block.

[0635] In summary, the embodiment of the present application is a detailed description of the post-processing operation process after WCP prediction in the prediction process of the WCP mode, which mainly includes four aspects: on the one hand, the luminance information of the reference pixel and the current block is fully utilized to realize the calculation of the chrominance weighting coefficient of the reference pixel; on the other hand, the characteristic of the human eye being low in sensitivity to chrominance and in order to reduce the complexity of the chrominance weighting calculation, the core parameters of the WCP mode are fully considered, that is, when predSizeW×predSizeH is less than or equal to nTbW×nTbH, the chrominance prediction block is up-sampled; on the other hand, when up-sampling is performed, full consideration is given to the chrominance prediction block. By utilizing reference chroma information, characteristics in different directions are taken into account; and different weights are assigned to different interpolation points between existing adjacent points during the linear interpolation process, fully considering the spatial correlation between the interpolation points and the existing points, thereby improving the accuracy of upsampling filtering; on the other hand, the chroma prediction block output by the WCP prediction may cause unstable and inaccurate prediction values, as well as the inaccurate prediction values ​​that may result from upsampling filtering in the embodiment of the present application, and the chroma prediction block in these cases is filtered and enhanced using a bilateral filtering method with edge-preserving denoising, thereby further improving the accuracy and subjective and objective quality of the chroma prediction block. In addition, it should be noted that the four aspects described here do not have a sequential relationship, and can be used individually or in combination.

[0636] An embodiment of the present application also provides an encoding method, which determines a reference sample value of a first color component of a current block; determines a weighting coefficient based on the reference sample value of the first color component of the current block; determines a first prediction block of the second color component of the current block based on the weighting coefficient and the reference sample value of the second color component of the current block; performs a first filtering process on the first prediction block to determine a second prediction block of the second color component of the current block; wherein the second prediction block includes the prediction values ​​of all the second color component sampling points in the current block; and determines the reconstructed values ​​of the second color component sampling points of the current block based on the second prediction block. In this way, the weighting coefficients are calculated using the reference pixels adjacent to the current block and the color component information of the current block, which fully exploits the correlation between the brightness information of the current block and the adjacent areas, and involves this correlation in the chrominance prediction of the current block, thereby improving the accuracy of the chrominance prediction; in addition, the human eye has a low sensitivity to chrominance, and in order to reduce the calculation complexity of the weighting coefficients, the first prediction block is upsampled and filtered when the first prediction block is smaller than the size of the current block; even considering the instability of the predicted value of the first prediction block, it can also be filtered and enhanced, thereby further improving the accuracy and subjective and objective quality of the chrominance prediction, saving bit rate, and improving the encoding and decoding performance.

[0637] In another embodiment of the present application, the embodiment of the present application further provides a code stream, which is generated by bit encoding based on the information to be encoded; wherein the information to be encoded includes at least: the predicted difference value of the second color component sampling point of the current block.

[0638] In an embodiment of the present application, after the predicted difference value of the second color component sampling point of the current block is transmitted from the encoding end to the decoding end, the decoding end obtains the predicted difference value of the second color component sampling point through decoding, and then combines it with the predicted value of the second color component sampling point of the current block to restore the reconstructed value of the second color component sampling point of the current block. In this way, taking advantage of the human eye's low sensitivity to chroma and to reduce the computational complexity of the weighting coefficients, upsampling and filtering are performed on the first prediction block when the first prediction block is smaller than the size of the current block; even considering the instability of the predicted value of the first prediction block, filtering and enhancement processing can be performed on it, thereby further improving the accuracy and subjective and objective quality of chroma prediction, saving bit rate, and improving encoding and decoding performance.

[0639] In another embodiment of the present application, based on the same inventive concept as the above embodiment, refer to FIG22 , which shows a schematic diagram of the composition structure of an encoding device 300 provided in an embodiment of the present application. As shown in FIG22 , the encoding device 300 may include: a first determination unit 3001, a first prediction unit 3002, and a first filtering unit 3003; wherein,

[0640] A first determining unit 3001 is configured to determine a reference sample value of a first color component of a current block; and determine a weighting coefficient according to the reference sample value of the first color component of the current block;

[0641] The first prediction unit 3002 is configured to determine a first prediction block of the second color component of the current block according to the weighting coefficient and the reference sample value of the second color component of the current block;

[0642] A first filtering unit 3003 is configured to perform a first filtering process on the first prediction block to determine a second prediction block of the second color component of the current block; wherein the second prediction block includes prediction values ​​of all second color component sampling points in the current block;

[0643] The first determining unit 3001 is further configured to determine a prediction difference value of a second color component sampling point of the current block according to the second prediction block.

[0644] In some embodiments, the first prediction block includes predicted values ​​of at least some of the second color component sampling points in the current block.

[0645] In some embodiments, the first determination unit 3001 is further configured to determine the reference sample value of the first color component of the current block based on the value of the first color component sampling point in the adjacent area of ​​the current block; wherein the adjacent area includes at least one of the following: the upper adjacent area, the upper right adjacent area, the left adjacent area and the lower left adjacent area.

[0646] In some embodiments, the first determining unit 3001 is further configured to perform screening processing on the first color component sampling points in the adjacent area to determine the values ​​of the first color component sampling points.

[0647] In some embodiments, the first determination unit 3001 is further configured to determine the position of the sampling point to be selected based on the position and / or color component intensity of the first color component sampling point in the adjacent area; and determine the value of the first color component sampling point from the adjacent area according to the position of the sampling point to be selected.

[0648] In some embodiments, the first filtering unit 3003 is configured to perform a second filtering process on the value of the first color component sampling point to obtain the filtered adjacent sample values ​​of the first color component of the current block; and determine the reference sample values ​​of the first color component of the current block based on the filtered adjacent sample values ​​of the first color component of the current block.

[0649] In some embodiments, the number of filtered adjacent samples of the first color component of the current block is less than the number of values ​​of the first color component sampling points.

[0650] In some embodiments, the first determining unit 3001 is further configured to determine a reference sample value of the first color component of the current block based on a reconstructed value of a first reference color component sampling point in the current block.

[0651] In some embodiments, the reference sample value of the first color component of the current block is set to the absolute value of the difference between the value of the first color component sampling point and the reconstructed value of the first reference color component sampling point.

[0652] In some embodiments, the reference sample value of the first color component of the current block is set to the absolute value of the difference between the filtered adjacent sample value of the first color component and the reconstructed value of the first reference color component sampling point.

[0653] In some embodiments, the first filtering unit 3003 is configured to perform a second filtering process on the value of the first color component sampling point to obtain the first color of the current block; perform a third filtering process on the reconstructed value of the first reference color component sampling point in the current block to obtain the filtered sample value of the first reference color component sampling point in the current block; and determine the reference sample value of the first color component of the current block based on the filtered sample value of the first reference color component sampling point in the current block.

[0654] In some embodiments, the number of filtered sample values ​​of the first reference color component sampling point in the current block is less than the number of reconstructed values ​​of the first reference color component sampling point in the current block.

[0655] In some embodiments, the reference sample value of the first color component of the current block is set to the absolute value of the difference between the filtered adjacent sample value of the first color component and the filtered sample value of the first reference color component sampling point.

[0656] In some embodiments, the reference sample value of the first color component of the current block is set to the absolute value of the difference between the value of the first color component sampling point and the filtered sample value of the first reference color component sampling point.

[0657] In some embodiments, the first determining unit 3001 is further configured to determine a value corresponding to the reference sample value of the first color component under a preset mapping relationship; and set the weighting coefficient to be equal to the value.

[0658] In some embodiments, the first determination unit 3001 is further configured to determine a first factor; determine a first product value based on the first factor and a reference sample value of the first color component; and determine a value corresponding to the first product value under a preset mapping relationship.

[0659] In some embodiments, the first factor is a preset constant value.

[0660] In some embodiments, the first determination unit 3001 is further configured to determine the value of the first factor based on a size parameter of the current block; wherein the size parameter of the current block includes at least one of the following parameters: the width of the current block, the height of the current block, and the product of the width and height of the current block.

[0661] In some embodiments, the preset mapping relationship is a Softmax function.

[0662] In some embodiments, the preset mapping relationship is a weighting function that has an inverse proportional relationship with the reference sample value of the first color component.

[0663] In some embodiments, the first determining unit 3001 is further configured to determine a reference sample value of the second color component of the current block according to a value of a second color component sampling point in an adjacent area of ​​the current block.

[0664] In some embodiments, the first filtering unit 3003 is further configured to perform a fourth filtering process on the values ​​of the second color component sampling points in the adjacent area of ​​the current block to obtain filtered adjacent sample values ​​of the second color component of the current block; and determine the reference sample values ​​of the second color component of the current block based on the filtered adjacent sample values ​​of the second color component of the current block.

[0665] In some embodiments, the number of filtered adjacent samples of the second color component of the current block is greater than the number of values ​​of the second color component sampling points in the adjacent area of ​​the current block.

[0666] In some embodiments, the fourth filtering process is upsampling filtering; wherein the upsampling rate is a positive integer multiple of 2.

[0667] In some embodiments, the first filtering unit 3003 is further configured to perform a fourth filtering process on the values ​​of the second color component sampling points in the adjacent area of ​​the current block based on the color format information to obtain filtered adjacent sample values ​​of the second color component of the current block.

[0668] In some embodiments, the first filtering unit 3003 is further configured to perform upsampling filtering on the values ​​of the second color component sampling points in the adjacent area of ​​the current block if the color format information indicates 4:2:0 sampling; wherein the upsampling rate is a positive integer multiple of 2.

[0669] In some embodiments, the first prediction unit 3002 is further configured to determine the weighted value of the reference sample value of the second color component and the corresponding weighting coefficient; and set the predicted value of the second color component sampling point in the first prediction block to be equal to the sum of N weighted values; wherein N represents the number of reference sample values ​​of the second color component, and N is a positive integer.

[0670] In some embodiments, the first filtering process comprises an upsampling filtering process; wherein an input of the upsampling filtering process is a first upsampling input block; and an output of the upsampling filtering process is a first upsampling output block.

[0671] In some embodiments, the first determining unit 3001 is further configured to determine an upsampling factor, wherein the upsampling factor includes at least one of the following: a horizontal upsampling factor, a vertical upsampling factor;

[0672] The first filtering unit 3003 is further configured to perform upsampling filtering on the first upsampling input block according to the upsampling factor to obtain a first upsampling output block.

[0673] In some embodiments, the first filtering unit 3003 is further configured to perform upsampling filtering on the first upsampling input block to obtain a first upsampling output block if the horizontal upsampling factor is greater than 1 or the vertical upsampling factor is greater than 1.

[0674] In some embodiments, the first filtering unit 3003 is further configured to perform upsampling filtering on the first upsampled input block, including at least one of the following:

[0675] Performing upsampling filtering on the first upsampled input block in the horizontal direction;

[0676] Performing upsampling filtering on the first upsampled input block in a vertical direction;

[0677] Performing upsampling filtering processing on the first upsampled input block in the horizontal direction and then performing upsampling filtering processing in the vertical direction;

[0678] The first up-sampled input block is subjected to up-sampling filtering in the vertical direction and then to up-sampling filtering in the horizontal direction.

[0679] In some embodiments, the first filtering unit 3003 is further configured to use the first prediction block as a first up-sampled input block; and use the first up-sampled output block as a second prediction block of a second color component of the current block.

[0680] In some embodiments, the first filtering unit 3003 is further configured to perform filtering enhancement processing on the first prediction block to determine a first enhanced prediction block; and use the first enhanced prediction block as a first upsampling input block; and use the first upsampling output block as a second prediction block for the second color component of the current block.

[0681] In some embodiments, the first filtering unit 3003 is further configured to use the first enhanced prediction block as the first upsampling input block; and use the first upsampling output block as the first upsampling filtering prediction block; and perform filtering enhancement processing on the first upsampling filtering prediction block to determine the second prediction block of the second color component of the current block.

[0682] In some embodiments, the first filtering unit 3003 is further configured to perform a first filtering enhancement process on the first prediction block to determine a second enhanced prediction block; and use the second enhanced prediction block as a first upsampling input block; and use the first upsampling output block as a second upsampling filtering prediction block; and perform a second filtering enhancement process on the second upsampling filtering prediction block to determine a second prediction block for the second color component of the current block.

[0683] In some embodiments, the first filtering unit 3003 is further configured to perform up-sampling filtering on the first prediction block to determine a second prediction block of the second color component of the current block.

[0684] In some embodiments, the first filtering unit 3003 is further configured to determine a horizontal upsampling factor and a vertical upsampling factor; and perform upsampling filtering on the first prediction block according to the horizontal upsampling factor and the vertical upsampling factor to obtain a second prediction block of the second color component of the current block.

[0685] In some embodiments, the first filtering unit 3003 is further configured to perform upsampling filtering on the first prediction block to obtain a second prediction block if the horizontal upsampling factor is greater than 1 or the vertical upsampling factor is greater than 1.

[0686] In some embodiments, the first filtering unit 3003 is further configured to perform at least one of the following upsampling filtering processes on the first prediction block:

[0687] Performing upsampling filtering on the first prediction block in the horizontal direction;

[0688] Performing upsampling filtering on the first prediction block in a vertical direction;

[0689] Performing upsampling filtering processing on the first prediction block in the horizontal direction and then performing upsampling filtering processing in the vertical direction;

[0690] The first prediction block is subjected to upsampling filtering in the vertical direction and then to upsampling filtering in the horizontal direction.

[0691] In some embodiments, the first filtering unit 3003 is further configured to perform filtering enhancement processing on the first prediction block before performing upsampling filtering processing on the first prediction block, and use the enhanced first prediction block as the first prediction block.

[0692] In some embodiments, the first filtering unit 3003 is further configured to perform filtering enhancement processing on the first prediction block obtained after upsampling filtering to obtain a second prediction block of the second color component of the current block.

[0693] In some embodiments, the implementation of the upsampling filtering process includes at least one of the following: a linear interpolation method, a convolution operation method based on a preset neural network.

[0694] In some embodiments, the filtering enhancement processing includes at least one of the following: bilateral filtering processing, median filtering processing, Gaussian filtering processing, normalized filtering processing, and neural network filtering processing.

[0695] In some embodiments, the first filtering unit 3003 is further configured to perform filtering enhancement processing on the first prediction block to determine a second prediction block of the second color component of the current block.

[0696] In some embodiments, the first filtering unit 3003 is further configured to determine a first weight value of 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 a second prediction block.

[0697] In some embodiments, the first prediction unit 3002 is further configured to determine a compensation value of a second color component sampling point of the first prediction block based on a reference sample value in an adjacent area of ​​the current block; and to correct the prediction value of the second color component sampling point of the first prediction block based on the compensation value to determine a second prediction block.

[0698] In some embodiments, the first prediction unit 3002 is further configured to perform prediction processing on the second color component sampling point of the first prediction block according to at least one prediction mode to determine at least one initial prediction value of the second color component sampling point of the first prediction block; and perform weighted fusion processing based on the at least one initial prediction value and the prediction value of the second color component sampling point in the first prediction block to determine the second prediction block.

[0699] In some embodiments, the first determination unit 3001 is further configured to determine the predicted value of the second color component sampling point of the current block based on the second prediction block; and determine the predicted difference value of the second color component sampling point of the current block based on the original value of the second color component sampling point of the current block and the predicted value of the second color component sampling point of the current block.

[0700] In some embodiments, referring to FIG. 22 , the encoding apparatus 300 may further include an encoding unit 3004 configured to encode the predicted difference value of the second color component sampling point of the current block, and write the obtained encoding bits into the bitstream.

[0701] It is understandable that in the embodiments of the present application, a "unit" can be a portion of a circuit, a portion of a processor, a portion of a program or software, etc., and of course it can also be a module, or it can be non-modular. Moreover, the various components in this embodiment can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into a single unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional modules.

[0702] If the integrated unit is implemented as a software functional module and is not sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this embodiment, or the portion that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, server, or network device, etc.) or a processor to execute all or part of the steps of the method described in this embodiment. The aforementioned storage medium includes various media that can store program code, such as a USB flash drive, a mobile hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0703] Therefore, an embodiment of the present application provides a computer-readable storage medium, which is applied to the encoding device 300. The computer-readable storage medium stores a computer program, and when the computer program is executed by the first processor, it implements the method described in any one of the aforementioned embodiments.

[0704] Based on the composition of the above-mentioned encoding device 300 and the computer-readable storage medium, refer to Figure 23, which shows a specific hardware structure diagram of the encoding device 310 provided in an embodiment of the present application. As shown in Figure 23, the encoding device 310 may include: a first communication interface 3101, a first memory 3102 and a first processor 3103; each component is coupled together through a first bus system 3104. It can be understood that the first bus system 3104 is used to realize the connection and communication between these components. In addition to the data bus, the first bus system 3104 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, various buses are labeled as the first bus system 3104 in Figure 23. Among them,

[0705] The first communication interface 3101 is used to receive and send signals when sending and receiving information with other external network elements;

[0706] A first memory 3102 is used to store computer programs that can be run on the first processor 3103;

[0707] The first processor 3103 is configured to, when running the computer program, execute:

[0708] Determining a reference sample value of a first color component of a current block;

[0709] Determining a weighting coefficient according to a reference sample value of a first color component of a current block;

[0710] Determining a first prediction block of the second color component of the current block according to the weighting coefficient and the reference sample value of the second color component of the current block;

[0711] Performing a first filtering process on the first prediction block to determine a second prediction block of the second color component of the current block; wherein the second prediction block includes prediction values ​​of all second color component sampling points in the current block;

[0712] Determine a prediction difference value of a second color component sampling point of the current block according to the second prediction block.

[0713] It is understood that the first memory 3102 in the embodiment of the present application can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct RAM bus random access memory (DRRAM). The first memory 3102 of the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[0714] The first processor 3103 may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by hardware integrated logic circuits or software instructions in the first processor 3103. The above-mentioned 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 gate or transistor logic devices, or discrete hardware components. The various methods, steps, and logic block diagrams disclosed in the embodiments of this application can be implemented or executed. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the embodiments of this application can be directly implemented as a hardware decoding processor, or can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium mature in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, or electrically erasable programmable memory, registers, etc. The storage medium is located in the first memory 3102 , and the first processor 3103 reads the information in the first memory 3102 and completes the steps of the above method in combination with its hardware.

[0715] It is to be understood that these embodiments described in the present application can be implemented with hardware, software, firmware, middleware, microcode or its combination.For hardware implementation, the processing unit can be implemented in one or more application specific integrated circuits (Application Specific Integrated Circuits, ASIC), digital signal processor (Digital Signal Processing, DSP), digital signal processing equipment (DSP Device, DSPD), programmable logic device (Programmable Logic Device, PLD), field programmable gate array (Field-Programmable Gate Array, FPGA), general-purpose processor, controller, microcontroller, microprocessor, other electronic units for performing functions described in the present application or its combination.For software implementation, the technology described in the present application can be realized by the module (such as process, function etc.) that performs functions described in the present application. The software code can be stored in a memory and executed by a processor. The memory can be implemented in the processor or outside the processor.

[0716] Optionally, as another embodiment, the first processor 3103 is further configured to execute any one of the methods described in the foregoing embodiments when running the computer program.

[0717] This embodiment provides an encoding device, which may also include the encoding apparatus 300 described in any of the preceding embodiments. The encoding device utilizes the human eye's low sensitivity to chrominance and, to reduce the computational complexity of weighting coefficients, performs upsampling filtering on the first prediction block when the first prediction block is smaller than the current block. Furthermore, considering the instability of the predicted value of the first prediction block, filtering enhancement processing may be performed on the first prediction block, thereby further improving the accuracy and subjective and objective quality of chrominance prediction, saving bit rate, and improving encoding and decoding performance.

[0718] Based on the same inventive concept as the above embodiment, referring to FIG24, a schematic diagram of the structure of a decoding device 320 provided in an embodiment of the present application is shown. As shown in FIG24, the decoding device 320 may include: a second determination unit 3201, a second prediction unit 3202 and a second filtering unit 3203; wherein,

[0719] The second determining unit 3201 is configured to determine a reference sample value of the first color component of the current block; and determine a weighting coefficient according to the reference sample value of the first color component of the current block;

[0720] The second prediction unit 3202 is configured to determine a first prediction block of the second color component of the current block according to the weighting coefficient and the reference sample value of the second color component of the current block;

[0721] The second filtering unit 3203 is configured to perform a first filtering process on the first prediction block to determine a second prediction block of the second color component of the current block; wherein the second prediction block includes prediction values ​​of all second color component sampling points in the current block;

[0722] The second determining unit 3201 is further configured to determine the reconstructed value of the second color component sampling point of the current block according to the second prediction block.

[0723] In some embodiments, the first prediction block includes predicted values ​​of at least some of the second color component sampling points in the current block.

[0724] In some embodiments, the second determination unit 3201 is further configured to determine the reference sample value of the first color component of the current block based on the value of the first color component sampling point in the adjacent area of ​​the current block; wherein the adjacent area includes at least one of the following: the upper adjacent area, the upper right adjacent area, the left adjacent area and the lower left adjacent area.

[0725] In some embodiments, the second determining unit 3201 is further configured to perform screening processing on the first color component sampling points in the adjacent area to determine the values ​​of the first color component sampling points.

[0726] In some embodiments, the second determination unit 3201 is further configured to determine the position of the sampling point to be selected based on the position and / or color component intensity of the first color component sampling point in the adjacent area; and determine the value of the first color component sampling point from the adjacent area according to the position of the sampling point to be selected.

[0727] In some embodiments, the second filtering unit 3203 is further configured to perform a second filtering process on the value of the first color component sampling point to obtain the filtered adjacent sample values ​​of the first color component of the current block; and determine the reference sample values ​​of the first color component of the current block based on the filtered adjacent sample values ​​of the first color component of the current block.

[0728] In some embodiments, the number of filtered adjacent samples of the first color component of the current block is less than the number of values ​​of the first color component sampling points.

[0729] In some embodiments, the second determining unit 3201 is further configured to determine a reference sample value of the first color component of the current block based on a reconstructed value of a first reference color component sampling point in the current block.

[0730] In some embodiments, the reference sample value of the first color component of the current block is set to the absolute value of the difference between the value of the first color component sampling point and the reconstructed value of the first reference color component sampling point.

[0731] In some embodiments, the reference sample value of the first color component of the current block is set to the absolute value of the difference between the filtered adjacent sample value of the first color component and the reconstructed value of the first reference color component sampling point.

[0732] In some embodiments, the second filtering unit 3203 is further configured to perform a third filtering process on the reconstructed value of the first reference color component sampling point in the current block to obtain the filtered sample value of the first reference color component sampling point in the current block; and determine the reference sample value of the first color component of the current block based on the filtered sample value of the first reference color component sampling point in the current block.

[0733] In some embodiments, the number of filtered sample values ​​of the first reference color component sampling point in the current block is less than the number of reconstructed values ​​of the first reference color component sampling point in the current block.

[0734] In some embodiments, the reference sample value of the first color component of the current block is set to the absolute value of the difference between the filtered adjacent sample value of the first color component and the filtered sample value of the first reference color component sampling point.

[0735] In some embodiments, the reference sample value of the first color component of the current block is set to the absolute value of the difference between the value of the first color component sampling point and the filtered sample value of the first reference color component sampling point.

[0736] In some embodiments, the second determining unit 3201 is further configured to determine a value corresponding to the reference sample value of the first color component under a preset mapping relationship; and set the weighting coefficient to be equal to the value.

[0737] In some embodiments, the second determination unit 3201 is further configured to determine the first factor; determine the first product value based on the first factor and the reference sample value of the first color component; and determine the value corresponding to the first product value under a preset mapping relationship.

[0738] In some embodiments, the first factor is a preset constant value.

[0739] In some embodiments, the second determination unit 3201 is further configured to determine the value of the first factor based on a size parameter of the current block; wherein the size parameter of the current block includes at least one of the following parameters: the width of the current block, the height of the current block, and the product of the width and height of the current block.

[0740] In some embodiments, the preset mapping relationship is a Softmax function.

[0741] In some embodiments, the preset mapping relationship is a weighting function that has an inverse proportional relationship with the reference sample value of the first color component.

[0742] In some embodiments, the second determining unit 3201 is further configured to determine a reference sample value of the second color component of the current block according to a value of a second color component sampling point in an adjacent area of ​​the current block.

[0743] In some embodiments, the second filtering unit 3203 is further configured to perform a fourth filtering process on the values ​​of the second color component sampling points in the adjacent area of ​​the current block to obtain filtered adjacent sample values ​​of the second color component of the current block; and determine the reference sample values ​​of the second color component of the current block based on the filtered adjacent sample values ​​of the second color component of the current block.

[0744] In some embodiments, the number of filtered adjacent samples of the second color component of the current block is greater than the number of values ​​of the second color component sampling points in the adjacent area of ​​the current block.

[0745] In some embodiments, the fourth filtering process is upsampling filtering; wherein the upsampling rate is a positive integer multiple of 2.

[0746] In some embodiments, the second filtering unit 3203 is further configured to perform a fourth filtering process on the values ​​of the second color component sampling points in the adjacent area of ​​the current block based on the color format information to obtain filtered adjacent sample values ​​of the second color component of the current block.

[0747] In some embodiments, the second filtering unit 3203 is further configured to perform upsampling filtering on the values ​​of the second color component sampling points in the adjacent area of ​​the current block if the color format information indicates 4:2:0 sampling; wherein the upsampling rate is a positive integer multiple of 2.

[0748] In some embodiments, the second prediction unit 3202 is further configured to determine the weighted value of the reference sample value of the second color component and the corresponding weighting coefficient; and set the predicted value of the second color component sampling point in the first prediction block to be equal to the sum of N weighted values; wherein N represents the number of reference sample values ​​of the second color component, and N is a positive integer.

[0749] In some embodiments, the first filtering process comprises an upsampling filtering process; wherein an input of the upsampling filtering process is a first upsampling input block; and an output of the upsampling filtering process is a first upsampling output block.

[0750] In some embodiments, the second determining unit 3201 is further configured to determine an upsampling factor, wherein the upsampling factor includes at least one of the following: a horizontal upsampling factor, a vertical upsampling factor;

[0751] The second filtering unit 3203 is further configured to perform upsampling filtering on the first upsampling input block according to the upsampling factor to obtain a first upsampling output block.

[0752] In some embodiments, the second filtering unit 3203 is further configured to perform upsampling filtering on the first upsampling input block to obtain a first upsampling output block if the horizontal upsampling factor is greater than 1 or the vertical upsampling factor is greater than 1.

[0753] In some embodiments, the second filtering unit 3203 is further configured to perform upsampling filtering on the first upsampled input block, including at least one of the following:

[0754] Performing upsampling filtering on the first upsampled input block in the horizontal direction;

[0755] Performing upsampling filtering on the first upsampled input block in a vertical direction;

[0756] Performing upsampling filtering processing on the first upsampled input block in the horizontal direction and then performing upsampling filtering processing in the vertical direction;

[0757] The first up-sampled input block is subjected to up-sampling filtering in the vertical direction and then to up-sampling filtering in the horizontal direction.

[0758] In some embodiments, the second filtering unit 3203 is further configured to use the first prediction block as a first up-sampled input block; and use the first up-sampled output block as a second prediction block of a second color component of the current block.

[0759] In some embodiments, the second filtering unit 3203 is further configured to perform filtering enhancement processing on the first prediction block to determine a first enhanced prediction block; and use the first enhanced prediction block as a first upsampling input block; and use the first upsampling output block as a second prediction block for the second color component of the current block.

[0760] In some embodiments, the second filtering unit 3203 is further configured to use the first enhanced prediction block as the first upsampling input block; and use the first upsampling output block as the first upsampling filtering prediction block; and perform filtering enhancement processing on the first upsampling filtering prediction block to determine the second prediction block of the second color component of the current block.

[0761] In some embodiments, the second filtering unit 3203 is further configured to perform a first filtering enhancement process on the first prediction block to determine a second enhanced prediction block; and use the second enhanced prediction block as a first upsampling input block; and use the first upsampling output block as a second upsampling filtering prediction block; and perform a second filtering enhancement process on the second upsampling filtering prediction block to determine a second prediction block for the second color component of the current block.

[0762] In some embodiments, the second filtering unit 3203 is further configured to perform up-sampling filtering on the first prediction block to determine a second prediction block of the second color component of the current block.

[0763] In some embodiments, the second filtering unit 3203 is further configured to determine a horizontal upsampling factor and a vertical upsampling factor; and perform upsampling filtering on the first prediction block according to the horizontal upsampling factor and the vertical upsampling factor to obtain a second prediction block of the second color component of the current block.

[0764] In some embodiments, the second filtering unit 3203 is further configured to perform upsampling filtering on the first prediction block to obtain a second prediction block if the horizontal upsampling factor is greater than 1 or the vertical upsampling factor is greater than 1.

[0765] In some embodiments, the second filtering unit 3203 is further configured to perform at least one of the following upsampling filtering processes on the first prediction block:

[0766] Performing upsampling filtering on the first prediction block in the horizontal direction;

[0767] Performing upsampling filtering on the first prediction block in a vertical direction;

[0768] Performing upsampling filtering processing on the first prediction block in the horizontal direction and then performing upsampling filtering processing in the vertical direction;

[0769] The first prediction block is subjected to upsampling filtering in the vertical direction and then to upsampling filtering in the horizontal direction.

[0770] In some embodiments, the second filtering unit 3203 is further configured to perform filtering enhancement processing on the first prediction block before performing upsampling filtering processing on the first prediction block, and use the enhanced first prediction block as the first prediction block.

[0771] In some embodiments, the second filtering unit 3203 is further configured to perform filtering enhancement processing on the first prediction block obtained after upsampling filtering to obtain a second prediction block of the second color component of the current block.

[0772] In some embodiments, the implementation of the upsampling filtering process includes at least one of the following: a linear interpolation method, a convolution operation method based on a preset neural network.

[0773] In some embodiments, the filtering enhancement processing includes at least one of the following: bilateral filtering processing, median filtering processing, Gaussian filtering processing, normalized filtering processing, and neural network filtering processing.

[0774] In some embodiments, the second filtering unit 3203 is further configured to perform filtering enhancement processing on the first prediction block to determine a second prediction block of the second color component of the current block.

[0775] In some embodiments, the second filtering unit 3203 is further configured to determine a first weight value of 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 a second prediction block.

[0776] In some embodiments, the second prediction unit 3202 is further configured to determine a compensation value of the second color component sampling point of the first prediction block based on a reference sample value in an adjacent area of ​​the current block; and to correct the prediction value of the second color component sampling point of the first prediction block based on the compensation value to determine the second prediction block.

[0777] In some embodiments, the second prediction unit 3202 is further configured to perform prediction processing on the second color component sampling point of the first prediction block according to at least one prediction mode to determine at least one initial prediction value of the second color component sampling point of the first prediction block; and perform weighted fusion processing based on the at least one initial prediction value and the prediction value of the second color component sampling point in the first prediction block to determine the second prediction block.

[0778] In some embodiments, the second determination unit 3201 is further configured to determine a prediction difference value of the second color component sampling point of the current block; and determine the prediction value of the second color component sampling point of the current block based on the second prediction block; and determine the reconstructed value of the second color component sampling point of the current block based on the prediction difference value of the second color component sampling point of the current block and the prediction value of the second color component sampling point of the current block.

[0779] In some embodiments, referring to FIG. 24 , the decoding device 320 may further include a decoding unit 3204 configured to parse the code stream and determine a prediction difference value of a sampling point of the second color component of the current block.

[0780] It is understood that in this embodiment, a "unit" can be a portion of a circuit, a portion of a processor, a portion of a program or software, etc., and can also be a module or a non-modular system. Furthermore, the various components in this embodiment can be integrated into a single processing unit, or each unit can exist physically separately, or two or more units can be integrated into a single unit. The aforementioned integrated units can be implemented in the form of hardware or software functional modules.

[0781] If the integrated unit is implemented as a software functional module and is not sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, this embodiment provides a computer-readable storage medium for use in decoding device 320. The computer-readable storage medium stores a computer program. When the computer program is executed by the second processor, it implements any of the methods described in the aforementioned embodiments.

[0782] Based on the composition of the above-mentioned decoding device 320 and the computer-readable storage medium, refer to Figure 25, which shows a specific hardware structure diagram of the decoding device 330 provided in an embodiment of the present application. As shown in Figure 25, the decoding device 330 may include: a second communication interface 3301, a second memory 3302 and a second processor 3303; each component is coupled together through a second bus system 3304. It can be understood that the second bus system 3304 is used to realize the connection and communication between these components. In addition to the data bus, the second bus system 3304 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, various buses are marked as the second bus system 3304 in Figure 25. Among them,

[0783] The second communication interface 3301 is used to receive and send signals when sending and receiving information with other external network elements;

[0784] The second memory 3302 is used to store computer programs that can be run on the second processor 3303;

[0785] The second processor 3303 is configured to, when running the computer program, execute:

[0786] Determining a reference sample value of a first color component of a current block;

[0787] Determining a weighting coefficient according to a reference sample value of a first color component of a current block;

[0788] Determining a first prediction block of the second color component of the current block according to the weighting coefficient and the reference sample value of the second color component of the current block;

[0789] Performing a first filtering process on the first prediction block to determine a second prediction block of the second color component of the current block; wherein the second prediction block includes prediction values ​​of all second color component sampling points in the current block;

[0790] Determine a reconstructed value of a second color component sampling point of the current block according to the second prediction block.

[0791] Optionally, as another embodiment, the second processor 3303 is further configured to execute any one of the methods described in the foregoing embodiments when running the computer program.

[0792] It can be understood that the hardware functions of the second memory 3302 are similar to those of the first memory 3102, and the hardware functions of the second processor 3303 are similar to those of the first processor 3103; they will not be described in detail here.

[0793] This embodiment provides a decoding device, which may further include the decoding apparatus 320 described in the aforementioned embodiment. The decoding device utilizes the human eye's low sensitivity to chrominance and, to reduce the computational complexity of weighting coefficients, performs upsampling filtering on the first prediction block when the first prediction block is smaller than the current block. Furthermore, considering the instability of the predicted value of the first prediction block, filtering enhancement processing may be performed on the first prediction block, thereby further improving the accuracy and subjective and objective quality of chrominance prediction, saving bit rate, and improving encoding and decoding performance.

[0794] In yet another embodiment of the present application, see Figure 26, which shows a schematic diagram of the structure of a coding and decoding system provided in an embodiment of the present application. As shown in Figure 26, the coding and decoding system 340 may include an encoder 3401 and a decoder 3402. The encoder 3401 may be a device integrated with the encoding device 300 described in the previous embodiment, or may be the encoding device 310 described in the previous embodiment; the decoder 3402 may be a device integrated with the decoding device 320 described in the previous embodiment, or may be the decoding device 330 described in the previous embodiment.

[0795] In an embodiment of the present application, in the encoding and decoding system 340, both the encoder 3401 and the decoder 3402 can utilize the low sensitivity of the human eye to chrominance, and in order to reduce the calculation complexity of the weighting coefficient, the first prediction block is upsampled and filtered when the first prediction block is smaller than the size of the current block; even considering the instability of the predicted value of the first prediction block, it can also be filtered and enhanced, thereby further improving the accuracy and subjective and objective quality of the chrominance prediction, saving bit rate, and improving the encoding and decoding performance.

[0796] It should be noted that, in this application, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.

[0797] The serial numbers of the above embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0798] The methods disclosed in the several method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.

[0799] The features disclosed in the several product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.

[0800] The features disclosed in the several method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments or device embodiments.

[0801] The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims. Industrial Applicability

[0802] In an embodiment of the present application, whether at the encoding end or the decoding end, a reference sample value of the first color component of the current block is determined; a weighting coefficient is determined based on the reference sample value of the first color component of the current block; a first prediction block of the second color component of the current block is determined based on the weighting coefficient and the reference sample value of the second color component of the current block; a first filtering process is performed on the first prediction block to determine a second prediction block of the second color component of the current block; wherein the second prediction block includes the prediction values ​​of all the second color component sampling points in the current block. In this way, the encoding end can determine the prediction difference of the second color component sampling points of the current block based on the second prediction block and write the prediction difference into the bitstream; so that at the decoding end, the reconstructed value of the second color component sampling points of the current block can be determined based on the second prediction block and the prediction difference obtained by decoding. In this way, the weighting coefficients are calculated using the reference pixels adjacent to the current block and the color component information of the current block, which fully exploits the correlation between the current block and the adjacent areas in brightness information, and uses this correlation in the chrominance prediction of the current block, thereby improving the accuracy of the chrominance prediction. In addition, by utilizing the low sensitivity of the human eye to chrominance, and in order to reduce the calculation complexity of the weighting coefficients, the first prediction block is upsampled and filtered when the first prediction block is smaller than the size of the current block. Even considering the instability of the predicted value of the first prediction block, it can also be filtered and enhanced, thereby further improving the accuracy and subjective and objective quality of the chrominance prediction, saving bit rate, improving encoding and decoding efficiency, and thus improving encoding and decoding performance.

Claims

1. A decoding method, comprising: Determining a reference sample value of a first color component of a current block; Determining a weighting coefficient according to a reference sample value of the first color component of the current block; determining a first prediction block of the second color component of the current block according to the weighting coefficient and a reference sample value of the second color component of the current block; Performing a first filtering process on the first prediction block to determine a second prediction block for the second color component of the current block; wherein the second prediction block includes prediction values ​​of all sampling points of the second color component in the current block; Determine, according to the second prediction block, a reconstructed value of the second color component sampling point of the current block.

2. The method according to claim 1, wherein The first prediction block includes predicted values ​​of at least some of the second color component sampling points in the current block.

3. The method according to claim 1, wherein The determining of the reference sample value of the first color component of the current block includes: Determining a reference sample value of the first color component of the current block according to a value of a first color component sampling point in an adjacent area of ​​the current block; The adjacent area includes at least one of the following: an upper adjacent area, an upper right adjacent area, a left adjacent area, and a lower left adjacent area.

4. The method according to claim 3, wherein: The method further comprises: Screening processing is performed on the first color component sampling points in the adjacent area to determine the values ​​of the first color component sampling points.

5. The method according to claim 4, wherein The screening process of the first color component sampling points in the adjacent area to determine the values ​​of the first color component sampling points includes: Determining a position of a sampling point to be selected based on a position and / or a color component intensity of a first color component sampling point in the adjacent area; According to the position of the sampling point to be selected, the value of the first color component sampling point is determined from the adjacent area.

6. The method according to claim 3, wherein: The determining of the reference sample value of the first color component of the current block further includes: Performing a second filtering process on the values ​​of the first color component sampling points to obtain filtered adjacent samples of the first color component of the current block; A reference sample value of the first color component of the current block is determined according to the filtered adjacent sample values ​​of the first color component of the current block.

7. The method according to claim 6, wherein: The number of filtered adjacent sample values ​​of the first color component of the current block is less than the number of values ​​of the first color component sampling points.

8. The method according to claim 3 or 6, wherein: The determining of the reference sample value of the first color component of the current block further includes: Based on the reconstructed value of the first reference color component sampling point in the current block, a reference sample value of the first color component of the current block is determined.

9. The method according to claim 8, wherein The reference sample value of the first color component of the current block is set to the absolute value of the difference between the value of the first color component sampling point and the reconstructed value of the first reference color component sampling point.

10. The method according to claim 8, wherein The reference sample value of the first color component of the current block is set to the absolute value of the difference between the filtered adjacent sample value of the first color component and the reconstructed value of the first reference color component sampling point.

11. The method according to claim 3 or 6, wherein: The determining of the reference sample value of the first color component of the current block further includes: Performing a third filtering process on the reconstructed value of the first reference color component sampling point in the current block to obtain a filtered sample value of the first reference color component sampling point in the current block; Determine a reference sample value of the first color component of the current block according to the filtered sample value of the first reference color component sampling point in the current block.

12. The method according to claim 11, wherein The number of filtered sample values ​​of the first reference color component sampling point in the current block is less than the number of reconstructed values ​​of the first reference color component sampling point in the current block.

13. The method according to claim 11, wherein The reference sample value of the first color component of the current block is set to the absolute value of the difference between the filtered adjacent sample value of the first color component and the filtered sample value of the first reference color component sampling point.

14. The method according to claim 11, wherein The reference sample value of the first color component of the current block is set to the absolute value of the difference between the value of the first color component sampling point and the filtered sample value of the first reference color component sampling point.

15. The method according to claim 1, wherein The determining of the weighting coefficient according to the reference sample value of the first color component of the current block includes: Determining a value corresponding to the reference sample value of the first color component under a preset mapping relationship; The weighting coefficient is set equal to the value.

16. The method according to claim 15, wherein The determining of a value corresponding to the reference sample value of the first color component under a preset mapping relationship includes: Determine the first factor; determining a first product value according to the first factor and a reference sample value of the first color component; Determine a value corresponding to the first product value under the preset mapping relationship.

17. The method according to claim 16, wherein: The determining of the first factor comprises: The first factor is a preset constant value.

18. The method according to claim 16, wherein The determining of the first factor comprises: Determining a value of the first factor according to a size parameter of the current block; The size parameter of the current block includes at least one of the following parameters: the width of the current block and the height of the current block.

19. The method according to claim 15, wherein The determining of a value corresponding to the reference sample value of the first color component under a preset mapping relationship includes: The preset mapping relationship is a Softmax function.

20. The method according to claim 15, wherein The determining of a value corresponding to the reference sample value of the first color component under a preset mapping relationship includes: The preset mapping relationship is a weighting function that has an inverse proportional relationship with the reference sample value of the first color component.

21. The method according to claim 1, wherein The method further comprises: Determine a reference sample value of the second color component of the current block according to the value of the second color component sampling point in the adjacent area of ​​the current block.

22. The method according to claim 21, wherein The method further comprises: Performing a fourth filtering process on the values ​​of the second color component sampling points in the adjacent area of ​​the current block to obtain filtered adjacent sample values ​​of the second color component of the current block; A reference sample value of the second color component of the current block is determined according to the filtered adjacent sample values ​​of the second color component of the current block.

23. The method according to claim 22, wherein The number of filtered adjacent sample values ​​of the second color component of the current block is greater than the number of values ​​of the second color component sampling points in the adjacent area of ​​the current block.

24. The method according to claim 22, wherein The method further comprises: The fourth filtering process is upsampling filtering; wherein the upsampling rate is a positive integer multiple of 2.

25. The method according to claim 22, wherein The method further comprises: Based on the color format information, a fourth filtering process is performed on the values ​​of the second color component sampling points in the adjacent area of ​​the current block to obtain filtered adjacent sample values ​​of the second color component of the current block.

26. The method according to claim 25, wherein The fourth filtering process further includes: If the color format information indicates 4:2:0 sampling, upsampling filtering is performed on the values ​​of the second color component sampling points in the adjacent area of ​​the current block; wherein the upsampling rate is a positive integer multiple of 2.

27. The method according to claim 1, wherein The determining, according to the weighting coefficient and the reference sample value of the second color component of the current block, a first predicted block of the second color component of the current block comprises: Determining a weighted value of a reference sample value of the second color component and the corresponding weighting coefficient; The predicted value of the second color component sampling point in the first prediction block is set to be equal to the sum of N weighted values; wherein N represents the number of reference sample values ​​of the second color component, and N is a positive integer.

28. The method according to claim 1, wherein The performing a first filtering process on the first prediction block to determine a second prediction block for the second color component of the current block includes: The first filtering process comprises an upsampling filtering process; wherein the input of the upsampling filtering process is a first upsampling input block; and the output of the upsampling filtering process is a first upsampling output block.

29. The method according to claim 28, wherein The upsampling filtering process includes: Determining an upsampling factor, wherein the upsampling factor includes at least one of the following: a horizontal upsampling factor and a vertical upsampling factor; Perform upsampling filtering on the first upsampling input block according to the upsampling factor to obtain the first upsampling output block.

30. The method according to claim 29, wherein The performing upsampling filtering on the first upsampling input block according to the upsampling factor to obtain the first upsampling output block includes: If the horizontal upsampling factor is greater than 1, or the vertical upsampling factor is greater than 1, upsampling filtering is performed on the first upsampling input block to obtain the first upsampling output block.

31. The method according to claim 30, wherein The performing upsampling filtering on the first upsampling input block includes at least one of the following: performing upsampling filtering processing on the first upsampled input block in a horizontal direction; performing upsampling filtering on the first upsampled input block in a vertical direction; performing upsampling filtering processing on the first upsampled input block in a horizontal direction and then performing upsampling filtering processing in a vertical direction; The first up-sampled input block is subjected to up-sampling filtering processing in a vertical direction and then to up-sampling filtering processing in a horizontal direction.

32. The method of claim 28, wherein: The method further comprises: using the first prediction block as the first up-sampled input block; The first up-sampled output block is used as a second prediction block for a second color component of the current block.

33. The method of claim 28, wherein: The method further comprises: performing filtering enhancement processing on the first prediction block to determine a first enhanced prediction block; using the first enhanced prediction block as the first up-sampled input block; The first up-sampled output block is used as a second prediction block for a second color component of the current block.

34. The method of claim 28, wherein The method further comprises: using the first prediction block as the first up-sampled input block; using the first up-sampled output block as a first up-sampled filtered prediction block; Performing filtering enhancement processing on the first up-sampled filtered prediction block to determine a second prediction block of the second color component of the current block.

35. The method of claim 28, wherein The method further comprises: performing a first filtering enhancement process on the first prediction block to determine a second enhanced prediction block; Using the second enhanced prediction block as the first up-sampled input block; Using the first up-sampled output block as a second up-sampled filtered prediction block; A second filtering enhancement process is performed on the second up-sampled filtered prediction block to determine a second prediction block of the second color component of the current block.

36. The method according to any one of claims 28 to 35, wherein The implementation method of the upsampling filtering process includes at least one of the following: a linear interpolation method, a convolution operation method based on a preset neural network.

37. The method according to any one of claims 33 to 35, wherein: The filtering enhancement processing includes at least one of the following: bilateral filtering processing, median filtering processing, Gaussian filtering processing, normalized filtering processing, and neural network filtering processing.

38. The method of claim 1, wherein The performing a first filtering process on the first prediction block to determine a second prediction block for the second color component of the current block includes: determining a first weight value of 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.

39. The method of claim 1, wherein The performing a first filtering process on the first prediction block to determine a second prediction block for the second color component of the current block includes: determining, according to reference sample values ​​in an adjacent area of ​​the current block, a compensation value for a second color component sampling point of the first prediction block; The predicted value of the second color component sampling point of the first prediction block is corrected according to the compensation value to determine the second prediction block.

40. The method of claim 1, wherein The performing a first filtering process on the first prediction block to determine a second prediction block for the second color component of the current block includes: performing prediction processing on the second color component sampling point of the first prediction block according to at least one prediction mode to determine at least one initial prediction value of the second color component sampling point of the first prediction block; The second prediction block is determined by performing weighted fusion processing on the at least one initial prediction value and the prediction value of the second color component sampling point in the first prediction block.

41. The method of claim 1, wherein The determining, according to the second prediction block, a reconstructed value of the second color component sampling point of the current block includes: Determining a predicted difference value of the second color component sampling point of the current block; Determining, according to the second prediction block, a predicted value of the second color component sampling point of the current block; Determine a reconstructed value of the second color component sampling point of the current block according to the predicted difference value of the second color component sampling point of the current block and the predicted value of the second color component sampling point of the current block.

42. A coding method comprising: Determining a reference sample value of a first color component of a current block; Determining a weighting coefficient according to a reference sample value of the first color component of the current block; determining a first prediction block of the second color component of the current block according to the weighting coefficient and a reference sample value of the second color component of the current block; Performing a first filtering process on the first prediction block to determine a second prediction block for the second color component of the current block; wherein the second prediction block includes prediction values ​​of all sampling points of the second color component in the current block; Determine, according to the second prediction block, a prediction difference value of the second color component sampling point of the current block.

43. The method according to claim 42, wherein The first prediction block includes predicted values ​​of at least some of the second color component sampling points in the current block.

44. The method of claim 42, wherein: The determining of the reference sample value of the first color component of the current block includes: Determining a reference sample value of the first color component of the current block according to a value of a first color component sampling point in an adjacent area of ​​the current block; The adjacent area includes at least one of the following: an upper adjacent area, an upper right adjacent area, a left adjacent area, and a lower left adjacent area.

45. The method of claim 44, wherein: The method further comprises: Screening processing is performed on the first color component sampling points in the adjacent area to determine the values ​​of the first color component sampling points.

46. ​​The method of claim 45, wherein The screening process of the first color component sampling points in the adjacent area to determine the values ​​of the first color component sampling points includes: Determining a position of a sampling point to be selected based on a position and / or a color component intensity of a first color component sampling point in the adjacent area; According to the position of the sampling point to be selected, the value of the first color component sampling point is determined from the adjacent area.

47. The method of claim 44, wherein The determining of the reference sample value of the first color component of the current block further includes: Performing a second filtering process on the values ​​of the first color component sampling points to obtain filtered adjacent samples of the first color component of the current block; A reference sample value of the first color component of the current block is determined according to the filtered adjacent sample values ​​of the first color component of the current block.

48. The method of claim 47, wherein The number of filtered adjacent sample values ​​of the first color component of the current block is less than the number of values ​​of the first color component sampling points.

49. The method according to claim 44 or 47, wherein The determining of the reference sample value of the first color component of the current block further includes: Based on the reconstructed value of the first reference color component sampling point in the current block, a reference sample value of the first color component of the current block is determined.

50. The method of claim 49, wherein The reference sample value of the first color component of the current block is set to the absolute value of the difference between the value of the first color component sampling point and the reconstructed value of the first reference color component sampling point.

51. The method of claim 49, wherein The reference sample value of the first color component of the current block is set to the absolute value of the difference between the filtered adjacent sample value of the first color component and the reconstructed value of the first reference color component sampling point.

52. The method of claim 44 or 47, wherein: The determining of the reference sample value of the first color component of the current block further includes: Performing a third filtering process on the reconstructed value of the first reference color component sampling point in the current block to obtain a filtered sample value of the first reference color component sampling point in the current block; Determine a reference sample value of the first color component of the current block according to the filtered sample value of the first reference color component sampling point in the current block.

53. The method of claim 52, wherein: The number of filtered sample values ​​of the first reference color component sampling point in the current block is less than the number of reconstructed values ​​of the first reference color component sampling point in the current block.

54. The method of claim 52, wherein: The reference sample value of the first color component of the current block is set to the absolute value of the difference between the filtered adjacent sample value of the first color component and the filtered sample value of the first reference color component sampling point.

55. The method of claim 52, wherein: The reference sample value of the first color component of the current block is set to the absolute value of the difference between the value of the first color component sampling point and the filtered sample value of the first reference color component sampling point.

56. The method of claim 42, wherein The determining of the weighting coefficient according to the reference sample value of the first color component of the current block includes: Determining a value corresponding to the reference sample value of the first color component under a preset mapping relationship; The weighting coefficient is set equal to the value.

57. The method of claim 56, wherein The determining of a value corresponding to the reference sample value of the first color component under a preset mapping relationship includes: Determine the first factor; determining a first product value according to the first factor and a reference sample value of the first color component; Determine a value corresponding to the first product value under the preset mapping relationship.

58. The method of claim 57, wherein The determining of the first factor comprises: The first factor is a preset constant value.

59. The method of claim 57, wherein The determining of the first factor comprises: Determining a value of the first factor according to a size parameter of the current block; The size parameter of the current block includes at least one of the following parameters: the width of the current block and the height of the current block.

60. The method of claim 56, wherein The determining of a value corresponding to the reference sample value of the first color component under a preset mapping relationship includes: The preset mapping relationship is a Softmax function.

61. The method of claim 56, wherein: The determining of a value corresponding to the reference sample value of the first color component under a preset mapping relationship includes: The preset mapping relationship is a weighting function that has an inverse proportional relationship with the reference sample value of the first color component.

62. The method of claim 42, wherein: The method further comprises: Determine a reference sample value of the second color component of the current block according to the value of the second color component sampling point in the adjacent area of ​​the current block.

63. The method of claim 62, wherein: The method further comprises: Performing a fourth filtering process on the values ​​of the second color component sampling points in the adjacent area of ​​the current block to obtain filtered adjacent sample values ​​of the second color component of the current block; A reference sample value of the second color component of the current block is determined according to the filtered adjacent sample values ​​of the second color component of the current block.

64. The method of claim 63, wherein The number of filtered adjacent sample values ​​of the second color component of the current block is greater than the number of values ​​of the second color component sampling points in the adjacent area of ​​the current block.

65. The method of claim 63, wherein The method further comprises: The fourth filtering process is upsampling filtering; wherein the upsampling rate is a positive integer multiple of 2.

66. The method of claim 63, wherein The method further comprises: Based on the color format information, a fourth filtering process is performed on the values ​​of the second color component sampling points in the adjacent area of ​​the current block to obtain filtered adjacent sample values ​​of the second color component of the current block.

67. The method of claim 66, wherein The fourth filtering process further includes: If the color format information indicates 4:2:0 sampling, upsampling filtering is performed on the values ​​of the second color component sampling points in the adjacent area of ​​the current block; wherein the upsampling rate is a positive integer multiple of 2.

68. The method of claim 42, wherein The determining, according to the weighting coefficient and the reference sample value of the second color component of the current block, a first predicted block of the second color component of the current block comprises: Determining a weighted value of a reference sample value of the second color component and the corresponding weighting coefficient; The predicted value of the second color component sampling point in the first prediction block is set to be equal to the sum of N weighted values; wherein N represents the number of reference sample values ​​of the second color component, and N is a positive integer.

69. The method of claim 42, wherein The performing a first filtering process on the first prediction block to determine a second prediction block for the second color component of the current block includes: The first filtering process comprises an upsampling filtering process; wherein the input of the upsampling filtering process is a first upsampling input block; and the output of the upsampling filtering process is a first upsampling output block.

70. The method of claim 69, wherein The upsampling filtering process includes: Determining an upsampling factor, wherein the upsampling factor includes at least one of the following: a horizontal upsampling factor and a vertical upsampling factor; Perform upsampling filtering on the first upsampling input block according to the upsampling factor to obtain the first upsampling output block.

71. The method of claim 70, wherein The performing upsampling filtering on the first upsampling input block according to the upsampling factor to obtain the first upsampling output block includes: If the horizontal upsampling factor is greater than 1, or the vertical upsampling factor is greater than 1, upsampling filtering is performed on the first upsampling input block to obtain the first upsampling output block.

72. The method of claim 71, wherein The performing upsampling filtering on the first upsampling input block includes at least one of the following: performing upsampling filtering processing on the first upsampled input block in a horizontal direction; performing upsampling filtering on the first upsampled input block in a vertical direction; performing upsampling filtering processing on the first upsampled input block in a horizontal direction and then performing upsampling filtering processing in a vertical direction; The first up-sampled input block is subjected to up-sampling filtering processing in a vertical direction and then to up-sampling filtering processing in a horizontal direction.

73. The method of claim 69, wherein The method further comprises: using the first prediction block as the first up-sampled input block; The first up-sampled output block is used as a second prediction block for a second color component of the current block.

74. The method of claim 69, wherein The method further comprises: performing filtering enhancement processing on the first prediction block to determine a first enhanced prediction block; using the first enhanced prediction block as the first up-sampled input block; The first up-sampled output block is used as a second prediction block for a second color component of the current block.

75. The method of claim 74, wherein The method further comprises: using the first enhanced prediction block as the first up-sampled input block; using the first up-sampled output block as a first up-sampled filtered prediction block; Performing filtering enhancement processing on the first up-sampled filtered prediction block to determine a second prediction block of the second color component of the current block.

76. The method of claim 69, wherein The method further comprises: performing a first filtering enhancement process on the first prediction block to determine a second enhanced prediction block; Using the second enhanced prediction block as the first up-sampled input block; Using the first up-sampled output block as a second up-sampled filtered prediction block; A second filtering enhancement process is performed on the second up-sampled filtered prediction block to determine a second prediction block of the second color component of the current block.

77. The method according to any one of claims 69 to 76, wherein The implementation method of the upsampling filtering process includes at least one of the following: a linear interpolation method, a convolution operation method based on a preset neural network.

78. The method according to any one of claims 74 to 76, wherein The filtering enhancement processing includes at least one of the following: bilateral filtering processing, median filtering processing, Gaussian filtering processing, normalized filtering processing, and neural network filtering processing.

79. The method of claim 42, wherein The performing a first filtering process on the first prediction block to determine a second prediction block for the second color component of the current block includes: determining a first weight value of 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.

80. The method of claim 42, wherein The performing a first filtering process on the first prediction block to determine a second prediction block for the second color component of the current block includes: determining, according to reference sample values ​​in an adjacent area of ​​the current block, a compensation value for a second color component sampling point of the first prediction block; The predicted value of the second color component sampling point of the first prediction block is corrected according to the compensation value to determine the second prediction block.

81. The method of claim 42, wherein: The performing a first filtering process on the first prediction block to determine a second prediction block for the second color component of the current block includes: performing prediction processing on the second color component sampling point of the first prediction block according to at least one prediction mode to determine at least one initial prediction value of the second color component sampling point of the first prediction block; The second prediction block is determined by performing weighted fusion processing on the at least one initial prediction value and the prediction value of the second color component sampling point in the first prediction block.

82. The method of claim 42, wherein: The determining, according to the second prediction block, a predicted difference value of the second color component sampling point of the current block, includes: Determining, according to the second prediction block, a predicted value of the second color component sampling point of the current block; Determine a predicted difference value of the second color component sampling point of the current block according to the original value of the second color component sampling point of the current block and the predicted value of the second color component sampling point of the current block.

83. The method of claim 82, wherein The method further comprises: The predicted difference value of the second color component sampling point of the current block is encoded, and the obtained encoding bits are written into a bitstream.

84. A coding device comprising a first determining unit, a first predicting unit, and a first filtering unit; wherein, The first determining unit is configured to determine a reference sample value of a first color component of a current block; and determining a weighting coefficient according to a reference sample value of the first color component of the current block; The first prediction unit is configured to determine a first prediction block of the second color component of the current block according to the weighting coefficient and a reference sample value of the second color component of the current block; The first filtering unit is configured to perform a first filtering process on the first prediction block to determine a second prediction block of the second color component of the current block; wherein the second prediction block includes prediction values ​​of all sampling points of the second color component in the current block; The first determining unit is further configured to determine a prediction difference value of the second color component sampling point of the current block according to the second prediction block.

85. A coding device comprising a first memory and a first processor; wherein, The first memory is used to store a computer program that can be run on the first processor; The first processor is configured to execute the method according to any one of claims 42 to 83 when running the computer program.

86. A decoding device comprising a second determining unit, a second predicting unit, and a second filtering unit; wherein: The second determining unit is configured to determine a reference sample value of a first color component of a current block; and determining a weighting coefficient according to a reference sample value of the first color component of the current block; The second prediction unit is configured to determine a first prediction block of the second color component of the current block according to the weighting coefficient and the reference sample value of the second color component of the current block; The second filtering unit is configured to perform a first filtering process on the first prediction block to determine a second prediction block of the second color component of the current block; wherein the second prediction block includes prediction values ​​of all sampling points of the second color component in the current block; The second determining unit is further configured to determine a reconstructed value of the second color component sampling point of the current block according to the second prediction block.

87. A decoding device comprising a second memory and a second processor; wherein, The second memory is used to store a computer program that can be run on the second processor; The second processor is configured to execute the method according to any one of claims 1 to 41 when running the computer program.

88. A computer-readable storage medium, wherein: The computer-readable storage medium stores a computer program, and when the computer program is executed, the method according to any one of claims 1 to 41 is implemented, or the method according to any one of claims 42 to 83 is implemented.