Encoding and decoding method and device, encoding equipment, decoding equipment and storage medium
Patent Information
- Application Number
- CN202280097702.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-05
- Publication Date
- 2025-02-14
AI Technical Summary
The predicted values of the coded blocks calculated by the inter-color component prediction technique of H.266/VVC deviate significantly from the original values, resulting in low prediction accuracy and affecting coding performance.
By determining the reference values of the first and second color components of the current block, calculating the weighting coefficients and reference mean, the chromaticity prediction process is optimized. Integer operations are used to reduce computational complexity and improve prediction accuracy.
While ensuring the accuracy of chroma prediction, it reduces computational complexity and improves encoding and decoding performance.
Smart Images

Figure CN119452661A_ABST
Abstract
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 have emerged. 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 chroma prediction and reduce the computational complexity of chroma prediction, 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 value of a first color component of a current block and a reference value of a second color component of the current block;
[0009] determining a weighting coefficient according to a reference value of a first color component of a current block;
[0010] determining a reference mean value of the second color component of the current block according to the reference value of the second color component of the current block; and determining a reference sample value of the second color component of the current block according to the reference value of the second color component of the current block and the reference mean value of the second color component of the current block;
[0011] Determine a predicted value of a sampling point of the second color component in the current block according to a reference mean value of the second color component of the current block, a reference sample value of the second color component of the current block, and a corresponding weighting coefficient;
[0012] Determine a reconstructed value of the second color component sampling point in the current block according to the predicted value of the second color component sampling point in the current block.
[0013] In a second aspect, an embodiment of the present application provides an encoding method, including:
[0014] determining a reference value of a first color component of a current block and a reference value of a second color component of the current block;
[0015] determining a weighting coefficient according to a reference value of a first color component of a current block;
[0016] determining a reference mean value of the second color component of the current block according to the reference value of the second color component of the current block; and determining a reference sample value of the second color component of the current block according to the reference value of the second color component of the current block and the reference mean value of the second color component of the current block;
[0017] Determine a predicted value of a sampling point of the second color component in the current block according to a reference mean value of the second color component of the current block, a reference sample value of the second color component of the current block, and a corresponding weighting coefficient;
[0018] Determine a predicted difference value of the second color component sampling point in the current block according to the predicted value of the second color component sampling point in the current block.
[0019] In a third aspect, an embodiment of the present application provides an encoding device, comprising a first determining unit, a first calculating unit, and a first predicting unit; wherein,
[0020] a first determining unit configured to determine a reference value of a first color component of a current block and a reference value of a second color component of the current block; and determine a weighting coefficient according to the reference value of the first color component of the current block;
[0021] a first calculating unit configured to determine a reference mean value of the second color component of the current block according to a reference value of the second color component of the current block; and determine a reference sample value of the second color component of the current block according to the reference value of the second color component of the current block and the reference mean value of the second color component of the current block;
[0022] a first prediction unit configured to determine a predicted value of a sampling point of the second color component in the current block according to a reference mean value of the second color component of the current block, a reference sample value of the second color component of the current block, and a corresponding weighting coefficient;
[0023] The first determining unit is further configured to determine a predicted difference value of the second color component sampling point in the current block according to the predicted value of the second color component sampling point in the current 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 calculating unit, and a second predicting unit; wherein,
[0028] a second determining unit configured to determine a reference value of a first color component of a current block and a reference value of a second color component of the current block; and determine a weighting coefficient according to the reference value of the first color component of the current block;
[0029] a second calculating unit configured to determine a reference mean value of the second color component of the current block according to the reference value of the second color component of the current block; and determine a reference sample value of the second color component of the current block according to the reference value of the second color component of the current block and the reference mean value of the second color component of the current block;
[0030] a second prediction unit configured to determine a predicted value of a sampling point of the second color component in the current block according to a reference mean value of the second color component of the current block, a reference sample value of the second color component of the current block, and a corresponding weighting coefficient;
[0031] The second determining unit is further configured to determine the reconstructed value of the second color component sampling point in the current block according to the predicted value of the second color component sampling point in the current 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 coding method determines a reference value of a first color component of a current block and a reference value of a second color component of the current block; determines a weighting coefficient based on the reference value of the first color component of the current block; determines a reference mean value of the second color component of the current block based on the reference value of the second color component of the current block; and determines a reference sample value of the second color component of the current block based on the reference value of the second color component of the current block and the reference mean value of the second color component of the current block; and determines a predicted value of a sampling point of the second color component in the current block based on the reference mean value of the second color component of the current block, the reference sample value of the second color component of the current block, and the corresponding weighting coefficient. In this way, the coding end can determine a predicted difference value of the sampling point of the second color component of the current block based on the predicted value of the sampling point of the second color component of the current block; and the decoding end can determine a reconstructed value of the sampling point of the second color component of the current block based on the predicted value of the sampling point of the second color component of the current block. That is to say, based on the color component reference information in the adjacent areas of the current block and the color component reconstruction information in the current block, it is necessary not only to construct a luminance difference vector in order to determine the weighting coefficient; but also to determine the chrominance average value based on the chrominance reference information, and then determine the chrominance difference vector based on the chrominance reference information and the chrominance average value, and then determine the chrominance prediction value based on the chrominance difference vector and the corresponding weighting coefficient, plus the chrominance average value; in this way, by optimizing the calculation process of the weighted chrominance prediction, it is possible to fully adopt integer operations, and fully consider the characteristics of the weight model, and reasonably optimize the integer operation process; while fully ensuring the accuracy of the chrominance prediction, it is also possible to reduce the computational complexity, improve the encoding and decoding efficiency, and thus improve 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 schematic diagram of a flow chart of a decoding method provided in an embodiment of the present application;
[0043] FIG6 is a schematic diagram of a reference area of a current block provided by an embodiment of the present application;
[0044] FIG7 is a schematic diagram of a flow chart of another decoding method provided in an embodiment of the present application;
[0045] FIG8 is a schematic flow chart of another decoding method provided in an embodiment of the present application;
[0046] FIG9 is a schematic diagram of a flow chart of an encoding method provided in an embodiment of the present application;
[0047] FIG10 is a schematic diagram of the structure of an encoding device provided in an embodiment of the present application;
[0048] FIG11 is a schematic diagram of a specific hardware structure of an encoding device provided in an embodiment of the present application;
[0049] FIG12 is a schematic diagram of the structure of a decoding device provided in an embodiment of the present application;
[0050] FIG13 is a schematic diagram of a specific hardware structure of a decoding device provided in an embodiment of the present application;
[0051] FIG14 is a schematic diagram of the composition structure of a coding and decoding system provided in an embodiment of the present application. DETAILED DESCRIPTION
[0052] 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.
[0053] 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.
[0054] 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.
[0055] 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). Among them, 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; in this way, 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., and the embodiments of the present application do not impose any restrictions.
[0056] 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.
[0057] 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 H.266 / Versatile Video Coding (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)+β.
[0058] 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.
[0059] 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.
[0060] 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,
[0061] 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;
[0062] 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 W′=0;
[0063] 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.
[0064] 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,
[0065] 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};
[0066] 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}.
[0067] 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.
[0068] 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.
[0069] 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:
[0070] S301: Acquire reference pixels in a selected area.
[0071] S302: Determine the number of valid reference pixels.
[0072] S303: If the number of valid reference pixels is 0, the model parameter α is set to 0 and β is set to a default value.
[0073] S304: The chroma prediction value is filled with a default value.
[0074] 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.
[0075] S306: Calculate the mean point corresponding to the larger value and the mean point corresponding to the smaller value.
[0076] S307: Derivation of model parameters α and β based on the two mean points.
[0077] S308: Perform chroma prediction using the prediction model constructed using α and β.
[0078] It should be noted that in VVC, the step of valid reference pixels being 0 is judged based on the validity of adjacent areas.
[0079] 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.
[0080] 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 prediction 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 across different locations within the coding block. Furthermore, the high correlation between the reconstructed luminance information of the current block and the reference information of adjacent regions is not fully considered during the CCLM prediction process, resulting in inaccurate prediction for some coding blocks using this technology, thus reducing the gain of the technology. Simply put, the current CCLM technology results in significant deviations between the predicted and original values for some coding blocks, leading to low prediction accuracy, reduced quality, and lower encoding and decoding efficiency.
[0081] Based on this, an embodiment of the present application provides an encoding method, which determines a reference value of a first color component of a current block and a reference value of a second color component of the current block; determines a weighting coefficient based on the reference value of the first color component of the current block; determines a reference mean value of the second color component of the current block based on the reference value of the second color component of the current block; and determines a reference sample value of the second color component of the current block based on the reference value of the second color component of the current block and the reference mean value of the second color component of the current block; determines a predicted value of a sampling point of the second color component in the current block based on the reference mean value of the second color component of the current block, the reference sample value of the second color component of the current block and the corresponding weighting coefficient; and determines a predicted difference value of the sampling point of the second color component in the current block based on the predicted value of the sampling point of the second color component in the current block.
[0082] An embodiment of the present application also provides a decoding method, which determines a reference value of a first color component of a current block and a reference value of a second color component of the current block; determines a weighting coefficient based on the reference value of the first color component of the current block; determines a reference mean value of the second color component of the current block based on the reference value of the second color component of the current block; and determines a reference sample value of the second color component of the current block based on the reference value of the second color component of the current block and the reference mean value of the second color component of the current block; determines a predicted value of a sampling point of the second color component in the current block based on the reference mean value of the second color component of the current block, the reference sample value of the second color component of the current block and the corresponding weighting coefficient; and determines a reconstructed value of the sampling point of the second color component in the current block based on the predicted value of the sampling point of the second color component in the current block.
[0083] In this way, based on the color component reference information in the adjacent areas of the current block and the color component reconstruction information in the current block, it is necessary not only to construct a luminance difference vector in order to determine the weighting coefficient; but also to determine the chromaticity average value based on the chromaticity reference information, and then determine the chromaticity difference vector based on the chromaticity reference information and the chromaticity average value, and then determine the chromaticity prediction value based on the chromaticity difference vector and the corresponding weighting coefficient, plus the chromaticity average value; in this way, by optimizing the calculation process of weight-based chromaticity prediction, it is possible to fully adopt integer operations, and fully consider the characteristics of the weight model, and reasonably optimize the integer operation process; while fully ensuring the accuracy of chromaticity prediction, it is also possible to reduce computational complexity, improve encoding and decoding efficiency, and thus improve encoding and decoding performance.
[0084] The embodiments of the present application will be described in detail below with reference to the accompanying drawings.
[0085] 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 .
[0086] 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.
[0087] 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.
[0088] 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.
[0089] 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:
[0090] S501: Determine a reference value of a first color component of a current block and a reference value of a second color component of the current block.
[0091] 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 may specifically refer to an intra-frame prediction method, more specifically, an integer operation method of weighted chroma prediction (WCP).
[0092] 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.
[0093] It should also be noted that, in embodiments 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.
[0094] Here, the upper adjacent area and the upper right adjacent area can be considered as the upper area, and the left adjacent area and the lower left adjacent area can be considered as the left area. In addition, the adjacent area can also include the upper left area, as shown in Figure 6. When predicting the second color component of the current block, the upper area, left area, and upper left area of the current block as adjacent areas can all be called reference areas of the current block, and the pixels in the reference areas are all reconstructed reference pixels.
[0095] In some embodiments, determining a reference value of a first color component of a current block and a reference value of a second color component of the current block may include:
[0096] Determining a reference value of the first color component of the current block according to the value of the first color component sampling point in the adjacent area of the current block;
[0097] A reference value of the second color component of the current block is determined according to the values of the second color component sampling points in the adjacent areas of the current block.
[0098] 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.
[0099] It should also be noted that, in the embodiment of the present application, it is assumed that the first color component is a luminance component and the second color component is a chrominance component; then, 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.
[0100] It should also be noted that, in the embodiment of the present application, the value of the first color component sampling point or the value of the second 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.
[0101] 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: if the prediction mode of the current block is the upper adjacent mode, then the adjacent area of the current block is determined to include the upper adjacent area and / or the upper right adjacent area; if the prediction mode of the current block is the left adjacent mode, then the adjacent area of the current block is determined to include the left adjacent area and / or the lower left adjacent area. The upper adjacent mode includes a prediction mode using an upper adjacent reference sampling point, and the left adjacent mode includes a prediction mode using a left adjacent reference sampling point.
[0102] Exemplarily, if the prediction mode of the current block is the vertical mode in the upper adjacent mode, then the adjacent area in the weight-based chrominance component prediction can only select the upper adjacent area and / or the upper right adjacent area; if the prediction mode of the current block is the horizontal mode in the left adjacent mode, then the adjacent area in the weight-based chrominance component prediction can only select the left adjacent area and / or the lower left adjacent area.
[0103] Furthermore, in some embodiments, determining the reference pixel of the current block may include: performing screening processing on pixels in an adjacent area of the current block to determine the reference pixel.
[0104] Specifically, in an embodiment of the present application, a first reference pixel set is formed based on pixels in an adjacent area of the current block. This first reference pixel set can then be screened to determine the reference pixels. Here, the number of reference pixels can be M, where M is a positive integer. In other words, M reference pixels can be selected from the pixels in the adjacent area. The value of M can generally be 4, but this is not a specific limitation.
[0105] It should also be noted that among the pixels in the adjacent area of the current block, there may be some unimportant pixels (for example, these pixels have poor correlation) or some abnormal pixels. In order to ensure the accuracy of the prediction, these pixels need to be eliminated to obtain valid reference pixels. Therefore, in a specific embodiment, the pixels in the adjacent area are screened to determine the reference pixels, which may include:
[0106] Determining a pixel position to be selected based on positions and / or color component intensities of pixels in a neighboring area;
[0107] According to the position of the pixel to be selected, a reference pixel is determined from pixels in an adjacent area.
[0108] It should be noted that, in the embodiment of the present application, the color component intensity can be represented by color component information, such as reference luminance information, reference chrominance information, etc. Here, the larger the value of the color component information, the higher the color component intensity. In this way, the pixels in the adjacent area are screened, which can be based on the pixel position or the color component intensity, so as to determine the reference pixel of the current block based on the screened pixels, and further determine the value of the first color component sampling point in the adjacent area of the current block and the value of the second color component sampling point in the adjacent area of the current block; then, the reference value of the first color component of the current block is determined based on the value of the first color component sampling point in the adjacent area of the current block, and the reference value of the second color component of the current block is determined based on the value of the second color component sampling point in the adjacent area of the current block.
[0109] In some embodiments, determining the reference 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 may include: performing a first filtering process on the value of the first color component sampling point in the adjacent area of the current block to determine the reference value of the first color component of the current block.
[0110] In an embodiment of the present application, the first filtering process is a downsampling filtering process. Where the first color component is a luminance component, downsampling filtering can be performed on the reference luminance information 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 size of the current block is 2M×2N and the reference luminance information is 2M+2N, then after downsampling filtering, it can be converted to M+N to obtain the reference value of the first color component of the current block.
[0111] In some embodiments, determining the reference 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 may include: performing a second filtering process on the value of the second color component sampling point in the adjacent area of the current block to determine the reference value of the second color component of the current block.
[0112] In the embodiment of the present application, the second filtering process is an upsampling filtering process, wherein the upsampling rate is a positive integer multiple of 2.
[0113] That is, the first color component is the luminance component, and the second color component is the 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, it may be converted to 2M+2N to obtain the reference value of the second color component of the current block.
[0114] S502: Determine a weighting coefficient according to a reference value of a first color component of a current block.
[0115] It should be noted that, in this embodiment of the present application, the reference information of the current block may also include the reconstructed value of the first color component sampling point in the current block. Assuming that the first color component is the luminance component, the reconstructed value of the first color component sampling point in the current block is the reconstructed luminance information of the current block.
[0116] In some embodiments, determining the weighting coefficient according to the reference value of the first color component of the current block may include:
[0117] Determine a reconstructed value of a first color component sampling point in the current block;
[0118] Determine a reference sample value of the first color component of the current block according to a reconstructed value of a first color component sampling point in the current block and a reference value of the first color component of the current block;
[0119] A weighting coefficient is determined according to a reference sample value of the first color component of the current block.
[0120] In a possible embodiment, determining the reference sample value of the first color component of the current block according to the reconstructed value of the first color component sampling point in the current block and the reference value of the first color component of the current block may include:
[0121] Determine a difference between a reconstructed value of a first color component sampling point in a current block and a reference value of the first color component of the current block;
[0122] A reference sample value of the first color component of the current block is determined according to the difference.
[0123] In an embodiment of the present application, the reference sample value of the first color component of the current block can be set equal to the absolute value of the difference. Furthermore, the reference sample value of the first color component of the current block can be determined based on the difference. Alternatively, the difference can be squared, or the difference can be subjected to some correlation processing and mapping, etc., to determine the reference sample value of the first color component of the current block. This is not limited to any particular embodiment.
[0124] In another possible embodiment, determining the reference sample value of the first color component of the current block according to the reconstructed value of the first color component sampling point in the current block and the reference value of the first color component of the current block may include:
[0125] Performing a third filtering process on the reconstructed value of the first color component sampling point in the current block to obtain a filtered sample value of the first color component sampling point in the current block;
[0126] The reference sample value of the first color component of the current block is determined according to the filtered sample value of the first color component sampling point in the current block and the reference value of the first color component of the current block.
[0127] In the embodiment of the present application, the third filtering process is a downsampling filtering process. Where the first color component is a luminance component, downsampling filtering can 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 can be transformed to M×N.
[0128] In an embodiment of the present application, the reference sample value of the first color component of the current block is determined based on the filtered sample value of the first color component sampling point in the current block and the reference value of the first color component of the current block. The reference sample value of the first color component of the current block can be determined based on the difference between the filtered sample value of the first color component sampling point in the current block and the reference value of the first color component of the current block; more specifically, the reference sample value of the first color component of the current block can be determined based on the absolute value of the difference between the filtered sample value of the first color component sampling point in the current block and the reference value of the first color component of the current block. No limitation is made here.
[0129] It is understandable that after determining the reference sample value of the first color component of the current block, the embodiment of the present application can further determine the weighting coefficient. The reference sample value of the first color component of the current block can be the absolute value of the difference between the reconstructed value of the first color component sampling point in the current block and the reference value of the first color component of the current block.
[0130] In a possible implementation, assuming that the first color component is a chrominance component and the second color component is a 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 chrominance 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, w k =f(|ΔC k |). Where |Δ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 |).
[0131] In another possible implementation, assuming that the first color component is the luminance component and the second color component is the chrominance component, at this time, at least one pixel to be predicted in the current block can be selected, and the luminance difference between its reconstructed luminance and the reference luminance in the adjacent area can be 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. Thus, when calculating the weighting coefficient, the reference sample value of the first color component can also be |ΔY k |, according to w k =f(|ΔY k |) can also calculate the weighting coefficient.
[0132] 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 The product of | and the model factor can be obtained as |ΔC k |; Thus, the product value is equal to the model factor and |ΔY k 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 model factor described in the embodiment of the present application.
[0133] Furthermore, with respect to the model 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 model factor.
[0134] 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 model factor. For example, the least squares regression calculation is as follows:
[0135]
[0136] 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 model factor, which can be calculated using least squares regression. It should be noted that the model factor can also be a fixed value or fine-tuned based on a fixed value, etc., and this embodiment of the application does not specifically limit this.
[0137] In another possible embodiment, the reference sample value of the first color component of the current block may be the absolute value of the difference between the luminance reconstruction information (recY) in the current block and the reference luminance information (refY) of inSize. pred [i][j], and its corresponding brightness difference vector diffY[i][j][k] can be obtained by subtracting its corresponding brightness reconstruction information recY[i][j] from the reference brightness information refY[k] of inSize quantity and taking the absolute value; that is, in this embodiment of the present application, the reference sample value of the first color component of the current block can be represented by diffY[i][j][k].
[0138] Further, in some embodiments, determining the weighting coefficient based on the reference sample value of the first color component of the current block may include: determining the weight index value based on the reference sample value of the first color component of the current block; and determining the weighting coefficient based on the weight index value using a first preset mapping relationship.
[0139] In a specific embodiment, determining the weight index value according to the reference sample value of the first color component of the current block may include:
[0140] Determine the maximum weight index value and the minimum weight index value of the current block;
[0141] The reference sample value of the first color component is corrected according to the maximum weight index value and the minimum weight index value to determine the weight index value.
[0142] It should be noted that in the embodiment of the present application, the maximum weight index value can be represented by theMaxPos, the minimum weight index value can be represented by zero, and the weight index value is represented by index. Here, the weight index value is limited between theMaxPos and zero. Exemplarily, the weight index value can be calculated according to the following formula, as shown below:
[0143] index=Clip3(0,theMaxPos,diffY[i][j][k]) (2)
[0144] Where k = 0, 1, ..., inSize-1, That is, in formula (2), if diffY[i][j][k]<0, then index=0; if diffY[i][j][k]>theMaxPos, then index=theMaxPos; otherwise, if 0≤diffY[i][j][k]≤theMaxPos, then index=diffY[i][j][k].
[0145] In a specific embodiment, the maximum weight index value may be related to the bit depth (expressed as BitDepth) of the color component. For example, the maximum weight index value may be calculated according to the following formula, as shown below:
[0146] theMaxPos=1<<BitDepth-1 (3)
[0147] It should be noted that, in the embodiment of the present application, the value of theMaxPos includes but is not limited to that calculated according to formula (3), and it can also be determined in the core parameters of WCP.
[0148] Furthermore, for the first preset mapping relationship, in some embodiments, the first preset mapping relationship is a numerical mapping lookup table of weight index values and weighting coefficients. That is, in an embodiment of the present application, the decoding end may be pre-set with a corresponding lookup table (LUT). Through the lookup table, the corresponding weighting coefficient can be determined in combination with the index. Exemplarily, the weighting coefficient cWeightInt[i][j][k] can be represented by the following mapping relationship:
[0149] cWeightInt[i][j][k]=LUT[index] (4)
[0150] In some embodiments, the first preset mapping relationship may also be a preset function relationship. In some embodiments, determining a weighting coefficient based on a weight index value using the first preset mapping relationship may include: determining a first value corresponding to the weight index value under the first preset mapping relationship; and setting the weighting coefficient equal to the first value.
[0151] In a specific embodiment, determining the first value corresponding to the weight index value under the first preset mapping relationship may include:
[0152] Determine the first factor;
[0153] Determine a second value using a second preset mapping relationship according to the weight index value;
[0154] Calculate a first product value of the first factor and the second value;
[0155] The first value is set to be equal to the value corresponding to the first product value under the first preset mapping relationship.
[0156] It should be noted that, in the embodiment of the present application, the first factor can be represented by ModelScale, and the weight index value can be represented by index. For example, the weight coefficient cWeightInt[i][j][k] can also be represented by the following functional relationship:
[0157] cWeightInt[i][j][k]=Round(e -index ×ModelScale) (5)
[0158] Here, the second preset mapping relationship may be an exponential function relationship based on n, for example, e -n ; Among them, the value of n is equal to the weight index value, that is, n = 0, 1, ..., theMaxPos. Thus, when the value of n is equal to index, then the second value is equal to e -index , the first product value is equal to e -index ×ModelScale. In addition, the first preset mapping relationship can be set to Round(x); then when x is equal to the first product value, the value of Round(x) is the first value, that is, the weighting coefficient cWeightInt[i][j][k].
[0159] It should also be noted that, in the embodiment of the present application, the first preset mapping relationship can be expressed as follows:
[0160] Round(x)=Sign(x)×Floor(Abs(x)+0.5) (6)
[0161] in, Floor(x) represents the largest integer less than or equal to x.
[0162] Furthermore, for the first factor, in some embodiments, the first factor may be a preset constant value. In other words, the first factor may be a preset constant that is independent of the block size parameter.
[0163] For the first factor, in some embodiments, the value of the first factor may also be related to the block size parameter. In a specific embodiment, determining the first factor may include: determining the value of the first factor based on the 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. That is, the embodiment of the present application may adopt a classification method to fix the value of the first factor. For example, the size parameter of the current block is 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 may also pre-store a lookup table mapping the size parameter 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.
[0164] For example, W represents the width of the current block, and H represents the height of the current block; if the size parameter of the current block meets the first preset condition, that is, Min(W,H)<=4, then the value of the first factor is set to the first value; if the size parameter of the current block meets the second preset condition, that is, Min(W,H)>4&&Min(W,H)<=16, then the value of the first factor is set to the second value; if the size parameter of the current block meets the third preset condition, that is, Min(W,H)>16, then the value of the first factor is set to the third value. Simply put, in the embodiment of the present application, the first factor can be a preset constant, or it can be determined based on the size parameter of the current block, or even determined in other ways (for example, based on the BitDepth of the color component, etc.), and no limitation is made here.
[0165] Further, in some embodiments, determining the weight index value based on the reference sample value of the first color component of the current block may include: determining a second factor; and determining the weight index value based on the reference sample value of the first color component of the current block and the second factor.
[0166] It should be noted that, in the embodiments of the present application, under certain conditions, the weighting coefficients can also be adjusted based on the control parameters in the core parameters of the WCP. Here, the second factor is the control parameter (also referred to as the "scale parameter," "scale factor," etc.) described in this embodiment, and is represented by S. For example, if the size of the current block is highly flexible, the weighting coefficients can be adjusted based on the second factor. For example, using a nonlinear function (such as the Softmax function) as an example, different second factors can be selected to adjust the function based on the block classification category to which the current block belongs, so that the weighting coefficients are determined based on the adjusted function.
[0167] It should also be noted that, for the second factor, in some embodiments, the second factor can be a preset constant value. That is, in this case, for S, the weighted coefficient distribution of the adjacent chromaticity can be adjusted according to the relatively flat characteristic of the chromaticity, so as to capture the weighted coefficient distribution suitable for the chromaticity prediction of natural images. In order to determine the parameter S suitable for the chromaticity prediction of natural images, the given S set is traversed, and the suitability of S is measured by the difference between the predicted chromaticity and the original chromaticity under different S. For example, S can be taken as 2-ε, where ε∈{1,0,-1,-2,-3}; It has been found through experiments that in this S set, the best value of S is 4. Therefore, in a specific embodiment, S can be set to 4, but the embodiment of the present application does not make a specific limitation.
[0168] It should also be noted that, in some embodiments, the value of the second factor may also be related to a block size parameter. In a specific embodiment, determining the second factor may include: determining the value of the second 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 and the height of the current block.
[0169] In a possible implementation, determining the value of the second factor according to the size parameter of the current block may include:
[0170] If the minimum value of the height and width of the current block is less than or equal to 4, the second factor is determined to be 8;
[0171] If the minimum value of the height and width of the current block is greater than 4 and less than or equal to 16, the second factor is determined to be 12;
[0172] If the minimum value of the height and width of the current block is greater than 16, the second factor is determined to be 16.
[0173] It should be noted that embodiments of the present application can use a classification method to fix the value of the second factor. For example, the size parameters of the current block can be divided into three categories, and the value of the second factor corresponding to each category can be determined. In this case, embodiments of the present application can also pre-store a lookup table mapping the size parameters of the current block to the values of the second factor, and then determine the value of the second factor based on this lookup table. For example, Table 1 shows a corresponding relationship between the second factor and the size parameters of the current block provided in an embodiment of the present application.
[0174] Table 1
[0175] The second factor of the size parameter of the current block Min(W,H)<=48Min(W,H)>4&&Min(W,H)<=1612Min(W,H)>1616
[0176] In another possible implementation, when adjusting the weight coefficient, the correspondence between the second factor and the size parameter of the current block can also be fine-tuned. Table 2 shows another correspondence between the second factor and the size parameter of the current block provided in an embodiment of the present application.
[0177] Table 2
[0178] The second factor of the size parameter of the current block Min(W,H)<=48Min(W,H)>4&&Min(W,H)<1612Min(W,H)>=1616
[0179] In another possible implementation, when adjusting the weight coefficient, the value of the second factor may be fine-tuned. In some embodiments, determining the value of the second factor based on the size parameter of the current block may include:
[0180] If the minimum value of the height and width of the current block is less than or equal to 4, the second factor is determined to be 7;
[0181] If the minimum value of the height and width of the current block is greater than 4 and less than or equal to 16, the second factor is determined to be 11;
[0182] If the minimum value of the height and width of the current block is greater than 16, the second factor is determined to be 15.
[0183] That is, by fine-tuning the value of the second factor described above, Table 3 shows a correspondence between another second factor provided in an embodiment of the present application and the size parameter of the current block.
[0184] Table 3
[0185] The second factor of the size parameter of the current block Min(W,H)<=47Min(W,H)>4&&Min(W,H)<=1611Min(W,H)>1615
[0186] It should also be noted that, in this embodiment of the present application, the size parameters of the current block are divided into three categories, and different size parameters can also be indicated by a block type index value (represented by wcpSizeId). In another possible implementation, determining the value of the second factor based on the size parameter of the current block can include: determining the value of the second factor based on the block type index value.
[0187] For example, if the block type index value is equal to 0, it indicates that the current block has Min(W, H) <= 4; if the block type index value is equal to 1, it indicates that the current block has Min(W, H) > 4 and Min(W, H) <= 16; if the block type index value is equal to 2, it indicates that the current block has Min(W, H) > 16. In this case, Table 4 shows a correspondence between a second factor and a block type index value provided in an embodiment of the present application.
[0188] Table 4
[0189] Block type index value second factor 08
[0190] 112216
[0191] For example, if the block type index value is equal to 0, it indicates that the current block has Min(W, H) < 128; if the block type index value is equal to 1, it indicates that the current block has Min(W, H) >= 128 && Min(W, H) <= 256; if the block type index value is equal to 2, it indicates that the current block has Min(W, H) > 256. In this case, Table 5 shows another correspondence between the second factor and the block type index value provided in an embodiment of the present application.
[0192] Table 5
[0193] Block type index value second factor 0101821
[0194] For example, if the block type index value is equal to 0, it indicates that the current block has Min(W, H) < 64; if the block type index value is equal to 1, it indicates that the current block has Min(W, H) >= 64 && Min(W, H) <= 512; if the block type index value is equal to 2, it indicates that the current block has Min(W, H) > 512. In this case, Table 6 shows another correspondence between the second factor and the block type index value provided in an embodiment of the present application.
[0195] Table 6
[0196] Block type index value second factor 0161421
[0197] It should also be noted that, in some embodiments, the second factor can also be classified according to the number of reference pixels in the current block. In another specific embodiment, determining the second factor may include: determining a value of the second factor according to the number of reference pixels in the current block; where N represents the number of reference pixels.
[0198] In a possible implementation, determining the value of the second factor according to the number of reference pixels of the current block may include:
[0199] If the value of N is less than 16, the second factor is determined to be 8;
[0200] If the value of N is greater than or equal to 16 and less than 32, the second factor is determined to be 12;
[0201] If the value of N is greater than or equal to 32, the second factor is determined to be 16.
[0202] That is, classification is performed according to the number of reference pixels of the current block. Table 7 shows a corresponding relationship between a second factor and the number of reference pixels provided in an embodiment of the present application.
[0203] Table 7
[0204] The second factor of the number of reference pixels N<168N>=16&&N<3212N>=3216
[0205] It should be noted that whether it is Table 1, Table 2, Table 3, or Table 4, Table 5, Table 6, Table 7, etc., this is only an exemplary lookup table and is not specifically limited in the embodiments of the present application.
[0206] Furthermore, in some embodiments, determining the weight index value according to the reference sample value of the first color component of the current block and the second factor may include:
[0207] Determine a third value using a third preset mapping relationship according to the reference sample value of the first color component and the second factor;
[0208] Determine the maximum weight index value and the minimum weight index value of the current block;
[0209] The third value is corrected according to the maximum weight index value and the minimum weight index value to determine the weight index value.
[0210] It should be noted that in the embodiment of the present application, the maximum weight index value can be represented by theMaxPos, the minimum weight index value can be represented by zero, and the weight index value is represented by index. Here, the weight index value is limited between theMaxPos and zero, and the third value is f(S,diffY[i][j][k]). Exemplarily, the weight index value can be calculated according to the following formula, as shown below:
[0211] index=Clip3(0,theMaxPos,f(S,diffY[i][j][k])) (7)
[0212] Where k = 0, 1, ..., inSize-1, That is, in formula (7), if f(S,diffY[i][j][k])<0, then index=0; if f(S,diffY[i][j]]k])>theMaxPos, then index=theMaxPos; otherwise, if 0≤f(S,diffY[i][j][k])≤theMaxPos, then index=f(S,diffY[i][j][k]). Here, the value of theMaxPos can be calculated according to the above formula (3) or determined by the core parameters of the WCP, and there is no limitation on this.
[0213] It should also be noted that, for the third preset mapping relationship, f() refers to a function of the second factor S and the brightness difference vector diffY[i][j][k]. In one possible implementation, f(S, diffY[i][j][k]) can be implemented by the following formula, as shown below:
[0214] f(S,diffY[i][j][k])=diffY[i][j][k] (8)
[0215] In another possible implementation, f(S, diffY[i][j][k]) may be implemented by the following operations. In some embodiments, determining the third value using a third preset mapping relationship based on the reference sample value of the first color component and the second factor may include:
[0216] Determine at least one shift array;
[0217] determining a target offset from at least one shift array based on a second factor;
[0218] A right shift operation of the target offset is performed on the reference sample value of the first color component to determine a third value.
[0219] Here, since different second factors S can use their own LUTs [S], the embodiment of the present application only stores a few basic LUTs. For example, when S = {2, 4, 8}, only the LUT when S = 2 is stored; for other second factors S, they can be obtained through shift operations. In this case, f(S, diffY[i][j][k]) can be implemented by the following formula, as shown below:
[0220] f(S,diffY[i][j][k])=diffY[i][j][k]>>LUTshift[S] (9)
[0221] Among them, the shift array LUTshift[S] is defined as follows:
[0222]
[0223] In an embodiment of the present application, if the second factor is equal to 2, then the target offset is equal to 0; if the second factor is equal to 4, then the target offset is equal to 1; if the second factor is equal to 8, then the target offset is equal to 2; then the reference sample value of the first color component is right-shifted by the target offset to determine the third value.
[0224] In addition, it should be noted that for f(S, diffY[i][j][k]), its implementation is not limited to formula (8) or formula (9), and can also be other implementation methods, and the embodiments of the present application do not impose any limitations.
[0225] Furthermore, in some embodiments, determining the weighting coefficient using the first preset mapping relationship according to the weight index value may include:
[0226] Determining a second product value according to the second factor and the weight index value;
[0227] Determine a fourth value corresponding to the second product value under the first preset mapping relationship, and set the weighting coefficient to be equal to the fourth value.
[0228] In a specific embodiment, determining the fourth value corresponding to the second product value under the first preset mapping relationship may include:
[0229] Determine the first factor;
[0230] Determine a fifth value using a second preset mapping relationship according to the second product value;
[0231] Calculate a third product value of the first factor and the fifth value;
[0232] The fourth value is set to be equal to the value corresponding to the third product value under the first preset mapping relationship.
[0233] It should be noted that, in the embodiment of the present application, the first factor can be represented by ModelScale, the second factor can be represented by S, and the weight index value can be represented by index.
[0234] For the first preset mapping relationship, in some embodiments, the first preset mapping relationship is a numerical mapping lookup table of the second factor, the weight index value and the weighting coefficient. That is, in an embodiment of the present application, the decoding end can be pre-set with a corresponding lookup table (LUT). Through the lookup table, the corresponding weighting coefficient can be determined in combination with the index. Exemplarily, the weighting coefficient cWeightInt[i][j][k] can be represented by the following mapping relationship:
[0235] cWeightInt[i][j][k]=LUT[S][index] (11)
[0236] For the first preset mapping relationship, in some embodiments, the first preset mapping relationship may also be a preset function relationship, the input of the function is index and S, and the output is a weighting coefficient. For example, the weighting coefficient cWeightInt[i][j][k] may also be represented by the following function relationship:
[0237]
[0238] Here, the second preset mapping relationship may still be an exponential function relationship based on n, for example Among them, the value of n is equal to the weight index value, that is, n = 0, 1, ..., theMaxPos. Thus, when the value of n is equal to index, then the fifth value is equal to The third product value is equal to In addition, the first preset mapping relationship can be set to Round(x), as shown in the above formula (6); then when x is equal to the third product value, the value of Round(x) is the fourth value, that is, the weighting coefficient cWeightInt[i][j][k].
[0239] In short, the embodiment of the present application uses LUT to determine the weighting coefficient cWeightInt[i][j][k]. Among them, the number of elements contained in LUT is theMaxPos, as shown in formula (3), theMaxPos is related to the bit depth of brightness or chrominance; as shown in formula (4) and formula (11), the values of the elements in LUT are all constant values. It can be implemented and stored in the decoder, or it can be calculated before encoding or decoding; as shown in (5) or formula (12), it can be said that it is determined based on an exponential function relationship with an exponent of n; as shown in formula (4) and formula (11), the index parameter of LUT is determined based on diffY[i][j][k], and LUT stores cWeightInt[i][j][k] corresponding to different index parameters.
[0240] S503: Determine a reference mean value of the second color component of the current block according to the reference value of the second color component of the current block; and determine a reference sample value of the second color component of the current block according to the reference value of the second color component of the current block and the reference mean value of the second color component of the current block.
[0241] It should be noted that in the embodiment of the present application, the number of input reference pixels based on weighted prediction can be represented by N or inSize. Here, the number of input reference pixels based on weighted prediction is the same as the number of reference samples of the second color component, or in other words, N represents the number of reference samples of the second color component, and N is a positive integer.
[0242] In some embodiments, determining the reference mean of the second color component of the current block based on the reference value of the second color component of the current block may include: calculating the average value of the reference values of the second color components of N current blocks to obtain the reference mean of the second color component of the current block.
[0243] It should also be noted that, in the embodiment of the present application, the reference value of the second color component of the current block can be represented by refC[k], and the reference average value of the second color component of the current block can be represented by avgC, where k = 0, 1, ..., N-1. avgC is calculated as follows:
[0244]
[0245] Regarding the value of N, in some embodiments, the method may further include: determining a block type index value based on a size parameter of the current block; and determining the value of N using a fifth preset mapping relationship based on the block type index value.
[0246] In a specific embodiment, the fifth preset mapping relationship represents a lookup table mapping block type index values to N values.
[0247] It should be noted that in the embodiment of the present application, the block type index value can be represented by wcpSizeId. For different block type index values, the number of input reference pixels based on weighted prediction will also be different; that is, the value of N or (inSize) will be different.
[0248] Exemplarily, if the current block has Min(W,H)<=4, the block type index value is determined to be equal to 0; if the current block has Min(W,H)>4&&Min(W,H)<=16, the block type index value is determined to be equal to 1; if the current block has Min(W,H)>16, the block type index value is determined to be equal to 2; or, if the current block has Min(W,H)<128, the block type index value is determined to be equal to 0; if the current block has Min(W,H)>=128&&Min(W,H)<=256, the block type index value is determined to be equal to 1; if the current block has Min(W,H)>256, the block type index value is determined to be equal to 2; there is no limitation on this.
[0249] In a possible implementation, Table 8 shows the correspondence between a block type index value and the value of N(inSize) provided in an embodiment of the present application.
[0250] Table 8
[0251] Block type index value N(inSize)02×H+2×W12×H+2×W22×H+2×W
[0252] In another possible implementation, Table 9 shows the correspondence between another block type index value and the value of N(inSize) provided in an embodiment of the present application.
[0253] Table 9
[0254] Block type index value N(inSize)02×H+2×W11.5×H+1.5×W2H+W
[0255] Furthermore, for the reference sample value of the second color component of the current block, in some embodiments, determining the reference sample value of the second color component of the current block according to the reference value of the second color component of the current block and a reference average value of the second color component of the current block may include:
[0256] A subtraction calculation is performed on the reference value of the second color component of the current block and the reference mean value of the second color component of the current block to obtain a reference sample value of the second color component of the current block.
[0257] In the embodiment of the present application, the average value avgC of N reference chromaticity information refC is calculated, and then the reference chromaticity difference vector diffC is obtained by subtracting the average value avgC from the N reference chromaticity information refC. Specifically, diffC is calculated as follows:
[0258] diffC[k]=refC[k]-avgC (14)
[0259] Where k = 0, 1,…, N-1.
[0260] S504: Determine a predicted value of a sampling point of the second color component in the current block according to a reference mean value of the second color component of the current block, a reference sample value of the second color component of the current block, and a corresponding weighting coefficient.
[0261] S505: Determine a reconstructed value of the second color component sampling point in the current block according to the predicted value of the second color component sampling point in the current block.
[0262] It should be noted that after determining the reference mean avgC of the second color component of the current block, the reference sample value diffC[k] of the second color component of the current block and the corresponding weighting coefficient cWeightInt[i][j][k], the predicted value of the second color component sampling point in the current block can be further determined.
[0263] In some embodiments, determining the predicted value of the second color component sampling point in the current block based on the reference mean value of the second color component of the current block, the reference sample value of the second color component of the current block, and the corresponding weighting coefficient may include:
[0264] Determining a weighted value of a reference sample value of a second color component and a corresponding weighting coefficient;
[0265] Setting the weighted sum of the pixels to be predicted in the current block to be equal to the sum of N weighted values, and setting the coefficient sum of the pixels to be predicted in the current block to be equal to the sum of N weighted coefficients; wherein N represents the number of reference samples of the second color component, and N is a positive integer;
[0266] Determine a sixth value using a fourth preset mapping relationship according to the weighted sum and the coefficient sum;
[0267] Adding the reference mean value of the second color component and the sixth value to obtain a predicted value of the second color component of the pixel to be predicted in the current block;
[0268] The predicted value of the second color component sampling point in the current block is determined according to the predicted value of the second color component of the pixel to be predicted in the current block.
[0269] It should 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 weighted value of each reference sample of the second color component and the corresponding weighting coefficient (i.e., subC[i][j][k]) is first determined, and then these N weighted values are added together to obtain the weighted sum value of the pixel to be predicted in the current block, which can be represented by calVal. Specifically, the calculation formula is as follows:
[0270] subC[i][j][k]=(cWeightInt[i][j][k]×diffC[k]) (15)
[0271]
[0272] Here, (i, j) represents the position information of the pixel to be predicted in the current block, k represents the reference sample value of the kth second color component used in the WCP calculation process, and k=0,...,N-1.
[0273] It should also be noted that in the embodiment of the present application, for the N weighting coefficients corresponding to the pixels to be predicted in the current block, these N weighting coefficients can be added to obtain the coefficient sum value of the pixels to be predicted in the current block, which can be expressed as sum. Specifically, the calculation formula is as follows:
[0274]
[0275] Furthermore, in some embodiments, determining the sixth value using the fourth preset mapping relationship according to the weighted sum value and the coefficient sum value may include:
[0276] Determine the preset offset;
[0277] Determine a first value using a sixth preset mapping relationship based on the coefficient and the value; determine an array index value using a seventh preset mapping relationship based on the coefficient and the value and the first value, and determine a second value using an eighth preset mapping relationship based on the array index value and the preset offset;
[0278] In the case that the array index value is equal to zero, determining a third value according to the first value; and determining the first offset according to the third value and a preset offset;
[0279] determining a fourth product value according to the second value and the weighted sum value, determining a preset addition value according to the third value and a preset offset, and performing an addition operation on the fourth product value and the preset addition value to obtain a target sum value;
[0280] A right shift operation is performed on the target sum value by the first offset to determine the sixth value.
[0281] It should be noted that in the embodiments of the present application, the preset offset can be represented by Shift, the array index value can be represented by normDiff, the first value can be represented by x, the second value can be represented by v, the third value can be represented by y, and the preset addition value can be represented by add. In a specific embodiment, the value of Shift can be set to 5, but this is not a specific limitation.
[0282] It should also be noted that, in the embodiment of the present application, for the calculation of the first value, the sixth preset mapping relationship can be expressed by the following formula:
[0283] x=Floor(Log2(sum)) (18)
[0284] In one possible implementation, the calculation of the first numerical value may include, according to a direct mathematical description: determining a logarithmic value with base 2 of the coefficient and value; determining a maximum integer value that is less than or equal to the logarithmic value; the maximum integer value determined here is the first numerical value.
[0285] In another possible implementation, the calculation of the first value may be described according to the calculation result and may include setting the first value equal to the number of bits of binary symbols required for the binary representation of the coefficient and the value minus one.
[0286] In another possible implementation, the calculation of the first numerical value is described according to a possible integer implementation method (textual description), which may include: performing a binary right shift operation on the coefficient and the value, determining the number of right shift bits when the value after right shift is exactly equal to zero; and setting the first numerical value to be equal to the number of right shift bits minus one.
[0287] In another possible implementation, the calculation of the first value is described according to a possible integer implementation (pseudo-code description), as shown in formula (18), and may include:
[0288] x=0
[0289] while(sum!=0){
[0290] sum=sum>>1;
[0291] x++;
[0292] }
[0293] x=x-1
[0294] Equivalently, the pseudocode can also be described as follows:
[0295] x=0
[0296] while(sum>1){
[0297] sum=sum>>1;
[0298] x++;
[0299] }
[0300] Alternatively, the pseudocode can be described as follows:
[0301] x=0
[0302] while(sum!=1){
[0303] sum=sum>>1;
[0304] x++;
[0305] }
[0306] It should be noted that in the pseudocode description, the symbols involved in the embodiments of the present application are understood according to the C language.
[0307] In some embodiments, determining the array index value based on the coefficient sum value and the first numerical value using the seventh preset mapping relationship may include: using the coefficient sum value and the first numerical value as inputs of the preset functional relationship, and outputting the array index value according to the preset functional relationship.
[0308] In the embodiment of the present application, the calculation of the array index value can be expressed as follows:
[0309] normDiff=Func(sum,x) (19)
[0310] Where sum represents the coefficient sum, x represents the first value, and normDiff represents the array index value. Here, Func() is a function related to Shift. For example, a specific form of Func() is as follows:
[0311] Func(sum,x)=(sum<<(Shift+1)>>x)&(1<<(Shift+1)-1) (20)
[0312] Correspondingly, when Shift=5, normDiff=((sum<<5)>>x)&31.
[0313] In some embodiments, determining the second value using the eighth preset mapping relationship according to the array index value and the preset offset may include:
[0314] According to the array index value, determine the index indication value in the array mapping table;
[0315] The second value is determined using an eighth preset mapping relationship according to the index indication value and the preset offset.
[0316] It should be noted that in the embodiment of the present application, the array mapping table is represented by DivSigTable, so the index indication value corresponding to the array index value normDiff in DivSigTable is DivSigTable[normDiff]. For example, based on DivSigTable[normDiff] and Shift, the eighth preset mapping relationship is shown as follows:
[0317] v=DivSigTable[normDiff]|(1<<Shift) (21)
[0318] Correspondingly, when Shift=5, v=DivSigTable[normDiff]|32. Here, the “|” operator represents a bitwise OR operation, that is, v is obtained by performing a bitwise OR operation on DivSigTable[normDiff] and 32.
[0319] In some embodiments, determining the third value based on the first value when the array index value is equal to zero may include:
[0320] If the array index value is equal to zero, then set the third array equal to the first value;
[0321] If the array index value is not equal to zero, the third array is set equal to the sum of the first value and one.
[0322] It should be noted that, in the embodiment of the present application, the first value is represented by x, and the third value is represented by y. For example, it can be represented by the following formula:
[0323]
[0324] Here, the "==" operator represents an equal operation, and the "!=" operator represents a not equal operation.
[0325] It should also be noted that, in the embodiment of the present application, the preset addition value is determined according to the third value and the preset offset, and its calculation formula is as follows:
[0326] add=1<<y<<(Shift-1) (23)
[0327] It should also be noted that in the embodiments of the present application, the first offset is determined by a third value and a preset offset. Exemplarily, the first offset is obtained by performing an addition operation on the third value and the preset offset, that is, the first offset can be y + Shift.
[0328] Thus, assuming that the sixth value is represented by C, then for the sixth value, it can be represented by the following formula:
[0329]
[0330] Here, the "<<" operator represents a left shift operation, and the ">>" operator represents a right shift operation.
[0331] Furthermore, for the determination of the predicted value of the second color component of the pixel to be predicted in the current block, assuming that the pixel to be predicted is (i, j), the predicted value of the second color component of the pixel to be predicted in the current block is represented by C pred [i][j]. At this time, by performing an addition calculation on the reference mean of the second color component and the sixth value, the predicted value of the second color component of the pixel to be predicted in the current block can be obtained. The calculation formula is as follows:
[0332]
[0333] Furthermore, in the embodiments of the present application, for C pred [i][j], it is usually also necessary to limit it within a preset range. Therefore, in some embodiments, the method may further include: performing a correction operation on the predicted value of the second color component of the pixel to be predicted, and using the corrected predicted value as the predicted value of the second color component of the pixel to be predicted in the current block.
[0334] It should be noted that in the embodiments of the present application, the preset range may be: between 0 and (1 << BitDepth) - 1; where BitDepth is the bit depth required for the chrominance component. If the predicted value exceeds the value within this preset range, then the predicted value needs to be corrected accordingly. Exemplarily, a clamping operation can be performed on C pred [i][j], specifically as follows:
[0335] When the value of C pred [i][j] is less than 0, set it to 0;
[0336] When the value of C pred [i][j] is greater than or equal to 0 and less than or equal to (1 << BitDepth) - 1, it is equal to C pred [i][j];
[0337] When the value of C predWhen the value of [i][j] is greater than (1<<BitDepth)-1, it is set to (1<<BitDepth)-1.
[0338] In this way, after the prediction value is corrected, it can be ensured that the prediction values of the second color components of the pixels to be predicted in the current block are all between 0 and (1<<BitDepth)-1.
[0339] Furthermore, after the prediction value is determined, a post-processing operation is required under certain conditions to be used as the final chrominance prediction value. Therefore, in some embodiments, determining the prediction value of the second color component sampling point in the current block according to the prediction value of the second color component of the pixel to be predicted in the current block may include:
[0340] Performing a filtering process on the prediction value of the second color component of the pixel to be predicted to determine the prediction value of the second color component sampling point in the current block.
[0341] In the embodiments of the present application, the prediction value of the second color component of the pixel to be predicted includes the prediction values of at least some of the second color component sampling points in the current block. In other words, according to the first prediction block composed of the prediction values of the second color component of the pixel to be predicted, the first prediction block includes the prediction values of at least some of the second color component sampling points in the current block.
[0342] It should be noted that in the embodiments of the present application, if the first prediction block includes the prediction values of some of the second color component sampling points in the current block, at this time, upsampling filtering needs to be performed on the first prediction block to obtain the final second prediction block. Therefore, in some embodiments, the method may further include: performing upsampling filtering on the first prediction block to determine the second prediction block of the second color component of the current block.
[0343] It should also be noted that in the embodiments of the present application, if the number of prediction values of the second color component included in the first prediction block is the same as the number of second color component sampling points included in the current block, but does not include the prediction values of the second color component sampling points of the current block, at this time, filtering is required to enhance the prediction value to obtain the final second prediction block. Therefore, in some embodiments, the method may further include: performing filtering enhancement on the first prediction block to determine the second prediction block of the second color component of the current block.
[0344] It should also be noted that in the embodiments of the present application, if the first prediction block includes the prediction values of all the second color component sampling points in the current block, at this time, no processing needs to be performed on the first prediction block, and the first prediction block can be directly used as the final second prediction block.
[0345] That is, the first prediction block may include predicted values of at least some of the second color component sampling points in the current block. If the first prediction block includes predicted values of all of the second color component sampling points in the current block, the predicted values of the second color component sampling points in the current block may be set equal to the values of the first prediction block. If the first prediction block includes predicted values of some of the second color component sampling points in the current block, upsampling filtering may be performed on the values of the first prediction block, and the predicted values of the second color component sampling points in the current block may be set equal to the output values after the upsampling filtering.
[0346] Thus, after the above operations, the second prediction block includes the predicted values of all second color component sampling points in the current block. Thus, the weighted chroma prediction output predWcp may require post-processing under certain conditions before it can be used as the final chroma prediction value predSamples. Otherwise, the final chroma prediction value predSamples is predWcp.
[0347] In some embodiments, after determining the predicted value of the second color component sampling point in the current block, determining the reconstructed value of the second color component sampling point in the current block based on the predicted value of the second color component sampling point in the current block may include:
[0348] Determining a predicted difference value of a second color component sampling point in the current block;
[0349] Determine a reconstructed value of the second color component sampling point in the current block according to the predicted difference value of the second color component sampling point in the current block and the predicted value of the second color component sampling point in the current block.
[0350] In a specific embodiment, determining the reconstructed value of the second color component sampling point in the current block includes: adding the predicted difference value of the second color component sampling point in the current block and the predicted value of the second color component sampling point in the current block to determine the reconstructed value of the second color component sampling point in the current block.
[0351] It should also be noted that, in the embodiment of the present application, determining the predicted residual of the second color component sampling point in the current block may be performed by parsing the bitstream to determine the predicted residual of the second color component sampling point in the current block.
[0352] In this way, taking the chroma component as an example, the chroma prediction difference value of the current block is determined by parsing the code stream; after determining the chroma prediction value of the current block, the chroma prediction value and the chroma prediction difference value are added to obtain the chroma reconstruction value of the current block.
[0353] As can be understood, the embodiments of this application optimize floating-point operations during the WCP prediction process, implementing them using integer operations. On one hand, this fully leverages the content characteristics of the current block to adaptively select the optimal integer operation displacement; on the other hand, it fully ensures the accuracy of the WCP prediction technology. Furthermore, it fully considers the characteristics of the weight model and rationally designs the integer operation process. This reduces the computational complexity of the WCP prediction technology while maintaining a certain level of accuracy.
[0354] This embodiment provides a decoding method, which includes determining a reference value of a first color component of a current block and a reference value of a second color component of the current block; determining a weighting coefficient based on the reference value of the first color component of the current block; determining a reference mean value of the second color component of the current block based on the reference value of the second color component of the current block; determining a reference sample value of the second color component of the current block based on the reference value of the second color component of the current block and the reference mean value of the second color component of the current block; determining a predicted value of a sampling point of the second color component in the current block based on the reference mean value of the second color component of the current block, the reference sample value of the second color component of the current block, and the corresponding weighting coefficient; and determining a reconstructed value of the sampling point of the second color component in the current block based on the predicted value of the sampling point of the second color component in the current block. In this way, based on the color component reference information in the adjacent areas of the current block and the color component reconstruction information in the current block, it is necessary not only to construct a luminance difference vector in order to determine the weighting coefficient; but also to determine the chromaticity average value based on the chromaticity reference information, and then determine the chromaticity difference vector based on the chromaticity reference information and the chromaticity average value, and then determine the chromaticity prediction value based on the chromaticity difference vector and the corresponding weighting coefficient, plus the chromaticity average value; in this way, by optimizing the calculation process of weight-based chromaticity prediction, it is possible to fully adopt integer operations, and fully consider the characteristics of the weight model, and reasonably optimize the integer operation process; while fully ensuring the accuracy of chromaticity prediction, it is also possible to reduce computational complexity, improve encoding and decoding efficiency, and thus improve encoding and decoding performance.
[0355] In another embodiment of the present application, based on the decoding method described in the aforementioned embodiment, taking the chroma prediction of the current block as an example, when the chroma prediction of the current block is performed, 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, the embodiment of the present application proposes a weighted chroma prediction technology that utilizes the above information, and all operations in the implementation process of this technology use integer operations. The technical solution of the embodiment of the present application mainly proposes: using integer operations instead of floating-point operations. Here, the detailed steps of the chroma prediction process of the WCP prediction technology are as follows:
[0356] 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.
[0357] 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.
[0358] The prediction process of the WCP prediction technology may include steps such as determining WCP core parameters, obtaining input information, weight-based chrominance prediction, and post-processing. After these steps, the chrominance prediction value of the current block may be obtained.
[0359] In a specific embodiment, referring to FIG7 , a flowchart of another decoding method provided by an embodiment of the present application is shown. As shown in FIG7 , the method may include:
[0360] S701: Determine WCP core parameters.
[0361] It should be noted that, for S701 , the core parameters involved in the WCP are determined, that is, the WCP core parameters can be obtained or inferred through configuration or in some way, for example, the WCP core parameters are obtained from the bitstream at the decoding end.
[0362] Here, the WCP core parameters include but are not limited to the control parameter (S), the number of weighted chroma prediction inputs (inSize), the number of weighted chroma prediction outputs (arranged as predSizeW×predSizeH), the weight model LUT, and the maximum weight index value theMaxPos of the weight model LUT. Among them, 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 (such as predSizeW=predSizeH=S / 4) or related to the size parameter of the current block (such as predSizeW=nTbW, predSizeH=nTbH). Among them, the control parameter (S) can be used to adjust the nonlinear function in the subsequent link or to adjust the data involved in the subsequent link. Here, the weight model LUT can be predefined or calculated in real time according to different WCP control parameters (S); the maximum weight index value theMaxPos of the weight model LUT can be adjusted according to different weight model LUTs or fixed.
[0363] The determination of WCP core parameters is affected by block size, block content, or the number of pixels in a block under certain conditions. For example:
[0364] The current block can be classified according to its block size, block content, or number of pixels within the block, and the same or different core parameters can be determined for different categories. That is, the control parameter (S) or the number of weighted chroma prediction inputs inSize or the number of weighted chroma prediction outputs (arranged as predSizeW×predSizeH) corresponding to different categories can be the same or different. Note that predSizeW and predSizeH can also be the same or different.
[0365] If WCP is applied to a wide variety of block sizes, or if there is a significant difference between block sizes, or if there is a significant difference in block content, or if there is a significant difference in the number of pixels within a block, the current block can be classified based on its block size, block content, or number of pixels within the block, and the same or different core parameters can be determined for different categories. That is, the control parameter (S), or the number of weighted chroma prediction inputs (inSize), or the number of weighted chroma prediction outputs (arranged as predSizeW × predSizeH), corresponding to different categories can be the same or different. Note that predSizeW and predSizeH can also be the same or different.
[0366] To better illustrate the determination of core parameters, two simple classifications are used as examples:
[0367] Classification Example 1: WCP can classify the current block based on its width and height, using wcpSizeId to represent the block type, also known as the block type index. For different block types, 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:
[0368] 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 the block type wcpSizeId is defined as follows:
[0369] wcpSizeId=0: indicates the current block with min(nTbW,nTbH)<=4. The control parameter (S) is 8, inSize is (2×nTbH+2×nTbW), and the weighted chroma prediction outputs nTbH×nTbW chroma prediction values.
[0370] 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;
[0371] 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;
[0372] The quantitative relationships of the above WCP core parameters are presented in tabular form as shown in Table 10.
[0373] Table 10
[0374] wcpSizeId Sin Size predSizeH predSizeW 0 8 2×nTbH + 2×nTbW nTbH nTbW 1 12 2×nTbH + 2×nTbW nTbH nTbW 2 16 2×nTbH + 2×nTbW nTbH nTbW
[0375] It can also be illustrated with another example by dividing it into 3 categories:
[0376] The current block is divided into 3 categories according to the width and height of the current block. The control parameter (S) for different categories can be set differently, and the inSize and the number of outputs of the weighted chrominance prediction (arranged as predSizeW × predSizeH) for different categories can be set 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:
[0377] 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;
[0378] wcpSizeId = 1: Represents 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 weighted chrominance prediction outputs nTbH / 2 × nTbW / 2 chrominance prediction values;
[0379] wcpSizeId=2: indicates the current block with min(nTbW,nTbH)>16. Here, the WCP control parameter (S) is 16, inSize is (nTbH+nTbW), and the weighted chroma prediction outputs nTbH / 4×nTbW / 4 chroma prediction values;
[0380] The quantitative relationship of the above core parameters is expressed in tabular form, as shown in Table 11.
[0381] Table 11
[0382] wcpSizeIdSinSizepredSizeHpredSizeW082×nTbH+2×nTbWnTbHnTbW1121.5×nTbH+1.5×nTbWnTbH / 2nTbW / 2216nTbH+nTbWnTbH / 4nTbW / 4
[0383] Classification Example 2: WCP mode can also classify the current block according to the number of pixels in the current block, 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 a classification into three categories:
[0384] The current block is divided into three categories based on the number of pixels in the current block. The control parameter (S) of different categories can be set to different. 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:
[0385] 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.
[0386] 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.
[0387] 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.
[0388] The quantitative relationship of the above core parameters is expressed in tabular form, as shown in Table 12.
[0389] Table 12
[0390] wcpSizeIdSinSizepredSizeHpredSizeW0102×nTbH+2×nTbWnTbHnTbW182×nTbH+2×nTbWnTbHnTbW212×nTbH+2×nTbWnTbHnTbW
[0391] The three categories can also be explained with another example:
[0392] The current block is divided into three categories based on the number of pixels in the current block. The control parameter (S) can be set differently for different categories, and the inSize and the number of weighted chroma prediction outputs (arranged as predSizeW × predSizeH) can be set to the same for different categories. 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:
[0393] 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.
[0394] 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.
[0395] 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.
[0396] The quantitative relationship of the above core parameters is expressed in tabular form, as shown in Table 13.
[0397] Table 13
[0398] wcpSizeIdSinSizepredSizeHpredSizeW0162×nTbH+2×nTbWnTbHnTbW141.5×nTbH+1.5×nTbWnTbH / 2nTbW / 221nTbH+nTbWnTbH / 4nTbW / 4
[0399] It should also be noted that for Tables 11 and 13, predSizeW×predSizeH is obtained by weighted chrominance prediction calculation; however, when wcpSizeId=1, only part of the chrominance prediction value, namely nTbH / 2×nTbW / 2, is obtained by WCP calculation; when wcpSizeId=2, only part of the chrominance prediction value, namely nTbH / 4×nTbW / 4, is obtained by WCP calculation; then the remaining part of the chrominance prediction value is obtained by filtering the chrominance prediction value calculated according to WCP. The filtering processing here can be an interpolation filtering method, an upsampling filtering method, etc., and there is no limitation on this.
[0400] S702: Acquire input information according to WCP core parameters.
[0401] It should be noted that, for S702, the input information may include reference chrominance information (refC), reference luminance information (refY), and reconstructed luminance information (recY). In obtaining the input information, 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 FIG6 above, the pixels in the adjacent areas are all reconstructed reference pixels.
[0402] It should also be noted that reference chromaticity information refC and reference luminance information refY are obtained from adjacent regions. The reference chromaticity information obtained includes, but is not limited to, selecting a reference chromaticity reconstruction value for the region above the current block and / or a reference chromaticity reconstruction value for the region to the left. The reference luminance information obtained includes, but is not limited to, obtaining corresponding reference luminance information based on the position of the reference chromaticity information.
[0403] The reconstructed luminance information recY of the current block is obtained, and the obtaining method includes but is not limited to: obtaining 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.
[0404] Obtaining input information includes obtaining inSize amount of reference chroma information refC (if pre-processing is required, it is after pre-processing operation), obtaining inSize amount of reference luminance information refY (if pre-processing is required, it is after pre-processing operation) and obtaining luminance reconstruction information recY of the current prediction block (if pre-processing is required, it is after pre-processing operation).
[0405] S703: Perform weighted chrominance prediction calculation according to the input information to determine the chrominance prediction value of the current block.
[0406] It should be noted that, for S703, the chromaticity prediction value C within the size specified by the WCP core parameter is pred [i][j], where i = 0 ... predSizeW - 1 and j = 0 ... predSizeH - 1, are obtained one by one. Note that predSizeH and predSizeW are fixed WCP core parameters and can be the same as or different from the height nTbH or width nTbW of the current chroma block to be predicted. Under certain conditions, the following calculation can also be performed on only a portion of the pixels to be predicted within the current block.
[0407] The WCP chroma prediction calculation involves the following operations: preprocessing the reference chroma information, obtaining a weight vector, performing weighted prediction based on the weight vector to obtain a weighted chroma prediction value, and then correcting the weighted chroma prediction value. The reference information preprocessing process includes calculating the average value and constructing a reference chroma difference vector; the weight vector acquisition process includes constructing a luminance difference vector and calculating the weight vector.
[0408] The detailed calculation process is as follows:
[0409] Calculate the average value avgC of the reference chromaticity information
[0410] For k = 0, 1... inSize-1
[0411] Construct reference chroma difference vector diffC
[0412] For i=0…predSizeW-1, j=0…predSizeH-1
[0413] For k = 0, 1... inSize-1
[0414] Construct each element diffY[i][j][k] in the brightness difference vector
[0415] Calculate each element cWeightInt[i][j][k] in the weight vector, and then calculate the chrominance prediction value C by cWeightInt[i][j], diffC and avgC pred [i][j].
[0416] In a specific embodiment, referring to FIG8 , a flowchart of another decoding method provided by an embodiment of the present application is shown. As shown in FIG8 , the method may include:
[0417] S801: For the current block, calculate the chrominance average value using the obtained reference chrominance information, and construct a reference chrominance difference vector using the chrominance average value.
[0418] It should be noted that S801 mainly pre-processes the reference chromaticity information, wherein the average value avgC of the inSize number of reference chromaticity information refC is calculated, and the reference chromaticity difference vector diffC is obtained by subtracting the inSize number of reference chromaticity information refC from the average value avgC.
[0419]
[0420] diffC[k]=refC[k]-avgC (27)
[0421] S802: For each pixel to be predicted, construct a brightness difference vector using reference brightness information and brightness reconstruction information of the current block.
[0422] It should be noted that, for S802, the main purpose is to construct a brightness difference vector. pred [i][j], subtract the corresponding brightness reconstruction information recY[i][j] from the reference brightness information refY of inSize and take the absolute value to obtain the brightness difference vector diffY[i][j].
[0423] diffY[i][j][k]=Abs(refY[k]-recY[i][j]) (28)
[0424] Under certain conditions, the brightness difference vector of the pixel to be predicted can be processed linearly or nonlinearly. For example, the brightness difference vector of the pixel to be predicted can be scaled according to the WCP control parameter S in the WCP core parameter.
[0425] S803: For each pixel to be predicted, use the obtained brightness difference vector to determine a weight vector according to the weight model LUT.
[0426] It should be noted that, for S803, the main purpose is to calculate the weight vector. pred[i][j], the corresponding integer weight vector cWeightInt[i][j] can be obtained by processing the brightness difference vector diffY[i][j] corresponding to [i][j].
[0427] For example, in one possible implementation, a nonlinear Softmax function can be used as the weight model. The method for obtaining the weight model LUT includes but is not limited to the following methods:
[0428] theMaxPos=1<<BitDepth-1 (29)
[0429] Here, the value of theMaxPos includes but is not limited to that calculated according to formula (29), and it can be a parameter determined in the WCP core parameters.
[0430] For n=0,1…theMaxPos
[0431] LUT[n]=Round(e -n ×ModelScale) (30)
[0432] Here, the value of ModelScale includes but is not limited to the parameters determined by the WCP core parameters, which represents the magnification of the weight coefficient and is a preset constant.
[0433] For k = 0, 1... inSize-1
[0434] index=Clip3(0,theMaxPos,diffY[i][j][k]) (31)
[0435] cWeightInt[i][j][k]=LUT[index] (32)
[0436] For example, in another possible implementation, under certain conditions, the weight model may be adjusted according to the WCP control parameter (S) in the core parameters.
[0437] If the current block size is flexible, the weight model LUT can be adjusted according to the WCP 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 type category of the current block. The methods for obtaining the weight model LUT include but are not limited to the following methods:
[0438] The value of theMaxPos includes but is not limited to that calculated according to formula (29), which can be a parameter determined in the WCP core parameters and can be assigned different values for different WCP control parameters (S), i.e., theMaxPos[S].
[0439] For n=0,1…theMaxPos
[0440]
[0441] Here, the value of ModelScale includes but is not limited to the parameters determined by the WCP core parameters, which represents the magnification of the weight coefficient.
[0442] For k = 0, 1... inSize-1
[0443] index=Clip3(0,theMaxPos,f(S,diffY[i][j][k])) (34)
[0444] cWeightInt[i][j][k]=LUT[S][index] (35)
[0445] Wherein, f() refers to a function of the WCP control parameter S and the brightness difference diffY[i][j][k], and its output is the weight index value of the LUT. Here, f() includes but is not limited to the following examples:
[0446] f(S,diffY[i][j][k])=diffY[i][j][k] (36)
[0447] in,
[0448]
[0449]
[0450] Floor(x) represents the largest integer less than or equal to x;
[0451] Log2(x) represents the logarithm with base 2;
[0452]
[0453] Round(x)=Sign(x)×Floor(Abs(x)+0.5) (40)
[0454] S804: For each pixel to be predicted, calculate a chrominance prediction value using the product of the obtained reference chrominance difference vector and the obtained weight vector and the chrominance average value.
[0455] It should be noted that, for S804, the main purpose is to calculate the chrominance prediction value. The chrominance prediction value of the pixel to be predicted is calculated based on the integer weight vector cWeightInt[i][j] corresponding to each pixel to be predicted, the reference chrominance difference vector diffC, and the average value of the reference chrominance information. Specifically, the reference chrominance difference vector diffC is multiplied one by one with the weight vector element corresponding to each pixel to be predicted to obtain subC[i][j], the multiplication result is accumulated and divided by the sum of the integer weight vector cWeightInt[i][j] corresponding to each pixel to be predicted, and then the average value of the reference chrominance information is added to obtain the chrominance prediction value C of each pixel to be predicted. pred [i][j]. Here, the division operations involved in the embodiments of the present application all use right shift operations, and the specific process is as follows:
[0456] For k = 0, 1... inSize-1
[0457] subC[i][j][k]=(cWeightInt[i][j][k]×diffC[k]) (41)
[0458] For i=0…predSizeW-1, j=0…predSizeH-1
[0459]
[0460] in,
[0461]
[0462] v=DivSigTable[normDiff]|(1<<Shift) (44)
[0463]
[0464]
[0465] add=1<<y<<(Shift-1) (47)
[0466] Here, the method for obtaining Shift includes but is not limited to the parameters determined by WCP. In the decoding specification text, the value of Shift can be assigned to 5.
[0467] In addition, the calculation formula for x corresponds to x=Floor(Log2(sum)) in the decoding specification text.
[0468] The calculation formula for v corresponds to divSigTable[normDiff]|32 when Shift=5 in the decoding standard text.
[0469] The calculation formula for normDiff corresponds to the decoding standard text, corresponding to the decoding standard text, normDiff = ((sum<<5)>>x)&31 when Shift=5.
[0470] The calculation formula for y corresponds to x+=(normDiff!=0)?1:0 in the decoding standard text.
[0471] The calculation formula for add corresponds to the decoding specification text, where add = 1 < Shift = 5. <x<<4。
[0472] It should also be noted that in the embodiment of the present application, DivSigTable is a predefined array related to Shift, and DivSigTable corresponds to divSigTable[]={0,15,14,13,12,12,11,10,10,9,8,8,7,7,6,6,5,5,4,4,4,3,3,3,2,2,2,1,1,1,1,0} in the decoding specification text.
[0473] It should also be noted that, in the embodiment of the present application, Func() is a function related to Shift, the input is the sum of the weight vector and the calculated x, and the output is the array index value of DivSigTable[]. For example, a specific form of Func() can be expressed as:
[0474]
[0475] Among them, formula (48) corresponds to normDiff = ((sum<<5)>>x)&31 when Shift=5 in the decoding standard text.
[0476] S805: For each pixel to be predicted, correct the calculated chrominance prediction value to determine the chrominance prediction value of the current block.
[0477] It should be noted that, for S805, the main purpose is to correct the chrominance prediction value in the first prediction block predWcp. The chrominance prediction value in predWcp should be within a preset range. If it exceeds the preset range, then a corresponding correction operation needs to be performed. For example:
[0478] The chroma prediction value of C pred [i][j] can be clamped as follows:
[0479] ● When the value of C pred [i][j] is less than 0, set it to 0;
[0480] ● When the value of C pred [i][j] is greater than (1 << BitDepth) – 1, set it to (1 << BitDepth) – 1.
[0481] Here, BitDepth is the required bit depth of the chroma pixel value, so as to ensure that all chroma prediction values in predWcp are between 0 and (1 << BitDepth) – 1. That is, as shown in the following formula:
[0482] C pred [i][j] = Clip3(0, (1 << BitDepth) - 1, C pred [i][j]) (49)
[0483] S704: Perform post-processing operations on the chroma prediction value to determine the target chroma prediction value of the current block.
[0484] It should be noted that for S704, the weighted chroma prediction output predWcp needs to be post-processed as the final target chroma prediction value predSamples under certain conditions, otherwise the final target chroma prediction value predSamples is predWcp.
[0485] For example, in order to reduce the instability caused by the independent parallel prediction of WCP pixel by pixel, predWcp can be smoothed and filtered as the final chroma prediction value predSamples. Alternatively, in order to further improve the accuracy of the WCP prediction value, predWcp can be subjected to a position-related correction process. For example: a chroma compensation value is calculated for each pixel to be predicted using a reference pixel with a close spatial position, and the predWcp is corrected using this chroma compensation value, and the corrected prediction value is used as the final chroma prediction value predSamples. Alternatively, in order to further improve the accuracy of the WCP prediction value, the chroma prediction value calculated by other chroma prediction modes can be weighted and fused with the chroma prediction value predWcp calculated by WCP, and the fusion result can be used as the final chroma prediction value predSamples. For example: the chroma prediction value obtained by CCLM mode prediction and the chroma prediction value predWcp calculated by WCP can be weighted with equal weight or unequal weight, and the weighted result can be used as the final chroma prediction value predSamples. Alternatively, in order to improve the WCP prediction performance, a neural network model may be used to correct the WCP prediction output predWcp, etc., and the embodiments of the present application do not impose any limitation on this.
[0486] It is understandable that in the embodiment of the present application, the acquisition of the weight vector, including the LUT of the weight model with the WCP control parameter (S) and the derivation of the index still takes up a large storage space. Therefore, the embodiment of the present application can also modify the LUT of the weight model with the WCP control parameter (S), while keeping the other parts unchanged. The specific steps are as follows:
[0487] Under certain conditions, the weight model LUT can be adjusted according to the WCP control parameter (S) in the WCP core parameter. For example, if the size of the current block is flexible, the weight model can be adjusted according to the WCP control parameter (S). Taking the nonlinear Softmax function as an example, different control parameters can be selected to adjust the function according to the different block types to which the current prediction block belongs. The methods for obtaining the weight model LUT at this time include but are not limited to the following methods:
[0488] theMaxPos=1<<BitDepth-1 (50)
[0489] Here, the value of theMaxPos includes but is not limited to that calculated according to formula (50), which can be a parameter determined in the WCP core parameters and can be assigned different values for different WCP control parameters (S), that is, theMaxPos[S].
[0490] For n=0,1…theMaxPos
[0491]
[0492] Here, the value of ModelScale includes but is not limited to the parameters determined by the WCP core parameters, which represents the magnification of the weight coefficient.
[0493] Since different WCP control parameters (S) use their own LUTs [S], only a few basic LUTs can be stored here. For example, when S = {2, 4, 8}, only the LUT when S = 2 is stored. The code is as follows:
[0494] For k = 0, 1... inSize-1
[0495] index=Clip3(0,theMaxPos,f(S,diffY[i][j][k])) (52)
[0496] cWeightInt[i][j][k]=LUT[index] (53)
[0497] Wherein, f() refers to a function of the WCP control parameter (S) and the brightness difference vector diffY[i][j][k], and its output is the weight index value of the LUT. Here, f() includes but is not limited to the following examples:
[0498] f(S,diffY[i][j][k])=diffY[i][j][k]>>LUTshift[S] (54)
[0499] The definition of the array LUTshift in formula (54) is as follows:
[0500]
[0501] For example, when S = {8, 12, 16}, only the LUT when S = 12 is stored. The code is as follows:
[0502] For k = 0, 1... inSize-1
[0503] index=Clip3(0,theMaxPos,f(S,diffY[i][j][k])) (56)
[0504] cWeightInt[i][j][k]=LUT[index] (57)
[0505] Wherein, f() refers to a function of the WCP control parameter (S) and the brightness difference vector diffY[i][j][k], and its output is the weight index value of the LUT. Here, f() includes but is not limited to the following examples:
[0506] f(S,diffY[i][j][k])=diffY[i][j][k]+(wcpSizeId&1)×(diffY[i][j][k]>>1)-(wcpSizeId&2)×(diffY[i][j][k]>>2)+indexOffset (58)
[0507] It should also be noted that formula (58) corresponds to (baseDiffL+(blockIndex&1)*(baseDiffL>>1)-(blockIndex&2)*(baseDiffL>>2)+indexOffset[cnt]) in the decoding standard text.
[0508] The wcpSizeId in formula (58) is a variable that determines the WCP core parameters. In addition, the indexOffset is calculated as follows:
[0509] indexOffset=((wcpSizeId&1)-(wcpSizeId&2))×(diffY[i][j][k]&1) (59)
[0510] It should also be noted that formula (59) corresponds to indexOffset[cnt]=((blockIndex&1)–(blockIndex&2))*(baseDiffY[cnt]&1) in the decoding standard text.
[0511] In another specific embodiment, based on the decoding method described in the above embodiment, a specific description of a decoding standard text provided in the embodiment of the present application is as follows:
[0512] (1) Specification of INTRA_WCP intra prediction mode.
[0513] Inputs to this process include:
[0514] – The identifier of the intra prediction mode predModeIntra.
[0515] – The top left sample position of the current transform block is relative to the top left sample position of the current picture (xTbC, yTbC).
[0516] – The variable nTbW representing the transform block width.
[0517] – The variable nTbH representing the transform block height.
[0518] – The variable cIdx representing the color component of the current block.
[0519] – Adjacent chroma samples p[x][y], x=-1, y=-1...2*nTbH-1 and x=0...2*nTbW-1, y=-1.
[0520] The output of this process is the predicted samples predSamples[x][y], x=0…nTbW-1, y=0…nTbH-1.
[0521] The luminance position (xTbY, yTbY) corresponding to the current block is derived as follows:
[0522] (xTbY, yTbY) = (xTbC<<(SubWidthC-1), yTbC<<(SubHeightC-1))
[0523] The variables availL and availT are derived as follows:
[0524] – When the derivation process for neighbor block availability specified in section (2) is called, the luma position (xCurr, yCurr) of the current block is set equal to (xTbY, yTbY), the neighboring luma position (xTbY-1, yTbY), checkPredModeY is set to FALSE, cIdx is taken as input, and the output is assigned to availL.
[0525] – When the derivation process for neighbor block availability specified in section (2) is called, the luma position (xCurr, yCurr) of the current block is set equal to (xTbY, yTbY), the neighboring luma position (xTbY, yTbY-1), checkPredModeY is set to FALSE, cIdx is taken as input, and the output is assigned to availT.
[0526] The number of top-right adjacent chroma samples available, numTopRight, is as follows:
[0527] – The variable numTopRight is set to 0 and availTR is set to TRUE.
[0528] – When predModeIntra is equal to INTRA_WCP, the following applies for x=nTbW…2*nTbW-1 until availTR is equal to FALSE:
[0529] – When the derivation process for neighboring block availability specified in section (2) is called, the current luma position (xCurr, yCurr) is set equal to the (xTbY, yTbY) neighboring luma position (xTbY+x*SubWidthC, yTbY-1), checkPredModeY is set to FALSE, cIdx is taken as input, and the output is assigned to availTR.
[0530] – When availTR is equal to TRUE, numTopRight is increased by 1.
[0531] The number of available lower-left-neighboring chroma samples, numleftbellow, is as follows:
[0532] – The variable numleftbellow is set to 0 and availLB is set to TRUE.
[0533] – When predModeIntra is equal to INTRA_WCP, the following applies for y=nTbH…2*nTbH-1 until availB is equal to FALSE:
[0534] – When the derivation process for neighbor block availability specified in section (2) is called, the current luma position (xCurr, yCurr) is set equal to (xTbY, yTbY), the neighboring luma position (xTbY-1, yTbY+y*SubweightC), checkPredModeY is set to FALSE, cIdx is taken as input, and the output is assigned to AvailLB.
[0535] – When availLB is equal to TRUE, numLeftBelow will be increased by 1.
[0536] The number of available adjacent chroma samples numSampT above and to the upper right and the number of available adjacent chroma samples numSampL to the left and to the lower left are derived as follows:
[0537] – If predModeIntra is equal to INTRA_WCP, the following applies:
[0538] numSampT=availT? (nTbW+numTopRight):0
[0539] numSampL=availL? (nTbH+numLeftBelow):0
[0540] The number of all available adjacent chroma samples numSamp and the variable enableWcp are derived as follows:
[0541] – If predModeIntra is equal to INTRA_WCP, the following applies:
[0542] numSamp=numSampT+numSampL
[0543] enableWcp=numSamp? true:false
[0544] The derivation of the predicted samples predSamples[x][y] with x=0…nTbW-1, y=0…nTbH-1 is as follows:
[0545] – If enableWcp equals FALSE, the following applies:
[0546] predSamples[x][y]=1<<(BitDepth-1)
[0547] Otherwise, follow these steps in order:
[0548] 1. The luma sample pY[x][y] of x=0...nTbW*SubWidthC-1, y=0...nTbH*SubHeightC-1 is set equal to the reconstructed luma sample before the decoding filtering process at the position (xTbY+x, yTbY+y).
[0549] 2. The adjacent brightness samples pY[x][y] are derived as follows:
[0550] –When availL is equal to TRUE, the adjacent luma samples pY[x][y], x = -3…-1, y = (availT?-1:0)…SubHeightC*Max(nTbH,numSampL)-1, are set to the reconstructed luma samples before decoding filtering at position (xTbY+x, yTbY+y).
[0551] – When availT is equal to FALSE, the adjacent luma samples pY[x][y], x=-2..SubWidthC*nTbW-1, y=-2..-1, are set equal to the reconstructed luma sample pY[x][0].
[0552] –When availT is equal to TRUE, the adjacent luma samples pY[x][y], x = (availL?-1:0)…SubWidthC*Max(nTbW,numSampT)-1, y = -3…-1, are set equal to the reconstructed luma sample before decoding filtering at position (xTbY+x, yTbY+y).
[0553] – When avillL is equal to FALSE, the adjacent luma samples pY[x][y], x=-1, y=-2..SubHeightC*nTbH-1, are set equal to the reconstructed luma sample pY[0][y].
[0554] 3. The derivation of the downsampled co-located luminance samples pDsY[x][y], x=0..nTbW-1, y=0..nTbH-1 is as follows:
[0555] – If SubWidthC and SubHeightC are both equal to 1, then the following apply:
[0556] pDsY[x][y]=pY[x][y]
[0557] – Otherwise, if SubHeightC is equal to 1, the following applies:
[0558] pDsY[x][y]=(pY[SubWidthC*x-1][y]+2*pY[SubWidthC*x][y]+pY[SubWidthC*x+1][y]+2)>>2
[0559] – Otherwise (SubHeightC is not equal to 1), the following applies:
[0560] – If sps_chroma_vertical_collocated_flag is equal to 1, the following applies:
[0561] pDsY[x][y]=(pY[SubWidthC*x][SubHeightC*y-1]+
[0562] pY[SubWidthC*x-1][SubHeightC*y]+
[0563] 4*pY[SubWidthC*x][SubHeightC*y]+
[0564] pY[SubWidthC*x+1][SubHeightC*y]+
[0565] pY[SubWidthC*x][SubHeightC*y+1]+4)>>3
[0566] – Otherwise (sps_chroma_vertical_collocated_flag is equal to 0), the following applies:
[0567] pDsY[x][y]=(pY[SubWidthC*x-1][SubHeightC*y]+
[0568] pY[SubWidthC*x-1][SubHeightC*y+1]+
[0569] 2*pY[SubWidthC*x][SubHeightC*y]+
[0570] 2*pY[SubWidthC*x][SubHeightC*y+1]+
[0571] pY[SubWidthC*x+1][SubHeightC*y]+
[0572] pY[SubWidthC*x+1][SubHeightC*y+1]+4)>>3
[0573] 4. When numSampT is greater than 0, the adjacent upper chroma sample refC[idx] is set equal to p[idx][-1], where idx = 0 ... numSampT-1, and the downsampled adjacent upper luma sample refY[idx], idx = 0 ... numSampT-1 is defined as follows:
[0574] If SubWidthC and SubHeightC are both equal to 1, the following applies:
[0575] refY[idx]=pY[idx][-1]
[0576] Otherwise, the following applies:
[0577] If SubHeightC is not equal to 1 and bCTUboundary is equal to FALSE, the following applies:
[0578] If sps_chroma_vertical_collocated_flag is equal to 1, the following applies:
[0579] refY[idx]=(pY[SubWidthC*x][-3]+
[0580] pY[SubWidthC*x-1][-2]+
[0581] 4*pY[SubWidthC*x][-2]+
[0582] pY[SubWidthC*x+1][-2]+
[0583] pY[SubWidthC*x][-1]+4)>>3
[0584] Otherwise (sps_chroma_vertical_collocated_flag is equal to 0), the following applies:
[0585] refY[idx]=(pY[SubWidthC*x-1][-1]+
[0586] pY[SubWidthC*x-1][-2]+
[0587] 2*pY[SubWidthC*x][-1]+
[0588] 2*pY[SubWidthC*x][-2]+
[0589] pY[SubWidthC*x+1][-1]+
[0590] pY[SubWidthC*x+1][-2]+4)>>3
[0591] Otherwise (SubHeightC equals 1 or bCTUboundary equals TRUE), the following applies:
[0592] refY[idx]=(pY[SubWidthC*x-1][-1]+
[0593] 2*pY[SubWidthC*x][-1]+
[0594] pY[SubWidthC*x+1][-1]+2)>>2
[0595] 5. When numSampL is greater than 0, the adjacent left chroma sample refC[idx] is set equal to p[-1][idx-numSampT], where idx=numSampT...numSamp-1, and the downsampled adjacent left luma sample refY[idx], where idx=numSampT...numSamp-1 is derived as follows:
[0596] If SubWidthC and SubHeightC are both equal to 1, the following applies:
[0597] refY[idx]=pY[-1][y]
[0598] Otherwise, if SubHeightC is equal to 1, the following applies:
[0599] refY[idx]=(pY[-1-SubWidthC][y]+
[0600] 2*pY[-SubWidthC][y]+
[0601] pY[1-SubWidthC][y]+2)>>2
[0602] Otherwise, the following applies:
[0603] If sps_chroma_vertical_collocated_flag is equal to 1, the following applies:
[0604] refY[idx]=(pY[-SubWidthC][SubHeightC*y-1]+
[0605] pY[-1-SubWidthC][SubHeightC*y]+
[0606] 4*pY[-SubWidthC][SubHeightC*y]+
[0607] pY[1-SubWidthC][SubHeightC*y]+
[0608] pY[-SubWidthC][SubHeightC*y+1]+4)>>3
[0609] Otherwise (sps_chroma_vertical_collocated_flag is equal to 0), the following applies:
[0610] refY[idx]=(pY[-1-SubWidthC][SubHeightC*y]+
[0611] pY[-1-SubWidthC][SubHeightC*y+1]+
[0612] 2*pY[-SubWidthC][SubHeightC*y]+
[0613] 2*pY[-SubWidthC][SubHeightC*y+1]+
[0614] pY[1-SubWidthC][SubHeightC*y]+
[0615] pY[1-SubWidthC][SubHeightC*y+1]+4)>>3
[0616] 6. The variables avgC and chroma reference sample difference refDiffC[idx], where idx = 0..numSamp-1, are derived as follows:
[0617] RedNumSamp=1< <Floor(Log2(numSamp))
[0618] bDwn=numSamp / RedNumSamp
[0619]
[0620] refDiffC[idx]=refC[idx]-avgC
[0621] 7. Variables minBlockSize, blockIndex, the difference between the luminance reference sample and the reconstructed sample baseDiffY[cnt], where cnt = 0...numSamp–1; variable indexDiffY[cnt], where cnt = 0..numSamp–1; variable indexOffset[cnt], where cnt = 0...numSamp–1; variable LUTindex[cnt], where cnt = 0...numSamp–1; and the final predicted samples predSamples[x][y], where x = 0...nTbW-1, y = 0...nTbH–1 are derived as follows:
[0622] minBlockSize=Min(nTbW,nTbH)
[0623] –If minBlockSize is equal to 2 or 4, blockIndex is set to 0
[0624] –If minBlockSize is equal to 8 or 16, blockIndex is set to 1
[0625] –If minBlockSize is greater than 16, blockIndex is set to 2
[0626] baseDiffY[cnt]=Abs(refY[cnt]-predSamples[x][y])
[0627] indexOffset[cnt]=((blockIndex&1)–(blockIndex&2))*(baseDiffY[cnt]&1)
[0628] LUTindex[cnt]=Clip3(0,WCP_LUT_Max_Index,(baseDiffL+(blockIndex&1)*(baseDiffL>>1)-(blockIn dex&2)*(baseDiffL>>2)+indexOffset[cnt]))
[0629] Among them, WCP_LUT_Max_Index is equal to 49
[0630] 8. The variable numerator[cnt], where cnt = 0…numSamp–1; the variables sum and finalVal for the predicted samples predSamples[x][y], where x = 0…nTbW–1 and y = 0…nTbH–1 are derived as follows:
[0631] numerator[cnt]=WcpLUT[LUTindex[cnt]]
[0632] whereWcpLUT[i]={31,29,26,24,22,20,19,17,16,15,13,12,11,10,10,9,8, 8,7,6,6,5,5,5,4,4,4,3,3,3,3,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1}
[0633]
[0634]
[0635] x = Floor(Log2(sum))
[0636] normDiff=((sum<<5)>>x)&31
[0637] x+=(normDiff!=0)? 1:0
[0638] add=1< <x<<4
[0639] finalVal=(calVal*(divSigTable[normDiff]|32)+add)>>(x+5)+avgC
[0640] where divSigTable[]is specified as follows:
[0641] divSigTable[]={0,15,14,13,12,12,11,10,10,9,8,8,7,7,6,6,5,5,4,4,4,3,3,3,2,2,2,1,1,1,1,0}
[0642] 9. The predicted samples predSamples[x][y], where x = 0…nTbW-1 and y = 0…nTbH-1, are derived as follows:
[0643] predSamples[x][y]=Clip1(finalVal[x][y])
[0644] Clip1(x)=Clip3(0,(1< <BitDepth)-1,x)
[0645] (2) A specification of the derivation process for the availability of adjacent blocks.
[0646] Inputs to this process include:
[0647] – Luma position of the top left sample of the current block relative to the top left sample of the current picture (xCurr, yCurr).
[0648] – The luma position (xNbY, yNbY) of the neighboring block, which is relative to the luma sample at the top left of the current picture.
[0649] – The variable checkPredModeY is used to identify whether the availability depends on the prediction mode.
[0650] – The variable cIdx representing the color component of the current block.
[0651] The output of this process is the availability of neighboring blocks containing the position (xNbY, yNbY), denoted by availableN.
[0652] The availability availableN of the neighboring block availability is derived as follows:
[0653] – availableN is set to FALSE if one or more of the following conditions are TRUE:
[0654] –xNbY is less than 0;
[0655] –yNbY is less than 0;
[0656] –xNbY is greater than or equal to pps_pic_width_in_luma_samples;
[0657] –yNbY is greater than or equal to pps_pic_height_in_luma_samples;
[0658] – (xNbY>>CtbLog2SizeY) is greater than (xCurr>>CtbLog2SizeY) and (yNbY>>CtbLog2SizeY) is greater than or equal to (yCurr>>CtbLog2SizeY);
[0659] –(yNbY>>CtbLog2SizeY) is greater than or equal to (yCurr>>CtbLog2SizeY)+1;
[0660] –IsAvailable[cIdx][xNbY][yNbY] is equal to FALSE;
[0661] – The adjacent block is contained in a different slice than the current block;
[0662] – The adjacent block is contained in a different tile than the current block;
[0663] –sps_entropy_coding_sync_enabled_flag is equal to 1 and (xNbY>>CtbLog2SizeY) is greater than or equal to (xCurr>>CtbLog2SizeY)+1;
[0664] – Otherwise, availableN is set equal to TRUE.
[0665] availableN is set to FALSE when all of the following conditions are true:
[0666] –checkPredModeY is equal to TRUE;
[0667] – CuPredMode[0][xNbY][yNbY] is not equal to CuPredMode[0][xCurr][yCurr].
[0668] This embodiment provides a decoding method. The specific implementation of the aforementioned embodiment is described in detail through the above embodiment. According to the technical solution of the aforementioned embodiment, it can be seen that the optimization of floating-point operations in the WCP prediction process is implemented by integer operations. On the one hand, the content characteristics of the current block are fully utilized to adaptively select the optimal integer operation displacement. On the other hand, the accuracy of the WCP prediction technology is fully guaranteed. On the other hand, the characteristics of the weight model are fully considered and the integer operation process is reasonably designed. In other words, by optimizing the calculation process of the weighted chrominance prediction in the WCP prediction technology, this technical solution completely adopts integer operations, and can also adaptively select the optimal integer operation required for displacement, further reducing the computational complexity. Moreover, since the calculation method adopted by the WCP prediction technology is all integer operations, it is extremely friendly to hardware implementation. In this way, the computational complexity of the WCP prediction technology can be reduced while ensuring a certain accuracy of the WCP prediction technology, thereby improving the encoding and decoding performance.
[0669] In another embodiment of the present application, see Figure 9, which shows a schematic flow chart of an encoding method provided by an embodiment of the present application. As shown in Figure 9, the method may include:
[0670] S901: Determine a reference value of a first color component of a current block and a reference value of a second color component of the current block.
[0671] 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, an integer operation method of weighted chroma prediction (WCP).
[0672] 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.
[0673] 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 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.
[0674] Here, the upper adjacent area and the upper right adjacent area can be considered as the upper area, and the left adjacent area and the lower left adjacent area can be considered as the left area. In addition, the adjacent area can also include the upper left area, as shown in Figure 6. When predicting the second color component of the current block, the upper area, left area, and upper left area of the current block as adjacent areas can all be called reference areas of the current block, and the pixels in the reference areas are all reconstructed reference pixels.
[0675] In some embodiments, determining a reference value of a first color component of a current block and a reference value of a second color component of the current block may include:
[0676] Determining a reference value of the first color component of the current block according to the value of the first color component sampling point in the adjacent area of the current block;
[0677] A reference value of the second color component of the current block is determined according to the values of the second color component sampling points in the adjacent areas of the current block.
[0678] 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.
[0679] It should also be noted that, in the embodiment of the present application, it is assumed that the first color component is a luminance component and the second color component is a chrominance component; then, 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.
[0680] It should also be noted that, in the embodiment of the present application, the value of the first color component sampling point or the value of the second 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.
[0681] Furthermore, in some embodiments, determining the reference pixel of the current block may include: performing screening processing on pixels in an adjacent area of the current block to determine the reference pixel.
[0682] Specifically, in an embodiment of the present application, a first reference pixel set is formed based on pixels in an adjacent area of the current block. This first reference pixel set can then be screened to determine the reference pixels. Here, the number of reference pixels can be M, where M is a positive integer. In other words, M reference pixels can be selected from the pixels in the adjacent area. The value of M can generally be 4, but this is not a specific limitation.
[0683] It should also be noted that among the pixels in the adjacent area of the current block, there may be some unimportant pixels (for example, these pixels have poor correlation) or some abnormal pixels. In order to ensure the accuracy of the prediction, these pixels need to be eliminated to obtain valid reference pixels. Therefore, in a specific embodiment, the pixels in the adjacent area are screened to determine the reference pixels, which may include:
[0684] Determining a pixel position to be selected based on positions and / or color component intensities of pixels in a neighboring area;
[0685] According to the position of the pixel to be selected, a reference pixel is determined from pixels in an adjacent area.
[0686] It should be noted that, in the embodiment of the present application, the color component intensity can be represented by color component information, such as reference luminance information, reference chrominance information, etc. Here, the larger the value of the color component information, the higher the color component intensity. In this way, the pixels in the adjacent area are screened, which can be based on the pixel position or the color component intensity, so as to determine the reference pixel of the current block based on the screened pixels, and further determine the value of the first color component sampling point in the adjacent area of the current block and the value of the second color component sampling point in the adjacent area of the current block; then, the reference value of the first color component of the current block is determined based on the value of the first color component sampling point in the adjacent area of the current block, and the reference value of the second color component of the current block is determined based on the value of the second color component sampling point in the adjacent area of the current block.
[0687] In some embodiments, determining the reference 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 may include: performing a first filtering process on the value of the first color component sampling point in the adjacent area of the current block to determine the reference value of the first color component of the current block.
[0688] In an embodiment of the present application, the first filtering process is a downsampling filtering process. Where the first color component is a luminance component, downsampling filtering can be performed on the reference luminance information 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 size of the current block is 2M×2N and the reference luminance information is 2M+2N, then after downsampling filtering, it can be converted to M+N to obtain the reference value of the first color component of the current block.
[0689] In some embodiments, determining the reference 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 may include: performing a second filtering process on the value of the second color component sampling point in the adjacent area of the current block to determine the reference value of the second color component of the current block.
[0690] In the embodiment of the present application, the second filtering process is an upsampling filtering process, wherein the upsampling rate is a positive integer multiple of 2.
[0691] That is, the first color component is the luminance component, and the second color component is the 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, it may be converted to 2M+2N to obtain the reference value of the second color component of the current block.
[0692] S902: Determine a weighting coefficient according to a reference value of the first color component of the current block.
[0693] It should be noted that, in this embodiment of the present application, the reference information of the current block may also include the reconstructed value of the first color component sampling point in the current block. Assuming that the first color component is the luminance component, the reconstructed value of the first color component sampling point in the current block is the reconstructed luminance information of the current block.
[0694] In some embodiments, determining the weighting coefficient according to the reference value of the first color component of the current block may include:
[0695] Determine a reconstructed value of a first color component sampling point in the current block;
[0696] Determine a reference sample value of the first color component of the current block according to a reconstructed value of a first color component sampling point in the current block and a reference value of the first color component of the current block;
[0697] A weighting coefficient is determined according to a reference sample value of the first color component of the current block.
[0698] In a possible embodiment, determining the reference sample value of the first color component of the current block according to the reconstructed value of the first color component sampling point in the current block and the reference value of the first color component of the current block may include:
[0699] Determine a difference between a reconstructed value of a first color component sampling point in a current block and a reference value of the first color component of the current block;
[0700] A reference sample value of the first color component of the current block is determined according to the difference.
[0701] In an embodiment of the present application, the reference sample value of the first color component of the current block can be set equal to the absolute value of the difference. Furthermore, the reference sample value of the first color component of the current block can be determined based on the difference. Alternatively, the difference can be squared, or the difference can be subjected to some correlation processing and mapping, etc., to determine the reference sample value of the first color component of the current block. This is not limited to any particular embodiment.
[0702] In another possible embodiment, determining the reference sample value of the first color component of the current block according to the reconstructed value of the first color component sampling point in the current block and the reference value of the first color component of the current block may include:
[0703] Performing a third filtering process on the reconstructed value of the first color component sampling point in the current block to obtain a filtered sample value of the first color component sampling point in the current block;
[0704] The reference sample value of the first color component of the current block is determined according to the filtered sample value of the first color component sampling point in the current block and the reference value of the first color component of the current block.
[0705] In the embodiment of the present application, the third filtering process is a downsampling filtering process. Where the first color component is a luminance component, downsampling filtering can 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 can be transformed to M×N.
[0706] In an embodiment of the present application, the reference sample value of the first color component of the current block is determined based on the filtered sample value of the first color component sampling point in the current block and the reference value of the first color component of the current block. The reference sample value of the first color component of the current block can be determined based on the difference between the filtered sample value of the first color component sampling point in the current block and the reference value of the first color component of the current block; more specifically, the reference sample value of the first color component of the current block can be determined based on the absolute value of the difference between the filtered sample value of the first color component sampling point in the current block and the reference value of the first color component of the current block. No limitation is made here.
[0707] It is understandable that after determining the reference sample value of the first color component of the current block, the embodiment of the present application can further determine the weighting coefficient. The reference sample value of the first color component of the current block can be the absolute value of the difference between the reconstructed value of the first color component sampling point in the current block and the reference value of the first color component of the current block.
[0708] In the embodiment of the present application, the reference sample value of the first color component of the current block can be the absolute value of the difference between the luminance reconstruction information (recY) in the current block and the reference luminance information (refY) of inSize. pred [i][j], and its corresponding brightness difference vector diffY[i][j][k] can be obtained by subtracting its corresponding brightness reconstruction information recY[i][j] from the reference brightness information refY[k] of inSize quantity and taking the absolute value; that is, in this embodiment of the present application, the reference sample value of the first color component of the current block can be represented by diffY[i][j][k].
[0709] Further, in some embodiments, determining the weighting coefficient based on the reference sample value of the first color component of the current block may include: determining the weight index value based on the reference sample value of the first color component of the current block; and determining the weighting coefficient based on the weight index value using a first preset mapping relationship.
[0710] In a specific embodiment, determining the weight index value according to the reference sample value of the first color component of the current block may include:
[0711] Determine the maximum weight index value and the minimum weight index value of the current block;
[0712] The reference sample value of the first color component is corrected according to the maximum weight index value and the minimum weight index value to determine the weight index value.
[0713] It should be noted that, in the embodiment of the present application, the maximum weight index value can be represented by theMaxPos, the minimum weight index value can be represented by zero, and the weight index value is represented by index. Here, the weight index value is limited between theMaxPos and zero. Exemplarily, the weight index value can be calculated according to the following formula, as shown in the aforementioned formula (2).
[0714] Where k = 0, 1, ..., inSize-1, That is, in formula (2), if diffY[i][j][k]<0, then index=0; if diffY[i][j][k]>theMaxPos, then index=theMaxPos; otherwise, if 0≤diffY[i][j][k]≤theMaxPos, then index=diffY[i][j][k].
[0715] In a specific embodiment, the maximum weight index value may be related to the bit depth (expressed as BitDepth) of luminance or chrominance. For example, the maximum weight index value may be calculated according to the following formula, as shown in the aforementioned formula (3).
[0716] It should be noted that, in the embodiment of the present application, the value of theMaxPos includes but is not limited to that calculated according to formula (3), and it can also be determined in the core parameters of WCP.
[0717] Furthermore, for the first preset mapping relationship, in some embodiments, the first preset mapping relationship is a numerical mapping lookup table of weight index values and weighting coefficients. That is, in an embodiment of the present application, the decoding end may be pre-set with a corresponding lookup table (LUT). Through the lookup table, the corresponding weighting coefficient can be determined in combination with the index. Exemplarily, the weighting coefficient cWeightInt[i][j][k] can be represented by the following mapping relationship, as shown in the aforementioned formula (4).
[0718] In some embodiments, the first preset mapping relationship may also be a preset function relationship. In some embodiments, determining a weighting coefficient based on a weight index value using the first preset mapping relationship may include: determining a first value corresponding to the weight index value under the first preset mapping relationship; and setting the weighting coefficient equal to the first value.
[0719] In a specific embodiment, determining the first value corresponding to the weight index value under the first preset mapping relationship may include:
[0720] Determine the first factor;
[0721] Determine a second value using a second preset mapping relationship according to the weight index value;
[0722] Calculate a first product value of the first factor and the second value;
[0723] The first value is set to be equal to the value corresponding to the first product value under the first preset mapping relationship.
[0724] It should be noted that, in the embodiment of the present application, the first factor can be represented by ModelScale, and the weight index value is represented by index. For example, the weight coefficient cWeightInt[i][j][k] can also be represented by the following functional relationship, as shown in the aforementioned formula (5).
[0725] Here, the second preset mapping relationship may be an exponential function relationship based on n, for example, e -n ; Among them, the value of n is equal to the weight index value, that is, n = 0, 1, ..., theMaxPos. Thus, when the value of n is equal to index, then the second value is equal to e -index , the first product value is equal to e -index×ModelScale. In addition, the first preset mapping relationship can be set to Round(x); then when x is equal to the first product value, the value of Round(x) is the first value, that is, the weighting coefficient cWeightInt[i][j][k]. In addition, in the embodiment of the present application, the first preset mapping relationship can be as shown in the aforementioned formula (6).
[0726] Furthermore, for the first factor, in some embodiments, the first factor may be a preset constant value. In other words, the first factor may be a preset constant that is independent of the block size parameter.
[0727] For the first factor, in some embodiments, the value of the first factor may also be related to the block size parameter. In a specific embodiment, determining the first factor may include: determining the value of the first factor based on the 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. That is, the embodiment of the present application may adopt a classification method to fix the value of the first factor. For example, the size parameter of the current block is 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 may also pre-store a lookup table mapping the size parameter 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, if the size parameters of the current block meet the first preset condition, i.e., Min(W,H)<=4, the value of the first factor is set to the first value; if the size parameters of the current block meet the second preset condition, i.e., Min(W,H)>4&&Min(W,H)<=16, the value of the first factor is set to the second value; if the size parameters of the current block meet the third preset condition, i.e., Min(W,H)>16, the value of the first factor is set to the third value. Where W represents the width of the current block, and H represents the height of the current block.
[0728] Further, in some embodiments, determining the weight index value based on the reference sample value of the first color component of the current block may include: determining a second factor; and determining the weight index value based on the reference sample value of the first color component of the current block and the second factor.
[0729] It should be noted that, in the embodiments of the present application, under certain conditions, the weighting coefficients can also be adjusted based on the control parameters in the core parameters of the WCP. Here, the second factor is the control parameter (also referred to as the "scale parameter," "scale factor," etc.) described in this embodiment, and is represented by S. For example, if the size of the current block is highly flexible, the weighting coefficients can be adjusted based on the second factor. For example, using a nonlinear function (such as the Softmax function) as an example, different second factors can be selected to adjust the function based on the block classification category to which the current block belongs, so that the weighting coefficients are determined based on the adjusted function.
[0730] It should also be noted that, for the second factor, in some embodiments, the second factor can be a preset constant value. That is, in this case, for S, the weighted coefficient distribution of the adjacent chromaticity can be adjusted according to the relatively flat characteristic of the chromaticity, so as to capture the weighted coefficient distribution suitable for the chromaticity prediction of natural images. In order to determine the parameter S suitable for the chromaticity prediction of natural images, the given S set is traversed, and the suitability of S is measured by the difference between the predicted chromaticity and the original chromaticity under different S. For example, S can be taken as 2-ε, where ε∈{1,0,-1,-2,-3}; It has been found through experiments that in this S set, the best value of S is 4. Therefore, in a specific embodiment, S can be set to 4, but the embodiment of the present application does not make a specific limitation.
[0731] It should also be noted that, in some embodiments, the value of the second factor may also be related to a block size parameter. In a specific embodiment, determining the second factor may include: determining the value of the second 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 and the height of the current block.
[0732] In a possible implementation, determining the value of the second factor according to the size parameter of the current block may include:
[0733] If the minimum value of the height and width of the current block is less than or equal to 4, the second factor is determined to be 8;
[0734] If the minimum value of the height and width of the current block is greater than 4 and less than or equal to 16, the second factor is determined to be 12;
[0735] If the minimum value of the height and width of the current block is greater than 16, the second factor is determined to be 16.
[0736] It should be noted that embodiments of the present application can use a classification method to fix the value of the second factor. For example, the size parameters of the current block can be divided into three categories, and the value of the second factor corresponding to each category can be determined. In this case, embodiments of the present application can also pre-store a lookup table mapping the size parameters of the current block to the values of the second factor, and then determine the value of the second factor based on this lookup table. For example, the aforementioned Table 1 shows a correspondence between the second factor and the size parameters of the current block provided in an embodiment of the present application.
[0737] In another possible implementation, when adjusting the weight coefficient, the correspondence between the second factor and the size parameter of the current block can also be fine-tuned. Table 2 above shows another correspondence between the second factor and the size parameter of the current block provided in an embodiment of the present application.
[0738] In another possible implementation, when adjusting the weight coefficient, the value of the second factor may be fine-tuned. In some embodiments, determining the value of the second factor based on the size parameter of the current block may include:
[0739] If the minimum value of the height and width of the current block is less than or equal to 4, the second factor is determined to be 7;
[0740] If the minimum value of the height and width of the current block is greater than 4 and less than or equal to 16, the second factor is determined to be 11;
[0741] If the minimum value of the height and width of the current block is greater than 16, the second factor is determined to be 15.
[0742] That is, by fine-tuning the value of the second factor, the aforementioned Table 3 shows a correspondence between another second factor provided by an embodiment of the present application and the size parameter of the current block.
[0743] It should also be noted that, in this embodiment of the present application, the size parameters of the current block are divided into three categories, and different size parameters can also be indicated by a block type index value (represented by wcpSizeId). In another possible implementation, determining the value of the second factor based on the size parameter of the current block can include: determining the value of the second factor based on the block type index value.
[0744] For example, if the block type index value is equal to 0, it indicates that the current block has Min(W, H) <= 4; if the block type index value is equal to 1, it indicates that the current block has Min(W, H) > 4 and Min(W, H) <= 16; if the block type index value is equal to 2, it indicates that the current block has Min(W, H) > 16. In this case, the aforementioned Table 4 shows a correspondence between a second factor and a block type index value provided in an embodiment of the present application.
[0745] For example, if the block type index value is equal to 0, it indicates that the current block has Min(W, H) < 128; if the block type index value is equal to 1, it indicates that the current block has Min(W, H) >= 128 && Min(W, H) <= 256; if the block type index value is equal to 2, it indicates that the current block has Min(W, H) > 256. In this case, the aforementioned Table 5 shows the correspondence between another second factor and the block type index value provided in an embodiment of the present application.
[0746] For example, if the block type index value is equal to 0, it indicates that the current block has Min(W, H) < 64; if the block type index value is equal to 1, it indicates that the current block has Min(W, H) >= 64 && Min(W, H) <= 512; if the block type index value is equal to 2, it indicates that the current block has Min(W, H) > 512. In this case, the aforementioned Table 6 shows the correspondence between another second factor and the block type index value provided in an embodiment of the present application.
[0747] It should also be noted that, in some embodiments, the second factor can also be classified according to the number of reference pixels in the current block. In another specific embodiment, determining the second factor may include: determining a value of the second factor according to the number of reference pixels in the current block; where N represents the number of reference pixels.
[0748] In a possible implementation, determining the value of the second factor according to the number of reference pixels of the current block may include:
[0749] If the value of N is less than 16, the second factor is determined to be 8;
[0750] If the value of N is greater than or equal to 16 and less than 32, the second factor is determined to be 12;
[0751] If the value of N is greater than or equal to 32, the second factor is determined to be 16.
[0752] That is, classification is performed according to the number of reference pixels of the current block. The aforementioned Table 7 shows a corresponding relationship between a second factor and the number of reference pixels provided in an embodiment of the present application.
[0753] Furthermore, in some embodiments, determining the weight index value according to the reference sample value of the first color component of the current block and the second factor may include:
[0754] Determine a third value using a third preset mapping relationship according to the reference sample value of the first color component and the second factor;
[0755] Determine the maximum weight index value and the minimum weight index value of the current block;
[0756] The third value is corrected according to the maximum weight index value and the minimum weight index value to determine the weight index value.
[0757] It should be noted that, in the embodiment of the present application, the maximum weight index value can be represented by theMaxPos, the minimum weight index value can be represented by zero, and the weight index value is represented by index. Here, the weight index value is limited between theMaxPos and zero, and the third value is f(S,diffY[i][j][k]). Exemplarily, the weight index value can be calculated according to the following formula, as shown in the aforementioned formula (7).
[0758] Where k = 0, 1, ..., inSize-1, That is, in formula (7), if f(S,diffY[i][j][k])<0, then index=0; if f(S,diffY[i][j][k])>theMaxPos, then index=theMaxPos; otherwise, if 0≤f(S,diffY[i][j][k])≤theMaxPos, then index=f(S,diffY[i][j][k]). Here, the value of theMaxPos can be calculated according to the above formula (3) or determined by the core parameters of the WCP, and there is no limitation on this.
[0759] It should also be noted that, for the third preset mapping relationship, f() refers to a function of the second factor S and the brightness difference vector diffY[i][j][k]. In one possible implementation, f(S, diffY[i][j][k]) can be implemented by the following formula, as shown in the aforementioned formula (8).
[0760] In another possible implementation, f(S, diffY[i][j][k]) may be implemented by the following operations. In some embodiments, determining the third value using a third preset mapping relationship based on the reference sample value of the first color component and the second factor may include:
[0761] Determine at least one shift array;
[0762] determining a target offset from at least one shift array based on a second factor;
[0763] A right shift operation of the target offset is performed on the reference sample value of the first color component to determine a third value.
[0764] Here, since different second factors S can use their own LUTs [S], the embodiment of the present application only stores a few basic LUTs. For example, when S = {2, 4, 8}, only the LUT when S = 2 is stored; for other second factors S, they can be obtained through shift operations. In this case, f(S, diffY[i][j][k]) can be implemented by the following formula, as shown in the above formulas (9) and (10).
[0765] In an embodiment of the present application, if the second factor is equal to 2, then the target offset is equal to 0; if the second factor is equal to 4, then the target offset is equal to 1; if the second factor is equal to 8, then the target offset is equal to 2; then the reference sample value of the first color component is right-shifted by the target offset to determine the third value.
[0766] In addition, it should be noted that for f(S, diffY[i][j][k]), its implementation is not limited to formula (8) or formula (9), and can also be other implementation methods, and the embodiments of the present application do not impose any limitations.
[0767] Furthermore, in some embodiments, determining the weighting coefficient using the first preset mapping relationship according to the weight index value may include:
[0768] Determining a second product value according to the second factor and the weight index value;
[0769] Determine a fourth value corresponding to the second product value under the first preset mapping relationship, and set the weighting coefficient to be equal to the fourth value.
[0770] In a specific embodiment, determining the fourth value corresponding to the second product value under the first preset mapping relationship may include:
[0771] Determine the first factor;
[0772] Determine a fifth value using a second preset mapping relationship according to the second product value;
[0773] Calculate a third product value of the first factor and the fifth value;
[0774] The fourth value is set to be equal to the value corresponding to the third product value under the first preset mapping relationship.
[0775] It should be noted that, in the embodiment of the present application, the first factor can be represented by ModelScale, the second factor can be represented by S, and the weight index value can be represented by index.
[0776] For the first preset mapping relationship, in some embodiments, the first preset mapping relationship is a numerical mapping lookup table of the second factor, the weight index value and the weighting coefficient. That is, in an embodiment of the present application, the decoding end can be pre-set with a corresponding lookup table (LUT). Through the lookup table, the corresponding weighting coefficient can be determined in combination with the index. Exemplarily, the weighting coefficient cWeightInt[i][j][k] can be represented by the following mapping relationship as shown in the aforementioned formula (11).
[0777] For the first preset mapping relationship, in some embodiments, the first preset mapping relationship may also be a preset function relationship, where the input of the function is index and S, and the output is a weighting coefficient. For example, the weighting coefficient cWeightInt[i][j][k] may also be expressed using the following functional relationship as shown in the aforementioned formula (12).
[0778] Here, the second preset mapping relationship may still be an exponential function relationship based on n, for example Among them, the value of n is equal to the weight index value, that is, n = 0, 1, ..., theMaxPos. Thus, when the value of n is equal to index, then the fifth value is equal to The third product value is equal to In addition, the first preset mapping relationship can be set to Round(x), as shown in the above formula (6); then when x is equal to the third product value, the value of Round(x) is the fourth value, that is, the weighting coefficient cWeightInt[i][j][k].
[0779] S903: Determine a reference mean value of the second color component of the current block according to the reference value of the second color component of the current block; and determine a reference sample value of the second color component of the current block according to the reference value of the second color component of the current block and the reference mean value of the second color component of the current block.
[0780] It should be noted that in the embodiment of the present application, the number of input reference pixels based on weighted prediction can be represented by N or inSize. Here, the number of input reference pixels based on weighted prediction is the same as the number of reference samples of the second color component, or in other words, N represents the number of reference samples of the second color component, and N is a positive integer.
[0781] In some embodiments, determining the reference mean of the second color component of the current block based on the reference value of the second color component of the current block may include: calculating the average value of the reference values of the second color components of N current blocks to obtain the reference mean of the second color component of the current block.
[0782] It should also be noted that, in the embodiment of the present application, the reference value of the second color component of the current block can be represented by refC[k], the reference average value of the second color component of the current block can be represented by avgC, and the calculation of avgC is shown in the aforementioned formula (13).
[0783] Regarding the value of N, in some embodiments, the method may further include: determining a block type index value based on a size parameter of the current block; and determining the value of N using a fifth preset mapping relationship based on the block type index value.
[0784] In a specific embodiment, the fifth preset mapping relationship represents a lookup table mapping block type index values to N values.
[0785] It should be noted that in the embodiment of the present application, the block type index value can be represented by wcpSizeId. For different block type index values, the number of input reference pixels based on weighted prediction will also be different; that is, the value of N or (inSize) will be different.
[0786] For example, if Min(W,H)<=4 for the current block, the block type index value is determined to be 0; if Min(W,H)>4 &&Min(W,H)<=16 for the current block, the block type index value is determined to be 1; if Min(W,H)>16 for the current block, the block type index value is determined to be 2; or, if Min(W,H)<128 for the current block, the block type index value is determined to be 0; if Min(W,H)>=128 &&Min(W,H)<=256 for the current block, the block type index value is determined to be 1; if Min(W,H)>256 for the current block, the block type index value is determined to be 2; this is not limited in any way. For example, the aforementioned Tables 8 and 9 respectively show the corresponding relationship between the block type index value and the value of N(inSize).
[0787] Furthermore, for the reference sample value of the second color component of the current block, in some embodiments, determining the reference sample value of the second color component of the current block according to the reference value of the second color component of the current block and a reference average value of the second color component of the current block may include:
[0788] A subtraction calculation is performed on the reference value of the second color component of the current block and the reference mean value of the second color component of the current block to obtain a reference sample value of the second color component of the current block.
[0789] In the embodiment of the present application, the average value avgC of N reference chromaticity information refC is calculated, and then the reference chromaticity difference vector diffC is obtained by subtracting the average value avgC from the N reference chromaticity information refC. Specifically, the calculation of diffC is shown in the above formula (14).
[0790] S904: Determine a predicted value of a sampling point of the second color component in the current block according to a reference mean value of the second color component of the current block, a reference sample value of the second color component of the current block, and a corresponding weighting coefficient.
[0791] S905: Determine a prediction difference value of the second color component sampling point in the current block according to the prediction value of the second color component sampling point in the current block.
[0792] It should be noted that after determining the reference mean avgC of the second color component of the current block, the reference sample value diffC[k] of the second color component of the current block and the corresponding weighting coefficient cWeightInt[i][j][k], the predicted value of the second color component sampling point in the current block can be further determined.
[0793] In some embodiments, determining the predicted value of the second color component sampling point in the current block based on the reference mean value of the second color component of the current block, the reference sample value of the second color component of the current block, and the corresponding weighting coefficient may include:
[0794] Determining a weighted value of a reference sample value of a second color component and a corresponding weighting coefficient;
[0795] Setting the weighted sum of the pixels to be predicted in the current block to be equal to the sum of N weighted values, and setting the coefficient sum of the pixels to be predicted in the current block to be equal to the sum of N weighted coefficients; wherein N represents the number of reference samples of the second color component, and N is a positive integer;
[0796] Determine a sixth value using a fourth preset mapping relationship according to the weighted sum and the coefficient sum;
[0797] Adding the reference mean value of the second color component and the sixth value to obtain a predicted value of the second color component of the pixel to be predicted in the current block;
[0798] The predicted value of the second color component sampling point in the current block is determined according to the predicted value of the second color component of the pixel to be predicted in the current block.
[0799] It should be noted that in this embodiment of the present application, if the number of reference samples of the second color component is N, then the weighted value of each reference sample of the second color component and the corresponding weighting coefficient (i.e., subC[i][j][k]) is first determined, and then these N weighted values are added together to obtain the weighted sum value of the pixel to be predicted in the current block, which can be represented by calVal. Specifically, the calculation formula is as shown in the aforementioned equations (15) and (16).
[0800] It should also be noted that in the embodiment of the present application, the N weighting coefficients corresponding to the pixels to be predicted in the current block can be added together to obtain the coefficient sum of the pixels to be predicted in the current block, which can be expressed as sum. Specifically, the calculation formula is as shown in the aforementioned formula (17).
[0801] Furthermore, in some embodiments, determining the sixth value using the fourth preset mapping relationship according to the weighted sum value and the coefficient sum value may include:
[0802] Determine the preset offset;
[0803] Determine a first value using a sixth preset mapping relationship based on the coefficient and the value; determine an array index value using a seventh preset mapping relationship based on the coefficient and the value and the first value, and determine a second value using an eighth preset mapping relationship based on the array index value and the preset offset;
[0804] In the case that the array index value is equal to zero, determining a third value according to the first value; and determining the first offset according to the third value and a preset offset;
[0805] determining a fourth product value according to the second value and the weighted sum value, determining a preset addition value according to the third value and a preset offset, and performing an addition operation on the fourth product value and the preset addition value to obtain a target sum value;
[0806] A right shift operation is performed on the target sum value by the first offset to determine the sixth value.
[0807] It should be noted that in the embodiments of the present application, the preset offset can be represented by Shift, the array index value can be represented by normDiff, the first value can be represented by x, the second value can be represented by v, the third value can be represented by y, and the preset addition value can be represented by add. In a specific embodiment, the value of Shift can be set to 5, but this is not a specific limitation.
[0808] It should also be noted that, in the embodiment of the present application, for the calculation of the first value, the sixth preset mapping relationship can be as shown in the aforementioned formula (18).
[0809] Here, the calculation of the first numerical value can be: first determine the logarithmic value with base 2 of the coefficient and value, and then determine the maximum integer value less than or equal to the logarithmic value. The maximum integer value determined here is the first numerical value; or, it can also be: set the first numerical value to be equal to the number of binary symbols required for the binary representation of the coefficient and value minus one; or, it can also be: perform a binary right shift operation on the coefficient and value, determine the number of right shift bits when the right-shifted value is exactly equal to zero, and then set the first numerical value to be equal to the number of right shift bits minus one, and so on. The embodiments of the present application do not impose any restrictions.
[0810] In some embodiments, determining the array index value based on the coefficient sum value and the first numerical value using the seventh preset mapping relationship may include: using the coefficient sum value and the first numerical value as inputs of the preset functional relationship, and outputting the array index value according to the preset functional relationship.
[0811] In the embodiment of the present application, the calculation of the array index value can be shown in the aforementioned formula (19). Here, Func() is a function related to Shift, and the aforementioned formula (20) shows a specific form of Func().
[0812] In some embodiments, determining the second value using the eighth preset mapping relationship according to the array index value and the preset offset may include:
[0813] According to the array index value, determine the index indication value in the array mapping table;
[0814] The second value is determined using an eighth preset mapping relationship according to the index indication value and the preset offset.
[0815] It should be noted that, in the embodiment of the present application, the array mapping table is represented by DivSigTable, and the index indication value corresponding to the array index value normDiff in DivSigTable is DivSigTable[normDiff]. For example, according to DivSigTable[normDiff] and Shift, the eighth preset mapping relationship is shown in the aforementioned formula (21).
[0816] In some embodiments, determining the third value based on the first value when the array index value is equal to zero may include:
[0817] If the array index value is equal to zero, then set the third array equal to the first value;
[0818] If the array index value is not equal to zero, the third array is set equal to the sum of the first value and one.
[0819] It should be noted that in the embodiments of the present application, the first value is represented by x, and the third value is represented by y. Exemplarily, it can be represented by the aforementioned formula (22).
[0820] It should also be noted that in the embodiments of the present application, for the preset addition value, the preset addition value is determined according to the third value and the preset offset, and its calculation formula is as shown in the aforementioned formula (23).
[0821] It should also be noted that in the embodiments of the present application, the first offset is determined by the third value and the preset offset. Exemplarily, by performing an addition operation on the third value and the preset offset, the first offset can be obtained, that is, the first offset can be y + Shift.
[0822] Thus, assuming that the sixth value is represented by C, then for the sixth value, it can be represented by the aforementioned formula (24).
[0823] Further, for the determination of the predicted value of the second color component of the pixel to be predicted in the current block, assuming that the pixel to be predicted is (i, j), the predicted value of the second color component of the pixel to be predicted in the current block is represented by C pred [i][j]. At this time, by performing an addition calculation on the reference mean value of the second color component and the sixth value, the predicted value of the second color component of the pixel to be predicted in the current block can be obtained, and its calculation formula is as shown in the aforementioned formula (25).
[0824] Further, in the embodiments of the present application, for C pred [i][j], it is usually also necessary to limit it within a preset range. Therefore, in some embodiments, the method may further include: performing a correction operation on the predicted value of the second color component of the pixel to be predicted, and using the corrected predicted value as the predicted value of the second color component of the pixel to be predicted in the current block.
[0825] It should be noted that in the embodiments of the present application, the preset range may be: between 0 and (1 << BitDepth) - 1; where BitDepth is the bit depth required for the chrominance component. If the predicted value exceeds the value range of this preset range, then the predicted value needs to be corrected accordingly. Exemplarily, a clamping operation can be performed on C pred [i][j] as follows:[[]]
[0826] When the value of C pred [i][j] is less than 0, set it to 0;
[0827] When the value of C pred [i][j] is greater than or equal to 0 and less than or equal to (1 << BitDepth) - 1, it is equal to C pred [i][j];
[0828] When C pred [i][j] is greater than (1 << BitDepth) - 1, it is set to (1 << BitDepth) - 1.
[0829] In this way, after the prediction value is corrected, it can be ensured that the prediction values of the second color components of the pixels to be predicted in the current block are all between 0 and (1 << BitDepth) - 1.
[0830] Furthermore, after the prediction value is determined, a post-processing operation is required under certain conditions as the final chrominance prediction value. Therefore, in some embodiments, determining the prediction value of the second color component sampling point in the current block according to the prediction value of the second color component of the pixel to be predicted may include:
[0831] Performing a filtering process on the prediction value of the second color component of the pixel to be predicted to determine the prediction value of the second color component sampling point in the current block.
[0832] In the embodiments of the present application, the prediction value of the second color component of the pixel to be predicted includes the prediction values of at least some of the second color component sampling points in the current block. In other words, according to the first prediction block composed of the prediction values of the second color component of the pixel to be predicted, the first prediction block includes the prediction values of at least some of the second color component sampling points in the current block.
[0833] It should be noted that in the embodiments of the present application, if the first prediction block includes the prediction values of some of the second color component sampling points in the current block, an upsampling filter needs to be performed on the first prediction block to obtain the final second prediction block. Therefore, in some embodiments, the method may further include: performing an upsampling filtering process on the first prediction block to determine the second prediction block of the second color component of the current block.
[0834] It should also be noted that in the embodiments of the present application, if the number of the prediction values of the second color component included in the first prediction block is the same as the number of the second color component sampling points included in the current block, but does not include the prediction values of the second color component sampling points of the current block, filtering needs to be used to enhance the prediction values to obtain the final second prediction block. Therefore, in some embodiments, the method may further include: performing a filtering enhancement process on the first prediction block to determine the second prediction block of the second color component of the current block.
[0835] It should also be noted that in the embodiments of the present application, if the first prediction block includes the prediction values of all the second color component sampling points in the current block, no processing needs to be performed on the first prediction block, and the first prediction block can be directly used as the final second prediction block.
[0836] That is, the first prediction block may include predicted values of at least some of the second color component sampling points in the current block. If the first prediction block includes predicted values of all of the second color component sampling points in the current block, the predicted values of the second color component sampling points in the current block may be set equal to the values of the first prediction block. If the first prediction block includes predicted values of some of the second color component sampling points in the current block, upsampling filtering may be performed on the values of the first prediction block, and the predicted values of the second color component sampling points in the current block may be set equal to the output values after the upsampling filtering.
[0837] Thus, after the above operations, the second prediction block includes the predicted values of all second color component sampling points in the current block. Thus, the weighted chroma prediction output predWcp may require post-processing under certain conditions before it can be used as the final chroma prediction value predSamples. Otherwise, the final chroma prediction value predSamples is predWcp.
[0838] In some embodiments, after determining the predicted value of the second color component sampling point in the current block, determining the predicted difference value of the second color component sampling point in the current block according to the predicted value of the second color component sampling point in the current block may include:
[0839] Get the original value of the second color component sampling point in the current block;
[0840] Determine a predicted difference value of the second color component sampling point in the current block according to the original value of the second color component sampling point in the current block and the predicted value of the second color component sampling point in the current block.
[0841] Furthermore, in some embodiments, the method may further include: encoding the predicted difference value of the second color component sampling point in the current block, and writing the obtained coded bits into the bitstream.
[0842] It should be noted that in the embodiment of the present application, after determining the predicted value of the second color component sampling point in 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 original value of the second color component sampling point and the predicted value of the second color component sampling point can be subtracted to determine the predicted difference value of the second color component sampling point in the current block. 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 in the current block.
[0843] It can be understood that 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 in the current block.
[0844] It can also be understood that the embodiments of this application optimize floating-point operations during the WCP prediction process, implementing them using integer operations. On one hand, this fully leverages the content characteristics of the current block to adaptively select the optimal integer operation displacement; on the other hand, it fully ensures the accuracy of the WCP prediction technology. Furthermore, it fully considers the characteristics of the weight model and rationally designs the integer operation process. This reduces the computational complexity of the WCP prediction technology while maintaining a certain level of accuracy.
[0845] An embodiment of the present application also provides an encoding method, which determines a reference value of a first color component of a current block and a reference value of a second color component of the current block; determines a weighting coefficient based on the reference value of the first color component of the current block; determines a reference mean value of the second color component of the current block based on the reference value of the second color component of the current block; and determines a reference sample value of the second color component of the current block based on the reference value of the second color component of the current block and the reference mean value of the second color component of the current block; determines a predicted value of a sampling point of the second color component in the current block based on the reference mean value of the second color component of the current block, the reference sample value of the second color component of the current block and the corresponding weighting coefficient; and determines a predicted difference value of the sampling point of the second color component in the current block based on the predicted value of the sampling point of the second color component in the current block. In this way, based on the color component reference information in the adjacent areas of the current block and the color component reconstruction information in the current block, it is necessary not only to construct a luminance difference vector in order to determine the weighting coefficient; but also to determine the chromaticity average value based on the chromaticity reference information, and then determine the chromaticity difference vector based on the chromaticity reference information and the chromaticity average value, and then determine the chromaticity prediction value based on the chromaticity difference vector and the corresponding weighting coefficient, plus the chromaticity average value; in this way, by optimizing the calculation process of weight-based chromaticity prediction, it is possible to fully adopt integer operations, and fully consider the characteristics of the weight model, and reasonably optimize the integer operation process; while fully ensuring the accuracy of chromaticity prediction, it is also possible to reduce computational complexity, improve encoding and decoding efficiency, and thus improve encoding and decoding performance.
[0846] In another embodiment of the present application, based on the same inventive concept as the above embodiment, refer to FIG10 , which shows a schematic diagram of the composition structure of an encoding device 310 provided in an embodiment of the present application. As shown in FIG10 , the encoding device 310 may include: a first determining unit 3101, a first calculating unit 3102, and a first predicting unit 3103; wherein,
[0847] A first determining unit 3101 is configured to determine a reference value of a first color component of a current block and a reference value of a second color component of the current block; and determine a weighting coefficient according to the reference value of the first color component of the current block;
[0848] A first calculation unit 3102 is configured to determine a reference mean value of the second color component of the current block according to the reference value of the second color component of the current block; and determine a reference sample value of the second color component of the current block according to the reference value of the second color component of the current block and the reference mean value of the second color component of the current block;
[0849] The first prediction unit 3103 is configured to determine a predicted value of a sampling point of the second color component in the current block according to a reference mean value of the second color component of the current block, a reference sample value of the second color component of the current block, and a corresponding weighting coefficient;
[0850] The first determining unit 3101 is further configured to determine a predicted difference value of the second color component sampling point in the current block according to the predicted value of the second color component sampling point in the current block.
[0851] In some embodiments, the first determination unit 3101 is further configured to obtain the original value of the second color component sampling point in the current block; and determine the predicted difference value of the second color component sampling point in the current block based on the original value of the second color component sampling point in the current block and the predicted value of the second color component sampling point in the current block.
[0852] In some embodiments, referring to FIG. 10 , the encoding device 310 may further include an encoding unit 3104 configured to encode the predicted difference value of the second color component sampling point in the current block, and write the obtained encoding bits into the bitstream.
[0853] 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.
[0854] 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.
[0855] Therefore, an embodiment of the present application provides a computer-readable storage medium, which is applied to the encoding device 310. The computer-readable storage medium stores a computer program, and when the computer program is executed by the first processor, the steps of the method described in any one of the aforementioned embodiments are implemented.
[0856] Based on the composition of the above-mentioned encoding device 310 and the computer-readable storage medium, refer to Figure 11, which shows a schematic diagram of the composition structure of the encoding device 320 provided in an embodiment of the present application. As shown in Figure 11, the encoding device 320 may include: a first communication interface 3201, a first memory 3202 and a first processor 3203; each component is coupled together through a first bus system 3204. It can be understood that the first bus system 3204 is used to achieve connection and communication between these components. In addition to the data bus, the first bus system 3204 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 3204 in Figure 11. Among them,
[0857] The first communication interface 3201 is used to receive and send signals when sending and receiving information with other external network elements;
[0858] A first memory 3202 is used to store computer programs that can be run on the first processor 3203;
[0859] The first processor 3203 is configured to, when running the computer program, execute:
[0860] determining a reference value of a first color component of a current block and a reference value of a second color component of the current block;
[0861] determining a weighting coefficient according to a reference value of a first color component of a current block;
[0862] determining a reference mean value of the second color component of the current block according to the reference value of the second color component of the current block; and determining a reference sample value of the second color component of the current block according to the reference value of the second color component of the current block and the reference mean value of the second color component of the current block;
[0863] Determine a predicted value of a sampling point of the second color component in the current block according to a reference mean value of the second color component of the current block, a reference sample value of the second color component of the current block, and a corresponding weighting coefficient;
[0864] Determine a predicted difference value of the second color component sampling point in the current block according to the predicted value of the second color component sampling point in the current block.
[0865] It is understood that the first memory 3202 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 3202 of the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0866] The first processor 3203 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 3203. The above-mentioned first processor 3203 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 and executed by a hardware decoding processor, or 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, electrically erasable programmable memory, registers, etc. The storage medium is located in the first memory 3202 , and the first processor 3203 reads the information in the first memory 3202 and completes the steps of the above method in combination with its hardware.
[0867] 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.
[0868] Optionally, as another embodiment, the first processor 3203 is further configured to execute the method described in any one of the aforementioned embodiments when running the computer program.
[0869] This embodiment provides an encoding device, which may also include the encoding device 310 described in the aforementioned embodiment. For the encoding device, based on the color component reference information in the adjacent areas of the current block and the color component reconstruction information in the current block, it is necessary not only to construct a luminance difference vector in order to determine the weighting coefficient; but also to determine the chrominance average value based on the chrominance reference information, and then determine the chrominance difference vector based on the chrominance reference information and the chrominance average value, and then determine the chrominance prediction value based on the chrominance difference vector and the corresponding weighting coefficient, plus the chrominance average value; in this way, by optimizing the calculation process of the weighted chrominance prediction, it is possible to fully adopt integer operations, fully consider the characteristics of the weight model, and reasonably optimize the integer operation process; while fully ensuring the accuracy of the chrominance prediction, it is also possible to reduce the computational complexity, improve the encoding and decoding efficiency, and thus improve the encoding and decoding performance.
[0870] Based on the same inventive concept as the above embodiment, refer to FIG12, which shows a schematic diagram of the structure of a decoding device 330 provided in an embodiment of the present application. As shown in FIG12, the decoding device 330 may include: a second determination unit 3301, a second calculation unit 3302, and a second prediction unit 3303; wherein,
[0871] The second determining unit 3301 is configured to determine a reference value of a first color component of a current block and a reference value of a second color component of the current block; and determine a weighting coefficient according to the reference value of the first color component of the current block;
[0872] The second calculation unit 3302 is configured to determine a reference mean value of the second color component of the current block according to the reference value of the second color component of the current block; and determine a reference sample value of the second color component of the current block according to the reference value of the second color component of the current block and the reference mean value of the second color component of the current block;
[0873] The second prediction unit 3303 is configured to determine a predicted value of a sampling point of the second color component in the current block according to a reference mean value of the second color component of the current block, a reference sample value of the second color component of the current block, and a corresponding weighting coefficient;
[0874] The second determining unit 3301 is further configured to determine the reconstructed value of the second color component sampling point in the current block according to the predicted value of the second color component sampling point in the current block.
[0875] In some embodiments, the second determination unit 3301 is further configured to determine a predicted difference value of the second color component sampling point in the current block; and determine a reconstructed value of the second color component sampling point in the current block based on the predicted difference value of the second color component sampling point in the current block and the predicted value of the second color component sampling point in the current block.
[0876] In some embodiments, referring to FIG. 12 , the decoding device 330 may further include a decoding unit 3304 configured to parse the code stream and determine a prediction difference value of a second color component sampling point in the current block.
[0877] 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.
[0878] 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 330. The computer-readable storage medium stores a computer program that, when executed by the second processor, implements the steps of any of the methods described in the aforementioned embodiments.
[0879] Based on the composition of the above-mentioned decoding device 330 and the computer-readable storage medium, refer to Figure 13, which shows a schematic diagram of the composition structure of the decoding device 340 provided in an embodiment of the present application. As shown in Figure 13, the decoding device 340 may include: a second communication interface 3401, a second memory 3402 and a second processor 3403; each component is coupled together through a second bus system 3404. It can be understood that the second bus system 3404 is used to achieve connection and communication between these components. In addition to the data bus, the second bus system 3404 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 second bus system 3404 in Figure 13. Among them,
[0880] The second communication interface 3401 is used to receive and send signals when sending and receiving information with other external network elements;
[0881] The second memory 3402 is used to store computer programs that can be run on the second processor 3403;
[0882] The second processor 3403 is configured to, when running the computer program, execute:
[0883] determining a reference value of a first color component of a current block and a reference value of a second color component of the current block;
[0884] determining a weighting coefficient according to a reference value of a first color component of a current block;
[0885] determining a reference mean value of the second color component of the current block according to the reference value of the second color component of the current block; and determining a reference sample value of the second color component of the current block according to the reference value of the second color component of the current block and the reference mean value of the second color component of the current block;
[0886] Determine a predicted value of a sampling point of the second color component in the current block according to a reference mean value of the second color component of the current block, a reference sample value of the second color component of the current block, and a corresponding weighting coefficient;
[0887] Determine a reconstructed value of the second color component sampling point in the current block according to the predicted value of the second color component sampling point in the current block.
[0888] Optionally, as another embodiment, the second processor 3403 is further configured to execute any one of the methods described in the foregoing embodiments when running the computer program.
[0889] It can be understood that the hardware functions of the second memory 3402 are similar to those of the first memory 2102, and the hardware functions of the second processor 3403 are similar to those of the first processor 2103; they will not be described in detail here.
[0890] This embodiment provides a decoding device, which may also include the decoding device 340 described in the aforementioned embodiment. For the decoding device, based on the color component reference information in the adjacent areas of the current block and the color component reconstruction information in the current block, it is necessary not only to construct a luminance difference vector in order to determine the weighting coefficient, but also to determine the chrominance average value based on the chrominance reference information, and then determine the chrominance difference vector based on the chrominance reference information and the chrominance average value, and then determine the chrominance prediction value based on the chrominance difference vector and the corresponding weighting coefficient, plus the chrominance average value; in this way, by optimizing the calculation process of the weighted chrominance prediction, it is possible to fully adopt integer operations, fully consider the characteristics of the weight model, and reasonably optimize the integer operation process; while fully ensuring the accuracy of the chrominance prediction, it is also possible to reduce the computational complexity, improve the encoding and decoding efficiency, and thus improve the encoding and decoding performance.
[0891] In yet another embodiment of the present application, see Figure 14, 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 14, the coding and decoding system 350 may include an encoder 3501 and a decoder 3502. The encoder 3501 may be a device integrated with the encoding device 310 described in the previous embodiment, or may be the encoding device 320 described in the previous embodiment; the decoder 3502 may be a device integrated with the decoding device 330 described in the previous embodiment, or may be the decoding device 340 described in the previous embodiment.
[0892] In an embodiment of the present application, in the codec system 350, both the encoder 3501 and the decoder 3502 can achieve full adoption of integer operations by optimizing the calculation process of weight-based chrominance prediction, and fully consider the characteristics of the weight model to reasonably optimize the integer operation process; while fully ensuring the accuracy of chrominance prediction, it can also reduce the computational complexity, improve the coding and decoding efficiency, and thus enhance the coding and decoding performance.
[0893] 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.
[0894] 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.
[0895] The methods disclosed in the several method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.
[0896] The features disclosed in the several product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.
[0897] The features disclosed in several method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments or device embodiments.
[0898] 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
[0899] In an embodiment of the present application, whether at the encoding end or the decoding end, by determining a reference value of the first color component of the current block and a reference value of the second color component of the current block; determining a weighting coefficient based on the reference value of the first color component of the current block; determining a reference mean value of the second color component of the current block based on the reference value 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 reference value of the second color component of the current block and the reference mean value of the second color component of the current block; and determining a predicted value of a sampling point of the second color component in the current block based on the reference mean value of the second color component of the current block, the reference sample value of the second color component of the current block, and the corresponding weighting coefficient. In this way, the encoding end can determine a predicted difference value of the sampling point of the second color component of the current block based on the predicted value of the sampling point of the second color component in the current block; so that at the decoding end, after decoding and obtaining the predicted difference value of the sampling point of the second color component of the current block, the reconstructed value of the sampling point of the second color component of the current block can be determined in combination with the predicted value of the sampling point of the second color component in the current block. That is to say, based on the color component reference information in the adjacent areas of the current block and the color component reconstruction information in the current block, it is necessary not only to construct a luminance difference vector in order to determine the weighting coefficient; but also to determine the chrominance average value based on the chrominance reference information, and then determine the chrominance difference vector based on the chrominance reference information and the chrominance average value, and then determine the chrominance prediction value based on the chrominance difference vector and the corresponding weighting coefficient, plus the chrominance average value; in this way, by optimizing the calculation process of the weighted chrominance prediction, it is possible to fully adopt integer operations, and fully consider the characteristics of the weight model, and reasonably optimize the integer operation process; while fully ensuring the accuracy of the chrominance prediction, it is also possible to reduce the computational complexity, improve the encoding and decoding efficiency, and thus improve the encoding and decoding performance.
Claims
1. A decoding method, comprising: determining a reference value of a first color component of a current block and a reference value of a second color component of the current block; determining a weighting coefficient according to a reference value of the first color component of the current block; determining a reference mean value of the second color component of the current block according to the reference value of the second color component of the current block; and determining a reference sample value of the second color component of the current block according to the reference value of the second color component of the current block and a reference mean value of the second color component of the current block; Determining, according to the reference mean value of the second color component of the current block, the reference sample value of the second color component of the current block, and the corresponding weighting coefficient, a predicted value of a sampling point of the second color component in the current block; Determine a reconstructed value of the second color component sampling point in the current block according to the predicted value of the second color component sampling point in the current block.
2. The method according to claim 1, wherein The determining a reference value of a first color component of a current block and a reference value of a second color component of the current block includes: Determining a reference 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; determining a reference value of the second color component of the current block according to the values of the second color component sampling points in the 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.
3. The method according to claim 2, wherein: The determining, according to the values of the first color component sampling points in the adjacent areas of the current block, a reference value of the first color component of the current block includes: A first filtering process is performed on the values of the first color component sampling points in the adjacent area of the current block to determine a reference value of the first color component of the current block.
4. The method according to claim 3, wherein: The first filtering process is a downsampling filtering process.
5. The method according to claim 2, wherein: The determining, according to the values of the second color component sampling points in the adjacent areas of the current block, a reference value of the second color component of the current block includes: A second filtering process is performed on the values of the second color component sampling points in the adjacent area of the current block to determine a reference value of the second color component of the current block.
6. The method according to claim 5, wherein: The second filtering process is an upsampling filtering process.
7. The method according to claim 1, wherein The determining of the weighting coefficient according to the reference value of the first color component of the current block includes: Determining a reconstructed value of a first color component sampling point in the current block; Determining a reference sample value of the first color component of the current block according to a reconstructed value of a first color component sampling point in the current block and a reference value of the first color component of the current block; The weighting coefficient is determined according to a reference sample value of the first color component of the current block.
8. The method according to claim 7, wherein: The determining, according to the reconstructed value of the first color component sampling point in the current block and the reference value of the first color component of the current block, a reference sample value of the first color component of the current block, comprises: Determine a difference between a reconstructed value of a first color component sampling point in the current block and a reference value 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 difference.
9. The method according to claim 8, wherein Determining, according to the difference, a reference sample value of the first color component of the current block, includes: The reference sample value of the first color component of the current block is set to be equal to the absolute value of the difference.
10. The method according to claim 7, wherein: The determining the weighting coefficient according to the reference sample value of the first color component of the current block includes: Determining a weight index value according to a reference sample value of the first color component of the current block; The weighting coefficient is determined according to the weight index value using a first preset mapping relationship.
11. The method according to claim 10, wherein: The determining of the weight index value according to the reference sample value of the first color component of the current block includes: Determining a maximum weight index value and a minimum weight index value of the current block; The reference sample value of the first color component is corrected according to the maximum weight index value and the minimum weight index value to determine the weight index value.
12. The method according to claim 10, wherein: Determining the weighting coefficient using a first preset mapping relationship according to the weight index value includes: The first preset mapping relationship is a numerical mapping lookup table of the weight index value and the weighting coefficient.
13. The method according to claim 10, wherein: Determining the weighting coefficient using a first preset mapping relationship according to the weight index value includes: Determine a first value corresponding to the weight index value under the first preset mapping relationship; The weighting coefficient is set to be equal to the first value.
14. The method according to claim 13, wherein The determining a first value corresponding to the weight index value under the first preset mapping relationship includes: Determine the first factor; Determine a second value using a second preset mapping relationship according to the weight index value; Calculate a first product value of the first factor and the second value; The first value is set to be equal to the value corresponding to the first product value under the first preset mapping relationship.
15. The method according to claim 14, wherein The second preset mapping relationship is an exponential function relationship based on n; wherein the value of n is equal to the weight index value.
16. The method according to claim 14, wherein The determining of the first factor comprises: The first factor is a preset constant value.
17. The method according to claim 14, 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.
18. The method according to claim 10, wherein The determining of the weight index value according to the reference sample value of the first color component of the current block includes: Determine the second factor; The weight index value is determined according to the reference sample value of the first color component of the current block and the second factor.
19. The method according to claim 18, wherein Determining the second factor includes: The second factor is a preset constant value.
20. The method according to claim 18, wherein Determining the second factor includes: Determining a value of the second 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.
21. The method according to claim 18, wherein The determining the weight index value according to the reference sample value of the first color component of the current block and the second factor includes: Determine a third value using a third preset mapping relationship according to the reference sample value of the first color component and the second factor; Determining a maximum weight index value and a minimum weight index value of the current block; The third value is corrected according to the maximum weight index value and the minimum weight index value to determine the weight index value.
22. The method according to claim 21, wherein The determining a third value using a third preset mapping relationship according to the reference sample value of the first color component and the second factor includes: Determine at least one shift array; determining a target offset from the at least one shift array based on the second factor; A right shift operation of the target offset is performed on the reference sample value of the first color component to determine the third value.
23. The method according to claim 18, wherein Determining the weighting coefficient using a first preset mapping relationship according to the weight index value includes: Determining a second product value according to the second factor and the weight index value; Determining a fourth value corresponding to the second product value under the first preset mapping relationship; The weighting coefficient is set to be equal to the fourth value.
24. The method according to claim 23, wherein The determining a fourth value corresponding to the second product value under the first preset mapping relationship includes: Determine the first factor; Determine a fifth value using a second preset mapping relationship according to the second product value; Calculating a third product value of the first factor and the fifth value; The fourth value is set to be equal to the value corresponding to the third product value under the first preset mapping relationship.
25. The method according to claim 1, wherein The determining, according to the reference mean value of the second color component of the current block, the reference sample value of the second color component of the current block, and the corresponding weighting coefficient, a predicted value of a sampling point of the second color component in the current block, comprises: Determining a weighted value of a reference sample value of the second color component and the corresponding weighting coefficient; Setting a weighted sum value of pixels to be predicted in the current block to be equal to the sum of N weighted values, and setting a coefficient sum value of pixels to be predicted in the current block to be equal to the sum of N weighted coefficients; wherein N represents the number of reference samples of the second color component, and N is a positive integer; Determine a sixth value using a fourth preset mapping relationship according to the weighted sum and the coefficient sum; performing addition calculation on the reference mean value of the second color component and the sixth value to obtain a predicted value of the second color component of the pixel to be predicted in the current block; Determine a predicted value of a sampling point of the second color component in the current block according to the predicted value of the second color component of the pixel to be predicted in the current block.
26. The method according to claim 25, wherein The predicted value of the second color component of the pixel to be predicted includes the predicted values of at least part of the second color component sampling points in the current block.
27. The method according to claim 1, wherein The determining, according to the reference value of the second color component of the current block, a reference mean value of the second color component of the current block, comprises: An average value of the N reference values of the second color components of the current block is calculated to obtain a reference mean value of the second color component of the current block.
28. The method according to claim 27, wherein The method further comprises: Determining a block type index value according to a size parameter of the current block; According to the block type index value, a fifth preset mapping relationship is used to determine the value of N.
29. The method according to claim 28, wherein The fifth preset mapping relationship represents a lookup table mapping the block type index value to a numerical value of N.
30. The method of claim 1, wherein The determining, according to the reference value of the second color component of the current block and the reference mean value of the second color component of the current block, a reference sample value of the second color component of the current block, comprises: A subtraction calculation is performed on the reference value of the second color component of the current block and the reference mean value of the second color component of the current block to obtain a reference sample value of the second color component of the current block.
31. The method of claim 25, wherein: Determining a sixth value using a fourth preset mapping relationship according to the weighted sum value and the coefficient sum value includes: Determine the preset offset; Determining a first numerical value using a sixth preset mapping relationship based on the coefficient and value; determining an array index value using a seventh preset mapping relationship based on the coefficient and value and the first numerical value, and determining a second numerical value using an eighth preset mapping relationship based on the array index value and the preset offset; In a case where the array index value is equal to zero, determining a third value according to the first value; and determining a first offset according to the third value and the preset offset; determining a fourth product value according to the second value and the weighted sum value, determining a preset addition value according to the third value and the preset offset, and performing an addition operation on the fourth product value and the preset addition value to obtain a target sum value; A right shift operation of the first offset is performed on the target sum value to determine the sixth value.
32. The method according to claim 31, wherein Determining the first value using a sixth preset mapping relationship according to the coefficient and the value includes: The first value is set equal to the number of bits of binary symbols required for the binary representation of the coefficient and value minus one.
33. The method according to claim 31, wherein The determining an array index value using a seventh preset mapping relationship according to the coefficient sum value and the first value includes: The coefficient sum value and the first numerical value are used as inputs of a preset functional relationship, and the array index value is output according to the preset functional relationship.
34. The method according to claim 31, wherein Determining the second value using an eighth preset mapping relationship according to the array index value and the preset offset includes: Determining an index indication value in an array mapping table according to the array index value; The second value is determined using the eighth preset mapping relationship according to the index indication value and the preset offset.
35. The method of claim 31 , wherein: The determining of a third value according to the first value when the array index value is equal to zero includes: If the array index value is equal to zero, setting the third array equal to the first value; If the array index value is not equal to zero, the third array is set to be equal to the sum of the first value and one.
36. The method of claim 25, wherein: The method further comprises: A correction operation is performed on the predicted value of the second color component of the pixel to be predicted, and the corrected predicted value is used as the predicted value of the second color component of the pixel to be predicted in the current block.
37. The method of claim 25, wherein: The step of determining the predicted value of the second color component sampling point in the current block according to the predicted value of the second color component of the pixel to be predicted in the current block includes: The predicted value of the second color component of the pixel to be predicted is filtered to determine the predicted value of the second color component sampling point in the current block.
38. The method according to any one of claims 1 to 33, wherein The determining, according to the predicted value of the second color component sampling point in the current block, the reconstructed value of the second color component sampling point in the current block includes: Determining a predicted difference value of a second color component sampling point in the current block; Determine a reconstructed value of the second color component sampling point in the current block according to the predicted difference value of the second color component sampling point in the current block and the predicted value of the second color component sampling point in the current block.
39. A coding method comprising: determining a reference value of a first color component of a current block and a reference value of a second color component of the current block; determining a weighting coefficient according to a reference value of the first color component of the current block; determining a reference mean value of the second color component of the current block according to the reference value of the second color component of the current block; and determining a reference sample value of the second color component of the current block according to the reference value of the second color component of the current block and a reference mean value of the second color component of the current block; Determining, according to the reference mean value of the second color component of the current block, the reference sample value of the second color component of the current block, and the corresponding weighting coefficient, a predicted value of a sampling point of the second color component in the current block; Determine a predicted difference value of the second color component sampling point in the current block according to the predicted value of the second color component sampling point in the current block.
40. The method of claim 39, wherein The determining a reference value of a first color component of a current block and a reference value of a second color component of the current block includes: Determining a reference 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; determining a reference value of the second color component of the current block according to the values of the second color component sampling points in the 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.
41. The method according to claim 40, wherein The determining, according to the values of the first color component sampling points in the adjacent areas of the current block, a reference value of the first color component of the current block includes: A first filtering process is performed on the values of the first color component sampling points in the adjacent area of the current block to determine a reference value of the first color component of the current block.
42. The method according to claim 41, wherein The first filtering process is a downsampling filtering process.
43. The method of claim 40, wherein: The determining, according to the values of the second color component sampling points in the adjacent areas of the current block, a reference value of the second color component of the current block includes: A second filtering process is performed on the values of the second color component sampling points in the adjacent area of the current block to determine a reference value of the second color component of the current block.
44. The method according to claim 43, wherein The second filtering process is an upsampling filtering process.
45. The method of claim 39, wherein The determining of the weighting coefficient according to the reference value of the first color component of the current block includes: Determining a reconstructed value of a first color component sampling point in the current block; Determining a reference sample value of the first color component of the current block according to a reconstructed value of a first color component sampling point in the current block and a reference value of the first color component of the current block; The weighting coefficient is determined according to a reference sample value of the first color component of the current block.
46. The method of claim 45, wherein The determining, according to the reconstructed value of the first color component sampling point in the current block and the reference value of the first color component of the current block, a reference sample value of the first color component of the current block, comprises: Determine a difference between a reconstructed value of a first color component sampling point in the current block and a reference value 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 difference.
47. The method of claim 46, wherein Determining, according to the difference, a reference sample value of the first color component of the current block, includes: The reference sample value of the first color component of the current block is set to be equal to the absolute value of the difference.
48. The method of claim 45, wherein The determining the weighting coefficient according to the reference sample value of the first color component of the current block includes: Determining a weight index value according to a reference sample value of the first color component of the current block; The weighting coefficient is determined according to the weight index value using a first preset mapping relationship.
49. The method according to claim 49, wherein The determining of the weight index value according to the reference sample value of the first color component of the current block includes: Determining a maximum weight index value and a minimum weight index value of the current block; The reference sample value of the first color component is corrected according to the maximum weight index value and the minimum weight index value to determine the weight index value.
50. The method of claim 48, wherein Determining the weighting coefficient using a first preset mapping relationship according to the weight index value includes: The first preset mapping relationship is a numerical mapping lookup table of the weight index value and the weighting coefficient.
51. The method of claim 48, wherein Determining the weighting coefficient using a first preset mapping relationship according to the weight index value includes: Determine a first value corresponding to the weight index value under the first preset mapping relationship; The weighting coefficient is set to be equal to the first value.
52. The method of claim 51, wherein The determining a first value corresponding to the weight index value under the first preset mapping relationship includes: Determine the first factor; Determine a second value using a second preset mapping relationship according to the weight index value; Calculate a first product value of the first factor and the second value; The first value is set to be equal to the value corresponding to the first product value under the first preset mapping relationship.
53. The method of claim 52, wherein: The second preset mapping relationship is an exponential function relationship based on n; wherein the value of n is equal to the weight index value.
54. The method of claim 52, wherein: The determining of the first factor comprises: The first factor is a preset constant value.
55. The method of claim 52, 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.
56. The method of claim 48, wherein The determining of the weight index value according to the reference sample value of the first color component of the current block includes: Determine the second factor; The weight index value is determined according to the reference sample value of the first color component of the current block and the second factor.
57. The method of claim 56, wherein Determining the second factor includes: The second factor is a preset constant value.
58. The method of claim 56, wherein Determining the second factor includes: Determining a value of the second 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.
59. The method of claim 56, wherein The determining the weight index value according to the reference sample value of the first color component of the current block and the second factor includes: Determine a third value using a third preset mapping relationship according to the reference sample value of the first color component and the second factor; Determining a maximum weight index value and a minimum weight index value of the current block; The third value is corrected according to the maximum weight index value and the minimum weight index value to determine the weight index value.
60. The method of claim 59, wherein The determining a third value using a third preset mapping relationship according to the reference sample value of the first color component and the second factor includes: Determine at least one shift array; determining a target offset from the at least one shift array based on the second factor; A right shift operation of the target offset is performed on the reference sample value of the first color component to determine the third value.
61. The method of claim 56, wherein: Determining the weighting coefficient using a first preset mapping relationship according to the weight index value includes: Determining a second product value according to the second factor and the weight index value; Determining a fourth value corresponding to the second product value under the first preset mapping relationship; The weighting coefficient is set to be equal to the fourth value.
62. The method of claim 61, wherein The determining a fourth value corresponding to the second product value under the first preset mapping relationship includes: Determine the first factor; Determine a fifth value using a second preset mapping relationship according to the second product value; Calculating a third product value of the first factor and the fifth value; The fourth value is set to be equal to the value corresponding to the third product value under the first preset mapping relationship.
63. The method of claim 39, wherein: The determining, according to the reference mean value of the second color component of the current block, the reference sample value of the second color component of the current block, and the corresponding weighting coefficient, a predicted value of a sampling point of the second color component in the current block, comprises: Determining a weighted value of a reference sample value of the second color component and the corresponding weighting coefficient; Setting a weighted sum value of pixels to be predicted in the current block to be equal to the sum of N weighted values, and setting a coefficient sum value of pixels to be predicted in the current block to be equal to the sum of N weighted coefficients; wherein N represents the number of reference samples of the second color component, and N is a positive integer; Determine a sixth value using a fourth preset mapping relationship according to the weighted sum and the coefficient sum; performing addition calculation on the reference mean value of the second color component and the sixth value to obtain a predicted value of the second color component of the pixel to be predicted in the current block; Determine a predicted value of a sampling point of the second color component in the current block according to the predicted value of the second color component of the pixel to be predicted in the current block.
64. The method of claim 63, wherein The predicted value of the second color component of the pixel to be predicted includes the predicted values of at least part of the second color component sampling points in the current block.
65. The method of claim 39, wherein The determining, according to the reference value of the second color component of the current block, a reference mean value of the second color component of the current block, comprises: An average value of the N reference values of the second color components of the current block is calculated to obtain a reference mean value of the second color component of the current block.
66. The method of claim 65, wherein The method further comprises: Determining a block type index value according to a size parameter of the current block; According to the block type index value, a fifth preset mapping relationship is used to determine the value of N.
67. The method of claim 66, wherein The fifth preset mapping relationship represents a lookup table mapping the block type index value to a numerical value of N.
68. The method of claim 39, wherein The determining, according to the reference value of the second color component of the current block and the reference mean value of the second color component of the current block, a reference sample value of the second color component of the current block, comprises: A subtraction calculation is performed on the reference value of the second color component of the current block and the reference mean value of the second color component of the current block to obtain a reference sample value of the second color component of the current block.
69. The method of claim 63, wherein Determining a sixth value using a fourth preset mapping relationship according to the weighted sum value and the coefficient sum value includes: Determine the preset offset; Determining a first numerical value using a sixth preset mapping relationship based on the coefficient and value; determining an array index value using a seventh preset mapping relationship based on the coefficient and value and the first numerical value, and determining a second numerical value using an eighth preset mapping relationship based on the array index value and the preset offset; In a case where the array index value is equal to zero, determining a third value according to the first value; and determining a first offset according to the third value and the preset offset; determining a fourth product value according to the second value and the weighted sum value, determining a preset addition value according to the third value and the preset offset, and performing an addition operation on the fourth product value and the preset addition value to obtain a target sum value; A right shift operation of the first offset is performed on the target sum value to determine the sixth value.
70. The method of claim 69, wherein Determining the first value using a sixth preset mapping relationship according to the coefficient and the value includes: The first value is set equal to the number of bits of binary symbols required for the binary representation of the coefficient and value minus one.
71. The method of claim 69, wherein The determining an array index value using a seventh preset mapping relationship according to the coefficient sum value and the first value includes: The coefficient sum value and the first numerical value are used as inputs of a preset functional relationship, and the array index value is output according to the preset functional relationship.
72. The method of claim 69, wherein Determining the second value using an eighth preset mapping relationship according to the array index value and the preset offset includes: Determining an index indication value in an array mapping table according to the array index value; The second value is determined using the eighth preset mapping relationship according to the index indication value and the preset offset.
73. The method of claim 69, wherein The determining of a third value according to the first value when the array index value is equal to zero includes: If the array index value is equal to zero, setting the third array equal to the first value; If the array index value is not equal to zero, the third array is set to be equal to the sum of the first value and one.
74. The method of claim 63, wherein The method further comprises: A correction operation is performed on the predicted value of the second color component of the pixel to be predicted, and the corrected predicted value is used as the predicted value of the second color component of the pixel to be predicted in the current block.
75. The method of claim 63, wherein The step of determining the predicted value of the second color component sampling point in the current block according to the predicted value of the second color component of the pixel to be predicted in the current block includes: The predicted value of the second color component of the pixel to be predicted is filtered to determine the predicted value of the second color component sampling point in the current block.
76. The method according to any one of claims 39 to 75, wherein The determining, according to the predicted value of the second color component sampling point in the current block, the predicted difference value of the second color component sampling point in the current block includes: Obtaining the original value of the second color component sampling point in the current block; Determine a predicted difference value of the second color component sampling point in the current block according to the original value of the second color component sampling point in the current block and the predicted value of the second color component sampling point in the current block.
77. The method of claim 76, wherein The method further comprises: The predicted difference value of the second color component sampling point in the current block is encoded, and the obtained encoding bits are written into a bitstream.
78. A coding device comprising a first determining unit, a first calculating unit, and a first predicting unit; wherein, The first determining unit is configured to determine a reference value of a first color component of a current block and a reference value of a second color component of the current block; and determining a weighting coefficient according to a reference value of the first color component of the current block; The first calculation unit is configured to determine a reference mean value of the second color component of the current block according to the reference value of the second color component of the current block; and determining a reference sample value of the second color component of the current block according to the reference value of the second color component of the current block and a reference mean value of the second color component of the current block; The first prediction unit is configured to determine a predicted value of a sampling point of the second color component in the current block according to a reference mean value of the second color component of the current block, a reference sample value of the second color component of the current block, and the corresponding weighting coefficient; The first determining unit is further configured to determine a predicted difference value of the second color component sampling point in the current block according to the predicted value of the second color component sampling point in the current block.
79. 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 39 to 77 when running the computer program.
80. A decoding device comprising a second determining unit, a second calculating unit and a second predicting unit; wherein: The second determining unit is configured to determine a reference value of a first color component of a current block and a reference value of a second color component of the current block; and determining a weighting coefficient according to a reference value of the first color component of the current block; The second calculation unit is configured to determine a reference mean value of the second color component of the current block according to the reference value of the second color component of the current block; and determining a reference sample value of the second color component of the current block according to the reference value of the second color component of the current block and a reference mean value of the second color component of the current block; The second prediction unit is configured to determine a predicted value of a sampling point of the second color component in the current block according to a reference mean value of the second color component of the current block, a reference sample value of the second color component of the current block, and the corresponding weighting coefficient; The second determining unit is further configured to determine a reconstructed value of the second color component sampling point in the current block according to the predicted value of the second color component sampling point in the current block.
81. 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 38 when running the computer program.
82. A computer-readable storage medium, wherein: The computer-readable storage medium stores a computer program, which, when executed, implements the method according to any one of claims 1 to 38 or any one of claims 39 to 77.