Encoding and decoding method and device, encoding equipment, decoding equipment and storage medium
Patent Information
- Application Number
- CN202280089392.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-25
- Publication Date
- 2024-09-06
AI Technical Summary
The existing chroma prediction method based on the inter-component linear model in H.266/VVC suffers from low prediction accuracy, which leads to a decrease in encoding and decoding performance.
By determining the reference pixel of the current block, calculating the weighting coefficient based on the reference pixel, and performing a weighted calculation on the first color component value of the reference pixel, the predicted value of the first color component of the pixel to be predicted in the current block is determined.
It improves the accuracy of chroma prediction, saves bitrate, and enhances encoding and decoding performance.
Smart Images

Figure CN118614063A
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 HD and UHD video have emerged. H.265 / High Efficiency Video Coding (HEVC) is no longer able to meet the demands of rapidly evolving video applications. The Joint Video Exploration Team (JVET) has proposed the next-generation video coding standard, H.266 / Versatile Video Coding (VVC), and its corresponding test model, the VVC Test Model (VTM).
[0003] H.266 / VVC currently integrates a component prediction method based on the Cross-Component Linear Model (CCLM), which can predict the chrominance components from the luma components of the current block. However, the current CCLM technology has a large deviation between the predicted values and the original values of some coding blocks, resulting in low prediction accuracy, reduced quality, and lower codec performance.
[0004] Summary of the Invention
[0005] The embodiments of the present application provide a coding and decoding method, apparatus, coding device, decoding device, and storage medium, which can not only improve the accuracy of chrominance prediction and save bit rate, but also improve coding and decoding performance.
[0006] The technical solution of the embodiment of the present application can be implemented as follows:
[0007] In a first aspect, an embodiment of the present application provides a decoding method, the method comprising:
[0008] Determine the reference pixel of the current block;
[0009] Determine a weighting coefficient according to the reference pixel;
[0010] A weighted calculation is performed on the first color component value of the reference pixel according to the weighting coefficient to determine the predicted value of the first color component of the pixel to be predicted in the current block.
[0011] In a second aspect, an embodiment of the present application provides an encoding method, the method comprising:
[0012] Determine the reference pixel of the current block;
[0013] Determine a weighting coefficient according to the reference pixel;
[0014] A weighted calculation is performed on the first color component value of the reference pixel according to the weighting coefficient to determine the predicted value of the first color component of the pixel to be predicted in the current block.
[0015] 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,
[0016] A first determining unit configured to determine a reference pixel of a current block;
[0017] A first calculation unit is configured to determine a weighting coefficient according to a reference pixel;
[0018] The first prediction unit is configured to perform weighted calculation on the first color component value of the reference pixel according to the weighting coefficient to determine the predicted value of the first color component of the pixel to be predicted in the current block.
[0019] In a fourth aspect, an embodiment of the present application provides an encoding device, comprising a first memory and a first processor; wherein,
[0020] a first memory for storing a computer program capable of running on the first processor;
[0021] The first processor is configured to execute the method according to the second aspect when running a computer program.
[0022] 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,
[0023] a second determining unit, configured to determine a reference pixel of a current block;
[0024] a second calculation unit configured to determine a weighting coefficient according to the reference pixel;
[0025] The second prediction unit is configured to perform weighted calculation on the first color component value of the reference pixel according to the weighting coefficient to determine the predicted value of the first color component of the pixel to be predicted in the current block.
[0026] In a sixth aspect, an embodiment of the present application provides a decoding device, including a second memory and a second processor; wherein,
[0027] a second memory for storing a computer program capable of running on the second processor;
[0028] The second processor is configured to execute the method according to the first aspect when running a computer program.
[0029] 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.
[0030] The embodiments of the present application provide a coding and decoding method, apparatus, coding device, decoding device, and storage medium. Whether at the coding end or the decoding end, the method determines the reference pixel of the current block; determines the weighting coefficient based on the reference pixel; and performs weighted calculation on the first color component value of the reference pixel based on the weighting coefficient to determine the predicted value of the first color component of the pixel to be predicted in the current block. In this way, the weighting coefficient corresponding to the pixel to be predicted in the current block can be calculated by using the color component information of the reference pixel of the current block and the pixel to be predicted in the current block. Moreover, different pixels to be predicted can have different weighting coefficients. This weighting coefficient is applied to the chrominance prediction of the pixel to be predicted in the current block, thereby not only improving the accuracy of the chrominance prediction and saving bit rate, but also improving the coding and decoding performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] FIG1 is a schematic diagram showing the distribution of effective adjacent areas;
[0032] FIG2 is a schematic diagram showing the distribution of selected areas under different prediction modes;
[0033] FIG3 is a flow chart of a model parameter derivation scheme;
[0034] FIG4A is a schematic block diagram of an encoder provided in an embodiment of the present application;
[0035] FIG4B is a schematic block diagram of a decoder according to an embodiment of the present application;
[0036] FIG5 is a flowchart of a decoding method according to an embodiment of the present application;
[0037] FIG6 is a schematic diagram of a position of reference pixel selection provided by an embodiment of the present application;
[0038] FIG7 is a second flow chart of a decoding method provided in an embodiment of the present application;
[0039] FIG8 is a third flow chart of a decoding method provided in an embodiment of the present application;
[0040] FIG9 is a flowchart diagram 1 of an encoding method provided in an embodiment of the present application;
[0041] FIG10 is a second flow chart of an encoding method provided in an embodiment of the present application;
[0042] FIG11 is a schematic diagram of the structure of an encoding device provided in an embodiment of the present application;
[0043] FIG12 is a schematic diagram of a specific hardware structure of an encoding device provided in an embodiment of the present application;
[0044] FIG13 is a schematic diagram of the structure of a decoding device provided in an embodiment of the present application;
[0045] FIG14 is a schematic diagram of a specific hardware structure of a decoding device provided in an embodiment of the present application;
[0046] FIG15 is a schematic diagram of the composition structure of a coding and decoding system provided in an embodiment of the present application. DETAILED DESCRIPTION
[0047] 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.
[0048] 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.
[0049] 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.
[0050] In a video image, a first color component, a second color component, and a third color component are generally used to represent a coding block (CB); wherein the three color components are a luminance component, a blue chrominance component, and a red chrominance component, respectively. Specifically, the luminance component is usually represented by the symbol Y, the blue chrominance component is usually represented by the symbol Cb or U, and the red chrominance component is usually represented by the symbol Cr or V; thus, the video image can be represented in either the YCbCr format or the YUV format.
[0051] 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.
[0052] Taking the prediction from the first color component to the second color component as an example, assuming that the first color component is the luminance component and the second color component is the chrominance component, in order to reduce the redundancy between the luminance component and the chrominance component, the CCLM prediction mode is used in VVC, that is, the chrominance prediction value is constructed according to the luminance reconstruction value of the same coding block, such as: Pred C (i, j) = α·Rec L (i,j)+β.
[0053] 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.
[0054] 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.
[0055] 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,
[0056] 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;
[0057] 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;
[0058] 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.
[0059] It should be noted that in VTM5.0, 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. Therefore, although the selection area of the INTRA_L_CCLM mode and the INTRA_T_CCLM mode is defined as W+H, in actual applications, the selection area of the INTRA_L_CCLM mode will be limited to H+H, and the selection area of the INTRA_T_CCLM mode will be limited to W+W. In this way,
[0060] 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};
[0061] 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}.
[0062] 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.
[0063] 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.
[0064] 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:
[0065] S301: Acquire reference pixels in a selected area.
[0066] S302: Determine the number of valid reference pixels.
[0067] S303: If the number of valid reference pixels is 0, the model parameter α is set to 0 and β is set to a default value.
[0068] S304: The chroma prediction value is filled with a default value.
[0069] 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 4 comparisons.
[0070] S306: Calculate the mean point corresponding to the larger value and the mean point corresponding to the smaller value.
[0071] S307: Derivation of model parameters α and β based on the two mean points.
[0072] S308: Perform chroma prediction using the prediction model constructed using α and β.
[0073] It should be noted that in VVC, the step of valid reference pixels being 0 is judged based on the validity of adjacent areas.
[0074] 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, 4 comparisons are performed to obtain the two reference pixels with larger values and the two reference pixels with smaller values in the brightness component; 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.
[0075] 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 can lead to the following defects: On the one hand, coding blocks with different content characteristics all use a simple linear model to map luminance to chrominance to achieve chrominance prediction, but not all luminance-to-chrominance mapping functions within any coding block can be accurately fitted by this simple linear model, resulting in inaccurate predictions for some coding blocks; on the other hand, during the prediction process, pixels at different positions within the coding block all use the same model parameters α and β, and there are also large differences in the prediction accuracy at different positions within the coding block. In other words, under the current CCLM technology, there is a large deviation between the predicted values and the original values of some coding blocks, resulting in low prediction accuracy, reduced quality, and lower encoding and decoding efficiency.
[0076] Based on this, an embodiment of the present application provides a coding and decoding method, whether on the encoding or decoding end, by determining the reference pixel of the current block; determining a weighting coefficient based on the reference pixel; and performing a weighted calculation on the first color component value of the reference pixel based on the weighting coefficient to determine the predicted value of the first color component of the pixel to be predicted in the current block. In this way, the weighting coefficient corresponding to the pixel to be predicted in the current block can be calculated by using the color component information of the reference pixel of the current block and the pixel to be predicted in the current block; and different pixels to be predicted can have different weighting coefficients. This weighting coefficient is applied to the chrominance prediction of the pixel to be predicted in the current block, thereby not only improving the accuracy of the chrominance prediction and saving bit rate, but also improving coding and decoding performance.
[0077] The embodiments of the present application will be described in detail below with reference to the accompanying drawings.
[0078] 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 .
[0079] 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.
[0080] 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.
[0081] 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.
[0082] In one embodiment of the present application, referring to FIG5 , a flowchart of a decoding method provided by the embodiment of the present application is shown. As shown in FIG5 , the method may include:
[0083] S501: Determine reference pixels of the current block.
[0084] It should be noted that the decoding method in the embodiment of the present application is applied to a decoder. Furthermore, the decoding method may specifically refer to an intra-frame prediction method, more specifically, a color component prediction method. A video image may be divided into multiple decoding blocks, each of which may include a first color component, a second color component, and a third color component. The current block in the embodiment of the present application refers to a decoding block in the video image that is currently to be intra-frame predicted.
[0085] Here, when the first color component needs to be predicted, the component to be predicted is the first color component; when the second color component needs to be predicted, the component to be predicted is the second color component; when the third color component needs to be predicted, the component to be predicted is the third color component. In addition, assuming that the current block predicts the first color component and the first color component is the luminance component, that is, the component to be predicted is the luminance component, then the current block can also be called a luminance block; or assuming that the current block predicts the second color component and the second color component is the chrominance component, that is, the component to be predicted is the chrominance component, then the current block can also be called a chrominance block.
[0086] It should also be noted that, in the embodiments of the present application, the reference pixel (Reference Sample) of the current block may refer to a reference pixel point adjacent to the current block; wherein, adjacent here may be spatially adjacent, but is not limited to this. For example, adjacent may also mean temporal adjacent, spatially and temporally adjacent, or even the reference pixel of the current block may be a reference pixel obtained by performing some processing on spatially adjacent, temporally adjacent, or spatially and temporally adjacent reference pixels, etc., and the embodiments of the present application do not impose any limitation thereto.
[0087] In some embodiments, determining the reference pixel of the current block may include:
[0088] The reference pixel is determined based on pixels in an adjacent area of the current block; wherein 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.
[0089] Specifically, in an embodiment of the present application, the reference pixels are determined based on the pixels in the adjacent areas of the current block, and the following methods may be used: a first reference pixel set is formed based on the pixels in the adjacent areas of the current block; and then the reference pixels are determined from the first reference pixel set. In this way, when the left adjacent area, the lower left adjacent area, the upper adjacent area, and the upper right adjacent area are all valid areas, for the INTRA_LT_CCLM mode, the first reference pixel set may be composed of pixels in the left adjacent area and the upper adjacent area of the current block, as shown in FIG2(a); for the INTRA_L_CCLM mode, the first reference pixel set may be composed of pixels in the left adjacent area and the lower left adjacent area of the current block, as shown in FIG2(b); for the INTRA_T_CCLM mode, the first reference pixel set may be composed of pixels in the upper adjacent area and the upper right adjacent area of the current block, as shown in FIG2(c).
[0090] It should also be noted that, in the embodiment of the present application, the adjacent area of the current block may include multiple rows or multiple columns. For example, the left adjacent area or the lower left adjacent area may include one or more columns, and the upper adjacent area or the upper right adjacent area may include one or more rows.
[0091] It should also be noted that, in an embodiment of the present application, pixels in some areas can be selected from these adjacent areas to participate in the color component prediction of the current block. For example, only the upper adjacent area, or only the left adjacent area, or only the upper adjacent area and the upper right adjacent area, or only the left adjacent area and the lower left adjacent area, or only the upper adjacent area and the left adjacent area, or only the upper adjacent area, the upper right adjacent area and the left adjacent area, or only the left adjacent area, the lower left adjacent area and the upper adjacent area, etc. In this way, the reference pixels of the four adjacent areas of the left, lower left, upper and upper right that can be obtained by the current block participate in the color component prediction of the current block.
[0092] It should also be noted that, in the embodiment of the present application, the selection method of the adjacent area can also be determined according to the prediction mode of the current block. In a specific embodiment, it can include:
[0093] If the prediction mode of the current block is the horizontal mode, the reference pixel is determined according to the pixels in the upper adjacent area and / or the upper right adjacent area;
[0094] If the prediction mode of the current block is the vertical mode, the reference pixel is determined according to the pixels in the left adjacent area and / or the lower left adjacent area.
[0095] Exemplarily, if the luminance prediction mode of the current block is a horizontal mode, then the adjacent areas in the prediction of the chrominance component can only select the upper adjacent area and / or the upper right adjacent area; if the luminance prediction mode of the current block is a vertical mode, then the adjacent areas in the prediction of the chrominance component can only select the left adjacent area and / or the lower left adjacent area.
[0096] Furthermore, in some embodiments, the method may further include: performing screening processing on pixels in adjacent areas to determine reference pixels.
[0097] 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 pixel. Here, the number of reference pixels can be N, where N is an integer greater than zero. In other words, N reference pixels can be selected from the pixels in the adjacent area. The value of N can generally be 4, but this is not a specific limitation.
[0098] 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 in order to obtain valid reference pixels.
[0099] In a specific embodiment, screening pixels in the adjacent area to determine the reference pixel may include:
[0100] Determining a pixel position to be selected based on positions and / or color component intensities of pixels in a neighboring area;
[0101] According to the position of the pixel to be selected, a reference pixel is determined from pixels in an adjacent area.
[0102] It should be noted that color component intensity can be represented by color component values, such as luminance and chrominance values. Here, a larger color component value indicates a higher color component intensity. Thus, filtering pixels in adjacent areas can be performed based on either pixel position or color component intensity, thereby determining the reference pixel for the current block based on the filtered pixels. The following description of filtering will use pixel position as an example.
[0103] For example, taking the INTRA_LT_CCLM mode as an example, assuming that the positions of the pixels in the upper selection area W′ are S[0,-1], ..., S[W′-1,-1], and the positions of the pixels in the left selection area H′ are S[-1,0], ..., S[-1,H′-1]; then the screening method for selecting up to 4 reference pixels is as follows:
[0104] When both the upper and left adjacent regions are valid, two pixels can be selected from the upper selection region W', with their corresponding positions being S[W' / 4, -1] and S[3W' / 4, -1]; two pixels can be selected from the left selection region H', with their corresponding positions being S[-1, H' / 4] and S[-1, 3H' / 4]; these four pixels are determined as the reference pixels of the current block, as shown in Figure 6. In Figure 6, both the left and upper adjacent regions of the current block are valid, and in order to maintain the same resolution for the luminance and chrominance components, the luminance component needs to be downsampled so that the downsampled luminance and chrominance components have the same resolution.
[0105] S502: Determine a weighting coefficient according to the reference pixel.
[0106] It should be noted that, in the embodiment of the present application, after the reference pixel is determined, the weighting coefficient can be determined according to the reference pixel and the position of the pixel to be predicted in the current block.
[0107] In some embodiments, determining the weighting coefficient according to the reference pixel may include:
[0108] Determining a first reference color component parameter according to a first reference color component relationship between the reference pixel and the pixel to be predicted in the current block;
[0109] A weighting coefficient is determined according to a first reference color component parameter using a preset first mapping.
[0110] It should be noted that the first reference color component parameter can be directly determined by the difference between the first reference color component value of the reference pixel and the first reference color component value of the pixel to be predicted. Therefore, in some embodiments, determining the first reference color component parameter based on the first reference color component relationship between the reference pixel and the pixel to be predicted in the current block may include:
[0111] Determine a difference between a first reference color component value of a reference pixel and a first reference color component value of a pixel to be predicted;
[0112] According to the difference, a first reference color component parameter is determined.
[0113] In a specific embodiment, determining the first reference color component parameter according to the difference may include: setting the first reference color component parameter to be equal to the absolute value of the difference.
[0114] In another specific embodiment, determining the first reference color component parameter according to the difference may include: setting the first color component parameter to be equal to the product of the absolute value of the difference and a preset multiplier.
[0115] It should be noted that, in the embodiment of the present application, the first reference color component may be the first color component; or, the first reference color component may be the second color component; wherein the second color component is a color component different from the first color component.
[0116] It should also be noted that the first color component is the component to be predicted in the embodiment of the present application. That is, if the first color component is a chroma component and the second color component is a luminance component, then the first color component parameter can be either chroma component information or luminance component information.
[0117] For example, assuming that the first color component is the chrominance component and the second color component is the luminance component, the embodiment of the present application mainly predicts the chrominance component of the pixel to be predicted in the current block. First, select at least one pixel to be predicted in the current block with obvious color difference, and calculate the chrominance difference between its chrominance and the reconstructed chrominance of the adjacent area (using |ΔC k | indicates); the chrominance difference of the pixels to be predicted at different positions in adjacent areas is different. The reference pixel position with the smallest chrominance difference will follow the change of the pixels to be predicted in the current block. Usually, the chrominance difference represents the similarity between chrominances. If |ΔC k | is small, indicating that the similarity of chromaticity values is relatively strong, and the corresponding weighting coefficient (using w k ) can be given a larger weight; on the contrary, if |ΔC k | is larger, indicating that the similarity of chromaticity values is weaker, w k A smaller weight can be assigned. That is, w k and |ΔC k | is approximately inversely proportional. Thus, according to |ΔC k |You can create a preset mapping relationship as shown below,
[0118] w k =f(|ΔC k |) (1)
[0119] That is, in some embodiments, determining the weighting coefficient according to the first reference color component parameter using the preset first mapping may include:
[0120] Determining a value corresponding to a first reference color component parameter under a preset functional relationship of the first mapping;
[0121] Set the weighting factor equal to the value.
[0122] Here, taking formula (1) as an example, |ΔC k | represents the first reference color component parameter, f(|ΔC k|) represents the value corresponding to the first reference color component parameter under the preset function relationship of the first mapping, w k Represents the weighting coefficient, that is, w k Set to be equal to f(|ΔC k |).
[0123] It should also be noted that, in the embodiment of the present application, if the number of reference pixels is N, then the number of weighting coefficients is also N; wherein the sum of the N weighting coefficients is equal to 1, and each weighting coefficient is a value greater than or equal to 0 and less than or equal to 1, that is, 0≤w k ≤1. However, it should be noted that "the sum of N weighting coefficients equals 1" is only a theoretical concept; in actual fixed-point implementation, the absolute value of the weighting coefficient can be greater than 1.
[0124] Understandably, in probability theory and related fields, the normalized exponential function, or Softmax function, is a generalization of the logistic function. It can "compress" an N-dimensional vector z containing arbitrary real numbers into another N-dimensional vector σ(z), so that each element ranges between (0, 1) and the sum of all elements is 1. It is often used as a nonlinear activation function for multi-class neural networks. The Softmax function is shown below.
[0125]
[0126] However, the Softmax function can satisfy w k However, its function value increases with the increase of vector elements, which does not meet the condition of w k and |ΔC k | Approximately inversely proportional relationship. Therefore, in order to adapt to w k The design and meet the requirements of w k For nonlinear expectations, we can propose a Softmax function with parameter γ to implement the f function in formula (1), as shown below:
[0127]
[0128] Among them, in order to achieve w k and |ΔC k | is approximately inversely proportional, γ can be limited to a negative number. That is, when the first reference color component parameter is |ΔC k |ΔC k |with w k The mapping relationship between them can be expressed as:
[0129]
[0130] According to formula (4), in some embodiments, determining the value corresponding to the first reference color component parameter under the preset functional relationship of the first mapping may include:
[0131] Determine the first factor;
[0132] determining a first product value according to the first factor and the first reference color component parameter;
[0133] Determine a value of the first product value corresponding to a preset functional relationship of the first mapping.
[0134] It should be noted that, in the embodiment of the present application, the first factor is a constant value less than zero. Taking the Softmax function as an example, in formula (4), γ represents the first factor, |ΔC k | represents the first reference color component parameter, γ|ΔC k | represents the first product value, w k Represents the weighting coefficient; k = 1, 2,…, N.
[0135] In a specific embodiment, determining the first factor may include: the first factor is a preset constant value.
[0136] It should be noted that, in this case, for γ, the weighted coefficient distribution of the adjacent chromaticity can be adjusted according to the relatively flat characteristics of chromaticity, so as to capture the weighted coefficient distribution suitable for natural image chromaticity prediction. In order to determine the parameter γ suitable for natural image chromaticity prediction, the given γ set is traversed, and the difference between the predicted chromaticity and the original chromaticity under different γ is used to measure whether γ is suitable or not. For example, γ can be -2 ε , where ε∈{1,0,-1,-2,-3}. Experiments have shown that the optimal value of γ in this γ set is -0.25. Therefore, in a specific embodiment, γ can be set to -0.25, but this embodiment is not specifically limited thereto.
[0137] In another specific embodiment, determining the first factor may include: determining a value of the first factor according to a size parameter of the current block.
[0138] Furthermore, in some embodiments, the method may further include: determining the value of the first factor according to a preset mapping lookup table between the size parameter of the current block and the value of the first factor.
[0139] Here, the size parameter of the current block may include at least one of the following parameters: the width of the current block, and the height of the current block.
[0140] It should be noted that the embodiment of the present application can fix the value of the first factor in a classification manner. For example, the size parameters of the current block are divided into three categories, and the value of the first factor corresponding to each category is determined. In view of this situation, the embodiment of the present application can also pre-store a lookup table mapping the size parameters of the current block and the values of the first factor, and then determine the value of the first factor based on the lookup table. For example, Table 1 shows a correspondence between a first factor and the size parameters of the current block provided by the embodiment of the present application. It should be noted that Table 1 is only an exemplary lookup table and is not a specific limitation.
[0141] Table 1
[0142] The first factor of the size parameter of the current block Min(W,H)<=4-0.125Min(W,H)>4&&Min(W,H)<=16-0.0833Min(W,H)>16-0.0625
[0143] In another specific embodiment, determining the first factor may include: determining a value of the first factor according to the number of reference pixels of the current block.
[0144] Furthermore, in some embodiments, the method may further include: determining the value of the first factor according to a preset mapping lookup table between the number of reference pixels of the current block and the value of the first factor.
[0145] It should be noted that the embodiment of the present application can divide the number of reference pixels into three categories, and still use the classification method to fix the value of the first factor. For example, the number of reference pixels of the current block can be divided into three categories, and the value of the first factor corresponding to each category is determined. In view of this situation, the embodiment of the present application can also pre-store a lookup table mapping the number of reference pixels of the current block and the value of the first factor, and then determine the value of the first factor based on the lookup table. For example, Table 2 shows a correspondence between a first factor and the number of reference pixels of the current block provided by the embodiment of the present application. It should be noted that Table 2 is only an exemplary lookup table and is not specifically limited.
[0146] Table 2
[0147] The first factor of the number of reference pixels is 0 <R<16-0.111316<=R<32-0.0773R> =32-0.0507
[0148] Furthermore, for the first product value, in a possible implementation, determining the first product value according to the first factor and the first reference color component parameter may include:
[0149] The first product value is set equal to the product of the first factor and the first reference color component parameter.
[0150] In another possible implementation, determining the first product value according to the first factor and the first reference color component parameter may include:
[0151] The first product value is set to be equal to a value obtained by right-shifting the first reference color component parameter, wherein the number of bits of the right-shift is equal to the first factor.
[0152] In yet another possible implementation, determining the first product value according to the first factor and the first reference color component parameter may include:
[0153] According to the first factor, addition and bit shift operations are performed on the first reference color component parameter to determine a first product value.
[0154] It should be noted that in an embodiment of the present application, the first product value can be equal to the product of the first factor and the first reference color component parameter, or it can be equal to the value obtained by bit right shifting the first reference color component parameter, or it can be obtained by adding and bit shifting the first reference color component parameter according to the first factor.
[0155] For example, assuming the first factor is 0.25 and the first reference color component parameter is represented by S, the first product value can be equal to 0.25×S. 0.25×S can be expressed as S / 4, that is, S>>2. Furthermore, during the fixed-point calculation process, floating-point numbers may be converted to addition and shift operations; in other words, there is no limitation on the calculation method for the first product value.
[0156] In yet another possible implementation, determining the first product value according to the first factor and the first reference color component parameter includes:
[0157] determining a second factor based on the first color component value of the reference pixel and the first reference color component value of the reference pixel;
[0158] The first product value is set to the product of the first factor, the first reference color component parameter, and the second factor.
[0159] It should be noted that when the first reference color component is the component to be predicted (i.e., the chrominance component), since the chrominance component value of the pixel to be predicted cannot be directly determined, the absolute chrominance difference between the reference pixel and the pixel to be predicted |ΔC k | cannot be obtained directly; in this case, the absolute difference in brightness between the reference pixel and the pixel to be predicted |ΔY k | to derive |ΔC k |. That is, according to |ΔY k | and the product of the second factor, we can get |ΔC k|; Thus, the first product value is equal to the first factor and |ΔC k |'s product.
[0160] Specifically, in actual prediction, |ΔC k | is unknown, but there is a strong correlation between the components in the local area of the current block. The CCLM technology in VVC uses the local correlation between brightness and chrominance to establish a prediction model, which can achieve good compression effect. For the current block, the chrominance component value C of the current pixel to be predicted (i, j) is ij The value Y can be reconstructed from the brightness ij It is estimated. The details are as follows:
[0161] C ij =αY ij +β (5)
[0162] Similarly, the adjacent chromaticity C k The corresponding brightness reconstruction value Y can also be used k It is estimated as follows,
[0163] C k =αY k +β (6)
[0164] Then, the relationship between |ΔC| and |ΔY| can be obtained by subtracting equation (5) from equation (6):
[0165] |ΔC k |=|C ij -C k |=|(αY ij +β)-(αY k +β)|=|α(Y ij -Y k )|=|αΔY k | (7)
[0166] That is, in the embodiment of the present application, for the first reference color component parameter, it can be |ΔC k |, that is, the absolute value of the difference between the first color component value of the reference pixel and the first color component value of the pixel to be predicted; or |ΔY k |, that is, the absolute value of the difference between the second color component value of the reference pixel and the second color component value of the pixel to be predicted; or it can also be |αΔY k |, that is, the product of the absolute value of the difference between the second color component value of the reference pixel and the second color component value of the pixel to be predicted and a preset multiplier, etc. The preset multiplier here is the second factor described in the embodiment of the present application.
[0167] Furthermore, for the second factor, in a possible implementation, determining the second factor according to the first color component value of the reference pixel and the first reference color component value of the reference pixel may include:
[0168] A second factor is determined by performing a least squares calculation based on the first color component value of the reference pixel and the first reference color component value of the reference pixel.
[0169] That is, assuming that the number of reference pixels is N, the first color component is the chroma component, and the first reference color component is the luminance component, then the chroma component values and the luminance component values of the N reference pixels can be calculated by least squares to obtain the second factor. For example, the least squares regression calculation is as follows:
[0170]
[0171] 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; α represents the second factor, which can be obtained by least squares regression calculation.
[0172] Furthermore, in addition to being directly determined by the absolute value of the first reference color component difference between the reference pixel and the pixel to be predicted, the first reference color component parameter can also be determined using a neural network approach. Therefore, in some embodiments, determining the first reference color component parameter based on the first reference color component relationship between the reference pixel and the pixel to be predicted in the current block can include: determining the first reference color component parameter using a first neural network model.
[0173] In a specific embodiment, it may include: the input of the first neural network model includes the first reference color component value of the reference pixel and the first reference color component value of the pixel to be predicted; the output of the first neural network model includes the first reference color component parameter.
[0174] It should be noted that in the embodiments of the present application, the preset neural network model may be a convolutional neural network, a deep learning neural network, etc. The first reference color component value of the reference pixel and the first reference color component value of the pixel to be predicted may be inputs to the preset neural network model, and the output of the preset neural network model is the first reference color component parameter.
[0175] Furthermore, with respect to the second factor, in another possible implementation, the method may further include:
[0176] Determining the number of first color component values according to the number of reference pixels of the current block;
[0177] Determine an initial value of the second factor according to the number of first color component values;
[0178] The second factor is determined based on the initial value of the second factor.
[0179] It should be noted that, in some embodiments, determining the second factor based on the initial value of the second factor may include: directly using the initial value of the second factor as the second factor; or adjusting the initial value of the second factor to obtain the second factor.
[0180] It should also be noted that, in some embodiments, determining the initial value of the second factor according to the number of first color component values may include:
[0181] If the number of first color component values is greater than zero and less than 16, the initial value of the second factor is determined to be 0.445;
[0182] If the number of first color component values is greater than or equal to 16 and less than 32, the initial value of the second factor is determined to be 0.3091;
[0183] If the number of first color component values is greater than or equal to 32, the initial value of the second factor is determined to be 0.2026.
[0184] That is, in this embodiment of the present application, for the second factor, α can be calculated using linear least squares regression from reference pixels in adjacent regions. However, on the one hand, α deviates from the theoretical optimum; on the other hand, estimating α using linear least squares regression requires additional calculations at both the encoding and decoding ends. Therefore, to further reduce the complexity of weighting coefficient calculation, α can be classified and fixed based on the size characteristics of the current block, thereby eliminating the linear least squares regression calculation process.
[0185] VVC uses a flexible block partitioning technology that supports binary tree, ternary tree, and quadtree partitioning. The minimum block size of the chroma coding unit only needs to meet the requirement that the total number of pixels is greater than or equal to 16. Therefore, the chroma coding unit in the same video image contains square blocks and rectangular blocks of various sizes, and the number of reference pixels involved in the estimation will change with the change of block size. In order to make the classification value of α concise and effective, and conform to the actual coding and decoding characteristics, the number of reference pixels is divided into three categories, each corresponding to a fixed α value. First, the average α corresponding to the number of reference pixels in these three categories (i.e., the initial value of the second factor described here) is calculated by counting the blocks encoded by VVC. Then, fine-tuning is performed with this average α as the center. Finally, the three categories of α with better coding and decoding performance can be used as the final α after fine-tuning. Table 3 shows the corresponding relationship between the chroma number R corresponding to the reference pixel and the average α.
[0186] Table 3
[0187] The average number of chromaticities R corresponding to the reference pixel is α0 <R<160.44516<=R<320.3091R> =320.2026
[0188] It should also be noted that after γ and α are determined, the weighting coefficient can be determined according to the first reference color component parameter using a preset first mapping.
[0189] In a specific embodiment, the first mapping may be a lookup table of numerical mappings between first reference color component parameters and weighting coefficients. In other words, the decoder may pre-store a lookup table of numerical mappings between first reference color component parameters and weighting coefficients. Thus, after obtaining the first reference color component parameters, the weighting coefficients may be directly determined based on the lookup table.
[0190] In another specific embodiment, the value corresponding to the first reference color component parameter under the preset functional relationship of the first mapping is determined, and then the weighting coefficient is set equal to the value.
[0191] It should be noted that the preset functional relationship of the first mapping may be a Softmax function, which is a normalized exponential function. However, in the embodiment of the present application, normalization is not required, and its value is not limited to the range of [0, 1].
[0192] For example, after γ and α are determined, since ΔY k It is known that |ΔC k |can be represented by |αΔY k | is approximately obtained, then the weighted coefficient w corresponding to the kth reference pixel k It can be calculated by the following formula:
[0193]
[0194] Where γ<0. In addition, assuming s = γ·α, then formula (9) can be simplified as follows,
[0195]
[0196] Here, s<0. Thus, a corresponding scaling factor (expressed as scale) can also be selected according to the size parameter of the current block, where s=-1 / scale.
[0197] For example, for the size parameters of the current block, if the minimum value of the length and height is less than or equal to 4, then the value of scale is equal to 8; if the minimum value of the length and height is greater than 4 and less than or equal to 16, then the value of scale is equal to 12; if the minimum value of the length and height is greater than 16, then the value of scale is equal to 16.
[0198] It should be noted that, for the preset functional relationship of the first mapping, in addition to the Softmax function, in other embodiments, the preset functional relationship of the first mapping may be a weighting function having an inversely proportional relationship with the first reference color component parameter.
[0199] The Softmax function in formula (10) can be replaced as follows,
[0200]
[0201] Wherein, k=1, 2, ... N, offset=1 or 2 or 0.5 or 0.25.
[0202] Alternatively, in another possible implementation, the Softmax function in formula (10) can be replaced as follows:
[0203]
[0204] Wherein, k=1, 2, ... N, offset=1 or 2 or 0.5 or 0.25.
[0205] In this way, the preset functional relationship of the first mapping can be as shown in formula (10), or as shown in formula (11), or as shown in formula (12), or even other functional models that can fit the trend that the closer the brightness information of the reference x pixel is to the pixel to be predicted in the current block, the higher the importance of the chrominance of the reference pixel to the pixel to be predicted in the current block is to construct weighted coefficients, etc., and the embodiments of the present application do not make specific limitations.
[0206] In this way, the weighting coefficients can be determined according to the positions of the reference pixel and the pixel to be predicted in the current block, which may include: w1, w2, ..., w N N weighting coefficients are used, where N represents the number of reference pixels. In theory, the sum of these N weighting coefficients is equal to 1, and each weighting coefficient is a value greater than or equal to 0 and less than or equal to 1.
[0207] S503: Perform weighted calculation on the first color component value of the reference pixel according to the weighting coefficient to determine a predicted value of the first color component of the pixel to be predicted in the current block.
[0208] It should be noted that after the weighting coefficient is determined, the weighting coefficient can be used to perform weighted calculation on the first color component value of the reference pixel, thereby obtaining the predicted value of the first color component of the pixel to be predicted in the current block.
[0209] It should also be noted that, in some embodiments, performing weighted calculation on the first color component value of the reference pixel according to the weighting coefficient to determine the predicted value of the first color component of the pixel to be predicted in the current block may include:
[0210] Determining a weighted value of a first color component value of a reference pixel and a corresponding weighting coefficient;
[0211] The predicted value of the first color component of the pixel to be predicted in the current block is set to be equal to the sum of N weighted values; wherein N represents the number of reference pixels and N is a positive integer.
[0212] That is, if the number of reference pixels is N, then first determine the weighted value of the first color component value of each reference pixel and the corresponding weighting coefficient (ie, w k C k ), and then the sum of these N weighted values is used as the predicted value of the first color component of the pixel to be predicted in the current block. Specifically, its calculation formula is as follows:
[0213]
[0214] For example, if the first reference color component is the luminance component, then the absolute luminance difference is first calculated based on the luminance component at position (i, j) in the current block and the luminance component of the reference pixel. Then, the weighting coefficient is calculated using the Softmax function, and the predicted value of the chrominance component at position (i, j) in the current block can be obtained using Equation (13). In particular, it should be noted that this method is conducive to parallel processing and can speed up the calculation.
[0215] In addition, it can also be understood that, assuming that the component to be predicted (i.e., the first color component) is a chroma component and the first reference color component (i.e., the second color component) is a luminance component, then considering the inconsistency of resolution, in an embodiment of the present application, the method may also include: downsampling the reference pixel and the first reference color component of the pixel to be predicted in the current block so that the resolution of the first reference color component is the same as the resolution of the component to be predicted.
[0216] In other words, if the resolution of the luma component is different from that of the chroma components, the luma component can be downsampled to align the resolution of the chroma components. The downsampling method can be a traditional filter coefficient method or a neural network method, and is not specifically limited in the present embodiment.
[0217] In short, the embodiment of the present application proposes a new chroma prediction technology that can improve the accuracy of chroma prediction. Specifically, a weighting coefficient is calculated by combining the luminance information of the reference pixels in the adjacent area and the pixels to be predicted in the current block, and this weighting coefficient is used to predict the chroma of the pixels to be predicted in the current block. In addition, in addition to the luminance / chroma of the adjacent areas, the luminance of the current block is also available in the prediction process of the current block. The embodiment of the present application fully exploits the correlation between the luminance information of the current block and the adjacent areas, and uses this correlation to predict the chroma of the current block, thereby improving the accuracy of chroma prediction. This method is tested on the latest reference software ECM3.1 at 48 frame intervals under All Intra conditions, and can obtain BD-rate changes of -0.10%, -0.74%, and -0.61% on Y, Cb, and Cr, respectively, that is, the average bit rate change under the same Peak Signal to Noise Ratio (PSNR). Especially on high-resolution sequences, it has better performance, and can achieve a BD-rate change of -0.24% on Class A1.
[0218] This embodiment provides a decoding method that determines a reference pixel for a current block; determines a weighting coefficient based on the reference pixel; and performs a weighted calculation on the first color component value of the reference pixel based on the weighting coefficient to determine a predicted value of the first color component of a pixel to be predicted in the current block. In this way, the weighting coefficient corresponding to the pixel to be predicted in the current block can be calculated using the color component information of the reference pixel and the pixel to be predicted in the current block. Furthermore, different pixels to be predicted can have different weighting coefficients. These weighting coefficients are applied to the chrominance prediction of the pixel to be predicted in the current block, thereby improving the accuracy of chrominance prediction, saving bitrate, and enhancing encoding and decoding performance.
[0219] In another embodiment of the present application, referring to FIG7 , which shows a second flow chart of a decoding method provided by an embodiment of the present application. As shown in FIG7 , the method may include:
[0220] S701: Determine reference pixels of the current block.
[0221] It should be noted that in the embodiments of the present application, reference pixels may refer to reference pixels adjacent to the current block. Thus, according to the adjacent region distribution diagram shown in FIG1 , the embodiments of the present application can determine reference pixels from pixels in the left adjacent region, the lower left adjacent region, the upper adjacent region, and the upper right adjacent region that can be obtained from the current block, and then use the reference pixels to predict the color components of the current block.
[0222] It should also be noted that, in the embodiment of the present application, taking the prediction of the chrominance component of the current block as an example, the acquisition of reference pixels can also be: (1) the adjacent area can be multiple rows / columns. (2) the reference pixel points in some adjacent areas can be selected to participate in the prediction of the chrominance component of the current block. For example, only the upper adjacent area or only the left adjacent area, or only the upper + upper right adjacent area, or only the left + lower left adjacent area, or only the upper + left adjacent area, or only the upper + upper right + left adjacent area, or only the left + lower left + upper adjacent area, etc., that is, the reference pixel points of the four adjacent areas of the left, lower left, upper, and upper right that can be obtained by the current block participate in the prediction of the chrominance component of the current block. (3) The selection method of the adjacent area can also be determined according to the brightness prediction mode of the current block. For example, if the luminance prediction mode of the current block is a horizontal mode, the adjacent area in the chrominance prediction may only select the upper adjacent area or the upper right adjacent area; if the luminance prediction mode of the current block is a vertical mode, the adjacent area in the chrominance prediction may only select the left adjacent area or the lower left adjacent area; however, the embodiments of the present application do not make specific limitations.
[0223] S702: Determine a second color component parameter according to a second color component relationship between a reference pixel and a pixel to be predicted in a current block.
[0224] It should be noted that, for the determination of the second color component parameter, in a possible implementation method, determining the second color component parameter based on the second color component relationship between the reference pixel and the pixel to be predicted in the current block may include: determining the difference between the second color component value of the reference pixel and the second color component value of the pixel to be predicted, and setting the second color component parameter to be equal to the absolute value of the difference.
[0225] For example, assuming that the first color component is the chrominance component and the second color component is the brightness component, the second color component parameter can also be called brightness information. For the acquisition of brightness information, after determining the reference pixel of the current block, the brightness component of the reference pixel can be subtracted from the brightness component of the pixel to be predicted (i, j) in the current block and then the absolute value is taken to obtain the second color component parameter (i.e., the absolute brightness difference value |ΔY kij |), k represents the kth reference pixel, |ΔY kij The calculation of | is as follows,
[0226] |△Y kij |=abs(Y ij -Y k ),k=1,2,…N (14)
[0227] In another possible implementation, determining the second color component parameter based on the second color component relationship between the reference pixel and the pixel to be predicted in the current block may include: inputting the second color component value of the reference pixel and the second color component value of the pixel to be predicted into a preset neural network, and outputting the second color component parameter through the preset neural network.
[0228] In another possible implementation, determining the second color component parameter based on the second color component relationship between the reference pixel and the pixel to be predicted in the current block may include: performing a similarity comparison between the second color component value of the reference pixel and the second color component value of the pixel to be predicted, and determining the second color component parameter based on the comparison result.
[0229] Still taking the acquisition of brightness information as an example, first, if the resolution of the Y component is different from that of the U or V component, the Y component can be downsampled to align the resolution of the U or V component. The downsampling method here can be in the form of traditional filter coefficients or neural network, etc.
[0230] Secondly, when obtaining brightness information, in addition to directly taking the difference between the brightness component value of the reference pixel and the brightness component value of the pixel to be predicted in the current block and then taking the absolute value as the obtained brightness information, the brightness component value of the reference pixel and the brightness component value of the pixel to be predicted in the current block can also be used as the input of a preset neural network, and the output of the preset neural network is used as the obtained brightness information.
[0231] Again, when obtaining brightness information, in addition to directly taking the difference between the brightness of the reference pixel and the brightness of the pixel to be predicted in the current block and then taking the absolute value as the obtained brightness information, the brightness component value of the k-th reference pixel and the pixel to be predicted in the current block can also be compared for similarity, that is, it is determined whether the k-th reference pixel is the reference pixel closest to the brightness component value of the pixel to be predicted in the current block as the obtained brightness information; for example, if the k-th reference pixel is the closest, the brightness information of the k-th reference pixel is set to 1, otherwise it is set to 0.
[0232] S703: Scale the second color component parameter using the third factor to determine the adjusted second color component parameter.
[0233] It should be noted that after obtaining the brightness information, the scale can be adjusted. The brightness information here is expressed as |△Y kij | as an example, then we can use the third factor to calculate N |△Y kij | Make scale adjustments.
[0234] In a possible implementation, the absolute brightness difference value |△Y corresponding to the pixel to be predicted in the current block with different size parameters is kij|, the scale can be adjusted by different third factors. Specifically, in some embodiments, the method may further include:
[0235] Determine the size parameters of the current block;
[0236] The third factor is determined according to a size parameter of the current block, wherein the size parameter of the current block includes at least one of the following parameters: a width of the current block and a height of the current block.
[0237] In a specific embodiment, determining the third factor according to the size parameter of the current block may include:
[0238] If the minimum value of the height and width of the current block is less than or equal to 4, the third factor is determined to be 8;
[0239] 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 third factor is determined to be 12;
[0240] If the minimum value of the height and width of the current block is greater than 16, the third factor is determined to be 16.
[0241] It should be noted that, in the embodiment of the present application, the value of the third factor (denoted by θ) can be fixed in a classified manner. In addition, the height of the current block is denoted by H, and the width of the current block is denoted by W. Table 4 shows a correspondence between the third factor θ and the size parameters of the current block provided in the embodiment of the present application.
[0242] Table 4
[0243] The third factor of the size parameter of the current block Min(W,H)<=48Min(W,H)>4&&Min(W,H)<=1612Min(W,H)>1616
[0244] In another specific embodiment, during the scale adjustment, the correspondence between the third factor θ and the size parameter of the current block can be fine-tuned. Table 5 shows another correspondence between the third factor θ and the size parameter of the current block provided in an embodiment of the present application.
[0245] Table 5
[0246] The third factor of the size parameter of the current block Min(W,H)<=48Min(W,H)>4&&Min(W,H)<1612Min(W,H)>=1616
[0247] In another specific embodiment, during the scale adjustment, the classification value of the third factor θ may be fine-tuned. In some embodiments, determining the third factor based on the size parameter of the current block may include:
[0248] If the minimum value of the height and width of the current block is less than or equal to 4, the third factor is determined to be 7;
[0249] 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 third factor is determined to be 11;
[0250] If the minimum value of the height and width of the current block is greater than 16, the third factor is determined to be 15.
[0251] That is, by fine-tuning the classification value of the third factor θ, Table 6 shows another correspondence between the third factor θ and the size parameter of the current block provided in an embodiment of the present application.
[0252] Table 6
[0253] The third factor of the size parameter of the current block Min(W,H)<=47Min(W,H)>4&&Min(W,H)<=1611Min(W,H)>1615
[0254] In another possible implementation, during the scale adjustment, the third factor may be further classified according to the number of reference pixels of the current block. Here, N represents the number of reference pixels. In some embodiments, the method may further include:
[0255] If the value of N is less than 16, the third factor is determined to be 8;
[0256] If the value of N is greater than or equal to 16 and less than 32, the third factor is determined to be 12;
[0257] If the value of N is greater than or equal to 32, the third factor is determined to be 16.
[0258] That is, classification is performed according to the number of reference pixels of the current block. Table 7 shows a corresponding relationship between a third factor θ and the number of reference pixels provided in an embodiment of the present application.
[0259] Table 7
[0260] The third factor of the number of reference pixels N<168N>=16&&N<3212N>=3216
[0261] In another possible implementation, during the scale adjustment, the third factor may also be calculated in another way. In some embodiments, the method may further include:
[0262] determining a first model parameter of the current block;
[0263] Scaling the first model parameter to obtain the scaled first model parameter;
[0264] The third factor is obtained by performing the inverse calculation on the scaled first model parameter.
[0265] That is, in the embodiment of the present application, a prediction model is constructed based on the luminance and chrominance of the reference pixels of the current block (the CCLM linear model construction scheme in the related art can be used, or the least squares method or weighted least squares method can be used to construct the prediction model) to calculate the first model parameter (i.e., the slope parameter, represented by α). This parameter α is scaled and then the inverse is taken as the third factor θ of the current block. For example, the value of the third factor θ can be obtained by dividing α by 4, scaling it, and then taking the inverse.
[0266] It's also important to note that during rescaling, the number of categories in the third factor θ can be adjusted based on performance requirements. For example, the θ classification can be more refined, increasing the number of θ categories to improve prediction accuracy. Alternatively, the number of θ categories can be reduced, or even the same θ can be used for all current blocks. Furthermore, θ can be unified to the average of the aforementioned multiple θ categories, eliminating further classification. This simplifies operations, but reduces prediction accuracy.
[0267] S704: Using the preset second mapping, determine a weighting coefficient according to the adjusted second color component parameter.
[0268] It should be noted that after obtaining brightness information and performing rescaling, weighting coefficients can be calculated using a preset second mapping. The preset second mapping is a nonlinear mapping. Assuming the number of reference pixels in the current block is N, N second color component parameters can be obtained. After rescaling, N adjusted second color component parameters can be obtained. Thus, the number of weighting coefficients calculated using the nonlinear mapping is also N.
[0269] Specifically, in the embodiment of the present application, a function model for weighted coefficient calculation can be constructed based on the trend that the closer the luminance information of the reference pixel is to the pixel to be predicted (i, j) in the current block, the more important the chrominance of the reference pixel is to the pixel to be predicted (i, j). Here, the Softmax function is selected as the f model, and the absolute luminance difference value is scaled and then further mapped to the chrominance weighted coefficient through the Softmax function. Specifically, the N absolute luminance difference values corresponding to the pixel to be predicted (i, j) |△Y kij After the scale is adjusted, it is negative; in this way, N |△Y kij After rescaling, the negative absolute brightness difference is mapped to the weighted coefficient w corresponding to each of the N reference pixels through the Softmax function. kij , and its calculation formula is as follows,
[0270]
[0271] It should also be noted that in the embodiment of the present application, for the f model, other function models for weighted coefficient calculation can also be used to fit the trend that the closer the brightness information of the reference pixel is to the pixel to be predicted in the current block, the more important the chromaticity of the reference pixel is to the pixel to be predicted.
[0272] For example, in one possible implementation, the Softmax function in equation (15) can be replaced as follows:
[0273]
[0274] Wherein, k=1, 2, ... N, offset=1 or 2 or 0.5 or 0.25.
[0275] Alternatively, in another possible implementation, the Softmax function in formula (15) can be replaced as follows:
[0276]
[0277] Wherein, k=1, 2, ... N, offset=1 or 2 or 0.5 or 0.25.
[0278] In this way, the preset second mapping can be as shown in formula (15), or as shown in formula (16), or as shown in formula (17), or even other function models that can fit the above trend to construct weighted coefficient calculation, etc., and the embodiments of the present application do not make specific limitations.
[0279] In addition, in some embodiments, both the preset first mapping and the preset second mapping can simplify operations, for example, by using an array element lookup table to reduce some computational operations. For the first mapping, the following steps can be performed: determining an array element value based on a preset lookup table mapping the first reference color component parameter, the first factor, and the array element; then determining the value corresponding to the array element value under the preset functional relationship of the first mapping; and then setting the weighting coefficient equal to the value.
[0280] For the second mapping, it can be: determining the array element value based on the preset mapping lookup table of the second color component parameter, the third factor and the array element; then determining the value corresponding to the array element value under the preset functional relationship of the second mapping; and then setting the weighting coefficient equal to the value.
[0281] Specifically, taking the second mapping as an example, the f model for calculating the weighted coefficient can be implemented by simplified operations, such as a table lookup method. k ij=f(|ΔY rij|). Here, the numerator in the f model can be expressed as the independent variable |ΔY rij The number of | and θ types are stored as array indices. Subsequent operations in the f model that are the same as the numerator calculation are obtained by looking up the table, thus avoiding the calculation operations of the numerator and denominator.
[0282] It should be noted that, in the embodiment of the present application, the storage here can be divided into complete storage or partial storage.
[0283] In a specific embodiment, full storage is to store |ΔY rij |The range of values and the number of θ species are all stored. Under full storage, it is necessary to open up (|ΔYr ij |value range multiplied by the number of θ types) of array space. Among them, the required storage array size is |ΔY rij |The value range size, the performance remains unchanged.
[0284] For example, taking 10-bit pixels and formula (15) as an example, the variable |ΔY rij The value range is an integer between 0 and 1023, the number of θ types is 3, and the value of |ΔY rij | and the number of θ species as indices into the two-dimensional array storMole to fully store the molecule:
[0285]
[0286] At this time, the calculation of the weighted coefficient of formula (15) can be simplified as follows:
[0287]
[0288] Thus, the elements of the two-dimensional array storMole[index 1][index 2] are as shown in Table 8.
[0289] Table 8
[0290]
[0291] Furthermore, the complete storage can also set the corresponding array offset according to the classification of θ, and then according to (|ΔY rij | plus offset) as the index of the one-dimensional array ostorMole to fully store the molecule, as shown below:
[0292]
[0293] At this time, the calculation of the weighted coefficient of formula (15) can be simplified as follows:
[0294]
[0295] Thus, the elements of the one-dimensional array ostorMole[index] are shown in Table 9.
[0296] Table 9
[0297]
[0298] In another specific embodiment, partial storage is to select and store part of all numerator values in the calculation weight coefficients, and |ΔY rij |Part of the range and / or the molecular values of some types of θ are stored. The f model values outside the selected range default to 0. The required storage array size is (the selected |ΔY rij |The value range is multiplied by the number of selected types of θ).
[0299] For example, taking 10-bit pixels and formula (15) as an example, assuming that |ΔY rij The range of values is 0 to 99 integers, and the numerator values of 3 kinds of θ are partially stored, then |ΔY rij The value range is an integer between 0 and 99, and the number of θ types is 3. Therefore, ΔY rij | and the number of θ species as indices into the two-dimensional array partstorMole to store molecules:
[0300]
[0301] At this time, the calculation of the weighted coefficient of formula (15) can be simplified as follows:
[0302]
[0303] Thus, the elements of the two-dimensional array partstorMole[index 1][index 2] are as shown in Table 10.
[0304] Table 10
[0305]
[0306] That is to say, the storage range of some storage can be stored according to actual needs, not limited to the |ΔY in the example rij |Within 100 integers, there are 3 types of θ; partial storage can also set corresponding offsets for selected parts of θ types to open up one-dimensional storage space for storage, and the embodiment of the present application does not impose any limitation on this.
[0307] S705: Perform weighted calculation on the first color component value of the reference pixel according to the weighting coefficient to determine a predicted value of the first color component of the pixel to be predicted in the current block.
[0308] It should be noted that after obtaining the brightness information, scale adjustment and weighted coefficients calculated by nonlinear mapping, the chrominance prediction value of the pixel to be predicted can be further calculated. Specifically, the chrominance component values C of the N reference pixels are k The weighted coefficients obtained in the above steps are used for weighted calculation to obtain the chrominance prediction value of the pixel (i, j) to be predicted in the current block. The details are as follows:
[0309]
[0310] It should also be noted that w kij The following conditions must be met: 1ij +w 2ij +…+w Nij =1; and 0≤w kij ≤1, and w kij It can be determined based on the absolute luminance difference, which has nonlinear characteristics. This not only fully considers the difference between luminance information and chrominance information at different block sizes, but also fully considers the trend that the closer the luminance information of the reference pixel is to the pixel to be predicted in the current block, the more important the chrominance of the reference pixel is to the pixel to be predicted, thereby improving the accuracy of chrominance prediction.
[0311] In addition, the embodiment of the present application can also use the brightness information of the pixels in the adjacent area and the current block to assign weights to the pixels in the adjacent area, and use the reference pixels with weight characteristics to perform weighted least mean square (Least Mean Square, LMS) to derive the first model parameters and the second model parameters for CCLM prediction, thereby also improving the accuracy of chrominance prediction.
[0312] Specifically, in some embodiments, FIG8 shows a flowchart diagram of a decoding method provided by an embodiment of the present application. As shown in FIG8 , taking the first reference color component as the second color component as an example, after S701 , the method may further include:
[0313] S801: Determine a difference between a second color component value of a reference pixel and a second color component value of a pixel to be predicted in a current block.
[0314] S802: Using a preset second mapping, determine a weight value of the reference pixel to the pixel to be predicted in the current block according to the difference.
[0315] S803: Determine a target weight value of the reference pixel in the current block according to the weight value of the reference pixel to the pixel to be predicted in the current block.
[0316] S804: Perform a weighted least squares calculation on the first color component value of the reference pixel and the first reference color component value of the reference pixel according to the target weight value to determine a first model parameter and a second model parameter.
[0317] S805: Construct a prediction model according to the first model parameter and the second model parameter.
[0318] S806: Use the prediction model to predict the first color component of the pixel to be predicted in the current block, and determine the predicted value of the first color component of the pixel to be predicted in the current block.
[0319] It should be noted that, in the embodiment of the present application, the first model parameter is represented by α and the second model parameter is represented by β. In the following, the first color component is the chroma component and the second color component is the luminance component as an example, that is, the chroma component of the current block is predicted.
[0320] First, we need to modify the two model parameters α and β. The steps are as follows:
[0321] (1) Obtain brightness information.
[0322] Obtain N reference pixels used to derive α and β in CCLM technology, subtract the brightness of these N reference pixels from the brightness of the pixel to be predicted (i, j) in the current block, and then take the absolute value to obtain N absolute brightness difference values |△Y rij |, r represents the r-th reference pixel used to derive α and β:
[0323] |△Y rij |=abs(Y ij -Y r ),r=1,2,…,N (25)
[0324] (2) Nonlinear mapping calculates the importance weight w of each reference pixel to each pixel to be predicted rij .
[0325] The function model f is constructed based on the trend that the closer the brightness information of the reference pixel is to the pixel to be predicted (i, j) in the current block, the higher the importance of the chrominance of the reference pixel to the predicted pixel (i, j). The importance weight of the reference pixel at the rth reference point to the predicted pixel (i, j) is calculated as follows:
[0326]
[0327] (3) Calculate the importance weight w of each reference pixel in the current block r .
[0328] According to formula (18), the importance weight w of each reference pixel to each pixel to be predicted is calculated rij, the importance weight w of the rth reference pixel in the current block r By w rij The average is as follows:
[0329]
[0330] (4) The model parameters α and β are derived by weighted LMS.
[0331] According to the importance weight of each reference pixel in the current block obtained by formula (21), the luminance and chrominance of N reference pixels are weighted least squares to solve α and β, as follows:
[0332]
[0333]
[0334] Among them, L r and C r It is the luminance component value and chrominance component value of N reference pixels obtained in CCLM technology.
[0335] Secondly, the α and β obtained by weighted LMS derivation using reference pixels with weight characteristics are used for CCLM prediction.
[0336] Specifically, in order to reduce the redundancy between the luminance component and the chrominance component, the inter-component linear model prediction method is used in VVC. That is, the luminance reconstruction value of the same current block is used to construct the chrominance prediction value, as shown below:
[0337] Pred C (i, j) = α·Rec L (i,j)+β (30)
[0338] Among them, Pred C (i, j) represents the chroma prediction value of the current block, Rec L (i, j) represents the (downsampled) brightness reconstruction value in the same current block; in addition, α and β are model parameters, which can be derived from the reference pixels in the adjacent area through the above-mentioned weight allocation scheme and weighted LMS.
[0339] It should also be noted that, for the second mapping, the above calculation w rij The function model f can also use other functions that can fit the trend that the closer the brightness information of the reference pixel is to the pixel to be predicted in the current block, the more important the chrominance of the reference pixel is to the pixel to be predicted. For example, it can be replaced by:
[0340]
[0341] Furthermore, in some embodiments, for S803, determining the target weight value of the reference pixel in the current block according to the weight value of the reference pixel to the pixel to be predicted in the current block may include:
[0342] Calculate the average value of the weight values of the pixels to be predicted in the current block based on the reference pixels to determine the target weight value of the reference pixels in the current block;
[0343] or,
[0344] The weight values of the pixels to be predicted in the current block are summed up according to the reference pixels to determine the target weight value of the reference pixels in the current block.
[0345] Furthermore, in some embodiments, for S803, the method may further include:
[0346] determining the number of minimum values from absolute values of the differences based on a difference between a first reference color component value of the reference pixel and a first reference color component value of a pixel to be predicted in the current block;
[0347] The number of minimum values is used as the target weight value of the reference pixel in the current block.
[0348] That is to say, for the importance weight of the current block (i.e., the "target weight value", w r In addition to using the average value shown in formula (27), the sum can also be used as the importance weight w of the current block. r , specifically as follows,
[0349]
[0350] In addition, the importance weight w of each reference pixel in the current block r We can also count the number of reference pixels with the smallest difference in brightness component value between the pixel to be predicted and the current block, and use it as the importance weight of the current block w r , specifically as follows,
[0351]
[0352]
[0353] Furthermore, in some embodiments, for the derivation of α and β, before constructing the prediction model based on the first model parameter and the second model parameter, the method may further include:
[0354] comparing the second color component values of N reference pixels;
[0355] Determining, based on the comparison result, a first sub-reference pixel set with relatively large second color component values and a second sub-reference pixel set with relatively small second color component values;
[0356] Calculating an average value on the first sub-reference pixel set to obtain a first fitting pixel; and calculating an average value on the second sub-reference pixel set to obtain a second fitting pixel;
[0357] Model parameters are calculated according to the first fitting pixels and the second fitting pixels to obtain first model parameters and second model parameters.
[0358] In other words, the current CCLM technology can be divided into two sub-reference point sets through comparison: a sub-reference point set with a larger luminance component value and a sub-reference point set with a smaller luminance component value. The two sub-reference point sets are averaged to obtain two mean reference points (i.e., two fitting pixels). The model parameters α and β can also be derived based on these two fitting pixels.
[0359] Specifically, after obtaining two fitting pixels (L min , C min ) and (L max , C max ) After that, the model parameters can be obtained from these two fitting pixels through the calculation method of "two points determine a straight line". Specifically, the calculation of model parameters α and β is as follows,
[0360]
[0361] Furthermore, in some embodiments, calculating the model parameters based on the first fitting pixels and the second fitting pixels to obtain the first model parameters and the second model parameters may include:
[0362] After determining the target weight value of each of the N reference pixels in the current block, determining a target weight value set corresponding to the first sub-reference pixel set and a target weight value set corresponding to the second sub-reference pixel set;
[0363] Normalizing the target weight value set corresponding to the first sub-reference pixel set to obtain a first weight mean; and normalizing the target weight value set corresponding to the second sub-reference pixel set to obtain a second weight mean;
[0364] A weighted least squares method is performed on the first fitting pixel and the second fitting pixel using the first weighted mean and the second weighted mean to obtain a first model parameter and a second model parameter.
[0365] That is to say, the importance weight w of each reference pixel in the current block is calculated according to the above rThe importance weights of the reference pixels are also divided into two sub-importance weight sets according to the classification scheme in the current CCLM technology. The weights in each sub-importance weight set are normalized to obtain the weights corresponding to the reference pixels in each sub-reference point set. Then, the two sub-reference point sets are weightedly combined according to the weights in their corresponding normalized sub-importance weight sets to obtain two weighted average reference points. Then, α and β are derived based on these two weighted average reference points.
[0366] It should also be noted that in the embodiments of this application, CCLM technology has undergone multiple evolutions, from the early stage of deriving α and β using LMS from the luminance and chromaticity of reference pixels in adjacent areas such as the upper side, upper right side, left side, and lower left side, to the current method of selecting only four reference pixels from the adjacent areas and calculating α and β using the maximum-minimum method. In addition, the weight calculation method described in the above embodiments can be applied to the derivation of model parameters α and β of CCLM technology in any version.
[0367] In addition, before constructing the prediction model according to the first model parameters and the second model parameters, the method may further include: parsing the code stream to determine the first model parameters and the second model parameters.
[0368] That is, the encoder can determine the model parameters α and β according to the above scheme and write them into the bitstream; thus, the decoder can obtain the model parameters α and β directly through decoding without the need for model parameter calculation.
[0369] Furthermore, in some embodiments, the method may further include:
[0370] Parse the code stream to determine the residual value of the first color component of the pixel to be predicted in the current block;
[0371] A reconstructed value of the first color component of a to-be-predicted pixel in the current block is determined according to the residual value of the first color component and the predicted value of the first color component.
[0372] It should be noted that after determining the predicted value of the first color component of the pixel to be predicted in the current block, the residual value of the first color component of the pixel to be predicted in the current block can be obtained by parsing the code stream; in this way, based on the residual value of the first color component and the predicted value of the first color component, the residual value of the first color component and the predicted value of the first color component can be specifically added together, so as to determine the reconstructed value of the first color component of the pixel to be predicted in the current block.
[0373] In summary, the embodiments of the present application propose a chroma prediction technique, specifically a chroma intra-frame prediction technique. The implementation principle is to calculate weighted coefficients using known reference pixels and the luminance information of the current block, and use these weighted coefficients in predicting the chroma of the current block. Here, the chroma component values of the reference pixels are weightedly predicted to obtain the predicted chroma component values of the pixels to be predicted in the current block. The weighted coefficients corresponding to the chroma component values of the reference pixels can be obtained by scaling and nonlinearly mapping the luminance information of the current pixel to be predicted and the reference pixels. Thus, in the embodiment of the present application, on the one hand, the luminance information of the reference pixel and the current block can be fully utilized to realize the calculation of the weighted coefficient corresponding to the chrominance component value of the reference pixel; on the other hand, the difference characteristics of the luminance information and the chrominance information under different block sizes are fully considered, and the luminance information is scaled according to the size parameters of the current block to improve the effectiveness of the weighted coefficient; on the other hand, the trend that the closer the luminance information of the reference pixel is to the pixel to be predicted in the current block, the higher the importance of the chrominance of the reference pixel to the pixel to be predicted is, is fully considered, and an effective and accurate mapping model f is constructed. Different weighted coefficients corresponding to the chrominance of the reference pixel can be designed for different pixels to be predicted, further improving the accuracy of chrominance prediction.
[0374] This embodiment provides a decoding method, and the specific implementation of the aforementioned embodiment is elaborated in detail through this embodiment. It can be seen that according to the technical solution of the aforementioned embodiment, the color component information of the reference pixel and the pixel to be predicted can be used to calculate the corresponding weighting coefficient of the pixel to be predicted; and different pixels to be predicted can have different weighting coefficients. This weighting coefficient is applied to the chrominance prediction of the pixel to be predicted in the current block, thereby not only improving the accuracy of the chrominance prediction and saving the bit rate, but also improving the encoding and decoding performance.
[0375] In another embodiment of the present application, referring to FIG9 , which shows a flow chart of a coding method provided in an embodiment of the present application. As shown in FIG9 , the method may include:
[0376] S901: Determine reference pixels of the current block.
[0377] It should be noted that the encoding method in the embodiment of the present application is applied to an encoder. In addition, the encoding method may specifically refer to an intra-frame prediction method, more specifically, a color component prediction method. A video image may be divided into multiple encoding and decoding blocks, each encoding block may include a first color component, a second color component, and a third color component, and the current block in the embodiment of the present application refers to the encoding block in the video image that is currently to be intra-frame predicted.
[0378] Here, when the first color component needs to be predicted, the component to be predicted is the first color component; when the second color component needs to be predicted, the component to be predicted is the second color component; when the third color component needs to be predicted, the component to be predicted is the third color component. In addition, assuming that the current block predicts the first color component and the first color component is the luminance component, that is, the component to be predicted is the luminance component, then the current block can also be called a luminance block; or assuming that the current block predicts the second color component and the second color component is the chrominance component, that is, the component to be predicted is the chrominance component, then the current block can also be called a chrominance block.
[0379] It should also be noted that, in the embodiments of the present application, the reference pixel (Reference Sample) of the current block may refer to a reference pixel point adjacent to the current block; wherein, adjacent here may be spatially adjacent, but is not limited to this. For example, adjacent may also mean temporal adjacent, spatially and temporally adjacent, or even the reference pixel of the current block may be a reference pixel obtained by performing some processing on spatially adjacent, temporally adjacent, or spatially and temporally adjacent reference pixels, etc., and the embodiments of the present application do not impose any limitation thereto.
[0380] In some embodiments, determining the reference pixel of the current block may include:
[0381] The reference pixel is determined based on pixels in an adjacent area of the current block; wherein 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.
[0382] Specifically, in an embodiment of the present application, the reference pixels are determined based on the pixels in the adjacent areas of the current block, and the following methods may be used: a first reference pixel set is formed based on the pixels in the adjacent areas of the current block; and then the reference pixels are determined from the first reference pixel set. In this way, when the left adjacent area, the lower left adjacent area, the upper adjacent area, and the upper right adjacent area are all valid areas, for the INTRA_LT_CCLM mode, the first reference pixel set may be composed of pixels in the left adjacent area and the upper adjacent area of the current block, as shown in FIG2(a); for the INTRA_L_CCLM mode, the first reference pixel set may be composed of pixels in the left adjacent area and the lower left adjacent area of the current block, as shown in FIG2(b); for the INTRA_T_CCLM mode, the first reference pixel set may be composed of pixels in the upper adjacent area and the upper right adjacent area of the current block, as shown in FIG2(c).
[0383] It should also be noted that, in the embodiment of the present application, the adjacent area of the current block may include multiple rows or multiple columns. For example, the left adjacent area or the lower left adjacent area may include one or more columns, and the upper adjacent area or the upper right adjacent area may include one or more rows.
[0384] It should also be noted that, in an embodiment of the present application, pixels in some areas can be selected from these adjacent areas to participate in the color component prediction of the current block. For example, only the upper adjacent area, or only the left adjacent area, or only the upper adjacent area and the upper right adjacent area, or only the left adjacent area and the lower left adjacent area, or only the upper adjacent area and the left adjacent area, or only the upper adjacent area, the upper right adjacent area and the left adjacent area, or only the left adjacent area, the lower left adjacent area and the upper adjacent area, etc. In this way, the reference pixels of the four adjacent areas of the left, lower left, upper and upper right that can be obtained by the current block participate in the color component prediction of the current block.
[0385] It should also be noted that, in the embodiment of the present application, the selection method of the adjacent area can also be determined according to the prediction mode of the current block. In a specific embodiment, it can include:
[0386] If the prediction mode of the current block is the horizontal mode, the reference pixel is determined according to the pixels in the upper adjacent area and / or the upper right adjacent area;
[0387] If the prediction mode of the current block is the vertical mode, the reference pixel is determined according to the pixels in the left adjacent area and / or the lower left adjacent area.
[0388] Exemplarily, if the luminance prediction mode of the current block is a horizontal mode, then the adjacent areas in the prediction of the chrominance component can only select the upper adjacent area and / or the upper right adjacent area; if the luminance prediction mode of the current block is a vertical mode, then the adjacent areas in the prediction of the chrominance component can only select the left adjacent area and / or the lower left adjacent area.
[0389] Furthermore, in some embodiments, the method may further include: performing screening processing on pixels in adjacent areas to determine reference pixels.
[0390] 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 pixel. Here, the number of reference pixels can be N, where N is an integer greater than zero. In other words, N reference pixels can be selected from the pixels in the adjacent area. The value of N can generally be 4, but this is not a specific limitation.
[0391] 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 in order to obtain valid reference pixels.
[0392] In a specific embodiment, screening pixels in the adjacent area to determine the reference pixel may include:
[0393] Determining a pixel position to be selected based on positions and / or color component intensities of pixels in a neighboring area;
[0394] According to the position of the pixel to be selected, a reference pixel is determined from pixels in an adjacent area.
[0395] It should be noted that the color component intensity can be represented by a color component value, such as a brightness component value, a chrominance component value, etc. A larger color component value indicates a higher color component intensity. Thus, the pixels in the adjacent area can be screened based on pixel position or color component intensity, and this embodiment of the present application does not impose any limitation thereto. Thus, based on the screened pixels, the reference pixels of the current block can be determined.
[0396] S902: Determine a weighting coefficient according to the reference pixel.
[0397] It should be noted that, in the embodiment of the present application, after the reference pixel is determined, the weighting coefficient can be determined according to the reference pixel and the position of the pixel to be predicted in the current block.
[0398] In some embodiments, determining the weighting coefficient according to the reference pixel may include:
[0399] Determining a first reference color component parameter according to a first reference color component relationship between the reference pixel and the pixel to be predicted in the current block;
[0400] A weighting coefficient is determined according to a first reference color component parameter using a preset first mapping.
[0401] It should be noted that the first reference color component parameter can be directly determined by the difference between the first reference color component value of the reference pixel and the first reference color component value of the pixel to be predicted. Therefore, in some embodiments, determining the first reference color component parameter based on the first reference color component relationship between the reference pixel and the pixel to be predicted in the current block may include:
[0402] Determine a difference between a first reference color component value of a reference pixel and a first reference color component value of a pixel to be predicted;
[0403] According to the difference, a first reference color component parameter is determined.
[0404] In a specific embodiment, determining the first reference color component parameter according to the difference may include: setting the first reference color component parameter to be equal to the absolute value of the difference.
[0405] In another specific embodiment, determining the first reference color component parameter according to the difference may include: setting the first color component parameter to be equal to the product of the absolute value of the difference and a preset multiplier.
[0406] In an embodiment of the present application, the first reference color component may be a first color component; or, the first reference color component may be a second color component; wherein the second color component is a color component different from the first color component.
[0407] It should also be noted that the first color component is the component to be predicted in the embodiment of the present application. That is, if the first color component is a chroma component and the second color component is a luminance component, then the first color component parameter can be either chroma component information or luminance component information.
[0408] For example, assuming that the first color component is the chrominance component and the second color component is the luminance component, the embodiment of the present application mainly predicts the chrominance component of the pixel to be predicted in the current block. First, select at least one pixel to be predicted in the current block with obvious color difference, and calculate the chrominance difference between its chrominance and the reconstructed chrominance of the adjacent area (using |ΔC k | indicates); the chrominance difference of the pixels to be predicted at different positions in adjacent areas is different. The reference pixel position with the smallest chrominance difference will follow the change of the pixels to be predicted in the current block. Usually, the chrominance difference represents the similarity between chrominances. 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 |A preset mapping relationship can be established, as shown in the aforementioned formula (1).
[0409] That is, in some embodiments, determining the weighting coefficient according to the first reference color component parameter using the preset first mapping may include:
[0410] Determining a value corresponding to a first reference color component parameter under a preset functional relationship of the first mapping;
[0411] Set the weighting factor equal to the value.
[0412] Here, taking formula (1) as an example, |ΔC k | represents the first reference color component parameter, f(|ΔC k |) represents the value corresponding to the first reference color component parameter under the preset function relationship of the first mapping, w k Represents the weighting coefficient, that is, w k Set to be equal to f(|ΔC k |).
[0413] It should also be noted that, in the embodiment of the present application, if the number of reference pixels is N, then the number of weighting coefficients is also N; wherein the sum of the N weighting coefficients is equal to 1, and each weighting coefficient is a value greater than or equal to 0 and less than or equal to 1, that is, 0≤w k ≤1. However, it should be noted that "the sum of N weighting coefficients equals 1" is only a theoretical concept; in actual fixed-point implementation, the absolute value of the weighting coefficient can be greater than 1.
[0414] Understandably, in probability theory and related fields, the normalized exponential function, or Softmax function, is a generalization of the logistic function. It can "compress" an N-dimensional vector z containing arbitrary real numbers into another N-dimensional vector σ(z), such that each element ranges between (0, 1) and the sum of all elements is 1. It is often used as a nonlinear activation function for multi-class neural networks. The Softmax function is shown in Equation (2) above.
[0415] However, the Softmax function can satisfy w k However, its function value increases with the increase of vector elements, which does not meet the condition of w k and |ΔC k | Approximately inversely proportional relationship. Therefore, in order to adapt to w k The design and meet the requirements of w k Nonlinear expectation can be realized by proposing a Softmax function with parameter γ, as shown in the above formula (3).
[0416] Among them, in order to achieve w k and |ΔC k | is approximately inversely proportional, γ can be limited to a negative number. That is, when the first reference color component parameter is |ΔC k |ΔC k |with w kThe mapping relationship between them is shown in the aforementioned formula (4). Therefore, in some embodiments, determining the value corresponding to the first reference color component parameter under the preset functional relationship of the first mapping may include:
[0417] Determine the first factor;
[0418] determining a first product value according to the first factor and the first reference color component parameter;
[0419] Determine a value of the first product value corresponding to a preset functional relationship of the first mapping.
[0420] It should be noted that, in the embodiment of the present application, the first factor is a constant value less than zero. Taking the Softmax function as an example, in formula (4), γ represents the first factor, |ΔC k | represents the first reference color component parameter, γ|ΔC k | represents the first product value, w k Represents the weighting coefficient; k = 1, 2,…, N.
[0421] In a specific embodiment, determining the first factor may include: the first factor is a preset constant value.
[0422] It should be noted that, in this case, for γ, the weighted coefficient distribution of the adjacent chromaticity can be adjusted according to the relatively flat characteristics of chromaticity, so as to capture the weighted coefficient distribution suitable for natural image chromaticity prediction. In order to determine the parameter γ suitable for natural image chromaticity prediction, the given γ set is traversed, and the difference between the predicted chromaticity and the original chromaticity under different γ is used to measure whether γ is suitable or not. For example, γ can be -2 ε , where ε∈{1,0,-1,-2,-3}. Experiments have shown that the optimal value of γ in this γ set is -0.25. Therefore, in a specific embodiment, γ can be set to -0.25, but this embodiment is not specifically limited thereto.
[0423] In another specific embodiment, determining the first factor may include: determining a value of the first factor according to a size parameter of the current block.
[0424] Furthermore, in some embodiments, the method may further include: determining the value of the first factor according to a preset mapping lookup table between the size parameter of the current block and the value of the first factor.
[0425] Here, the size parameter of the current block may include at least one of the following parameters: the width of the current block, and the height of the current block.
[0426] It should be noted that embodiments of the present application can use a classification method to fix the value of the first factor. For example, the size parameters of the current block can be divided into three categories, and the value of the first 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 first factor, and then determine the value of the first factor based on this lookup table. Table 1 shows a schematic table of the correspondence between the first factor and the size parameters of the current block, provided in embodiments of the present application.
[0427] In another specific embodiment, determining the first factor may include: determining a value of the first factor according to the number of reference pixels of the current block.
[0428] Furthermore, in some embodiments, the method may further include: determining the value of the first factor according to a preset mapping lookup table between the number of reference pixels of the current block and the value of the first factor.
[0429] It should be noted that the embodiment of the present application can divide the number of reference pixels into three categories, and still use the classification method to fix the value of the first factor. For example, the number of reference pixels of the current block can be divided into three categories, and the value of the first factor corresponding to each category is determined. In response to this situation, the embodiment of the present application can also pre-store a lookup table mapping the number of reference pixels of the current block to the value of the first factor, and then determine the value of the first factor based on the lookup table. Among them, Table 2 shows a schematic table of the corresponding relationship between the first factor and the number of reference pixels of the current block provided by the embodiment of the present application.
[0430] Furthermore, for the first product value, in a possible implementation, determining the first product value according to the first factor and the first reference color component parameter may include:
[0431] The first product value is set equal to the product of the first factor and the first reference color component parameter.
[0432] In another possible implementation, determining the first product value according to the first factor and the first reference color component parameter may include:
[0433] The first product value is set to be equal to a value obtained by right-shifting the first reference color component parameter, wherein the number of bits of the right-shift is equal to the first factor.
[0434] In yet another possible implementation, determining the first product value according to the first factor and the first reference color component parameter may include:
[0435] According to the first factor, addition and bit shift operations are performed on the first reference color component parameter to determine a first product value.
[0436] It should be noted that in an embodiment of the present application, the first product value can be equal to the product of the first factor and the first reference color component parameter, or it can be equal to the value obtained by bit right shifting the first reference color component parameter, or it can be obtained by adding and bit shifting the first reference color component parameter according to the first factor.
[0437] For example, assuming the first factor is 0.25 and the first reference color component parameter is represented by S, the first product value can be equal to 0.25×S. 0.25×S can be expressed as S / 4, that is, S>>2. Furthermore, during the fixed-point calculation process, floating-point numbers may be converted to addition and shift operations; in other words, there is no limitation on the calculation method for the first product value.
[0438] In yet another possible implementation, determining the first product value according to the first factor and the first reference color component parameter includes:
[0439] determining a second factor based on the first color component value of the reference pixel and the first reference color component value of the reference pixel;
[0440] The first product value is set to the product of the first factor, the first reference color component parameter, and the second factor.
[0441] It should be noted that when the first reference color component is the component to be predicted (i.e., the chrominance component), since the chrominance component value of the pixel to be predicted cannot be directly determined, the absolute chrominance difference between the reference pixel and the pixel to be predicted |ΔC k | cannot be obtained directly; in this case, the absolute difference in brightness between the reference pixel and the pixel to be predicted |ΔY k | to derive |ΔC k |. That is, according to |ΔY k | and the product of the second factor, we can get |ΔC k |; Thus, the first product value is equal to the first factor and |ΔC k |'s product.
[0442] Specifically, for the current block, the chrominance component value C of the current pixel to be predicted (i, j) ij The value Y can be reconstructed from the brightness ij Estimation is obtained. Specifically as shown in the above formula (5); similarly, the adjacent chromaticity C k The corresponding brightness reconstruction value Y can also be used k Estimation, as shown in the above formula (6); then, the relationship between |ΔC| and |ΔY| can be obtained by subtracting formula (5) from formula (6), as shown in the above formula (7).
[0443] That is, in the embodiment of the present application, for the first reference color component parameter, it can be |ΔC k |, that is, the absolute value of the difference between the first color component value of the reference pixel and the first color component value of the pixel to be predicted; or |ΔY k |, that is, the absolute value of the difference between the second color component value of the reference pixel and the second color component value of the pixel to be predicted; or it can also be |αΔY k |, that is, the product of the absolute value of the difference between the second color component value of the reference pixel and the second color component value of the pixel to be predicted and a preset multiplier, etc. The preset multiplier here is the second factor described in the embodiment of the present application.
[0444] Furthermore, for the second factor, in one possible implementation, determining the second factor based on the first color component value of the reference pixel and the first reference color component value of the reference pixel may include: performing a least squares calculation based on the first color component value of the reference pixel and the first reference color component value of the reference pixel to determine the second factor.
[0445] That is, assuming that the number of reference pixels is N, the first color component is a chrominance component, and the first reference color component is a luminance component, then the chrominance component values and the luminance component values of the N reference pixels can be least squares calculated to obtain the second factor. For example, the least squares regression calculation is shown in the aforementioned equation (8).
[0446] Furthermore, in addition to being directly determined by the absolute value of the first reference color component difference between the reference pixel and the pixel to be predicted, the first reference color component parameter can also be determined using a neural network approach. Therefore, in some embodiments, determining the first reference color component parameter based on the first reference color component relationship between the reference pixel and the pixel to be predicted in the current block can include: determining the first reference color component parameter using a first neural network model.
[0447] In a specific embodiment, it may include: the input of the first neural network model includes the first reference color component value of the reference pixel and the first reference color component value of the pixel to be predicted; the output of the first neural network model includes the first reference color component parameter.
[0448] It should be noted that in the embodiments of the present application, the preset neural network model may be a convolutional neural network, a deep learning neural network, etc. The first reference color component value of the reference pixel and the first reference color component value of the pixel to be predicted may be inputs to the preset neural network model, and the output of the preset neural network model is the first reference color component parameter.
[0449] Furthermore, with respect to the second factor, in another possible implementation, the method may further include:
[0450] Determining the number of first color component values according to the number of reference pixels of the current block;
[0451] Determine an initial value of the second factor according to the number of first color component values;
[0452] The second factor is determined based on the initial value of the second factor.
[0453] It should be noted that, in some embodiments, determining the second factor based on the initial value of the second factor may include: directly using the initial value of the second factor as the second factor; or adjusting the initial value of the second factor to obtain the second factor.
[0454] It should also be noted that, in some embodiments, determining the initial value of the second factor according to the number of first color component values may include:
[0455] If the number of first color component values is greater than zero and less than 16, the initial value of the second factor is determined to be 0.445;
[0456] If the number of first color component values is greater than or equal to 16 and less than 32, the initial value of the second factor is determined to be 0.3091;
[0457] If the number of first color component values is greater than or equal to 32, the initial value of the second factor is determined to be 0.2026.
[0458] That is, in this embodiment of the present application, for the second factor, α can be calculated using linear least squares regression from reference pixels in adjacent regions. However, on the one hand, α deviates from the theoretical optimum; on the other hand, estimating α using linear least squares regression requires additional calculations at both the encoding and decoding ends. Therefore, to further reduce the complexity of weighting coefficient calculation, α can be classified and fixed based on the size characteristics of the current block, thereby eliminating the linear least squares regression calculation process.
[0459] VVC uses a flexible block partitioning technology, supporting binary tree, ternary tree and quadtree partitioning. The minimum block size of the chroma coding unit only needs to satisfy the total number of pixels>=16; therefore, there are square blocks and rectangular blocks of various sizes in the chroma coding unit in the same video image, and the number of reference pixels involved in the estimation will change with the change of block size. In order to make the classification value of α concise and effective, and conform to the actual coding and decoding characteristics, the number of reference pixels is divided into three categories, and each category corresponds to a fixed α value. First, the average α (that is, the initial value of the second factor described here) corresponding to the three categories of reference pixel number ranges is counted by the blocks encoded by VVC, and then fine-tuning is performed with this average α as the center. Finally, the three categories of α after fine-tuning with better coding and decoding performance can be used as the final α. Among them, Table 3 shows a schematic table of the correspondence between the chroma number R corresponding to a reference pixel and the average α provided in an embodiment of the present application.
[0460] It should also be noted that after γ and α are determined, the weighting coefficient can be determined according to the first reference color component parameter using a preset first mapping.
[0461] In a specific embodiment, the first mapping may be a lookup table of numerical mappings between first reference color component parameters and weighting coefficients. In other words, the decoder may pre-store a lookup table of numerical mappings between first reference color component parameters and weighting coefficients. Thus, after obtaining the first reference color component parameters, the weighting coefficients may be directly determined based on the lookup table.
[0462] In another specific embodiment, the value corresponding to the first reference color component parameter under the preset functional relationship of the first mapping is determined, and then the weighting coefficient is set equal to the value.
[0463] It should be noted that the preset functional relationship of the first mapping may be a Softmax function, which is a normalized exponential function. However, in the embodiment of the present application, normalization is not required, and its value is not limited to the range of [0, 1].
[0464] For example, after γ and α are determined, since ΔY k It is known that |ΔC k |can be represented by |αΔY k | is approximately obtained, then the weighted coefficient w corresponding to the kth reference pixel k It can be calculated by the following formula, as shown in the above formula (9) or formula (10).
[0465] It should also be noted that, for the preset functional relationship of the first mapping, in addition to the Softmax function, in other embodiments, the preset functional relationship of the first mapping may be a weighting function having an inverse relationship with the first reference color component parameter.
[0466] That is to say, for the preset functional relationship of the first mapping, not only can the Softmax function of formula (10) be replaced by the aforementioned formula (11) or formula (12), etc., but it can even be other function models that can fit the trend that the closer the brightness information of the reference x pixel is to the pixel to be predicted in the current block, the higher the importance of the chrominance of the reference pixel to the pixel to be predicted in the current block is, and the weighted coefficients are constructed. The embodiments of the present application do not make specific limitations.
[0467] In this way, the weighting coefficients can be determined according to the positions of the reference pixel and the pixel to be predicted in the current block, which may include: w1, w2, ..., w N N weighting coefficients are used, where N represents the number of reference pixels. In theory, the sum of these N weighting coefficients is equal to 1, and each weighting coefficient is a value greater than or equal to 0 and less than or equal to 1.
[0468] S903: Perform weighted calculation on the first color component value of the reference pixel according to the weighting coefficient to determine a predicted value of the first color component of the pixel to be predicted in the current block.
[0469] It should be noted that after the weighting coefficient is determined, the weighting coefficient can be used to perform weighted calculation on the first color component value of the reference pixel, thereby obtaining the predicted value of the first color component of the pixel to be predicted in the current block.
[0470] It should also be noted that, in some embodiments, performing weighted calculation on the first color component value of the reference pixel according to the weighting coefficient to determine the predicted value of the first color component of the pixel to be predicted in the current block may include:
[0471] Determining a weighted value of a first color component value of a reference pixel and a corresponding weighting coefficient;
[0472] The predicted value of the first color component of the pixel to be predicted in the current block is set to be equal to the sum of N weighted values; wherein N represents the number of reference pixels and N is a positive integer.
[0473] That is, if the number of reference pixels is N, then first determine the weighted value of the first color component value of each reference pixel and the corresponding weighting coefficient (ie, w k C k), and then the sum of these N weighted values is used as the predicted value of the first color component of the pixel to be predicted in the current block. Specifically, its calculation formula is shown in the aforementioned formula (13). It should be noted that this method is conducive to parallel processing and can speed up the calculation speed.
[0474] It can also be understood that, assuming that the component to be predicted (i.e., the first color component) is a chroma component and the first reference color component (i.e., the second color component) is a luminance component, then taking into account the inconsistency of resolution, in an embodiment of the present application, the method may further include: downsampling the reference pixel and the first reference color component of the pixel to be predicted in the current block so that the resolution of the first reference color component is the same as the resolution of the component to be predicted.
[0475] In other words, if the resolution of the luma component is different from that of the chroma components, the luma component can be downsampled to align the resolution of the chroma components. The downsampling method can be a traditional filter coefficient method or a neural network method, and is not specifically limited in the present embodiment.
[0476] Furthermore, in some embodiments, FIG10 shows a second flow chart of an encoding method provided in an embodiment of the present application. As shown in FIG10 , the method may include:
[0477] S1001: Determine reference pixels of the current block.
[0478] It should be noted that in the embodiments of the present application, reference pixels may refer to reference pixels adjacent to the current block. Thus, according to the adjacent region distribution diagram shown in FIG1 , the embodiments of the present application can determine reference pixels from pixels in the left adjacent region, the lower left adjacent region, the upper adjacent region, and the upper right adjacent region that can be obtained from the current block, and then use the reference pixels to predict the color components of the current block.
[0479] S1002: Determine a second color component parameter according to a second color component relationship between a reference pixel and a pixel to be predicted in a current block.
[0480] It should be noted that, for the determination of the second color component parameter, in a possible implementation method, determining the second color component parameter based on the second color component relationship between the reference pixel and the pixel to be predicted in the current block may include: determining the difference between the second color component value of the reference pixel and the second color component value of the pixel to be predicted, and setting the second color component parameter to be equal to the absolute value of the difference.
[0481] For example, assuming that the first color component is the chrominance component and the second color component is the brightness component, the second color component parameter can also be called brightness information. For the acquisition of brightness information, after determining the reference pixel of the current block, the brightness component of the reference pixel can be subtracted from the brightness component of the pixel to be predicted (i, j) in the current block and then the absolute value is taken to obtain the second color component parameter (i.e., the absolute brightness difference value).
[0482] |ΔY kij |), k represents the kth reference pixel, |ΔY kij The calculation of | is detailed in the above formula (14).
[0483] In another possible implementation, determining the second color component parameter based on the second color component relationship between the reference pixel and the pixel to be predicted in the current block may include: inputting the second color component value of the reference pixel and the second color component value of the pixel to be predicted into a preset neural network, and outputting the second color component parameter through the preset neural network.
[0484] In another possible implementation, determining the second color component parameter based on the second color component relationship between the reference pixel and the pixel to be predicted in the current block may include: performing a similarity comparison between the second color component value of the reference pixel and the second color component value of the pixel to be predicted, and determining the second color component parameter based on the comparison result.
[0485] Still taking the acquisition of brightness information as an example, first, if the resolution of the Y component is different from that of the U or V component, the Y component can be downsampled to align the resolution of the U or V component. The downsampling method here can be in the form of traditional filter coefficients or neural network, etc.
[0486] Secondly, when obtaining brightness information, in addition to directly taking the difference between the brightness component value of the reference pixel and the brightness component value of the pixel to be predicted in the current block and then taking the absolute value as the obtained brightness information, the brightness component value of the reference pixel and the brightness component value of the pixel to be predicted in the current block can also be used as the input of a preset neural network, and the output of the preset neural network is used as the obtained brightness information.
[0487] Again, when obtaining brightness information, in addition to directly taking the difference between the brightness of the reference pixel and the brightness of the pixel to be predicted in the current block and then taking the absolute value as the obtained brightness information, the brightness component value of the k-th reference pixel and the pixel to be predicted in the current block can also be compared for similarity, that is, it is determined whether the k-th reference pixel is the reference pixel closest to the brightness component value of the pixel to be predicted in the current block as the obtained brightness information; for example, if the k-th reference pixel is the closest, the brightness information of the k-th reference pixel is set to 1, otherwise it is set to 0.
[0488] S1003: Scale the second color component parameter using the third factor to determine the adjusted second color component parameter.
[0489] It should be noted that after obtaining the brightness information, the scale can be adjusted. The brightness information here is expressed as |△Y kij | as an example, then we can use the third factor to calculate N |△Y kij | Make scale adjustments.
[0490] In a possible implementation, the absolute brightness difference value |△Y corresponding to the pixel to be predicted in the current block with different size parameters is kij |, the scale can be adjusted by different third factors. Specifically, in some embodiments, the method may further include:
[0491] Determine the size parameters of the current block;
[0492] The third factor is determined according to a size parameter of the current block, wherein the size parameter of the current block includes at least one of the following parameters: a width of the current block and a height of the current block.
[0493] In a specific embodiment, determining the third factor according to the size parameter of the current block may include:
[0494] If the minimum value of the height and width of the current block is less than or equal to 4, the third factor is determined to be 8;
[0495] 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 third factor is determined to be 12;
[0496] If the minimum value of the height and width of the current block is greater than 16, the third factor is determined to be 16.
[0497] It should be noted that, in the embodiment of the present application, the value of the third factor (denoted by θ) can be fixed by classification. In addition, the height of the current block is denoted by H, and the width of the current block is denoted by W. The correspondence between the third factor θ and the size parameter of the current block is detailed in Table 4.
[0498] In another specific embodiment, during the scale adjustment, the correspondence between the third factor θ and the size parameter of the current block may be fine-tuned. The correspondence between the fine-tuned third factor θ and the size parameter of the current block is shown in Table 5.
[0499] In another specific embodiment, during the scale adjustment, the classification value of the third factor θ may be fine-tuned. In some embodiments, determining the third factor based on the size parameter of the current block may include:
[0500] If the minimum value of the height and width of the current block is less than or equal to 4, the third factor is determined to be 7;
[0501] 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 third factor is determined to be 11;
[0502] If the minimum value of the height and width of the current block is greater than 16, the third factor is determined to be 15.
[0503] That is, by fine-tuning the classification value of the third factor θ, the corresponding relationship between the fine-tuned third factor θ and the size parameter of the current block is shown in Table 6.
[0504] In another possible implementation, during the scale adjustment, the third factor may be further classified according to the number of reference pixels of the current block. Here, N represents the number of reference pixels. In some embodiments, the method may further include:
[0505] If the value of N is less than 16, the third factor is determined to be 8;
[0506] If the value of N is greater than or equal to 16 and less than 32, the third factor is determined to be 12;
[0507] If the value of N is greater than or equal to 32, the third factor is determined to be 16.
[0508] That is, classification is performed according to the number of reference pixels of the current block, wherein the corresponding relationship between the third factor θ and the number of adjacent reference pixels is shown in Table 7.
[0509] In another possible implementation, during the scale adjustment, the third factor may also be calculated in another way. In some embodiments, the method may further include:
[0510] determining a first model parameter of the current block;
[0511] Scaling the first model parameter to obtain the scaled first model parameter;
[0512] The third factor is obtained by performing the inverse calculation on the scaled first model parameter.
[0513] That is, in the embodiment of the present application, a prediction model is constructed based on the luminance and chrominance of the reference pixels of the current block (the CCLM linear model construction scheme in the related art can be used, or the least squares method or weighted least squares method can be used to construct the prediction model) to calculate the first model parameter (i.e., the slope parameter, represented by α). This parameter α is scaled and then the inverse is taken as the third factor θ of the current block. For example, the value of the third factor θ can be obtained by dividing α by 4, scaling it, and then taking the inverse.
[0514] It's also important to note that during rescaling, the number of categories in the third factor θ can be adjusted based on performance requirements. For example, the θ classification can be more refined, increasing the number of θ categories to improve prediction accuracy. Alternatively, the number of θ categories can be reduced, or even the same θ can be used for all current blocks. Furthermore, θ can be unified to the average of the aforementioned multiple θ categories, eliminating further classification. This simplifies operations, but reduces prediction accuracy.
[0515] S1004: Using the preset second mapping, determine a weighting coefficient according to the adjusted second color component parameter.
[0516] It should be noted that after obtaining brightness information and performing rescaling, weighting coefficients can be calculated using a preset second mapping. The preset second mapping is a nonlinear mapping. Assuming the number of reference pixels in the current block is N, N second color component parameters can be obtained. After rescaling, N adjusted second color component parameters can be obtained. Thus, the number of weighting coefficients calculated using the nonlinear mapping is also N.
[0517] Specifically, in the embodiment of the present application, a function model for weighted coefficient calculation can be constructed based on the trend that the closer the luminance information of the reference pixel is to the pixel to be predicted (i, j) in the current block, the more important the chrominance of the reference pixel is to the pixel to be predicted (i, j). Here, the Softmax function is selected as the f model, and the absolute luminance difference value is scaled and then further mapped to the chrominance weighted coefficient through the Softmax function. Specifically, the N absolute luminance difference values corresponding to the pixel to be predicted (i, j) |△Y kij After the scale is adjusted, it is negative; in this way, N |△Y kij After rescaling, the negative absolute brightness difference is mapped to the weighted coefficient w corresponding to each of the N reference pixels through the Softmax function. kij , and its calculation is specifically shown in the above formula (15).
[0518] It should also be noted that in the embodiment of the present application, for the f model, other function models that can fit the trend that the closer the luminance information of the reference pixel is to the pixel to be predicted in the current block, the more important the chrominance of the reference pixel is to the pixel to be predicted is to be constructed to calculate the weighted coefficient. For example, for the f model, it can be as shown in formula (15), or the Softmax function in formula (15) can be replaced by formula (16) or formula (17), etc., and no limitation is made here.
[0519] In addition, in some embodiments, both the preset first mapping and the preset second mapping can simplify operations, for example, by using an array element lookup table to reduce some computational operations. For the first mapping, the following steps can be performed: determining an array element value based on a preset lookup table mapping the first reference color component parameter, the first factor, and the array element; then determining the value corresponding to the array element value under the preset functional relationship of the first mapping; and then setting the weighting coefficient equal to the value.
[0520] For the second mapping, it can be: determining the array element value based on the preset mapping lookup table of the second color component parameter, the third factor and the array element; then determining the value corresponding to the array element value under the preset functional relationship of the second mapping; and then setting the weighting coefficient equal to the value.
[0521] Specifically, taking the second mapping as an example, the f model for calculating the weighted coefficient can be implemented by simplified operations, such as a table lookup method. kij =f(|ΔY rij |). Here, the numerator in the f model can be expressed as the independent variable |ΔY rij The number of | and θ types are stored as array indices. Subsequent operations in the f model that are the same as the numerator calculation are obtained by looking up the table, thus avoiding the calculation operations of the numerator and denominator.
[0522] It should be noted that, in the embodiment of the present application, the storage here can be divided into complete storage or partial storage.
[0523] In a specific embodiment, full storage is to store |ΔY rij |The range of values and the number of θ species are all stored. Under full storage, it is necessary to open (|ΔY rij |value range multiplied by the number of θ types) of array space. Among them, the required storage array size is |ΔY rij |The value range size, the performance remains unchanged.
[0524] For example, taking 10-bit pixels and formula (15) as an example, the variable |ΔY rij The value range is an integer between 0 and 1023, the number of θ types is 3, and the value of |ΔY rij The number of species | and θ are used as indices of the two-dimensional array storMole to completely store the molecules. For details, see the above equations (18) and (19). Thus, the elements of the two-dimensional array storMole[index1][index2] are shown in Table 8.
[0525] Furthermore, the complete storage can also set the corresponding array offset according to the classification of θ, and then according to (|ΔY rij| plus the offset) as the index of the one-dimensional array ostorMole to completely store the numerator. For details, see the above formulas (20) and (21). Thus, the elements of the one-dimensional array ostorMole[index] are shown in Table 9.
[0526] In another specific embodiment, partial storage is to select and store part of all numerator values in the calculation weight coefficients, and |ΔY rij |Part of the range and / or the molecular values of some types of θ are stored. The f model values outside the selected range default to 0. The required storage array size is (the selected |ΔY rij |The value range is multiplied by the number of selected types of θ).
[0527] For example, taking 10-bit pixels and formula (15) as an example, assuming that |ΔY rij The range of values is 0 to 99 integers, and the numerator values of 3 kinds of θ are partially stored, then |ΔY rij The value range is an integer between 0 and 99, and the number of θ types is 3. Therefore, ΔY rij The number of species | and θ are used as indices of the two-dimensional array partstorMole to store molecules. For details, see the above equations (22) and (23). Thus, the elements of the two-dimensional array partstorMole[index 1][index 2] are shown in Table 10.
[0528] That is to say, the storage range of some storage can be stored according to actual needs, not limited to the |ΔY in the example rij |Within 100 integers, there are 3 types of θ; partial storage can also set corresponding offsets for selected parts of θ types to open up one-dimensional storage space for storage, and the embodiment of the present application does not impose any limitation on this.
[0529] S1005: Perform weighted calculation on the first color component value of the reference pixel according to the weighting coefficient to determine a predicted value of the first color component of the pixel to be predicted in the current block.
[0530] It should be noted that after obtaining the brightness information, scale adjustment and weighted coefficients calculated by nonlinear mapping, the chrominance prediction value of the pixel to be predicted can be further calculated. Specifically, the chrominance component values C of the N reference pixels are k The weighted coefficients obtained in the above steps are used for weighted calculation to obtain the chrominance prediction value of the pixel (i, j) to be predicted in the current block. The details are as shown in the above formula (24).
[0531] It should also be noted that w kij The following conditions must be met: 1ij +w 2ij +…+wNij =1; and 0≤w kij ≤1, and w kij It can be determined based on the absolute luminance difference, which has nonlinear characteristics. This not only fully considers the difference between luminance information and chrominance information at different block sizes, but also fully considers the trend that the closer the luminance information of the reference pixel is to the pixel to be predicted in the current block, the more important the chrominance of the reference pixel is to the pixel to be predicted, thereby improving the accuracy of chrominance prediction.
[0532] In addition, embodiments of the present application can also use the brightness information of the pixels in the adjacent area and the current block to assign weights to the pixels in the adjacent area, and use the reference pixels with weight characteristics to perform weighted LMS derivation to obtain the first model parameters and the second model parameters for CCLM prediction, thereby also improving the accuracy of chrominance prediction. Therefore, in some embodiments, the method can also include:
[0533] Determine a difference between a second color component value of a reference pixel and a second color component value of a pixel to be predicted in a current block;
[0534] Determining, by using a preset second mapping, a weight value of the reference pixel to the pixel to be predicted in the current block according to the difference;
[0535] Determining a target weight value of the reference pixel in the current block based on the weight value of the reference pixel to the pixel to be predicted in the current block;
[0536] Performing a weighted least squares calculation on the first color component value of the reference pixel and the first reference color component value of the reference pixel according to the target weight value to determine a first model parameter and a second model parameter;
[0537] Constructing a prediction model based on the first model parameter and the second model parameter;
[0538] A prediction model is used to predict a first color component of a pixel to be predicted in the current block, and a predicted value of the first color component of the pixel to be predicted in the current block is determined.
[0539] In a specific embodiment, determining the target weight value of the reference pixel in the current block according to the weight value of the reference pixel to the pixel to be predicted in the current block may include:
[0540] Calculate the average value of the weight values of the pixels to be predicted in the current block based on the reference pixels to determine the target weight value of the reference pixels in the current block;
[0541] or,
[0542] The weight values of the pixels to be predicted in the current block are summed up according to the reference pixels to determine the target weight value of the reference pixels in the current block.
[0543] In another specific embodiment, for determining the target weight value, the method may further include:
[0544] determining the number of minimum values from absolute values of the differences based on a difference between a first reference color component value of the reference pixel and a first reference color component value of a pixel to be predicted in the current block;
[0545] The number of minimum values is used as the target weight value of the reference pixel in the current block.
[0546] That is to say, for the importance weight of the current block (i.e., the "target weight value", w r In addition to using the average value shown in formula (27), the sum can also be used as the importance weight w of the current block. r , as in the aforementioned formula (32); In addition, the importance weight w of each reference pixel in the current block r We can also count the number of reference pixels with the smallest difference in brightness component value between the pixel to be predicted and the current block, and use it as the importance weight of the current block w r , such as the aforementioned formula (33) and formula (34), etc., and the embodiments of this application do not impose any limitations.
[0547] It should be noted that in the embodiment of the present application, the first model parameter is represented by α and the second model parameter is represented by β. In one possible implementation, for the derivation of α and β, before constructing the prediction model based on the first model parameter and the second model parameter, the method may further include:
[0548] comparing the second color component values of N reference pixels;
[0549] Determining, based on the comparison result, a first sub-reference pixel set with relatively large second color component values and a second sub-reference pixel set with relatively small second color component values;
[0550] Calculating an average value on the first sub-reference pixel set to obtain a first fitting pixel; and calculating an average value on the second sub-reference pixel set to obtain a second fitting pixel;
[0551] Model parameters are calculated according to the first fitting pixels and the second fitting pixels to obtain first model parameters and second model parameters.
[0552] In other words, the current CCLM technology can be divided into two sub-reference point sets through comparison: a sub-reference point set with a larger luminance component value and a sub-reference point set with a smaller luminance component value. The two sub-reference point sets are averaged to obtain two mean reference points (i.e., two fitting pixels). The model parameters α and β can also be derived based on these two fitting pixels.
[0553] In another possible implementation, for derivation of α and β, calculating the model parameters according to the first fitting pixels and the second fitting pixels to obtain the first model parameters and the second model parameters may include:
[0554] After determining the target weight value of each of the N reference pixels in the current block, determining a target weight value set corresponding to the first sub-reference pixel set and a target weight value set corresponding to the second sub-reference pixel set;
[0555] Normalizing the target weight value set corresponding to the first sub-reference pixel set to obtain a first weight mean; and normalizing the target weight value set corresponding to the second sub-reference pixel set to obtain a second weight mean;
[0556] A weighted least squares method is performed on the first fitting pixel and the second fitting pixel using the first weighted mean and the second weighted mean to obtain a first model parameter and a second model parameter.
[0557] That is to say, the importance weight w of each reference pixel in the current block is calculated according to the above r The importance weights of the reference pixels are also divided into two sub-importance weight sets according to the classification scheme in the current CCLM technology. The weights in each sub-importance weight set are normalized to obtain the weights corresponding to the reference pixels in each sub-reference point set. Then, the two sub-reference point sets are weightedly combined according to the weights in their corresponding normalized sub-importance weight sets to obtain two weighted average reference points. Then, α and β are derived based on these two weighted average reference points.
[0558] It should also be noted that in the embodiments of this application, CCLM technology has undergone multiple evolutions, from the early stage of deriving α and β using LMS from the luminance and chromaticity of reference pixels in adjacent areas such as the upper side, upper right side, left side, and lower left side, to the current method of selecting only four reference pixels from the adjacent areas and calculating α and β using the maximum-minimum method. In addition, the weight calculation method described in the above embodiments can be applied to the derivation of model parameters α and β of CCLM technology in any version.
[0559] In addition, after obtaining the first model parameter and the second model parameter, the method may further include: encoding the first model parameter and the second model parameter, and writing the obtained coded bits into a bitstream.
[0560] That is, the encoder can determine the model parameters α and β according to the above scheme, and then write them into the bitstream; in this way, the model parameters α and β can be obtained directly through decoding without the need for model parameter calculation at the decoding end.
[0561] Furthermore, in some embodiments, the method may further include:
[0562] Determining the original value of the first color component of the pixel to be predicted in the current block;
[0563] Determining a residual value of the first color component of a pixel to be predicted in the current block according to the original value of the first color component and the predicted value of the first color component;
[0564] The residual value of the first color component of the pixel to be predicted in the current block is encoded, and the obtained encoding bits are written into the bitstream.
[0565] It should be noted that after determining the predicted value of the first color component of the pixel to be predicted in the current block, a residual value of the first color component of the pixel to be predicted in the current block can be determined based on the original value of the first color component and the predicted value of the first color component. Specifically, a subtraction calculation can be performed on the original value of the first color component and the predicted value of the first color component to determine the residual value of the first color component of the pixel to be predicted in the current block. In this way, after the residual value of the first color component is written into the bitstream, the residual value of the first color component can be obtained through decoding at the decoding end to restore the reconstructed value of the first color component of the pixel to be predicted in the current block.
[0566] In summary, the embodiments of the present application propose a chroma prediction technique, specifically a chroma intra-frame prediction technique. The implementation principle is to calculate weighted coefficients using known reference pixels and the luminance information of the current block, and use these weighted coefficients in predicting the chroma of the current block. Here, the chroma component values of the reference pixels are weightedly predicted to obtain the predicted chroma component values of the pixels to be predicted in the current block. The weighted coefficients corresponding to the chroma component values of the reference pixels can be obtained by scaling and nonlinearly mapping the luminance information of the current pixel to be predicted and the reference pixels. Thus, in the embodiment of the present application, on the one hand, the luminance information of the reference pixel and the current block can be fully utilized to realize the calculation of the weighted coefficient corresponding to the chrominance component value of the reference pixel; on the other hand, the difference characteristics of the luminance information and the chrominance information under different block sizes are fully considered, and the luminance information is scaled according to the size parameters of the current block to improve the effectiveness of the weighted coefficient; on the other hand, the trend that the closer the luminance information of the reference pixel is to the pixel to be predicted in the current block, the higher the importance of the chrominance of the reference pixel to the pixel to be predicted is, is fully considered, and an effective and accurate mapping model f is constructed. Different weighted coefficients corresponding to the chrominance of the reference pixel can be designed for different pixels to be predicted, further improving the accuracy of chrominance prediction.
[0567] This embodiment provides an encoding method that determines a reference pixel of a current block; determines a weighting coefficient based on the reference pixel; and performs a weighted calculation on the first color component value of the reference pixel based on the weighting coefficient to determine a predicted value of the first color component of a pixel to be predicted in the current block. In this way, the weighting coefficient corresponding to the pixel to be predicted in the current block can be calculated using the color component information of the reference pixel and the pixel to be predicted in the current block. Different pixels to be predicted can have different weighting coefficients, which are applied to the chrominance prediction of the pixel to be predicted in the current block. In addition, since the correlation between the luminance information of the current block and the adjacent areas is fully exploited and this correlation is used in the chrominance prediction of the current block, not only can the accuracy of chrominance prediction be improved, bit rate can be saved, but also encoding and decoding performance can be improved.
[0568] In another embodiment of the present application, the embodiment of the present application further provides a code stream, which is generated by bit encoding based on the information to be encoded; wherein the information to be encoded includes at least: the residual value of the first color component of the pixel to be predicted in the current block.
[0569] In an embodiment of the present application, after the residual value of the first color component of the pixel to be predicted in the current block is transmitted from the encoder to the decoder, the decoder obtains the residual value of the first color component through decoding, and then combines the predicted value of the first color component of the pixel to be predicted in the current block to restore the reconstructed value of the first color component of the pixel to be predicted in the current block; in this way, the color component information of the adjacent reference pixels and the pixel to be predicted can be used to calculate the corresponding weighting coefficient of the pixel to be predicted, thereby not only improving the accuracy of chroma prediction and saving bit rate, but also improving the encoding and decoding performance.
[0570] In another embodiment of the present application, referring to FIG11 , a schematic diagram of the structure of a coding device provided by an embodiment of the present application is shown. As shown in FIG11 , the coding device 110 may include: a first determining unit 1101, a first calculating unit 1102, and a first predicting unit 1103; wherein,
[0571] A first determining unit 1101 is configured to determine a reference pixel of a current block;
[0572] A first calculation unit 1102 is configured to determine a weighting coefficient according to a reference pixel;
[0573] The first prediction unit 1103 is configured to perform weighted calculation on the first color component value of the reference pixel according to the weighting coefficient to determine the predicted value of the first color component of the pixel to be predicted in the current block.
[0574] In some embodiments, the first determining unit 1101 is further configured to determine a weighted value of a first color component value of a reference pixel and a corresponding weighting coefficient;
[0575] The first prediction unit 1103 is further configured to set the predicted value of the first color component of the pixel to be predicted in the current block to be equal to the sum of N weighted values; wherein N represents the number of reference pixels and N is a positive integer.
[0576] In some embodiments, the first determination unit 1101 is further configured to determine the reference pixel based on pixels in an adjacent area of the current block; wherein 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.
[0577] In some embodiments, the first determining unit 1101 is further configured to perform screening processing on pixels in an adjacent area to determine a reference pixel.
[0578] In some embodiments, the first determination unit 1101 is further configured to determine the position of the pixel to be selected based on the position and / or color component intensity of the pixels in the adjacent area; and determine the reference pixel from the pixels in the adjacent area according to the position of the pixel to be selected.
[0579] In some embodiments, the first determining unit 1101 is further configured to determine a first reference color component parameter according to a first reference color component relationship between the reference pixel and the pixel to be predicted in the current block;
[0580] The first calculation unit 1102 is further configured to use a preset first mapping to determine a weighting coefficient according to the first reference color component parameter.
[0581] In some embodiments, the first mapping is a lookup table mapping values of first reference color component parameters to weighting coefficients.
[0582] In some embodiments, the first determining unit 1101 is further configured to determine a value corresponding to the first reference color component parameter under a preset functional relationship of the first mapping; and set the weighting coefficient to be equal to the value.
[0583] In some embodiments, the first determining unit 1101 is further configured to determine a first factor;
[0584] The first calculation unit 1102 is further configured to determine a first product value according to the first factor and the first reference color component parameter; and determine a value corresponding to the first product value under a preset functional relationship of the first mapping.
[0585] In some embodiments, the first determination unit 1101 is further configured to determine the array element value based on a preset mapping lookup table of the first reference color component parameter, the first factor and the array element; and determine the corresponding value of the array element value under the preset functional relationship of the first mapping.
[0586] In some embodiments, the first factor is a preset constant value.
[0587] In some embodiments, the first determining unit 1101 is further configured to determine the value of the first factor according to a size parameter of the current block; wherein the size parameter of the current block includes at least one of the following parameters: the width of the current block, the height of the current block.
[0588] In some embodiments, the first determining unit 1101 is further configured to determine the value of the first factor according to a preset mapping lookup table between the size parameter of the current block and the value of the first factor.
[0589] In some embodiments, the first determining unit 1101 is further configured to determine a value of the first factor according to the number of reference pixels of the current block.
[0590] In some embodiments, the first determining unit 1101 is further configured to determine the value of the first factor according to a preset mapping lookup table between the number of reference pixels of the current block and the value of the first factor.
[0591] In some embodiments, the first calculation unit 1102 is further configured to set the first product value to be equal to the product of the first factor and the first reference color component parameter.
[0592] In some embodiments, the first calculation unit 1102 is further configured to set the first product value to be equal to a value obtained by right-shifting the first reference color component parameter, wherein the number of bits of the right-shift is equal to the first factor.
[0593] In some embodiments, the first calculation unit 1102 is further configured to perform addition and bit shift operations on the first reference color component parameter according to the first factor to determine a first product value.
[0594] In some embodiments, the first determining unit 1101 is further configured to determine a second factor based on the first color component value of the reference pixel and the first reference color component value of the reference pixel;
[0595] The first calculation unit 1102 is further configured to set the first product value to be the product of the first factor, the first reference color component parameter, and the second factor.
[0596] In some embodiments, the first determining unit 1101 is further configured to perform a least squares calculation based on the first color component value of the reference pixel and the first reference color component value of the reference pixel to determine the second factor.
[0597] In some embodiments, the preset functional relationship of the first mapping is a Softmax function.
[0598] In some embodiments, the preset functional relationship of the first mapping is a weighting function having an inverse relationship with the first reference color component parameter.
[0599] In some embodiments, the first reference color component is the first color component.
[0600] In some embodiments, the first reference color component is a second color component, wherein the second color component is a different color component than the first color component.
[0601] In some embodiments, the first determining unit 1101 is further configured to determine a difference between the first reference color component value of the reference pixel and the first reference color component value of the pixel to be predicted; and determine the first reference color component parameter according to the difference.
[0602] In some embodiments, the first determining unit 1101 is further configured to set the first color component parameter to be equal to the absolute value of the difference.
[0603] In some embodiments, the first determining unit 1101 is further configured to determine the first reference color component parameter using a first neural network model.
[0604] In some embodiments, the first determination unit 1101 is further configured such that the input of the first neural network model includes the first reference color component value of the reference pixel and the first reference color component value of the pixel to be predicted; and the output of the first neural network model includes the first reference color component parameter.
[0605] In some embodiments, referring to FIG11 , the encoding device 110 may further include a first constructing unit 1104 ; wherein,
[0606] The first determining unit 1101 is further configured to determine a difference between a first reference color component value of a reference pixel and a first reference color component value of a pixel to be predicted in the current block; and determine, using a preset second mapping, a weight value of the reference pixel for the pixel to be predicted in the current block according to the difference; and determine a target weight value of the reference pixel in the current block according to the weight value of the reference pixel for the pixel to be predicted in the current block;
[0607] The first calculation unit 1102 is further configured to perform a weighted least squares calculation on the first color component value of the reference pixel and the first reference color component value of the reference pixel according to the target weight value to determine the first model parameter and the second model parameter;
[0608] A first construction unit 1104 is configured to construct a prediction model based on the first model parameter and the second model parameter;
[0609] The first prediction unit 1103 is further configured to use the prediction model to predict the first color component of the pixel to be predicted in the current block, and determine a predicted value of the first color component of the pixel to be predicted in the current block.
[0610] In some embodiments, the first calculation unit 1102 is further configured to calculate the average value of the weight values of the pixels to be predicted in the current block based on the reference pixels to determine the target weight value of the reference pixels in the current block; or, to calculate the sum of the weight values of the pixels to be predicted in the current block based on the reference pixels to determine the target weight value of the reference pixels in the current block.
[0611] In some embodiments, the first determination unit 1101 is further configured to determine the number of minimum values from the absolute values of the differences between the first reference color component value of the reference pixel and the first reference color component value of the pixel to be predicted in the current block; and use the number of minimum values as the target weight value of the reference pixel in the current block.
[0612] In some embodiments, referring to FIG11 , the encoding device 110 may further include an encoding unit 1105 ; wherein,
[0613] The first determining unit 1101 is further configured to determine an original value of a first color component of a pixel to be predicted in the current block; and determine a residual value of the first color component of the pixel to be predicted in the current block based on the original value of the first color component and the predicted value of the first color component;
[0614] The encoding unit 1105 is configured to encode the residual value of the first color component of the pixel to be predicted in the current block, and write the obtained encoding bits into the bitstream.
[0615] 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.
[0616] 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.
[0617] Therefore, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a first processor, the method according to any one of the aforementioned embodiments is implemented.
[0618] Based on the composition of the above-mentioned encoding device 110 and the computer-readable storage medium, refer to Figure 12, which shows a specific hardware structure diagram of the encoding device provided by an embodiment of the present application. As shown in Figure 12, the encoding device 120 may include: a first communication interface 1201, a first memory 1202 and a first processor 1203; each component is coupled together through a first bus system 1204. It can be understood that the first bus system 1204 is used to realize the connection and communication between these components. In addition to the data bus, the first bus system 1204 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 1204 in Figure 12. Among them,
[0619] The first communication interface 1201 is used to receive and send signals when sending and receiving information with other external network elements;
[0620] A first memory 1202 is used to store computer programs that can be run on the first processor 1203;
[0621] The first processor 1203 is configured to, when running the computer program, execute:
[0622] Determine the reference pixel of the current block;
[0623] Determine a weighting coefficient according to the reference pixel;
[0624] A weighted calculation is performed on the first color component value of the reference pixel according to the weighting coefficient to determine the predicted value of the first color component of the pixel to be predicted in the current block.
[0625] It is understood that the first memory 1202 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 1202 of the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0626] The first processor 1203 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 1203. The above-mentioned first processor 1203 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 1202 , and the first processor 1203 reads the information in the first memory 1202 and completes the steps of the above method in combination with its hardware.
[0627] 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.
[0628] Optionally, as another embodiment, the first processor 1203 is further configured to execute the method described in any one of the aforementioned embodiments when running the computer program.
[0629] This embodiment provides an encoding device, which may include a first determining unit, a first calculating unit, and a first predicting unit. Thus, by utilizing color component information of adjacent reference pixels and the pixel to be predicted, weighting coefficients corresponding to the pixel to be predicted can be calculated. Furthermore, different pixels to be predicted can have different weighting coefficients, which are applied to chrominance prediction of the pixel to be predicted in the current block. This improves chrominance prediction accuracy, reduces bitrate, and enhances encoding and decoding performance.
[0630] In another embodiment of the present application, based on the same inventive concept as the above embodiment, refer to FIG13 , which shows a schematic diagram of the composition structure of a decoding device provided by an embodiment of the present application. As shown in FIG13 , the decoding device 130 may include: a second determination unit 1301, a second calculation unit 1302, and a second prediction unit 1303; wherein,
[0631] The second determining unit 1301 is configured to determine a reference pixel of a current block;
[0632] A second calculation unit 1302 is configured to determine a weighting coefficient according to the reference pixel;
[0633] The second prediction unit 1303 is configured to perform weighted calculation on the first color component value of the reference pixel according to the weighting coefficient to determine the predicted value of the first color component of the pixel to be predicted in the current block.
[0634] In some embodiments, the second determination unit 1301 is further configured to determine the weighted value of the first color component value of the reference pixel and the corresponding weighting coefficient; and set the predicted value of the first color component of the pixel to be predicted in the current block to be equal to the sum of N weighted values; wherein N represents the number of reference pixels, and N is a positive integer.
[0635] In some embodiments, the second determination unit 1301 is further configured to determine the reference pixel based on pixels in an adjacent area of the current block; wherein 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.
[0636] In some embodiments, the second determining unit 1301 is further configured to perform screening processing on pixels in an adjacent area to determine a reference pixel.
[0637] In some embodiments, the second determination unit 1301 is further configured to determine the position of the pixel to be selected based on the position and / or color component intensity of the pixels in the adjacent area; and determine the reference pixel from the pixels in the adjacent area according to the position of the pixel to be selected.
[0638] In some embodiments, the second determining unit 1301 is further configured to determine the first reference color component parameter according to a first reference color component relationship between the reference pixel and the pixel to be predicted in the current block;
[0639] The second calculation unit 1302 is further configured to use a preset first mapping to determine a weighting coefficient according to the first reference color component parameter.
[0640] In some embodiments, the first mapping is a lookup table mapping values of first reference color component parameters to weighting coefficients.
[0641] In some embodiments, the second determining unit 1301 is further configured to determine a value corresponding to the first reference color component parameter under a preset functional relationship of the first mapping; and set the weighting coefficient to be equal to the value.
[0642] In some embodiments, the second determining unit 1301 is further configured to determine the first factor;
[0643] The second calculation unit 1302 is further configured to determine a first product value according to the first factor and the first reference color component parameter; and determine a value corresponding to the first product value under a preset functional relationship of the first mapping.
[0644] In some embodiments, the second determination unit 1301 is further configured to determine the array element value based on a preset mapping lookup table of the first reference color component parameter, the first factor and the array element; and determine the corresponding value of the array element value under the preset functional relationship of the first mapping.
[0645] In some embodiments, the first factor is a preset constant value.
[0646] In some embodiments, the second determining unit 1301 is further configured to determine the value of the first factor according to a size parameter of the current block; wherein the size parameter of the current block includes at least one of the following parameters: the width of the current block, the height of the current block.
[0647] In some embodiments, the second determining unit 1301 is further configured to determine the value of the first factor according to a preset mapping lookup table between the size parameter of the current block and the value of the first factor.
[0648] In some embodiments, the second determining unit 1301 is further configured to determine the value of the first factor according to the number of reference pixels of the current block.
[0649] In some embodiments, the second determining unit 1301 is further configured to determine the value of the first factor according to a preset mapping lookup table between the number of reference pixels of the current block and the value of the first factor.
[0650] In some embodiments, the second calculation unit 1302 is further configured to set the first product value to be equal to the product of the first factor and the first reference color component parameter.
[0651] In some embodiments, the second calculation unit 1302 is further configured to set the first product value to be equal to a value obtained by right-shifting the first reference color component parameter, wherein the number of bits of the right-shift is equal to the first factor.
[0652] In some embodiments, the second calculation unit 1302 is further configured to perform addition and bit shift operations on the first reference color component parameter according to the first factor to determine a first product value.
[0653] In some embodiments, the second determining unit 1301 is further configured to determine a second factor based on the first color component value of the reference pixel and the first reference color component value of the reference pixel;
[0654] The second calculation unit 1302 is further configured to set the first product value to be the product of the first factor, the first reference color component parameter, and the second factor.
[0655] In some embodiments, the second determining unit 1301 is further configured to perform a least squares calculation based on the first color component value of the reference pixel and the first reference color component value of the reference pixel to determine the second factor.
[0656] In some embodiments, the preset functional relationship of the first mapping is a Softmax function.
[0657] In some embodiments, the preset functional relationship of the first mapping is a weighting function having an inverse relationship with the first reference color component parameter.
[0658] In some embodiments, the first reference color component is the first color component.
[0659] In some embodiments, the first reference color component is a second color component, wherein the second color component is a different color component than the first color component.
[0660] In some embodiments, the second determining unit 1301 is further configured to determine a difference between the first reference color component value of the reference pixel and the first reference color component value of the pixel to be predicted; and determine the first reference color component parameter according to the difference.
[0661] In some embodiments, the second determining unit 1301 is further configured to set the first color component parameter to be equal to the absolute value of the difference.
[0662] In some embodiments, the second determining unit 1301 is further configured to determine the first reference color component parameter using the first neural network model.
[0663] In some embodiments, the second determination unit 1301 is further configured such that the input of the first neural network model includes the first reference color component value of the reference pixel and the first reference color component value of the pixel to be predicted; and the output of the first neural network model includes the first reference color component parameter.
[0664] In some embodiments, referring to FIG. 13 , the decoding device 130 may further include a second constructing unit 1304 ; wherein,
[0665] The second determining unit 1301 is further configured to determine a difference between a first reference color component value of a reference pixel and a first reference color component value of a pixel to be predicted in the current block; determine a weight value of the reference pixel for the pixel to be predicted in the current block based on the difference using a preset second mapping; and determine a target weight value of the reference pixel in the current block based on the weight value of the reference pixel for the pixel to be predicted in the current block;
[0666] The second calculation unit 1302 is further configured to perform a weighted least squares calculation on the first color component value of the reference pixel and the first reference color component value of the reference pixel according to the target weight value to determine the first model parameter and the second model parameter;
[0667] The second construction unit 1304 is configured to construct a prediction model according to the first model parameter and the second model parameter;
[0668] The second prediction unit 1303 is further configured to use the prediction model to predict the first color component of the pixel to be predicted in the current block, and determine a predicted value of the first color component of the pixel to be predicted in the current block.
[0669] In some embodiments, the second calculation unit 1302 is further configured to calculate the average value of the weight values of the pixels to be predicted in the current block based on the reference pixels to determine the target weight value of the reference pixels in the current block; or, to calculate the sum of the weight values of the pixels to be predicted in the current block based on the reference pixels to determine the target weight value of the reference pixels in the current block.
[0670] In some embodiments, the second determination unit 1301 is further configured to determine the number of minimum values from the absolute values of the differences between the first reference color component value of the reference pixel and the first reference color component value of the pixel to be predicted in the current block; and use the number of minimum values as the target weight value of the reference pixel in the current block.
[0671] In some embodiments, referring to FIG13 , the decoding device 130 may further include a decoding unit 1305 ; wherein,
[0672] The decoding unit 1305 is configured to parse the code stream and determine the residual value of the first color component of the pixel to be predicted in the current block;
[0673] The second determining unit 1301 is further configured to determine a reconstructed value of the first color component of the to-be-predicted pixel in the current block according to the residual value of the first color component and the predicted value of the first color component.
[0674] 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.
[0675] 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 that stores a computer program. When the computer program is executed by a second processor, it implements any of the methods in the aforementioned embodiments.
[0676] Based on the composition of the above-mentioned decoding device 130 and the computer-readable storage medium, refer to Figure 14, which shows a specific hardware structure diagram of the decoding device provided by an embodiment of the present application. As shown in Figure 14, the decoding device 140 may include: a second communication interface 1401, a second memory 1402 and a second processor 1403; each component is coupled together through a second bus system 1404. It can be understood that the second bus system 1404 is used to achieve connection and communication between these components. In addition to the data bus, the second bus system 1404 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 1404 in Figure 14. Among them,
[0677] The second communication interface 1401 is used to receive and send signals when sending and receiving information with other external network elements;
[0678] The second memory 1402 is used to store computer programs that can be run on the second processor 1403;
[0679] The second processor 1403 is configured to, when running the computer program, execute:
[0680] Determine the reference pixel of the current block;
[0681] Determine a weighting coefficient according to the reference pixel;
[0682] A weighted calculation is performed on the first color component value of the reference pixel according to the weighting coefficient to determine the predicted value of the first color component of the pixel to be predicted in the current block.
[0683] Optionally, as another embodiment, the second processor 1403 is further configured to execute any one of the methods described in the foregoing embodiments when running the computer program.
[0684] It can be understood that the hardware functions of the second memory 1402 and the first memory 1202 are similar, and the hardware functions of the second processor 1403 and the first processor 1203 are similar; they will not be described in detail here.
[0685] This embodiment provides a decoding device that may include a second determination unit, a second calculation unit, and a second prediction unit. Thus, by utilizing color component information of adjacent reference pixels and the pixel to be predicted, weighting coefficients corresponding to the pixel to be predicted can be calculated. Furthermore, different pixels to be predicted can have different weighting coefficients, which are applied to chrominance prediction of the pixel to be predicted in the current block. This improves chrominance prediction accuracy, reduces bitrate, and enhances encoding and decoding performance.
[0686] In yet another embodiment of the present application, see Figure 15 , 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 15 , the coding and decoding system 150 may include an encoder 1501 and a decoder 1502. The encoder 1501 may be a device integrated with the encoding device 110 described in the aforementioned embodiment, or may be the encoding device 120 described in the aforementioned embodiment; the decoder 1502 may be a device integrated with the decoding device 130 described in the aforementioned embodiment, or may be the decoding device 140 described in the aforementioned embodiment.
[0687] In an embodiment of the present application, in the encoding and decoding system 150, both the encoder 1501 and the decoder 1502 can use the color component information of adjacent reference pixels and the pixels to be predicted to calculate the corresponding weighting coefficients of the pixels to be predicted; and different pixels to be predicted can have different weighting coefficients, and this weighting coefficient is applied to the chrominance prediction of the pixels to be predicted in the current block, thereby not only improving the accuracy of chrominance prediction and saving bit rate, but also improving encoding and decoding performance.
[0688] 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.
[0689] 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.
[0690] The methods disclosed in the several method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.
[0691] The features disclosed in the several product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.
[0692] The features disclosed in the several method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments or device embodiments.
[0693] 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
[0694] In the embodiment of the present application, both the encoding and decoding ends determine the reference pixel of the current block; determine the weighting coefficient based on the reference pixel; and perform weighted calculation on the first color component value of the reference pixel based on the weighting coefficient to determine the predicted value of the first color component of the pixel to be predicted in the current block. In this way, the weighting coefficient corresponding to the pixel to be predicted in the current block can be calculated by using the color component information of the reference pixel of the current block and the pixel to be predicted in the current block. Moreover, different pixels to be predicted can have different weighting coefficients. These weighting coefficients are applied to the chrominance prediction of the pixel to be predicted in the current block, thereby not only improving the accuracy of chrominance prediction and saving bit rate, but also improving encoding and decoding performance.
Claims
1. A decoding method, comprising: Determine the reference pixel of the current block; Determining a weighting coefficient according to the reference pixel; A weighted calculation is performed on the first color component value of the reference pixel according to the weighting coefficient to determine a predicted value of the first color component of the pixel to be predicted in the current block.
2. The method according to claim 1, wherein The step of performing weighted calculation on the first color component value of the reference pixel according to the weighting coefficient to determine the predicted value of the first color component of the pixel to be predicted in the current block includes: Determining a weighted value of the first color component value of the reference pixel and the corresponding weighting coefficient; The predicted value of the first color component of the pixel to be predicted in the current block is set to be equal to the sum of N weighted values; wherein N represents the number of the reference pixels and N is a positive integer.
3. The method according to claim 1, wherein The determining of the reference pixel of the current block includes: Determining the reference pixel according to pixels in an adjacent area of the current block; The adjacent area includes at least one of the following: an upper adjacent area, an upper right adjacent area, a left adjacent area, and a lower left adjacent area.
4. The method according to claim 3, wherein: The method further comprises: Screening is performed on pixels in the adjacent area to determine the reference pixel.
5. The method according to claim 4, wherein The screening of pixels in the adjacent area to determine the reference pixel includes: Determining a pixel position to be selected based on the position and / or color component intensity of the pixels in the adjacent area; The reference pixel is determined from pixels in the adjacent area according to the position of the pixel to be selected.
6. The method according to claim 1, wherein The determining of a weighting coefficient according to the reference pixel includes: determining a first reference color component parameter according to a first reference color component relationship between the reference pixel and the pixel to be predicted in the current block; The weighting coefficient is determined according to the first reference color component parameter using a preset first mapping.
7. The method according to claim 6, wherein: The determining the weighting coefficient according to the first reference color component parameter using the preset first mapping includes: The first mapping is a lookup table mapping values of the first reference color component parameters to the weighting coefficients.
8. The method according to claim 6, wherein: The determining the weighting coefficient according to the first reference color component parameter using the preset first mapping includes: Determining a value corresponding to the first reference color component parameter under a preset functional relationship of the first mapping; The weighting coefficient is set equal to the value.
9. The method according to claim 8, wherein The determining a value corresponding to the first reference color component parameter under a preset functional relationship of the first mapping includes: Determine the first factor; determining a first product value according to the first factor and the first reference color component parameter; Determine a value of the first product value corresponding to a preset functional relationship of the first mapping.
10. The method according to claim 9, wherein: The method further comprises: Determining an array element value according to a preset mapping lookup table of the first reference color component parameter, the first factor, and array elements; Determine the value of the array element corresponding to the preset functional relationship of the first mapping.
11. The method according to claim 9, wherein: The determining of the first factor comprises: The first factor is a preset constant value.
12. The method according to claim 9, 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.
13. The method according to claim 12, wherein: The method further comprises: The value of the first factor is determined according to a preset mapping lookup table between the size parameter of the current block and the value of the first factor.
14. The method according to claim 9, wherein The determining of the first factor comprises: The value of the first factor is determined according to the number of reference pixels of the current block.
15. The method according to claim 14, wherein The method further comprises: The value of the first factor is determined according to a preset mapping lookup table between the number of reference pixels of the current block and the value of the first factor.
16. The method according to claim 9, wherein The determining a first product value according to the first factor and the first reference color component parameter includes: The first product value is set equal to the product of the first factor and the first reference color component parameter.
17. The method according to claim 9, wherein The determining a first product value according to the first factor and the first reference color component parameter includes: The first product value is set to be equal to a value obtained by right-shifting the first reference color component parameter, wherein the number of bits of the right-shift is equal to the first factor.
18. The method according to claim 9, wherein The determining a first product value according to the first factor and the first reference color component parameter includes: According to the first factor, addition and bit shift operations are performed on the first reference color component parameter to determine the first product value.
19. The method according to claim 9, wherein The determining a first product value according to the first factor and the first reference color component parameter includes: determining a second factor based on the first color component value of the reference pixel and the first reference color component value of the reference pixel; The first product value is set to the product of the first factor, the first reference color component parameter, and the second factor.
20. The method according to claim 19, wherein The determining the second factor according to the first color component value of the reference pixel and the first reference color component value of the reference pixel includes: The second factor is determined by performing a least squares calculation based on the first color component value of the reference pixel and the first reference color component value of the reference pixel.
21. The method according to claim 8, wherein The determining a value corresponding to the first reference color component parameter under a preset functional relationship of the first mapping includes: The preset functional relationship of the first mapping is a Softmax function.
22. The method according to claim 8, wherein The determining a value corresponding to the first reference color component parameter under a preset functional relationship of the first mapping includes: The preset functional relationship of the first mapping is a weighting function having an inversely proportional relationship with the first reference color component parameter.
23. The method according to claim 6, wherein The method further comprises: The first reference color component is the first color component.
24. The method according to claim 6, wherein The method further comprises: The first reference color component is a second color component, wherein the second color component is a color component different from the first color component.
25. The method according to claim 6, wherein The determining of the first reference color component parameter according to the first reference color component relationship between the reference pixel and the pixel to be predicted in the current block includes: Determine a difference between a first reference color component value of the reference pixel and a first reference color component value of the pixel to be predicted; The first reference color component parameter is determined according to the difference.
26. The method according to claim 25, wherein The determining the first reference color component parameter according to the difference includes: The first color component parameter is set equal to the absolute value of the difference.
27. The method according to claim 6, wherein The determining of the first reference color component parameter according to the first reference color component relationship between the reference pixel and the pixel to be predicted in the current block includes: The first reference color component parameters are determined using a first neural network model.
28. The method according to claim 27, wherein The determining the first reference color component parameter using the first neural network model includes: The input of the first neural network model includes the first reference color component value of the reference pixel and the first reference color component value of the pixel to be predicted; The output of the first neural network model includes the first reference color component parameters.
29. The method according to claim 1, wherein The method further comprises: Determine a difference between a first reference color component value of the reference pixel and a first reference color component value of a pixel to be predicted in the current block; Determining, by using a preset second mapping, a weight value of the reference pixel to the pixel to be predicted in the current block according to the difference; Determining a target weight value of the reference pixel in the current block according to a weight value of the reference pixel to the pixel to be predicted in the current block; performing a weighted least squares calculation on the first color component value of the reference pixel and the first reference color component value of the reference pixel according to the target weight value to determine a first model parameter and a second model parameter; Constructing a prediction model according to the first model parameters and the second model parameters; The prediction model is used to predict the first color component of the pixel to be predicted in the current block, and a predicted value of the first color component of the pixel to be predicted in the current block is determined.
30. The method according to claim 29, wherein The determining, based on the weight value of the reference pixel to the pixel to be predicted in the current block, a target weight value of the reference pixel in the current block includes: Calculating an average value of weight values of pixels to be predicted in the current block according to the reference pixels to determine a target weight value of the reference pixels in the current block; or The weight values of the pixels to be predicted in the current block are summed up according to the reference pixels to determine a target weight value of the reference pixels in the current block.
31. The method according to claim 29, wherein The method further comprises: determining, based on a difference between a first reference color component value of the reference pixel and a first reference color component value of a pixel to be predicted in the current block, a number of minimum values from absolute values of the difference values; The number of the minimum values is used as the target weight value of the reference pixel in the current block.
32. The method of claim 1, wherein The method further comprises: Parsing the bitstream to determine a residual value of a first color component of a pixel to be predicted in the current block; A reconstructed value of the first color component of the to-be-predicted pixel in the current block is determined according to the residual value of the first color component and the predicted value of the first color component.
33. A coding method, the method comprising: Determine the reference pixel of the current block; Determining a weighting coefficient according to the reference pixel; A weighted calculation is performed on the first color component value of the reference pixel according to the weighting coefficient to determine a predicted value of the first color component of the pixel to be predicted in the current block.
34. The method according to claim 33, wherein The step of performing weighted calculation on the first color component value of the reference pixel according to the weighting coefficient to determine the predicted value of the first color component of the pixel to be predicted in the current block includes: Determining a weighted value of the first color component value of the reference pixel and the corresponding weighting coefficient; The predicted value of the first color component of the pixel to be predicted in the current block is set to be equal to the sum of N weighted values; wherein N represents the number of the reference pixels and N is a positive integer.
35. The method of claim 33, wherein: The determining of the reference pixel of the current block includes: Determining the reference pixel according to pixels in an adjacent area of the current block; The adjacent area includes at least one of the following: an upper adjacent area, an upper right adjacent area, a left adjacent area, and a lower left adjacent area.
36. The method of claim 35, wherein: The method further comprises: Screening is performed on pixels in the adjacent area to determine the reference pixel.
37. The method according to claim 36, wherein The screening of pixels in the adjacent area to determine the reference pixel includes: Determining a pixel position to be selected based on the position and / or color component intensity of the pixels in the adjacent area; The reference pixel is determined from pixels in the adjacent area according to the position of the pixel to be selected.
38. The method of claim 33, wherein: The determining of a weighting coefficient according to the reference pixel includes: determining a first reference color component parameter according to a first reference color component relationship between the reference pixel and the pixel to be predicted in the current block; The weighting coefficient is determined according to the first reference color component parameter using a preset first mapping.
39. The method according to claim 38, wherein The determining the weighting coefficient according to the first reference color component parameter using the preset first mapping includes: The first mapping is a lookup table mapping values of the first reference color component parameters to the weighting coefficients.
40. The method of claim 38, wherein The determining the weighting coefficient according to the first reference color component parameter using the preset first mapping includes: Determining a value corresponding to the first reference color component parameter under a preset functional relationship of the first mapping; The weighting coefficient is set equal to the value.
41. The method according to claim 40, wherein The determining a value corresponding to the first reference color component parameter under a preset functional relationship of the first mapping includes: Determine the first factor; determining a first product value according to the first factor and the first reference color component parameter; Determine a value of the first product value corresponding to a preset functional relationship of the first mapping.
42. The method according to claim 41, wherein The method further comprises: Determining an array element value according to a preset mapping lookup table of the first reference color component parameter, the first factor, and array elements; Determine the value of the array element corresponding to the preset functional relationship of the first mapping.
43. The method according to claim 41, wherein The determining of the first factor comprises: The first factor is a preset constant value.
44. The method of claim 41, 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.
45. The method of claim 44, wherein: The method further comprises: The value of the first factor is determined according to a preset mapping lookup table between the size parameter of the current block and the value of the first factor.
46. The method of claim 41, wherein The determining of the first factor comprises: The value of the first factor is determined according to the number of reference pixels of the current block.
47. The method of claim 46, wherein The method further comprises: The value of the first factor is determined according to a preset mapping lookup table between the number of reference pixels of the current block and the value of the first factor.
48. The method of claim 41, wherein The determining a first product value according to the first factor and the first reference color component parameter includes: The first product value is set equal to the product of the first factor and the first reference color component parameter.
49. The method of claim 41, wherein The determining a first product value according to the first factor and the first reference color component parameter includes: The first product value is set to be equal to a value obtained by right-shifting the first reference color component parameter, wherein the number of bits of the right-shift is equal to the first factor.
50. The method of claim 41, wherein The determining a first product value according to the first factor and the first reference color component parameter includes: According to the first factor, addition and bit shift operations are performed on the first reference color component parameter to determine the first product value.
51. The method of claim 41, wherein The determining a first product value according to the first factor and the first reference color component parameter includes: determining a second factor based on the first color component value of the reference pixel and the first reference color component value of the reference pixel; The first product value is set to the product of the first factor, the first reference color component parameter, and the second factor.
52. The method of claim 51, wherein The determining the second factor according to the first color component value of the reference pixel and the first reference color component value of the reference pixel includes: The second factor is determined by performing a least squares calculation based on the first color component value of the reference pixel and the first reference color component value of the reference pixel.
53. The method of claim 40, wherein: The determining a value corresponding to the first reference color component parameter under a preset functional relationship of the first mapping includes: The preset functional relationship of the first mapping is a Softmax function.
54. The method of claim 40, wherein: The determining a value corresponding to the first reference color component parameter under a preset functional relationship of the first mapping includes: The preset functional relationship of the first mapping is a weighting function having an inversely proportional relationship with the first reference color component parameter.
55. The method of claim 38, wherein The method further comprises: The first reference color component is the first color component.
56. The method of claim 38, wherein The method further comprises: The first reference color component is a second color component, wherein the second color component is a color component different from the first color component.
57. The method of claim 38, wherein The determining of the first reference color component parameter according to the first reference color component relationship between the reference pixel and the pixel to be predicted in the current block includes: Determine a difference between a first reference color component value of the reference pixel and a first reference color component value of the pixel to be predicted; The first reference color component parameter is determined according to the difference.
58. The method of claim 57, wherein The determining the first reference color component parameter according to the difference includes: The first color component parameter is set equal to the absolute value of the difference.
59. The method of claim 38, wherein The determining of the first reference color component parameter according to the first reference color component relationship between the reference pixel and the pixel to be predicted in the current block includes: The first reference color component parameters are determined using a first neural network model.
60. The method of claim 59, wherein The determining the first reference color component parameter using the first neural network model includes: The input of the first neural network model includes the first reference color component value of the reference pixel and the first reference color component value of the pixel to be predicted; The output of the first neural network model includes the first reference color component parameters.
61. The method of claim 33, wherein: The method further comprises: Determine a difference between a first reference color component value of the reference pixel and a first reference color component value of a pixel to be predicted in the current block; Determining, by using a preset second mapping, a weight value of the reference pixel to the pixel to be predicted in the current block according to the difference; Determining a target weight value of the reference pixel in the current block according to a weight value of the reference pixel to the pixel to be predicted in the current block; performing a weighted least squares calculation on the first color component value of the reference pixel and the first reference color component value of the reference pixel according to the target weight value to determine a first model parameter and a second model parameter; Constructing a prediction model according to the first model parameters and the second model parameters; The prediction model is used to predict the first color component of the pixel to be predicted in the current block, and a predicted value of the first color component of the pixel to be predicted in the current block is determined.
62. The method of claim 61, wherein The determining, based on the weight value of the reference pixel to the pixel to be predicted in the current block, a target weight value of the reference pixel in the current block includes: Calculating an average value of weight values of pixels to be predicted in the current block according to the reference pixels to determine a target weight value of the reference pixels in the current block; or The weight values of the pixels to be predicted in the current block are summed up according to the reference pixels to determine a target weight value of the reference pixels in the current block.
63. The method of claim 61, wherein The method further comprises: determining, based on a difference between a first reference color component value of the reference pixel and a first reference color component value of a pixel to be predicted in the current block, a number of minimum values from absolute values of the difference values; The number of the minimum values is used as the target weight value of the reference pixel in the current block.
64. The method of claim 33, wherein: The method further comprises: Determining an original value of a first color component of a pixel to be predicted in the current block; determining a residual value of the first color component of a pixel to be predicted in the current block according to the original value of the first color component and the predicted value of the first color component; The residual value of the first color component of the pixel to be predicted in the current block is encoded, and the obtained encoding bits are written into a bitstream.
65. 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 pixel of a current block; The first calculation unit is configured to determine a weighting coefficient according to the reference pixel; The first prediction unit is configured to perform weighted calculation on the first color component value of the reference pixel according to the weighting coefficient to determine a predicted value of the first color component of the pixel to be predicted in the current block.
66. 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 33 to 64 when running the computer program.
67. 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 pixel of the current block; The second calculation unit is configured to determine a weighting coefficient according to the reference pixel; The second prediction unit is configured to perform weighted calculation on the first color component value of the reference pixel according to the weighting coefficient to determine a predicted value of the first color component of the pixel to be predicted in the current block.
68. 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 32 when running the computer program.
69. A computer-readable storage medium, wherein: The computer-readable storage medium stores a computer program, and when the computer program is executed, the method according to any one of claims 1 to 32 is implemented, or the method according to any one of claims 33 to 64 is implemented.
