Encoding and decoding method, device, encoding device, decoding device, and storage medium
By determining encoding or decoding parameters based on template regions within the H.266/VVC video coding standard, the method improves prediction accuracy and coding performance for color components.
Patent Information
- Application Number
- JP2024560245
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2022-04-12
- Publication Date
- 2025-04-16
- Estimated Expiration
- 2042-04-12
AI Technical Summary
The existing H.266/VVC video coding standard faces challenges in prediction accuracy due to large differences between predicted and original values for color components, leading to reduced decoding video quality and coding performance.
The proposed solution involves determining a first encoding or decoding parameter based on a template region, using this parameter to calculate a weighting coefficient, and then using this coefficient to improve the prediction accuracy of the second color component.
This approach enhances prediction accuracy, reduces bit rates, and improves overall encoding and decoding performance.
Smart Images

Figure 2025512022000001_ABST
Abstract
Description
[Technical field]
[0001] TECHNICAL FIELD The present application relates to the technical field of video codec, and in particular to an encoding and decoding method, apparatus, encoding device, decoding device, and storage medium. [Background technology]
[0002] As the quality requirements for video display increase, new forms of video applications such as high definition and ultra high definition are emerging. The Joint Video Exploration Team (JVET) of the international standardization organizations ISO / IEC and ITU-T has established the next-generation video coding standard H.266 / VVC (Versatile Video Coding).
[0003] H.266 / VVC includes a prediction technique between color components. However, there is a large difference between the predicted value of the block to be coded calculated by the prediction technique between color components of H.266 / VVC and the original value, which reduces the prediction accuracy, degrades the decoded video quality, and reduces the coding performance. Summary of the Invention
[0004] The embodiments of the present application provide an encoding and decoding method, apparatus, encoding device, decoding device, and storage medium that can improve prediction accuracy of the second color component, save bit rate, and improve encoding and decoding performance.
[0005] In a first aspect, an embodiment of the present application provides a decoding method, the method including: determining a first decoding parameter based on a template region; determining a reference sample value of a first color component of a current block; determining a first weighting coefficient based on the reference sample value of the first color component of the current block and the first decoding parameter; and determining a first predicted value of a second color component of the current block based on the first weighting coefficient and a reference sample value of a second color component of the current block.
[0006] In a second aspect, an embodiment of the present application provides an encoding method, the method includes: determining a first encoding parameter based on a template region; determining a reference sample value of a first color component of a current block; determining a first weighting factor based on the reference sample value of the first color component of the current block and the first encoding parameter; and determining a first predicted value of a second color component of the current block based on the first weighting factor and a reference sample value of a second color component of the current block. In this way, the first encoding parameter is determined based on the template region, and a first weighting factor that is more suitable for the characteristics of the current block can be obtained based on the first encoding parameter, thereby improving the prediction accuracy of the second color component, saving bit rate, and improving encoding and decoding performance.
[0007] In a third aspect, an embodiment of the present application provides an encoding device, the device comprising a first decision module, a second decision module, a third decision module and a first prediction module, the first decision module being configured to determine a first encoding parameter based on a template region, the second decision module being configured to determine a reference sample value of a first color component of a current block, the third decision module being configured to determine a first weighting coefficient based on the reference sample value of the first color component of the current block and the first encoding parameter, and the first prediction module being configured to determine a first predicted value of a second color component of the current block based on the first weighting coefficient and the reference sample value of a second color component of the current block.
[0008] In a fourth aspect, an embodiment of the present application provides an encoding device, the encoding device comprising a first memory and a first processor, the first memory storing a computer program executable by the first processor, the first processor executing the computer program to perform the method according to the second aspect.
[0009] In a fifth aspect, an embodiment of the present application provides a decoding device, the device comprising a fourth decision module, a fifth decision module, a sixth decision module and a second prediction module, the fourth decision module being configured to determine a first decoding parameter based on a template region, the fifth decision module being configured to determine a reference sample value of a first color component of a current block, the sixth decision module being configured to determine a first weighting coefficient based on the reference sample value of the first color component of the current block and the first decoding parameter, and the second prediction module being configured to determine a first predicted value of the second color component of the current block based on the first weighting coefficient and the reference sample value of the second color component of the current block.
[0010] In a sixth aspect, an embodiment of the present application provides a decoding device, the decoding device comprising a second memory and a second processor, the second memory storing a computer program executable by the second processor, the second processor executing the computer program to perform the method according to the first aspect.
[0011] In a seventh aspect, an embodiment of the present application provides a computer readable storage medium having a computer program stored thereon, the computer program being configured, when executed, to realize a method according to the first aspect or a method according to the second aspect. [Brief description of the drawings]
[0012] [Figure 1] FIG. 13 is a schematic diagram showing the distribution of effective adjacent regions. [Diagram 2] FIG. 13 is a schematic diagram showing the distribution of selected regions in different prediction modes. [Diagram 3] 1 is a flowchart of a model parameter derivation method. [Figure 4A] FIG. 2 is a block diagram showing a configuration of an encoder according to an embodiment of the present application. [Figure 4B] FIG. 2 is a block diagram showing the configuration of a decoder according to an embodiment of the present application. [Diagram 5] 1 is a flowchart illustrating an implementation of an encoding method according to an embodiment of the present application; [Figure 6] FIG. 2 is a schematic diagram illustrating the location of an adjacent region of a current block according to an embodiment of the present application; [Figure 7] FIG. 13 illustrates an example in which the top template and the left template are not adjacent to the current block according to an embodiment of the present application. [Figure 8] 13A-13C are diagrams illustrating examples of different types of templates bordering a current block according to an embodiment of the present application. [Figure 9] 1 is a flowchart illustrating an implementation of step 51 according to an embodiment of the present application. [Figure 10] FIG. 13 illustrates an example of a left template overlapping a reference region according to an embodiment of the present application. [Figure 11] 13A and 13B are diagrams illustrating another example of reference regions of the left and right templates according to an embodiment of the present application. [Figure 12A] FIG. 13 illustrates yet another example of reference regions of the left and right templates according to an embodiment of the present application. [Figure 12B] FIG. 2 is a schematic diagram of a WCP prediction process according to an embodiment of the present application. [Figure 13] 1 is an implementation flowchart of a decoding method according to an embodiment of the present application; [Figure 14] FIG. 2 is a schematic diagram of the prediction process of the WCP technique according to an embodiment of the present application. [Figure 15] FIG. 2 illustrates an example of a reference area for a current block according to an embodiment of the present application; [Figure 16] 1 is a flowchart illustrating an implementation of step 143 according to an embodiment of the present application. [Figure 17] 13 is a flowchart illustrating an implementation of step 144 according to an embodiment of the present application. [Figure 18] FIG. 1 is a schematic diagram illustrating a configuration of an encoding device according to an embodiment of the present application. [Figure 19] FIG. 2 is a schematic diagram showing a specific hardware configuration of an encoding device according to an embodiment of the present application. [Figure 20]FIG. 2 is a schematic diagram showing the configuration of a decoding device according to an embodiment of the present application. [Figure 21] FIG. 2 is a schematic diagram showing a specific hardware configuration of a decoding device according to an embodiment of the present application. [Figure 22] 1 is a schematic diagram showing a configuration of a codec system according to an embodiment of the present application; DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0013] In order to more fully understand the features and technical contents of the embodiments of the present application, the implementation of the embodiments of the present application will be described in detail below with reference to the drawings, and the accompanying drawings are for reference purposes only and are not intended to limit the embodiments of the present application.
[0014] Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art of this application. The terms used herein are used only to describe the embodiments of this application and are not intended to limit the present application.
[0015] In the following, the statement "some embodiments" describes a subset of all possible embodiments, but it is understood that "some embodiments" may be the same or different subsets of all possible embodiments and may be combined with each other without inconsistency. It is further to be explained that the terms "first / second / third" and the like in the embodiments of the present application do not limit a particular order, but distinguish between similar objects. It is to be understood that "first / second / third" can be converted to a particular order or order when appropriate, so that the embodiments of the present application described herein can be performed in an order other than that shown or described herein.
[0016] In a video image, three color components are usually adopted to represent a coding block (CB), where the three color components are a luminance component, a blue chrominance component, and a red chrominance component, respectively. Exemplarily, 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 may be represented in a YCbCr format or a YUV format. Alternatively, the video image may be in an RGB format or a YCgCo format, etc., and the embodiment of the present application is not particularly limited.
[0017] It can be understood that in current video image or video codec processes, the cross-component prediction techniques mainly include a cross-component linear model (CCLM) prediction mode and a multi-directional linear model (MDLM) prediction mode, and whether the model parameters are derived based on the CCLM prediction mode or the MDLM prediction mode, the corresponding prediction models can realize prediction between color components, such as from the first color component to the second color component, from the second color component to the first color component, from the first color component to the third color component, from the third color component to the first color component, from the second color component to the third color component, or from the third color component to the second color component.
[0018] Taking the prediction from the first color component to the second color component as an example, assuming that the first color component is a luminance component and the second color component is a chrominance component, in order to reduce the redundancy between the luminance component and the chrominance component, VVC uses CCLM prediction mode, i.e., Pred C (i,j) = α × Rec L We construct a prediction of chrominance based on the luma reconstruction of the same coded block, such as (i,j)+β.
[0019] Here, i, j represent the position coordinates of the pixel to be predicted in the coding block, i represents the horizontal direction, j represents the vertical direction, and Pred C(i,j) represents the chromaticity prediction value corresponding to the pixel awaiting prediction at the position coordinates (i,j) in the coding block, and Rec L (i,j) represents a luminance reconstruction value corresponding to a pixel to be predicted at (downsampled) position coordinates (i,j) in the same coding block, and α and β are model parameters that can be derived by reference pixels.
[0020] For a coding block, its neighboring region can be divided into five parts: left neighboring region, upper neighboring region, lower left neighboring region, upper left neighboring region, and upper right neighboring region. H.266 / VVC includes three cross-component linear model prediction modes, which are left and upper neighboring intra CCLM prediction mode (which can be represented by INTRA_LT_CCLM), left and lower left neighboring intra CCLM prediction mode (which can be represented by INTRA_L_CCLM), and upper and upper right neighboring intra CCLM prediction mode (which can be represented by INTRA_T_CCLM). In these three prediction modes, each prediction mode can select a predetermined number (for example, four) of reference pixels to derive model parameters α and β, and the biggest difference between these three prediction modes is that the selection regions corresponding to the reference pixels for deriving model parameters α and β are different.
[0021] Specifically, the size of the coding block corresponding to the chrominance components is W × H. Let us assume that the upper selection area corresponding to the reference pixels is W' and the left selection area corresponding to the reference pixels is H'. Thus, in the case of INTRA_LT_CCLM mode, reference pixels can be selected from the upper adjacent region and the left adjacent region, i.e., W'=W, H'=H; in the case of INTRA_L_CCLM mode, reference pixels can be selected from the left adjacent region and the lower left adjacent region, i.e., H'=W+H, and W'=0 is set; and in the case of INTRA_T_CCLM mode, reference pixels can be selected from the upper adjacent region and the upper right adjacent region, i.e., W'=W+H, and H'=0 is set.
[0022] It should be noted that in VTM5.0, only pixel points in the maximum,W range are stored in the upper right adjacent region, and only pixel points in the maximum,H range are stored in the lower left adjacent region. Therefore, although the range of the selection region of INTRA_L_CCLM mode and INTRA_T_CCLM mode is defined as W+H, in actual application, the selection region of INTRA_L_CCLM mode is limited to H+H, and the selection region of INTRA_T_CCLM mode is limited to W+W.
[0023] Thus, in the case of the INTRA_L_CCLM mode, the reference pixels can be selected from the left adjacent region and the lower left adjacent region, and H'=min{W+H,H+H}. In the case of the INTRA_T_CCLM mode, the reference pixels can be selected in the upper neighboring region and the upper right neighboring region, where W'=min{W+H, W+W}.
[0024] Referring to Fig. 1, Fig. 1 is a schematic diagram showing the distribution of valid adjacent regions. In Fig. 1, the left adjacent region, the lower left adjacent region, the upper adjacent region, and the upper right adjacent region are all valid. Moreover, the blocks filled in gray are pixels awaiting prediction, whose position coordinates in the coding block are (i, j).
[0025] Thus, based on FIG. 1, the selection regions of the three prediction modes are shown in FIG. 2. Here, in FIG. 2, (a) represents the selection region of the INTRA_LT_CCLM mode, including the left adjacent region and the upper adjacent region, (b) represents the selection region of the INTRA_L_CCLM mode, including the left adjacent region and the lower left adjacent region, and (c) represents the selection region of the INTRA_T_CCLM mode, including the upper adjacent region and the upper right adjacent region. In this way, after the selection regions of the three prediction modes are determined, pixel selection for model parameter derivation can be performed within the selection region. The pixels selected in this way can be called reference pixels, and the number of reference pixels is usually four, and for one coding block of W×H whose size is determined, the position of the reference pixels is generally determined.
[0026] After obtaining the predetermined number of reference pixels, chromaticity prediction is now performed according to the flowchart of the model parameter derivation method shown in Figure 3. According to the process shown in Figure 3, assuming that the predetermined number is four, the process may include the following steps:
[0027] In S301, reference pixels are obtained in the selected area. In S302, the number of valid reference pixels is determined. In S303, if the number of valid reference pixels is 0, the model parameters α and β are set to default values. In S304, the chromaticity prediction value is set to a default value. In S305, if the number of valid reference pixels is four, two reference pixels with larger luminance component values and two reference pixels with smaller luminance component values are obtained through comparison. In S306, the average score corresponding to the large value and the average score corresponding to the small value are calculated. In S307, model parameters α and β are derived from the two average points. In S308, chromaticity prediction is performed using the prediction model constructed by α and β.
[0028] It should be noted that in VVC, the step of valid reference pixels being 0 is determined based on the validity of the neighboring regions.
[0029] It should be further explained that the principle of "determining one line by two points" is used to construct the prediction model, where the two points can be called fitting points. In the current technical solution, after obtaining the four reference pixels, two reference pixels with large values and two reference pixels with small values of the luminance component are obtained by comparison, and then one mean point is calculated based on the two reference pixels with large values. max Then, another mean point is calculated based on the two reference pixels with the smallest values. min (which can be expressed as max and mean minFurthermore, we can obtain the 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 chromaticity components is performed based on this prediction model.
[0030] However, in the related art, a simple linear model Pred is used for each coding block. C (i,j)=α·Rec L The chrominance component is predicted using (i,j)+β, and pixels at any position of each coding block are predicted using the same model parameters α and β. This leads to the following problems: (1) coding blocks with different content characteristics realize chrominance prediction by mapping from luminance to chrominance using a simple linear model, but the mapping function from luminance to chrominance in any coding block cannot be accurately fitted by this simple linear model, so the prediction effect of some coding blocks is inaccurate. (2) During prediction, pixel points at different positions in the coding block all use the same model parameters α and β, and there is also a large difference in the prediction accuracy of different positions in the coding block. (3) During CCLM prediction, the characteristics of coding blocks with different contents and different sizes are not fully taken into account, so the high correlation between the reconstructed luminance information of the current block and the reference information of the reference area is lost, so in such technology, some coding blocks cannot be predicted accurately, which affects the gain effect of such technology. In short, in the related solution of CCLM technology, there is a large difference between the predicted value and the original value of some coding blocks, which reduces the prediction accuracy, reduces the video quality of the decoded, and reduces the coding performance.
[0031] Based on this, the embodiment of the present application provides an encoding and decoding method, and the principle of the method is the same whether it is the encoding side or the decoding side. Take the encoding side as an example, determine a first encoding parameter based on a template region, determine a reference sample value of the first color component of the current block, determine a first weighting factor based on the reference sample value of the first color component of the current block and the first encoding parameter, and determine a first predicted value of the second color component of the current block based on the first weighting factor and the reference sample value of the second color component of the current block. In this way, the first encoding parameter is determined based on the template region, and a first weighting factor that is more suitable for the characteristics of the current block can be obtained based on this, thereby improving the prediction accuracy of the second color component of the current block, saving bit rate, and improving encoding performance.
[0032] Hereinafter, each embodiment of the present application will be described in detail with reference to the drawings.
[0033] Referring to Fig. 4A, Fig. 4A is a block diagram showing the configuration of an encoder according to an embodiment of the present application. As shown in Fig. 4A, an encoder (specifically a "video encoder") 100 may include a transform and quantization unit 101, an intra estimation unit 102, an intra 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 buffer unit 110, etc., where the filtering unit 108 can realize deblock filtering and sample adaptive offset (SAO: Sample Adaptive Offset) filtering, and the encoding unit 109 can realize header information coding and binary arithmetic coding based on context adaptive modeling (CABAC: Context-based Adaptive Binary Arithmetic Coding). For an input original video signal, one video coding block is obtained by splitting a coding tree unit (CTU), and then the video coding block is transformed by a transform and quantization unit 101 for residual pixel information obtained through intra prediction or inter prediction. The transform includes transforming the residual information from pixel domain to transform domain and quantizing the obtained transform coefficients to further reduce the bit rate. The intra estimation unit 102 and the intra prediction unit 103 are configured to perform intra prediction on the video coding block, and explicitly, the intra estimation unit 102 and the intra prediction unit 103 are configured to determine an intra prediction mode used to encode the video coding block.The motion compensation unit 104 and the motion estimation unit 105 are configured to perform inter-prediction coding of the received video coding block relative to one or more blocks in one or more reference frames to provide temporal prediction information, where the motion estimation performed by the motion estimation unit 105 is a process of generating a motion vector, which can estimate the motion of the video coding block, and then the motion compensation unit 104 performs motion compensation based on the motion vector determined by the motion estimation unit 105, and after determining the intra prediction mode, the intra prediction unit 103 is further configured to provide the selected intra prediction data to the encoding unit 109, and the motion estimation unit 105 also transmits the motion vector data determined by calculation to the encoding unit 109. Also, the inverse transform and inverse quantization unit 106 is for reconstruction of the video coding block and is configured to reconstruct a residual block in the pixel domain, the reconstructed residual block is filtered out of blocking effect artifacts by the filter control analysis unit 107 and the filtering unit 108, and then the reconstructed residual block is added to one prediction block in a 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, and in a CABAC-based encoding algorithm, the context content may be based on neighboring coding blocks and may be used to encode information indicating a determined intra-prediction mode to output a bitstream of the video signal, and 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 coding blocks are continuously generated, and these reconstructed video coding blocks are stored in the decoded image buffer unit 110.
[0034] Referring to FIG. 4B, FIG. 4B is a block diagram showing the configuration of a decoder according to an embodiment of the present application. As shown in FIG. 4B, a decoder (specifically, a "video decoder") 200 includes a decoding unit 201, an inverse transform and inverse quantization unit 202, an intra prediction unit 203, a motion compensation unit 204, a filtering unit 205, and a decoded image buffer unit 206, etc., where the decoding unit 201 can realize header information decoding and CABAC decoding, and the filtering unit 205 can realize deblock filtering and SAO filtering. After the input video signal undergoes the encoding process of FIG. 4A, the decoder outputs a bit stream of the video signal. The bitstream is input to the decoder 200, and first passes through a decoding unit 201 to obtain decoded transform coefficients, which are processed by an inverse transform and inverse quantization unit 202 to generate a residual block in the pixel domain; an intra prediction unit 203 may be configured to generate prediction data for a current video decoded block based on a determined intra prediction mode and data of a previously decoded block from a current frame or picture; and a motion compensation unit 204 determines prediction information for a video decoded block by analyzing motion vectors and other related syntax elements, and uses the prediction information to generate a prediction block for the video decoded 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 prediction block generated by the intra prediction unit 203 or the motion compensation unit 204; and the decoded video signal passes through a filtering unit 205 to remove blocking effect artifacts, which can improve the video quality. The decoded video blocks are then stored in a decoded image buffer unit 206, which is configured to store reference images for subsequent intra-prediction or motion compensation, and to output a video signal, i.e., a reconstructed original video signal is obtained.
[0035] It should be noted that the method of the embodiment of the present application is mainly applied to the intra prediction unit 103 part shown in Fig. 4A and the intra prediction unit 203 part shown in Fig. 4B. That is, the embodiment of the present application may be applied to the encoder, may be applied to the decoder, or may be applied to the encoder and the decoder simultaneously, but the embodiment of the present application is not particularly limited.
[0036] It should further be explained that when applied to intra prediction unit 103, the "current block" specifically refers to the encoded block currently awaiting intra prediction, and when applied to intra prediction unit 203, the "current block" specifically refers to the decoded block currently awaiting intra prediction.
[0037] First, the encoding method provided in the embodiment of the present application will be described. Fig. 5 is a flowchart showing the implementation of the encoding method according to the embodiment of the present application. As shown in Fig. 5, the encoding method may include the following steps 51 to 54.
[0038] In step 51, a first encoding parameter is determined based on the template region. In step 52, a reference sample value of a first color component of the current block is determined. In step 53, a first weighting factor is determined based on the reference sample value of the first color component of the current block and the first coding parameter. In step 54, a first predicted value of the second color component of the current block is determined based on the first weighting coefficient and a reference sample value of the second color component of the current block.
[0039] In the embodiment of the present application, since the first encoding parameter is determined based on the template region rather than a predetermined fixed value, the obtained first weighting coefficient is more compatible with the characteristics of the current block, thereby improving the prediction accuracy of the second color component of the current block, saving bit rate, and improving encoding performance.
[0040] Further alternative embodiments of each of the above steps and related nouns are described below.
[0041] In step 51, a first encoding parameter is determined based on the template region.
[0042] In some embodiments of the present application, the template region may include some or all of the region of the current block and the reference region of the current block, or the template region may not include the current block but includes the reference region of the template region. In some embodiments, the template region is a coded region.
[0043] A template region may be determined first, for example based on pixel availability of neighboring regions of the current block, and based on a relative position of the current block, the neighboring regions include at least one of the following: an upper region of the current block, a left region of the current block, an upper right region of the current block, a lower left region of the current block, and an upper left region of the current block.
[0044] As can be understood, the unavailable pixel is not set as a pixel of the template region. In some embodiments, the pixel availability of the pixel can be determined based on the pixel's location in the neighboring region and / or the coding state of the pixel. For example, if the pixel's location belongs to a defined edge region, the pixel is determined to be unavailable. In another example, if the coding state of the pixel is in a non-coded state, the pixel is determined to be unavailable, and in yet another example, if the pixel's location belongs to a defined edge region and the coding state of the pixel is in a non-coded state, the pixel is determined to be unavailable.
[0045] In the embodiment of the present application, the adjacent region of the current block may include a region adjacent to the current block and / or a region not adjacent to the current block. Taking the region adjacent to the current block as an example, as shown in FIG. 6, the adjacent region may include at least one of the regions in each direction shown in the figure.
[0046] In another example, the template region may be determined based on the template type included in the configured prediction mode.
[0047] In some embodiments, the template types include at least one of: an upper template, a left template, an upper right template, a lower left template, and an upper left template.
[0048] Furthermore, in some embodiments, the template region may be a template included in a configured prediction mode.
[0049] The template region may include a region adjacent to the current block, or may include a region not adjacent to the current block. For example, as shown in Figure 7, Figure 7 shows a case where the top template and the left template do not adjacent to the current block, and as shown in Figure 8, Figure 8 shows a case where the top template, the left template, the top right template, the lower left template, and the upper left template adjacent to the current block.
[0050] It should be noted that the width and height of the neighboring region can be configured based on the requirements of a metric such as bit rate, etc. Similarly, the width and height of the template region can be configured based on the requirements of a metric such as bit rate, etc.
[0051] After determining the template region, in some embodiments, step 51 can be realized by the following steps 511 and 512, as shown in FIG.
[0052] In step 511, a reference sample value of the template region is determined.
[0053] In some embodiments, the reference sample values of the template area include a reconstructed value of a first color component of the template area, a reconstructed value of a second color component of the template area, a reconstructed value of a first color component of a reference area of the template area, and a reconstructed value of a second color component of a reference area of the template area.
[0054] The reference area of a template area varies depending on the type of the template area, and the template area may overlap its reference area. In some embodiments, the reference area of the template area includes at least one of the upper adjacent area of the template area, the lower adjacent area of the template area, the left adjacent area of the template area, the right adjacent area of the template area, and the template area, and in this case, when the reference area of the template area includes the template area, the area of the reference area is larger than the area of the template area. In the embodiments of the present application, the size of the upper, lower, left, and right adjacent areas of the template area is not limited, and the size of the adjacent areas may be preset according to the type of the template area. The left and right edges of the upper and lower adjacent areas of the template area may be aligned or not aligned with the left and right edges of the upper template. Similarly, the top and bottom edges of the left and right adjacent areas of the template area may be aligned or not aligned with the top and bottom edges of the upper template.
[0055] For example, as shown in FIG. 10, FIG. 10 is a diagram showing an example where the left template overlaps with the reference region, and an example where the right template overlaps with the reference region. The reference region of the upper template includes the upper template, and the reference region of the left template includes the left template. Also, as shown in FIG. 11, FIG. 11 shows the reference regions of the left template and the right template, and the reference region includes the upper adjacent region of the upper template and the left adjacent region of the left template. Furthermore, as shown in FIG. 12A, FIG. 12A shows the reference regions of the left template and the right template, and the reference region includes the lower adjacent region of the upper template and the right adjacent region of the left template.
[0056] In step 512, the first encoding parameters are determined based on reference sample values of the template region.
[0057] In some embodiments, step 512 may be implemented by step 5121 and step 5122.
[0058] In step 5121, a first difference value for the template area is determined, and the first difference value for the template area is set equal to the absolute value of the difference between a reference value for a first color component of the template area and a reference value for a first color component of a reference area of the template area.
[0059] Furthermore, in some embodiments, the reference value of the first color component of the template region is a reconstructed value of the first color component of the template region or a value obtained by filtering the reconstructed value of the first color component of the template region, and the reference value of the first color component of the reference region of the template region is a reconstructed value of the first color component of the reference region of the template region or a value obtained by filtering the reconstructed value of the first color component of the reference region of the template region.
[0060] In step 5122, the first encoding parameter is determined based on a first difference value of the template region.
[0061] Furthermore, in some embodiments, the first encoding parameter can be determined by consulting a mapping table of a preset first difference value and a first encoding parameter, and the mapping table records the first encoding parameters corresponding to different first difference values when the bit rate is maximized. Furthermore, in some embodiments, step 5122 can be realized by steps 5122-1 to 5122-3.
[0062] In Step 5122-1, a second predicted value of a second colour component for the template region is determined based on the first difference value and candidate first coding parameters.
[0063] In some embodiments, a second predicted value of a second color component of the template region is set equal to a weighted sum of a reference value of a second color component of a reference region of the template region and a second weighting factor.
[0064] Furthermore, in some embodiments, the second weighting factor is determined based on the first difference value of the template region and the candidate first coding parameters using a predetermined correspondence.
[0065] In some embodiments, the predetermined correspondence is not limited and may be various kinds of function models, and the candidate first encoding parameter is one model parameter of the function model that affects the magnitude of the second weighting coefficient. The predetermined correspondence can also be obtained using a function model, for example, the predetermined correspondence is the first difference value and the second weighting coefficient corresponding to the candidate first encoding parameter.
[0066] Furthermore, in some embodiments, the predetermined correspondence is a softmax function, and an input of the softmax function is one of the ratio of the first difference value to the candidate first encoding parameter, the product of the first difference value and the candidate first encoding parameter, or a value obtained by bit-shifting the first difference value, the number of bits of the bit-shift being equal to the candidate first encoding parameter, and the direction of the bit-shift may be to the left or to the right.
[0067] For example, the following Equation 1 shows an example of a softmax function.
[0068]
number
[0069] [Formula 2] diffTempY[a][j][k]=abs(refTempY[k]-recTempY[i][j]) Here, refTempY[k] represents the reference value of the first color component of the kth pixel in the reference area of the template area, and recTempY[i][j] represents the reference value of the first color component of the pixel with pixel coordinates (i,j) in the template area.
[0070] Based on this, a second predicted value of the second color component of the pixel having pixel coordinates (i,j) in the template region is calculated as shown in Equation 3.
[0071]
number
[0072] In some embodiments, the predetermined correspondence can also be obtained by using a softmax function. First, the predetermined correspondence (e.g., a predetermined mapping table) is pre-calculated according to a softmax function, and then, when determining the second weighting coefficient, the predetermined correspondence can be consulted to obtain the first difference value of the template region and the second weighting coefficient corresponding to the candidate decoding parameters.
[0073] In some embodiments, the candidate first coding parameters include one or more candidate first coding parameters, for each candidate first coding parameter a corresponding first prediction error can be calculated by steps 5122-1 and 5122-2.
[0074] In step 5122-2, a first prediction error for a second color component of the template region is determined, the first prediction error being the error between a reference value for the second color component of the template region and a second predicted value for the second color component of the template region, and the reference value for the second color component of the template region being a reconstructed value of the second color component of the template region or a value obtained by filtering the reconstructed value of the second color component of the template region.
[0075] In some embodiments, a second predicted value for determining the first prediction error is set equal to a second predicted value obtained by a correction operation on a second predicted value of a second color component of the template region.
[0076] In Step 5122-3, the first coding parameters are determined based on the first prediction error.
[0077] In the embodiment of the present application, the embodiment for realizing step 5122-3 is not limited and may be various. For example, it can be realized by any one of the following embodiments 1 to 4.
[0078] In the first embodiment, step 5122-3 can be realized as follows: the first encoding parameter is set equal to the value of the candidate first encoding parameter corresponding to when the first prediction error satisfies a first condition, and the reference value of the second color component of the reference area of the template area is a reconstructed value of the second color component of the reference area of the template area or a value obtained by filtering the reconstructed value of the second color component of the reference area of the template area.
[0079] In some embodiments, the first condition includes the first prediction error being a minimum, the first prediction error being smaller than a first threshold, the first prediction error being a maximum, or the first prediction error being larger than a third threshold.
[0080] It should be noted that the first prediction errors of different evaluation criteria correspond to different first conditions. For example, for the evaluation criterion Sum of Absolute Differences (SAD), the first condition includes that the first prediction error is the smallest or that the first prediction error is smaller than a first threshold, and in another example, for the evaluation criterion Peak Signal-to-Noise Ratio (PSNR), the first condition includes that the first prediction error is the largest or that the first prediction error is larger than a third threshold.
[0081] In the second embodiment, step 5122-3 (i.e., determining the first encoding parameter based on the first prediction error) can also be realized as follows: Namely, from among each candidate first encoding parameter of the template region, a parameter whose first prediction error satisfies a first condition is selected, and the first encoding parameter is determined based on the parameter corresponding to the template region whose first prediction error satisfies the first condition.
[0082] Furthermore, the step of "determining the first encoding parameter based on a parameter corresponding to the template region and for which a first prediction error satisfies a first condition" can be realized according to the following Example 1, Example 2, Example 3, or Example 4.
[0083] In example 1, a sixth weighting coefficient is determined based on a reference sample value of a first color component of the current block and a candidate first encoding parameter whose first prediction error satisfies a first condition; a third predicted value of a second color component of the current block is determined based on the sixth weighting coefficient and a reference sample value of a second color component of the current block; a second prediction error of a candidate first encoding parameter whose corresponding first prediction error satisfies a first condition is determined based on the third predicted value of the second color component of the current block and an original value; and the first encoding parameter is determined based on the second prediction error of a candidate first encoding parameter whose corresponding first prediction error satisfies the first condition.
[0084] Here, the calculation principle of the sixth weighting coefficient is consistent with the calculation principle of the second weighting coefficient, and may refer to Equation 1 and Equation 2. Therefore, the specific calculation method of the sixth weighting coefficient is not described here repeatedly. In some embodiments, the reference sample value of the first color component of the current block includes a reconstructed value of the first color component of the reference area of the current block (or a value obtained by filtering the reconstructed value) and a reconstructed value of the first color component of the current block (or a value obtained by filtering the reconstructed value). The reference sample value of the second color component of the current block includes a reconstructed value of the second color component of the reference area of the current block, a value obtained by filtering the reconstructed value of the second color component of the reference area of the current block, an original value of the second color component of the reference area of the current block, or a value obtained by filtering the original value of the second color component of the reference area of the current block.
[0085] In some embodiments, a candidate first encoding parameter whose second prediction error satisfies a third condition is selected from among the candidate first encoding parameters whose first prediction error satisfies a first condition, and the first encoding parameter is determined based on the candidate first encoding parameter whose second prediction error satisfies the third condition.
[0086] For example, the first coding parameter is set equal to a candidate first coding parameter for which the second prediction error satisfies a third condition. Here, the number of candidate first coding parameters for which the second prediction error satisfies the third condition may be one or more. In the case of a plurality of candidate first coding parameters, the first coding parameter is set equal to any one of the candidate first coding parameters for which the second prediction error satisfies the third condition.
[0087] In another example, the first coding parameter is set equal to a blended value of a candidate first coding parameter for which the second prediction error satisfies a third condition. Furthermore, in some embodiments, a weighting factor for a corresponding candidate first coding parameter can be determined based on the magnitude of the second prediction error, and based thereon, the first coding parameter is set equal to a weighted sum of a candidate first coding parameter for which the second prediction error satisfies a third condition and a corresponding weighting factor. In some embodiments, the third condition includes the second prediction error being a minimum or the second prediction error being a maximum.
[0088] It should be noted that different evaluation criteria of the second prediction error correspond to different third conditions. For example, for the evaluation criterion Sum of Absolute Differences (SAD), the third condition includes that the second prediction error is the smallest, and in another example, for the evaluation criterion Peak Signal-to-Noise Ratio (PSNR), the third condition includes that the second prediction error is the largest.
[0089] In Example 2, the step of "determining the first coding parameter based on a parameter corresponding to the template region and whose first prediction error satisfies a first condition" can be realized as follows: extend a candidate first coding parameter whose first prediction error satisfies a first condition to obtain a first extension parameter, determine a seventh weighting coefficient based on a reference sample value of a first color component of the current block, the candidate first coding parameter whose first prediction error satisfies a first condition, and the first extension parameter, determine a fourth predicted value of a second color component of the current block based on the seventh weighting coefficient and a reference sample value of a second color component of the current block, determine a third prediction error of a corresponding parameter based on the fourth predicted value of the second color component of the current block and an original value, and determine the first coding parameter based on each of the candidate first coding parameters and the third prediction error of the first extension parameter.
[0090] Similarly, the calculation principle of the seventh weighting factor is consistent with the calculation principle of the second weighting factor, and can refer to the above Equation 1 and Equation 2, and will not be described again here. A seventh weighting factor corresponds to a candidate first coding parameter or a first extension parameter, that is, the seventh weighting factor is determined according to the candidate first coding parameter or the first extension parameter, the reference sample value of the first color component of the current block.
[0091] In some embodiments, at least one first extension parameter is obtained by extending left and / or right based on a predetermined step length around a candidate first coding parameter for which the first prediction error satisfies a first condition.
[0092] In some embodiments, from among the candidate first encoding parameters and the first extension parameters, a parameter for which a third prediction error satisfies a fourth condition is selected, and the first encoding parameter can be determined based on the parameter for which the third prediction error satisfies the fourth condition.
[0093] For example, the first coding parameter is set equal to a parameter for which the third prediction error satisfies a fourth condition, where the number of parameters for which the third prediction error satisfies the fourth condition may be one or more, in which case the first coding parameter is set equal to any of the parameters for which the third prediction error satisfies the fourth condition.
[0094] In another example, the first coding parameter is set equal to a blended value of parameters for which the third prediction error satisfies a fourth condition. Furthermore, in some embodiments, a weighting factor for a corresponding parameter can be determined based on the magnitude of the third prediction error, and based thereon, the first coding parameter is set equal to a weighted sum of parameters for which the third prediction error satisfies a fourth condition and corresponding weighting factors.
[0095] In some embodiments, the fourth condition includes the third prediction error being a minimum or the third prediction error being a maximum.
[0096] It should be noted that different evaluation criteria of the third prediction error correspond to different fourth conditions. For example, for the evaluation criterion Sum of Absolute Differences (SAD), the fourth condition includes that the third prediction error is the smallest, and in another example, for the evaluation criterion Peak Signal-to-Noise Ratio (PSNR), the fourth condition includes that the third prediction error is the largest.
[0097] In Example 3, the step of "determining the first encoding parameter based on a parameter corresponding to the template region for which the first prediction error satisfies a first condition" can also be implemented as follows: set the first encoding parameter equal to a parameter for which the first prediction error satisfies a first condition, or set the first encoding parameter equal to a blended value of parameters for which the first prediction error satisfies a first condition.
[0098] Furthermore, in some embodiments, the first coding parameter is set equal to a weighted sum of the parameter for which the first prediction error satisfies a first condition and a third weighting factor.
[0099] In some embodiments, based on the first prediction error corresponding to the parameter for which the first prediction error satisfies the first condition, a corresponding third weighting factor may be determined or the third weighting factor may be set to a predetermined constant value.
[0100] In Example 4, the step of "determining the first encoding parameter based on a parameter corresponding to the template region and for which the first prediction error satisfies a first condition" can also be implemented as follows: a parameter for which the first prediction error satisfies a first condition is expanded to obtain a first expanded parameter, and the first expanded parameter and / or a parameter for which the first prediction error satisfies the first condition are combined to obtain the first encoding parameter.
[0101] In some embodiments, a weighting factor of a corresponding parameter can be determined according to the magnitude of the first prediction error, and the weighting factor of the first extension parameter can be a predetermined constant value or a weighting factor of a corresponding candidate first coding parameter, and then a weighting calculation is performed on the parameters for which the first extension parameter and / or the first prediction error satisfy a first condition to obtain the first coding parameter.
[0102] In the third embodiment, step 5122-3 (i.e., determining the first coding parameter based on the first prediction error) can be further implemented as follows: setting the first coding parameter equal to a weighted sum of each of the candidate first coding parameters and a fourth weighting factor.
[0103] In some embodiments, a fourth weighting factor for the corresponding candidate first coding parameter is determined based on the first prediction error.
[0104] In the fourth embodiment, step 5122-3 (i.e., determining the first encoding parameters based on the first prediction errors) can be further implemented as follows: That is, based on the first prediction errors corresponding to each of the same candidate first encoding parameters of the template region, an evaluation parameter representing the performance of the corresponding candidate first encoding parameter is determined, and based on the evaluation parameter of each of the candidate first encoding parameters, the first encoding parameters are determined.
[0105] Furthermore, in some embodiments, the evaluation parameter is set equal to a blended value of first prediction errors corresponding to each of the same candidate first coding parameters of the template region, which may be the sum or product of these first prediction errors, etc.
[0106] Furthermore, in some embodiments, the evaluation parameter is set equal to the sum of first prediction errors corresponding to each of the same candidate first coding parameters of the template region.
[0107] Furthermore, in some embodiments, the step of "determining the first encoding parameters based on an evaluation parameter of each of the candidate first encoding parameters" can be implemented as follows: That is, from each of the candidate first encoding parameters, a parameter whose evaluation parameter satisfies a second condition is selected, and the first encoding parameter is determined based on the parameter whose evaluation parameter satisfies the second condition.
[0108] Furthermore, the step of "determining the first encoding parameter based on the evaluation parameter satisfying a second condition" can be realized according to Example 5 or Example 6 below.
[0109] In example 5, an eighth weighting coefficient is determined based on the reference sample value of the first color component of the current block and the parameter whose evaluation parameter satisfies a second condition, a fifth predicted value of the second color component of the current block is determined based on the eighth weighting coefficient and the reference sample value of the second color component of the current block, a fourth prediction error of the parameter whose corresponding evaluation parameter satisfies the second condition is determined based on the fifth predicted value and an original value of the second color component of the current block, and the first encoding parameter is determined based on the fourth prediction error of each candidate first encoding parameter.
[0110] Further, in some embodiments, the parameters whose evaluation parameters satisfy the second condition are expanded to obtain second expansion parameters, a ninth weighting coefficient is determined based on the reference sample value of the first color component of the current block, the parameters whose evaluation parameters satisfy the second condition, and the second expansion parameters, a sixth predicted value of the second color component of the current block is determined based on the ninth weighting coefficient and the reference sample value of the second color component of the current block, a fifth prediction error of a corresponding parameter is determined based on the sixth predicted value of the second color component of the current block and an original value, and the first encoding parameter is determined based on each candidate first encoding parameter and the fifth prediction error of the second expansion parameter.
[0111] Similarly, the calculation principle of the eighth weighting factor and the ninth weighting factor is consistent with the calculation principle of the second weighting factor, and can refer to the above Equation 1 and Equation 2, and will not be described again here. A ninth weighting factor corresponds to a candidate first coding parameter or a second extension parameter, that is, the ninth weighting factor is determined according to a candidate first coding parameter or a second extension parameter and a reference sample value of the first color component of the current block.
[0112] In Example 6, the step of "determining the first encoding parameter based on the parameter whose evaluation parameter satisfies the second condition" can be implemented as follows: setting the first encoding parameter equal to the parameter whose evaluation parameter satisfies the second condition, or setting the first encoding parameter equal to a blended value of the parameters whose evaluation parameter satisfies the second condition. In some embodiments, setting the first encoding parameter equal to a weighted sum of the parameter whose evaluation parameter satisfies the second condition and a fifth weighting factor.
[0113] Furthermore, the fifth weighting coefficient is obtained according to Example 7 or Example 8.
[0114] In Example 7, a fifth weighting factor for the corresponding parameter is determined based on the template region corresponding to the parameter whose evaluation parameter satisfies the second condition.
[0115] Furthermore, in some embodiments, a fifth weighting factor for the corresponding parameter is determined based on the number of pixels in the template region and / or the template type corresponding to the evaluation parameter that satisfies the second condition.
[0116] In some embodiments, the second condition includes that the evaluation parameter is a minimum, that the evaluation parameter is smaller than a second threshold, that the evaluation parameter is a maximum, or that the evaluation parameter is greater than a fourth threshold. It can be understood that the first prediction errors of different evaluation criteria correspond to different second conditions. For example, for the evaluation criterion Sum of Absolute Differences (SAD), the second condition includes that the evaluation parameter is a minimum or that the evaluation parameter is smaller than a second threshold, and in another example, for the evaluation criterion Peak Signal-to-Noise Ratio (PSNR), the second condition includes that the evaluation parameter is a maximum or that the evaluation parameter is greater than a fourth threshold.
[0117] In example 8, the fifth weighting factor is a predetermined constant value.
[0118] When performing intra prediction on a current block, there may be a case where a template region does not exist. In some embodiments, when the template region does not exist, a default value is set as a predicted value of the second color component of the current block. In other embodiments, when the template region does not exist, it may be determined to adopt a prediction method different from the above method to predict the second color component of the current block. The prediction method different from the above method may be, for example, a prediction method based on a cross-component linear model (CCLM).
[0119] In some embodiments, after obtaining the first coding parameters, the first coding parameters or an index of the first coding parameters may be coded and the resulting coded bits may be written to a bitstream.
[0120] In step 52, a reference sample value of a first color component of the current block is determined.
[0121] In some embodiments, the reference sample value of the first color component of the current block includes a reconstructed value of the first color component of the current block and a reconstructed value of the first color component of a reference area of the current block.
[0122] In step 53, a first weighting factor is determined based on the reference sample value of the first color component of the current block and the first coding parameter.
[0123] In some embodiments, a second difference value of the current block may be determined, where the second difference value of the current block is set equal to an absolute value of a difference between a reference value of a first color component of the current block and a reference value of a first color component of a reference area of the current block, and a first weighting factor is determined based on the second difference value of the current block and the first coding parameter, where the reference value of the first color component of the current block is a reconstructed value of the first color component of the current block or a value obtained by filtering the reconstructed value of the first color component of the current block, and the reference value of the first color component of the reference area of the current block is a reconstructed value of the first color component of the reference area of the current block or a value obtained by filtering the reconstructed value of the first color component of the reference area of the current block.
[0124] Furthermore, in some embodiments, a first weighting factor may be determined based on the second difference value of the current block and the first coding parameter using a predetermined correspondence relationship.
[0125] Furthermore, in some embodiments, the predetermined correspondence is a softmax function or the predetermined correspondence is obtained using a softmax function, an input of which is one of the ratio of the second difference value to the first encoding parameter, the product of the second difference value and the candidate first decoding parameter, or a value obtained by bit-shifting the second difference value, the number of bits of the bit-shift being equal to the candidate first decoding parameter.
[0126] For example, the following Equation 4 shows an example of a softmax function.
[0127]
number
[0128] [Formula 5] diffY[i][j][k]=abs(refY[k]-recY[i][j]) Here, refY[k] represents the reference value of the first color component of the kth pixel in the reference area of the current block (e.g., the reconstructed value, the value obtained by filtering the reconstructed value, the original value, or the value obtained by filtering the original value), and recY[i][j] represents the reference value of the first color component of the pixel whose pixel coordinates in the current block are (i,j) (e.g., the reconstructed value, the value obtained by filtering the reconstructed value, the original value, or the value obtained by filtering the original value).
[0129] In step 54, a first predicted value of the second color component of the current block is determined based on the first weighting coefficient and a reference sample value of the second color component of the current block.
[0130] In some embodiments, the reference sample value of the second color component of the current block comprises a reconstructed value of the second color component of the reference area of the current block, or a value obtained by filtering the reconstructed value, or an original value of the second color component of the reference area of the current block, or a value obtained by filtering the original value.
[0131] Based on Equation 5, a first predicted value of the second color component of the pixel whose pixel coordinates are (i,j) in the current block is calculated as shown in Equation 6.
[0132]
number
[0133] In some embodiments, after obtaining a first predicted value of the second color component of the current block in step 54, the encoding method further includes the following steps 55 to 57.
[0134] In step 55, the original value of the second color component of the current block is obtained.
[0135] In step 56, a residual value of the second color component of the current block is determined based on the original value of the second color component of the current block and the first predicted value of the second color component.
[0136] In step 57, the residual value of the second color component of the current block is encoded and the resulting encoded bits are written to the bitstream.
[0137] In some other embodiments, after obtaining the first predicted value of the second color component of the current block in step 54, the encoding method further includes the following steps 515 to 518.
[0138] In step 515, a correction operation is performed on the first predicted value of the second color component of the current block to obtain a corrected first predicted value.
[0139] The first predicted value of the second color component of the current block should be within a limited range. If it exceeds the limited range, a corresponding correction operation should be performed. For example, A clip operation can be performed on the first predicted value of the second color component of the current block. Specifically, C pred If the value of C pred [i][j] is less than 0, it is set to 0. Here, C
[0140] C pred [i][j] represents the first predicted value of the second color component of the pixel whose pixel coordinates of the current block are (i, j). If the value of C
[0141] [i][j] is greater than (1<<BitDepth)-1, it is set to (1<<BitDepth)-1.
[0142] That is, [Equation 7] C pred [i][j]=Clip3(0,(1≪BitDepth)-1,C pred [i][j]) Here,
Number
[0143]
Number
[0144] In step 517, based on the original value of the second color component of the current block and the corrected first predicted value, determine the residual value of the second color component of the current block.
[0145] In step 518, the residual value of the second color component of the current block is encoded and the resulting encoded bits are written to the bitstream.
[0146] In the following, an embodiment of the decoding side is provided, and the decoding method provided by the embodiment of the present application is similar to the above encoding method, the above first encoding parameter corresponds to the first decoding parameter described in the following embodiment and is essentially the same, and the above candidate first encoding parameter corresponds to the candidate first decoding parameter described in the following embodiment and is essentially the same, both of which are used to control the magnitude of the weighting coefficient. The decoding method provided in the following embodiment has the same beneficial effects as the encoding method of the above embodiment. The technical details not disclosed in the embodiment of the decoding method of the present application can be understood by referring to the description of the embodiment of the encoding method above. Therefore, the technical details and specific embodiments not disclosed in the embodiment of the decoding method of the present application will not be described repeatedly.
[0147] An embodiment of the present application provides a decoding method, and FIG. 13 is an implementation flowchart of the decoding method according to the embodiment of the present application. As shown in FIG. 13, the method may include the following steps 131 to 134.
[0148] In step 131, a first decoding parameter is determined based on the template region.
[0149] In step 132, a reference sample value of a first color component of the current block is determined.
[0150] In step 133, a first weighting factor is determined based on the reference sample value of the first color component of the current block and the first decoding parameter.
[0151] In step 134, a first predicted value of the second color component of the current block is determined based on the first weighting coefficient and a reference sample value of the second color component of the current block.
[0152] Further alternative embodiments of each of the above steps and related nouns are described below.
[0153] In step 131, a first decoding parameter is determined based on the template region.
[0154] In some embodiments, a template region may be determined first, for example based on pixel availability of neighboring regions of the current block, where the neighboring regions include at least one of the following based on their relative position to the current block: an upper region of the current block, a left region of the current block, an upper right region of the current block, a lower left region of the current block, and an upper left region of the current block.
[0155] In another example, the template region may be determined based on the template type included in the configured prediction mode.
[0156] In some embodiments, the template types include at least one of: an upper template, a left template, an upper right template, a lower left template, and an upper left template.
[0157] Furthermore, in some embodiments, the template region may be a template included in a configured prediction mode.
[0158] After determining the template region, in some embodiments, step 131 can be realized by the following steps 111 and 112.
[0159] In step 111, a reference sample value of the template region is determined.
[0160] In some embodiments, the reference sample values include a reconstructed value of a first color component of the template area, a reconstructed value of a second color component of the template area, a reconstructed value of a first color component of a reference area of the template area, and a reconstructed value of a second color component of a reference area of the template area.
[0161] Further, in some embodiments, the reference region of the template region includes at least one of an upper neighboring region of the template region, a lower neighboring region of the template region, a left neighboring region of the template region, a right neighboring region of the template region, or the template region.
[0162] In step 112, the first decoding parameters are determined based on reference sample values of the template region.
[0163] In some embodiments, step 112 may be implemented by steps 1121 and 1122 .
[0164] In step 1121, a first difference value for the template area is determined, and the first difference value for the template area is set equal to the absolute value of the difference between a reference value for a first color component of the template area and a reference value for a first color component of a reference area of the template area.
[0165] Furthermore, in some embodiments, the reference value of the first color component of the template region is a reconstructed value of the first color component of the template region or a value obtained by filtering the reconstructed value of the first color component of the template region, and the reference value of the first color component of the reference region of the template region is a reconstructed value of the first color component of the reference region of the template region or a value obtained by filtering the reconstructed value of the first color component of the reference region of the template region.
[0166] In step 1122, the first decoding parameter is determined based on a first difference value of the template region.
[0167] Furthermore, in some embodiments, step 1122 can be realized by steps 1122-1 to 1122-3.
[0168] In Step 1122-1, a second prediction of a second color component for the template region is determined based on the first difference value and candidate first decoding parameters.
[0169] In some embodiments, the candidate first encoding parameters include one or more candidate first decoding parameters.
[0170] In step 1122-2, a first prediction error for a second color component of the template region is determined, the first prediction error being the error between a reference value for the second color component of the template region and a second predicted value for the second color component of the template region, and the reference value for the second color component of the template region being a reconstructed value of the second color component of the template region or a value obtained by filtering the reconstructed value of the second color component of the template region.
[0171] In some embodiments, a second predicted value for determining the first prediction error is set equal to a second predicted value obtained by a correction operation on a second predicted value of a second color component of the template region.
[0172] In Step 1122-3, the first decoding parameters are determined based on the first prediction error.
[0173] In the embodiment of the present application, the embodiment for realizing step 1122-3 is not limited and may be various. For example, it can be realized by any one of the following embodiments 5 to 8.
[0174] In the fifth embodiment, step 1122-3 can be realized as follows: the second predicted value of the second color component of the template region is set equal to the weighted sum of the reference value of the second color component of the reference region of the template region and a second weighting coefficient, the first decoding parameter is set equal to the value of the candidate first decoding parameter corresponding to when the first prediction error satisfies a first condition, and the reference value of the second color component of the reference region of the template region is the reconstructed value of the second color component of the reference region of the template region or a value obtained by filtering the reconstructed value of the second color component of the reference region of the template region.
[0175] Furthermore, in some embodiments, the second weighting factor is determined based on the first difference value of the template region and the candidate first decoding parameters using a predetermined correspondence relationship.
[0176] Furthermore, in some embodiments, the predetermined correspondence is a softmax function or the predetermined correspondence is obtained using a softmax function, an input of the softmax function being one of the ratio of the first difference value to the candidate first decoding parameter, the product of the first difference value and the candidate first decoding parameter, or a value obtained by bit-shifting the first difference value, the number of bits of the bit-shift being equal to the candidate first decoding parameter.
[0177] In some embodiments, the first condition includes the first prediction error being a minimum, the first prediction error being smaller than a first threshold, the first prediction error being a maximum, or the first prediction error being larger than a third threshold.
[0178] In the sixth embodiment, step 1122-3 (i.e., determining the first decoding parameter based on the first prediction error) can also be realized as follows: Namely, from among each candidate first decoding parameter of the template region, a parameter whose first prediction error satisfies a first condition is selected, and the first decoding parameter is determined based on the parameter corresponding to the template region whose first prediction error satisfies the first condition.
[0179] Furthermore, the step of "determining the first decoding parameter based on a parameter corresponding to the template region and for which a first prediction error satisfies a first condition" can be realized according to Example 9 or Example 10 below.
[0180] In Example 9, the step of "determining the first decoding parameter based on a parameter corresponding to the template region for which the first prediction error satisfies a first condition" can also be implemented as follows: set the first decoding parameter equal to a parameter for which the first prediction error satisfies a first condition, or set the first decoding parameter equal to a blended value of parameters for which the first prediction error satisfies a first condition.
[0181] Furthermore, in some embodiments, the first decoding parameter is set equal to a weighted sum of the parameter for which the first prediction error satisfies the first condition and a third weighting factor.
[0182] In some embodiments, based on the first prediction error corresponding to the parameter for which the first prediction error satisfies the first condition, a corresponding third weighting factor may be determined or the third weighting factor may be set to a predetermined constant value.
[0183] In Example 10, the step of "determining the first decoding parameter according to a parameter corresponding to the template region and for which the first prediction error satisfies a first condition" can also be implemented as follows: A parameter for which the first prediction error satisfies a first condition is expanded to obtain a first expanded parameter, and the first expanded parameter and / or a parameter for which the first prediction error satisfies the first condition are fused to obtain the first decoding parameter.
[0184] In the seventh embodiment, step 1122-3 (i.e., determining the first decoding parameter based on the first prediction error) can be further implemented as follows: set the first decoding parameter equal to a weighted sum of each of the candidate first decoding parameters and a fourth weighting factor.
[0185] In some embodiments, a fourth weighting factor for the corresponding candidate first decoding parameter is determined based on the first prediction error.
[0186] In the eighth embodiment, step 1122-3 (i.e., determining the first decoding parameters based on the first prediction errors) can be further implemented as follows: According to the first prediction errors corresponding to each of the same candidate first decoding parameters of the template region, an evaluation parameter representing the performance of the corresponding candidate first decoding parameters is determined, and according to the evaluation parameters of each of the candidate first decoding parameters, the first decoding parameters are determined.
[0187] Furthermore, in some embodiments, the evaluation parameter is set equal to a blended value of first prediction errors corresponding to each of the same candidate first decoding parameters of the template region.
[0188] Furthermore, in some embodiments, the evaluation parameter is set equal to the sum of first prediction errors corresponding to each of the same candidate first decoding parameters of the template region.
[0189] Furthermore, in some embodiments, the step of "determining the first decoding parameters based on an evaluation parameter of each of the candidate first decoding parameters" can be implemented as follows: That is, from each of the candidate first decoding parameters, a parameter whose evaluation parameter satisfies a second condition is selected, and the first decoding parameter is determined based on the parameter whose evaluation parameter satisfies the second condition.
[0190] Furthermore, the step of "determining the first decoding parameter based on the parameter for which the evaluation parameter satisfies a second condition" can be realized according to Example 11 below.
[0191] In example 11, the first decoding parameter is set equal to a parameter whose evaluation parameter satisfies a second condition, or the first decoding parameter is set equal to a blended value of parameters whose evaluation parameter satisfies a second condition.
[0192] In some embodiments, the first decoding parameter is set equal to a weighted sum of the parameter for which the evaluation parameter satisfies the second condition and a fifth weighting factor.
[0193] Furthermore, the fifth weighting factor is obtained according to Example 12 or Example 13.
[0194] In Example 12, a fifth weighting factor for the corresponding parameter is determined based on the template region corresponding to the parameter whose evaluation parameter satisfies the second condition.
[0195] Furthermore, in some embodiments, a fifth weighting factor for the corresponding parameter is determined based on the number of pixels in the template region and / or the template type corresponding to the evaluation parameter that satisfies the second condition.
[0196] In some embodiments, the second condition includes the evaluation parameter being a minimum, the evaluation parameter being less than a second threshold, the evaluation parameter being a maximum, or the evaluation parameter being greater than a fourth threshold.
[0197] In example 13, the fifth weighting factor is a predetermined constant value.
[0198] When performing intra prediction on a current block, there may be a case where a template region does not exist. In some embodiments, when the template region does not exist, a default value is used as a predicted value of the second color component of the current block. In other embodiments, when the template region does not exist, it may be determined to adopt a prediction method different from the above method to predict the second color component of the current block.
[0199] In some embodiments, the decoding method further comprises parsing a bitstream to obtain an index of the first decoding parameter, and obtaining the first decoding parameter based on the index of the first decoding parameter.
[0200] In some embodiments, the decoding method further comprises parsing a bitstream to obtain the first decoding parameters.
[0201] In some embodiments, the decoding method further includes analyzing the bitstream to obtain a residual value of a second color component of the current block, and determining a reconstructed value of the second color component of the current block based on the residual value of the second color component and a first predicted value of the second color component of the current block.
[0202] In some embodiments, the decoding method further includes performing a correction operation on a first predicted value of a second color component of the current block to obtain a corrected first predicted value, and determining a reconstructed value of the second color component of the current block based on a residual value of the second color component and the corrected first predicted value.
[0203] In an embodiment of the present application, the first color component and the second color component are of different types. For example, the first color component is a luma component and the second color component is a chroma component. In another example, the first color component is a chroma component and the second color component is a luma component.
[0204] When performing chrominance prediction on a current block, the reconstructed luminance information of the current block, the reconstructed luminance information of the adjacent reference region, and the reconstructed chrominance information of the adjacent reference region are all reconstructed information that has already been coded. Therefore, by using the above reconstruction information, a weight-based chrominance prediction technique (WCP) is adopted, and a template matching step is added before the weight-based chrominance prediction process, with the aim of selecting optimal model parameters according to current blocks of different sizes and different contents. Here, the key point is to adopt a template matching method to find optimal model parameters of the weight model used to calculate weight vectors in the adjacent region, and for the decoding side, the optimal model parameters are an example of the first decoding parameters described in the above embodiment, and for the coding side, the optimal model parameters are an example of the first coding parameters described in the above embodiment.
[0205] In some embodiments, the detailed steps of the chromaticity prediction process of the WCP technique are as follows: Inputs of WCP: position of current block (xTbCmp, yTbCmp), width of current block nTbW, and height of current block nTbH.
[0206] Output of the WCP: chrominance predictions of the current block, predSamples[x][y], where the coordinate origin is the position of the top left pixel in the current block, and x=0,...,nTbW-1, y=0,...,nTbH-1. It should be noted that the chrominance components are an example of the second color components described in the above embodiment, and the luma components described below are an example of the first color components described in the above embodiment.
[0207] As shown in Figure 14, the prediction process of the WCP technology includes the following steps 141 to 145, namely, setting core parameters, obtaining input information, weight-based chrominance prediction and post-processing, and a template matching step is added between the two steps of obtaining input information and weight-based chrominance prediction. Through the above steps, the chrominance prediction value of the current block can be obtained.
[0208] In step 141, the WCP core parameters are determined, and these parameters may be preset.
[0209] In step 142, input information is obtained based on the determined core parameters, including obtaining reference chrominance information, reference luma information, and reconstructed luma information of the current block.
[0210] In step 143, a control parameter is determined by template matching, where in the case of the decoding side, the control parameter corresponds to an example of the first decoding parameter described in the above embodiment, and in the case of the encoding side, the control parameter corresponds to an example of the first encoding parameter described in the above embodiment.
[0211] In step 144, a weight-based chromaticity prediction calculation is performed based on the obtained input information.
[0212] In step 145, the chromaticity prediction calculation result is post-processed.
[0213] Each step shown in FIG. 14 above will now be described in detail.
[0214] In step 141, the WCP core parameters are determined.
[0215] Here, the core parameters related to the WCP are determined, that is, the WCP core parameters can be obtained or inferred by configuration or in some other way. For example, the decoding side obtains the WCP core parameters from the bitstream. The specific application will be described in detail later.
[0216] Determining the WCP core parameters includes, but is not limited to, determining a control parameter (T), the number of various input information for weight-based chroma prediction, inSize, and the number of outputs of weight-based chroma prediction (predWcp). predWcp is arranged as predSizeW×predSizeH. Here, the number of outputs of weight-based chroma prediction (predWcp) can be set to the same value (e.g., predSizeW=predSizeH=S / 4) or can be set in relation to the size of the current block (e.g., predSizeW=nTbW, predSizeH=nTbH). Here, the control parameter (T) can be used to adjust the nonlinear function of the subsequent stage or adjust the data related to the subsequent stage.
[0217] The determination of the WCP core parameters is influenced by the size of the block or the block contents under certain conditions. The current block can be classified based on its size or block contents or the number of pixels in the block, and the same or different core parameters can be configured based on different categories. That is, the inSize or predWcp (arranged as predSizeW×predSizeH) corresponding to different categories may be the same, e.g., predSizeW=predSizeH=s / 4, and predWcp may be related to the size of the current block, e.g., predSizeW=nTbW, predSizeH=nTbH. It is noted that predSizeW and predSizeH may be the same or different. The control parameters (T) corresponding to the current blocks of different sizes or different contents or different numbers of pixels in the block are determined by template matching in step 143.
[0218] In step 142, input information is obtained.
[0219] When predicting a current block, the area above, the area to the upper left, and the area to the left of the current prediction block are called the reference area of the current block, and the pixels in the reference area of the current block are reconstructed pixels and are called reference pixels, as shown in FIG. 15.
[0220] Obtain reference chromaticity information refC and reference luma information refY from the reference area. The obtained reference chromaticity information refC includes, but is not limited to, the reference reconstructed chromaticity value of the upper area of the selected current block and the reference reconstructed chromaticity value of the left area. The obtained reference luma information refY includes, but is not limited to, the corresponding reference luma information obtained based on the reference chromaticity information position.
[0221] The manner of obtaining the reconstructed luminance information recY of the current block includes, but is not limited to, obtaining corresponding reconstructed luminance information based on the position of the chrominance information of the current block as the reconstructed luminance information of the current block.
[0222] It should be noted that the reference chromaticity information refC is an example of a reference sample value of the second color component of the current block, and the reference luminance information refY and the reconstructed luminance information recY of the current block are examples of reference sample values of the first color component of the current block.
[0223] Obtaining input information includes obtaining reference chromaticity information refC of the inSize quantity (after a preprocessing operation if preprocessing is required), obtaining reference luma information refY of the inSize quantity (after a preprocessing operation if preprocessing is required), and obtaining reconstructed luma information recY of the current block (after a preprocessing operation if preprocessing is required).
[0224] In step 143, the control parameters are determined by template matching.
[0225] The prediction process of the WCP is simulated using the reconstructed luma pixels, reconstructed chroma pixels in the template region, and the reconstructed luma pixels and chroma pixels in the reference region of the template region, and the optimal control parameter (best_T) is selected therefrom. As shown in FIG. 16, the process specifically includes the following steps 1431 and 1433.
[0226] In step 1431, a template region and a reference region of the template are determined.
[0227] Based on the pixel availability of the neighboring regions of the current block, it is determined whether the pixels of the template region and the reference region of the template region are available, and the reconstructed luminance information and the reconstructed chrominance information are included. Based on the relative positional relationship between the template region and the current block, the template region can be classified into template types such as, but not limited to, an upper template, a left template, an upper right template, a lower left template, and an upper left template. The reference region of the template region changes according to the type of the template region, and the template region is allowed to overlap with its reference region. In addition, as shown in FIG. 10, FIG. 11, and FIG. 12A, the template types and the reference regions corresponding to the template regions can be flexibly combined to meet the needs of different current blocks. The template sizes of different types of different current blocks may be fixed to be the same or different. For example, different template sizes can be selected according to different sizes of the current block. Taking the template of FIG. 11 as an example, the template size setting condition is shown in the following formula, where nTbW and nTbH are the width and height of the current block, and iTempW and iTempH are the width and height of the determined template.
[0228]
number
[0229]
number
[0230] Figures 10, 11, and 12A are schematic diagrams respectively showing three types of template positions and the positions of the corresponding reference areas. The templates in the following examples are all described using the upper template and the left template in Figure 11 as examples. In an actual application process, more different template types and corresponding reference areas may be used in this step.
[0231] In step 1432, WCP prediction is performed within the template region.
[0232] In different template types, the reconstructed luma information of the template region, the reconstructed chroma information of the template region, the reconstructed luma information of the reference region of the template region, and the reconstructed chroma information are all encoded reconstructed information. Therefore, the basic process of WCP can be performed in the template region, where the reconstructed luma information of the template region and the reconstructed luma information of the reference region of the template region are examples of reference sample values of the first color component of the template region, and the reconstructed chroma information of the template region and the reconstructed chroma information of the reference region of the template region are examples of reference sample values of the second color component of the template region.
[0233] First, perform WCP prediction of the upper template. The detailed process is as follows: Template WCP inputs: upper template position (xTemp, yTemp), upper template width nTbW, and upper template height iTempH.
[0234] Output of template WCP: chromaticity prediction value predTempSamples[x][y] of the upper template, i.e., an example of the second prediction value of the second color component of the template region, where the position of the upper left corner pixel of the upper template is the coordinate origin, x = 0, ..., nTbW-1, y = 0, ..., nTbH-1.
[0235] Determining WCP core parameters: including but not limited to determining the control parameter (T), the number of various types of input information of weight-based chroma prediction inTempSize, and the number of outputs of weight-based chroma prediction (predTempWcp) (arranged as predTempSizeW×predTempSizeH). The above inTempSize, predTempSizeW, and predTempSizeH parameters may vary according to different template types, and may vary according to the WCP core parameters configured during the WCP prediction process of the current block.
[0236] Obtaining input information: Obtaining reference chromaticity information refTempC and reference luma information refTempY from the reference area of the upper template. Obtaining reference chromaticity information refTempC includes, but is not limited to, selecting a reference reconstruction chromaticity value of the reference area of the upper template. Obtaining reference luma information refTempY includes, but is not limited to, obtaining corresponding reference luma information according to the position of the reference chromaticity information.
[0237] The manner of obtaining the reconstructed chromaticity information recTempC of the template includes, but is not limited to, selecting the reconstructed chromaticity information in the current template.
[0238] The method of obtaining the reconstructed luminance information recTempY of the template includes, but is not limited to, obtaining the corresponding reconstructed luminance information according to the position of the reconstructed chrominance information in the current template, and taking it as the reconstructed luminance information of the current template. In this process, pre-processing can also be performed according to different requirements, such as performing up-down sampling according to different input color format information, selecting only a part of the reference area, or performing point selection in the reference area.
[0239] Next, the template chromaticity prediction value C predT Get [i][j] (i=0...predTempSizeW-1, j=0...predTempSizeH-1) one by one. Note that predTempSizeH and predTempSizeW are determined WCP core parameters, which may be the same as or different from the height or width of the current template.
[0240] The detailed calculation process is as follows:
[0241] i=0,…,predTempSizeW-1, j=0,…,predTempSizeH-1 are the processing targets. The processing target is k=0,1,…,inTempSize-1. Construct each element diffTempY[i][j][k] in the brightness difference vector, Calculate for each element cTempWeight[i][j][k] (or cTempWeightFloat[i][j][k]) in the weight vector, Chromaticity prediction value C by cTempWeight[i][j] (or cTempWeightFloat[i][j][k]) and refTempC predT Calculate [i][j].
[0242] Constructing a luminance difference vector: for each prediction-ready chromatic pixel C of the template within the size specified by the WCP core parameters predTFor [i][j], the corresponding reconstructed luminance information recTempY[i][j] is subtracted from the reference luminance information refTempY of inTempSize quantity, and the absolute value is taken to obtain a luminance difference vector diffTempY[i][j][k]. The calculation formula is shown in Equation 10, where k=0,1...inTempSize-1. Similarly, linear or nonlinear numerical processing may be performed on the obtained luminance difference vector. Here, the elements in the luminance difference vector are an example of first difference values.
[0243] [Formula 10] diffTempY[i][j][k]=abs(refTempY[k]-recTempY[i][j]) Where:
number
[0244]
number
[0245] [Formula 12] cTempWeight[i][j][k]=round(cTempWeightFloat[i][j][k]×2 Shift) Where: round(x)=Sign(x)×Floor(Abs(x)+0.5)
number
[0246]
number
[0247] For k=0,1…inSize-1, [Formula 13] subTempCFloat[i][j][k]=(cTempWeightFloat[i][j][k]×refTempC[k]) After the calculation is completed, fixed-point arithmetic can be performed on subTempCFloat, and in the fixed-point arithmetic process, in order to maintain a certain calculation accuracy, it can be multiplied by one coefficient as in Equation 14 and Equation 15.
[0248] [Formula 14] subTempC[i][j][k]=round(subTempCFloat[i][j][k]×2 Shift ) Or, [Formula 15] subTempC[i][j][k]=(cTempWeight[i][j][k]×refTempC[k]) Let i = 0…predSizeW-1, j = 0…predSizeH-1.
number
[0249] [Formula 17] C predT [i][j]=round(C predT Float[i][j]) Or, it is calculated using subTempC[i][j][k] calculated by fixed point calculation as in Equation 18.
[0250]
number
[0251]
number
[0252] Chrominance prediction value C of each pixel waiting for prediction predT Store [i][j] in a separate space and let the output of the weight-based chromaticity prediction be predTempWcp.
[0253] Correction of predTempWcp: The chrominance prediction values in predTempWcp should be within a limited range. If they exceed the limited range, the corresponding correction operation should be performed. The correction operation must be consistent with the correction operation adopted for the current block in step 1444 described later.
[0254] For example, C predT A clip operation can be performed on the chrominance prediction value in C[i][j], specifically as follows.
[0255] C predT If the value of C[i][j] is less than 0, set it to 0, C predT If the value of C[i][j] is greater than (1<<BitDepth)-1, set it to (1<<BitDepth)-1.
[0256] This ensures that all prediction values in predTempWcp are between 0 and (1<<BitDepth)-1.
[0257] That is,
Number
[0258] 12B shows the process of WCP, which may be the WCP process performed based on the template region and the reference region of the template region shown in FIG. 12A, or the WCP process performed based on other types of template regions and corresponding reference regions. As shown in FIG. 12B, for each sample recTempY[i][j] in the downsampled luma block, first, a luma difference vector diffTempY[i][j][k] is obtained based on the absolute value of the difference between recTempY[i][j] and the adjacent luma vector refTempY[k], then, a normalized weight vector cTempWeight[i][j][k] is derived based on the nonlinear mapping model associated with diffTempY[i][j][k], and third, the weight vector is used to vector-multiply the weight vector and the adjacent chroma vector to obtain a predicted chroma sample CTempWeight[i][j][k]. predT Get [i][j].
[0259] In the WCP prediction process of the left template, we only describe the WCP input, output, core parameter configuration, and input information acquisition of the WCP prediction process of the upper template, and other operations are consistent.
[0260] Template WCP input: left template position (xTemp, yTemp), left template width iTempW, and left template height nTbH.
[0261] The output of the template WCP is the chromaticity prediction value predTempSamples[x][y] of the left template, where the position of the upper left corner pixel of the left template is the coordinate origin, x = 0, ..., iTempW-1, y = 0, ..., nTbH-1.
[0262] Core parameter configuration: including but not limited to determining the control parameter (T), the number of various types of input information of weight-based chroma prediction inTempSize, and the number of outputs of weight-based chroma prediction (predTempWcp) (arranged as predTempSizeW×predTempSizeW). The above inTempSize, predTempSizeW, and predTempSizeW parameters may be the same as the configured parameters of the upper template, or different parameters may be selected based on the template type itself.
[0263] Obtaining input information: The reference regions of the upper template and the left template can be the same, or different reference regions can be selected respectively. Similarly, pre-processing operations can be performed according to different requirements.
[0264] Once the WCP prediction process for the left template is complete, the output of the chromaticity prediction based on its own weights is also saved.
[0265] In step 1433, the optimal control parameters best_T are selected.
[0266] The above describes the WCP prediction process for the upper template and the left template, in which the reconstructed chromaticity information recTempC[i][j] in each template and the predicted chromaticity information predTempWcp[i][j] corresponding to a certain control parameter (T) are obtained.
[0267] By loop-scanning the template WCP prediction process at different control parameters (T), a corresponding plurality of sets of predicted chromaticity information can be obtained, and one optimal control parameter (T) can be selected according to a certain evaluation criterion. For example, evaluation criteria such as the sum of absolute differences (SAD), the sum of absolute transform differences (SATD), the sum of squared errors (SSE), the mean absolute difference (MAD), the mean absolute error (MAE), the mean squared error (MSE), the rate-distortion function (RDO), etc., that is, an example of the first prediction error can be selected. Each of the evaluation criteria described later can be selected from any of the above criteria. Taking the evaluation criterion of MAE as an example, the calculation formula is as shown in Equation 20.
[0268] [Number] If any template cannot be obtained, all predicted values are set to default values (the default value is set as (1 << BitDepth) - 1, where BitDepth is the bit depth required by the chromaticity pixel value), or the WCP prediction algorithm (that is, the current block does not use the WCP prediction algorithm) can be directly terminated halfway.
[0269] If only one template can be obtained, either the upper template or the left template can be used. In this case, only one optimal control parameter can be selected, and this control parameter is saved and recorded as best_T.
[0270] If both of the two templates can be obtained, the optimal parameter above_T of the upper template and the optimal parameter left_T of the left template can be selected, and then both are processed. The processing methods include, but are not limited to, the following methods.
[0271] The first method is a method of weighted fusion of both above_T and left_T into one optimal parameter best_T, as shown in Equation 21.
[0272] [Equation 21] best_T=w0×above_T+w1×left_T The criterion for weighted fusion may be a fixed weighting coefficient, or a weighting coefficient may be assigned based on the mean absolute error between the reconstructed chromaticity and the predicted chromaticity of each template. The fixed weighting coefficient for the former is {0.5, 0.5}, and the latter is calculated using Equation 22 and the MAE A is the mean absolute error of the upper template, and MAE L is the mean absolute error of the left template, MAE A is the mean absolute error of the upper template, where MAE L and MAE A are both examples of the first prediction error.
[0273]
number
[0274] The third method is to similarly keep above_T and left_T, and scan the parameter values near the values above_T and left_T during the weight-based chrominance prediction in step 144. The encoding side processes the original chrominance values and predicted chrominance values of the current block according to a certain evaluation criterion, selects an optimal control parameter from the reduced parameter interval, and transmits the index of the optimal control parameter in the reduced parameter interval in the encoded bitstream, or transmits the parameter value directly. In the case of multiple optimal control parameters as in the second and third methods, no special description is given in step 144.
[0275] In the template selection process, if more than one template is selected for subsequent operations, the process may be carried out according to the above cases.
[0276] In step 144, a weighted chromaticity prediction calculation is performed based on the obtained input information.
[0277] Chroma prediction value C within the size specified by the configured parameters pred [i][j] (i=0, ..., predSizeW-1, j=0, ..., predSizeH-1) are obtained one by one. Note that predSizeH and predSizeW are determined WCP core parameters, and may be the same as or different from the height nTbH or width nTbW of the current template. Thus, under certain conditions, the following calculation is performed for only a portion of the pixels to be predicted in the current block.
[0278] As shown in FIG. 17, step 144 includes the following steps 1441 to 1444.
[0279] In step 1441, for each pixel to be predicted, a luminance difference vector is constructed using the obtained reference chrominance information, reference luminance information, and reconstructed luminance information of the current block.
[0280] In step 1442, for each pixel to be predicted, a weight vector is calculated based on the luminance difference vector using a non-linear function.
[0281] In step 1443, for each pixel to be predicted, a chrominance prediction value is calculated by weighting based on the weight vector and the obtained reference chrominance information.
[0282] In step 1444, for each pixel to be predicted, the calculated chrominance prediction value is corrected, where the correction includes a clip operation.
[0283] That is, the weights are obtained, and a weighted prediction is performed based on the weights to obtain a weight-based chrominance prediction value, which is then corrected. The process of obtaining the weights includes constructing a luma difference vector and calculating a weight vector.
[0284] The detailed calculation process is as follows:
[0285] The processing targets are i=0...predSizeW-1, j=0...predSizeH-1. The processing target is k=0,1…inSize-1. Construct each element diffY[i][j][k] in the brightness difference vector, Calculate for each element cWeight[i][j][k] (or cWeightFloat[i][j][k]) in the weight vector, Calculate the chromaticity prediction value Cpred[i][j] using cWeight[i][j] (or cWeightFloat[i][j][k]) and refC.
[0286] In step 1441, for each pixel to be predicted, a luminance difference vector is constructed using the obtained reference chrominance information, reference luminance information, and reconstructed luminance information of the current block.
[0287] Each prediction-waiting chromaticity pixel C within the size specified by the WCP core parameters pred For [i][j], the corresponding reconstructed luminance information recY[i][j] is subtracted from the reference luminance information refY of the inSize quantity, and the absolute value is taken to obtain the luminance difference vector diffY[i][j][k]. The calculation formula is shown in Equation 23, where k=0, 1...inSize-1.
[0288] [Formula 23] diffY[i][j][k]=abs(refY[k]-recY[i][j]) Where:
number
[0289] For example, the numerical value of the luminance difference vector of the pixel to be predicted can be scaled based on the WCP control parameter T in the WCP core parameters.
[0290] In step 1442, for each pixel to be predicted, a weight vector is calculated using a nonlinear function based on the luminance difference vector.
[0291] Based on the optimal control parameters (best_T) obtained in step 143, a nonlinear weighting model is adopted to estimate each pixel C pred The brightness difference vector diffY[i][j] corresponding to [i][j] is processed to obtain the corresponding weight vector cWeightFloat[i][j]. The weight model includes, but is not limited to, a nonlinear normalization function, a nonlinear exponential normalization function, etc.
[0292] for example, A nonlinear Softmax function is used as the weighting model, and each pixel C pred The brightness difference vector diffY[i][j] corresponding to [i][j] is taken as the input of the weighting model, and the optimal control parameter (best_T) can be taken as the adjustment parameter of the model, and the model outputs a weight vector cWeightFloat[i][j] corresponding to each pixel to be predicted. The calculation formula is shown in Equation 24, where k=0, 1, ..., inSize-1.
[0293]
number
[0294] [Formula 25] cWeight[i][j][k]=round(cWeightFloat[i][j][k]×2 Shift ) Where: Round(x)=Sign(x)×Floor(Abs(x)+0.5)
number
[0295]
number
[0296] The chromaticity prediction value of each pixel awaiting prediction is calculated based on the weight vector cWeight[i][j] (or cWeightFloat[i][j]) corresponding to each pixel awaiting prediction and the reference chromaticity information refC. pred The reference chromaticity information refC of [i][j] is multiplied by the weight vector elements corresponding to each pixel waiting to be predicted, one by one, to obtain subC[i][j] (or subCFloat[i][j]), and the multiplication results are accumulated to obtain the chromaticity prediction value C of each pixel waiting to be predicted. pred [i][j] (i.e., weighted prediction). The calculation formula is shown in the following formula 26.
[0297] For k=0,1…inSize-1, [Formula 26] subCFloat[i][j][k]=(cWeightFloat[i][j][k]×refC[k]) After the calculation is completed, fixed-point arithmetic can be performed on subCFloat, and in the fixed-point arithmetic process, in order to maintain a certain calculation accuracy, it can be multiplied by one coefficient as shown in Equation 27.
[0298] [Formula 27] subC[i][j][k]=round(subCFloat[i][j][k]×2 Shift ) or as shown in Equation 28.
[0299] [Formula 28] subC[i][j][k]=(cWeight[i][j][k]×refC[k]) Let i = 0…predSizeW-1, j = 0…predSizeH-1.
number
[0300] [Formula 30] C pred [i][j]=round(C pred Float[i][j]) Or, it is calculated using subC[i][j][k] calculated by fixed point arithmetic as shown in Equation 31.
[0301]
number
[0302] Chrominance prediction value C of each pixel waiting for prediction pred Store [i][j] in a separate space and denote the output of the weight-based chromaticity prediction as predWcp.
[0303] In step 1444, for each pixel to be predicted, the calculated chrominance prediction value is corrected, where the correction includes a clip operation.
[0304] The chromaticity prediction value in predWcp should be within a limited range, and if it exceeds the limited range, the corresponding correction operation should be performed. For example, C pred A clipping operation can be performed on the chrominance prediction value of [i][j], specifically, as follows.
[0305] C pred If the value of [i][j] is less than 0, it is set to 0. C pred If the value of [i][j] is greater than (1 << BitDepth) - 1, it is set to (1 << BitDepth) - 1.
[0306] This ensures that all prediction values in predWcp are within 0 to (1 << BitDepth) - 1.
[0307] That is, [Equation 32] C pred [i][j] = Clip3(0, (1 << BitDepth) - 1, C pred [i][j]) Here,
Number
[0308]
Number
[0309] The output predWcp of chrominance prediction based on weights needs to obtain the final chrominance prediction value predSamples after post - processing under certain conditions; otherwise, the final chrominance prediction value predSamples is predWcp.
[0310] The above solution can improve the accuracy of WCP prediction technology. By optimizing the control parameter (T) in the WCP core parameters, when the content characteristics of the current block are different, the technical solution can self-adaptively select the optimal control parameter, and further improve the weight model in step 144, so as to obtain a more accurate chrominance prediction value. The weight model adopted in the WCP prediction process is more matched with the content characteristics and spatial correlation of the current block, so that the prediction value can be made more accurate.
[0311] The key innovation of this technical solution lies in the optimization of the control parameter configuration during the WCP prediction process.
[0312] (1) Fully utilize the content characteristics of the current block to improve the accuracy of the prediction process.
[0313] (2) Making full use of the existing reconstructed pixel information in the adjacent regions, the accuracy of the prediction model is improved.
[0314] (3) Taking into full consideration the characteristic information of prediction blocks in different directions, different template matching methods are designed.
[0315] Extension Scheme 1: The above solution's modification regarding "3. Template Matching" is merely an implementation method, and the main idea is to directly select an optimal control parameter through template matching in the WCP chrominance prediction mode. The encoder defines multiple WCP chrominance prediction modes, which correspond to different combinations of template types and different template reference regions. When the current block scans all chrominance prediction modes to select the optimal chrominance prediction mode for rate distortion elimination and optimization, if a WCP chrominance prediction mode that matches a certain template type is found, the template selection process in step 1431 will only select one or a relatively small number of template types and their corresponding template reference regions.
[0316] Taking the upper template and the left template as an example, three template-matched WCP chrominance prediction modes, WCP_L, WCP_T, and WCP_LT, are added to the existing chrominance prediction modes. WCP_L means that in the template matching step of the WCP prediction process, only the left template is used to select the optimal control parameters as the parameters of the weight model of the WCP prediction of the current block, WCP_T means that in the template matching step of the WCP prediction process, only the upper template is used to select the optimal control parameters as the parameters of the weight model of the WCP prediction of the current block, and WCP_LT means that in the template matching step of the WCP prediction process, only the left template and the upper template are used to select the optimal control parameters as the parameters of the weight model of the WCP prediction of the current block, where the selection of the optimal control parameters is the same as the case of multiple template types in the above solution. Other operations are the same as the solution of the above embodiment.
[0317] Extension Scheme 2: The main idea of the solution in the above embodiment is to find the optimal parameters in all the acquired templates, and then perform various weighting fusion, or to hold multiple optimal parameters for subsequent operations. However, in this implementation, there may be situations where the optimal parameters cannot always be equal to the current block. Here, another implementation method is briefly described.
[0318] Taking the case where both the upper template and the left template are acquired as an example, and taking the WCP_LT mode of the extension scheme 1 as an example, “3.3. Selection of optimal parameters” is modified as follows:
[0319] Step 1432 describes the WCP prediction process of the upper template and the left template, thus obtaining the reconstructed chromaticity information in each template and the predicted chromaticity information corresponding to a certain control parameter (T). k) is the predicted chromaticity information corresponding to predAboveTempWcp k and the control parameters (T k ) is the predicted chromaticity information corresponding to predLeftTempWcp k For example, the MAE of the upper template and the left template is A and MAE L respectively, where different evaluation criteria may be employed.
[0320] MAE A and MAE L Adding these, we get the sum of the evaluations of the upper and left templates, MAE Sum (i.e., an example of an evaluation parameter) is obtained, which is a control parameter (T k By scanning different control parameters (T) and repeating the above operations, multiple MAE Sum From these, we can obtain the minimum MAE Sum Then, the control parameter (best_T) corresponding to the weights is selected to perform the weight-based chromaticity prediction in step 144.
[0321] MAE with multiple control parameters Sum If they are equal, the processing operations include, but are not limited to, the following methods.
[0322] The first method is to weight-fuse these multiple control parameters into one optimal parameter best_T. The criteria for weight-fusing include selecting a fixed weight coefficient, assigning a weight coefficient based on the number of pixels in the template, and so on.
[0323] The second method is to keep these multiple control parameters and continue with the weight-based chrominance prediction in step 144. The encoding side processes the original chrominance values and the predicted chrominance values of the current block according to some evaluation criterion, and selects the optimal control parameters from among them. The index of the top template or the left template can be transmitted in the encoded bitstream, or the parameter values can be transmitted directly.
[0324] The third method is to similarly keep these multiple control parameters and scan the parameter values in the neighborhood of these values during the weight-based chrominance prediction in step 144. The encoding side processes the original and predicted chrominance values of the current block according to some evaluation criterion, selects the optimal parameter from the reduced parameter interval, and transmits the optimal control parameter index in the reduced parameter interval in the encoded bitstream or transmits the parameter value directly.
[0325] In the above solution 1, when two or more templates are selected for subsequent operations, processing may be performed according to the above case.
[0326] It should be noted that although each step of the method of the present application is described in a specific order in the drawings, this does not require or imply that the steps must be performed in a specific order, or that all of the illustrated steps must be performed to achieve a desired result. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step to perform, and / or one step may be decomposed into multiple steps to perform. Or, steps in different embodiments may be combined into a new technical solution.
[0327] An embodiment of the present application provides an encoding device. FIG. 18 is a schematic diagram showing a configuration of an encoding device according to an embodiment of the present application. As shown in FIG. 18, the encoding device 18 includes a first determination module 181, a second determination module 182, a third determination module 183, and a first prediction module 184; The first determination module 181 is configured to determine a first encoding parameter based on the template region; The second determination module 182 is configured to determine a reference sample value of a first color component of the current block; the third determination module 183 is configured to determine a first weighting factor based on the reference sample value of the first color component of the current block and the first coding parameter; The first prediction module 184 is configured to determine a first predicted value of a second color component of the current block based on the first weighting coefficient and a reference sample value of a second color component of the current block.
[0328] In some embodiments, the first determination module 181 comprises a first determination unit and a second determination unit, where the first determination unit is configured to determine a reference sample value of the template region, and the second determination unit is configured to determine the first encoding parameter based on the reference sample value of the template region.
[0329] In some embodiments, the first determination unit is configured to determine a reconstruction value of a first color component of the template region and a reconstruction value of a second color component of the template region, and to determine a reconstruction value of the first color component of a reference region of the template region and a reconstruction value of the second color component of the reference region of the template region.
[0330] In some embodiments, the second determination unit comprises a first subunit and a second subunit, the first subunit configured to determine a first difference value for the template region, the first difference value for the template region being set equal to an absolute value of a difference between a reference value for a first color component of the template region and a reference value for a first color component of a reference region of the template region, and the second subunit configured to determine the first encoding parameter based on the first difference value for the template region.
[0331] In some embodiments, the second subunit is configured to determine a second predicted value of the second color component of the template region based on the first difference value and a candidate first coding parameter, determine a first prediction error of the second color component of the template region, and determine the first coding parameter based on the first prediction error, where the first prediction error is an error between a reference value of the second color component of the template region and the second predicted value of the second color component of the template region, and the reference value of the second color component of the template region is a reconstructed value of the second color component of the template region or a value obtained by filtering the reconstructed value of the second color component of the template region.
[0332] In some embodiments, the second sub-unit is further configured to determine the second weighting factor based on the first difference value of the template region and the candidate first encoding parameter using a predetermined correspondence relationship.
[0333] In some embodiments, the second subunit is configured to select, from among each candidate first encoding parameter of the template region, a parameter whose first prediction error satisfies a first condition, and to determine the first encoding parameter based on the parameter corresponding to the template region whose first prediction error satisfies a first condition.
[0334] In some embodiments, the second subunit is configured to determine a sixth weighting coefficient based on a reference sample value of a first color component of the current block and a candidate first encoding parameter whose first prediction error satisfies a first condition, determine a third predicted value of the second color component of the current block based on the sixth weighting coefficient and the reference sample value of the second color component of the current block, determine a second prediction error of a candidate first encoding parameter whose corresponding first prediction error satisfies a first condition based on the third predicted value of the second color component of the current block and an original value, and determine the first encoding parameter based on the second prediction error of the candidate first encoding parameter whose corresponding first prediction error satisfies the first condition.
[0335] In some embodiments, the second subunit is configured to select, from among the candidate first encoding parameters for which the first prediction error satisfies a first condition, a candidate first encoding parameter for which the second prediction error satisfies a third condition, and to determine the first encoding parameter based on the candidate first encoding parameter for which the second prediction error satisfies the third condition.
[0336] In some embodiments, the second sub-unit is configured to set the first coding parameter equal to a candidate first coding parameter for which the second prediction error satisfies a third condition, or to set the first coding parameter equal to a blended value of candidate first coding parameters for which the second prediction error satisfies a third condition.
[0337] In some embodiments, the second subunit is configured to: extend a candidate first coding parameter whose first prediction error satisfies a first condition to obtain a first extension parameter; determine a seventh weighting factor based on a reference sample value of a first color component of the current block, the candidate first coding parameter whose first prediction error satisfies a first condition and the first extension parameter; determine a fourth predicted value of a second color component of the current block based on the seventh weighting factor and the reference sample value of a second color component of the current block; determine a third prediction error of a corresponding parameter based on the fourth predicted value of the second color component of the current block and an original value; and determine the first coding parameter based on each of the candidate first coding parameters and the third prediction error of the first extension parameter.
[0338] In some embodiments, the second subunit is configured to select, from among each of the candidate first encoding parameters and the first extension parameter, a parameter for which a third prediction error satisfies a fourth condition, and to determine the first encoding parameter based on the parameter for which the third prediction error satisfies a fourth condition.
[0339] In some embodiments, the second sub-unit is configured to set the first coding parameter equal to a parameter for which the third prediction error satisfies a fourth condition, or to set the first coding parameter equal to a blended value of parameters for which the third prediction error satisfies a fourth condition.
[0340] In some embodiments, the second sub-unit is configured to set the first coding parameter equal to a parameter for which the first prediction error satisfies a first condition, or to set the first coding parameter equal to a blended value of parameters for which the first prediction error satisfies a first condition.
[0341] In some embodiments, the second sub-unit is configured to set said first coding parameter equal to a weighted sum of the parameter for which the first prediction error satisfies a first condition and a third weighting factor.
[0342] In some embodiments, the second subunit is further configured to determine a corresponding third weighting factor based on the first prediction error corresponding to the parameter for which the first prediction error satisfies the first condition, or to set the third weighting factor to a predetermined constant value.
[0343] In some embodiments, the second sub-unit is configured to extend a parameter for which the first prediction error satisfies a first condition to obtain a first extended parameter, and to fuse the first extended parameter and / or the parameter for which the first prediction error satisfies the first condition to obtain the first coding parameter.
[0344] In some embodiments, the second sub-unit is configured to set the first encoding parameter equal to a weighted sum of each of the candidate first encoding parameters and a fourth weighting factor.
[0345] In some embodiments, the second sub-unit is further configured to determine a fourth weighting factor for the corresponding candidate first coding parameter based on the first prediction error.
[0346] In some embodiments, the second subunit is configured to determine, based on first prediction errors corresponding to each of the same candidate first encoding parameters of the template region, an evaluation parameter representative of a performance of the corresponding candidate first encoding parameter, and to determine the first encoding parameter based on the evaluation parameter of each of the candidate first encoding parameters.
[0347] In some embodiments, the second sub-unit is configured to set said evaluation parameter equal to a blended value of first prediction errors corresponding to each of the same candidate first coding parameters of said template region.
[0348] In some embodiments, the second sub-unit is configured to be configured to set said evaluation parameter equal to a sum of first prediction errors corresponding to each of the same candidate first coding parameters of said template region.
[0349] In some embodiments, the second subunit is configured to select, from among the candidate first encoding parameters, a parameter whose evaluation parameter satisfies a second condition, and to determine the first encoding parameter based on the parameter whose evaluation parameter satisfies the second condition.
[0350] In some embodiments, the second sub-unit is configured to set the first encoding parameter equal to a parameter whose evaluation parameter satisfies a second condition, or to set the first encoding parameter equal to a blended value of parameters whose evaluation parameter satisfies a second condition.
[0351] In some embodiments, the second sub-unit is configured to set said first encoding parameter equal to a weighted sum of the parameter for which the evaluation parameter satisfies a second condition and a fifth weighting factor.
[0352] In some embodiments, the second subunit is further configured to determine, based on the template region corresponding to the parameter whose evaluation parameter satisfies the second condition, a fifth weighting factor for the corresponding parameter.
[0353] In some embodiments, the second subunit is configured to determine a fifth weighting factor for the corresponding parameter based on the number of pixels of the template region and / or the template type of the corresponding parameter for which the evaluation parameter satisfies the second condition.
[0354] In some embodiments, the second subunit is configured to determine an eighth weighting coefficient based on the reference sample value of the first color component of the current block and a parameter whose evaluation parameter satisfies a second condition, determine a fifth predicted value of the second color component of the current block based on the eighth weighting coefficient and the reference sample value of the second color component of the current block, determine a fourth prediction error of a parameter whose corresponding evaluation parameter satisfies the second condition based on the fifth predicted value and an original value of the second color component of the current block, and determine the first encoding parameter based on the fourth prediction error of each candidate first encoding parameter.
[0355] In some embodiments, the second subunit is configured to: extend the parameters whose evaluation parameters satisfy the second condition to obtain second extension parameters; determine a ninth weighting coefficient based on the reference sample values of the first color component of the current block, the parameters whose evaluation parameters satisfy the second condition, and the second extension parameters; determine a sixth predicted value of the second color component of the current block based on the ninth weighting coefficient and the reference sample values of the second color component of the current block; determine a fifth prediction error of a corresponding parameter based on the sixth predicted value and an original value of the second color component of the current block; and determine the first encoding parameter based on each candidate first encoding parameter and the fifth prediction error of the second extension parameter.
[0356] In some embodiments, the first determination module 181 is further configured to determine the template region based on a template type included in a configured prediction mode.
[0357] In some embodiments, the first determination module 181 is configured to determine that a template included in a configured prediction mode is the template region.
[0358] In some embodiments, the first determination module 181 is further configured to determine the template region based on pixel availability of neighboring regions of the current block, where the neighboring regions include at least one of an upper region of the current block, a left region of the current block, an upper right region of the current block, a lower left region of the current block, and an upper left region of the current block based on a relative positional relationship with the current block.
[0359] In some embodiments, the first prediction module 184 is further configured to set a default value as the predicted value of the second color component of the current block if the template region does not exist.
[0360] In some embodiments, the first prediction module 184 is further configured to determine, if the template region does not exist, to adopt another prediction method different from the above method to predict the second color component of the current block.
[0361] In some embodiments, the second subunit is configured to set a second predicted value for determining the first prediction error equal to a second predicted value obtained by a correction operation on a second predicted value of a second color component of the template region.
[0362] In some embodiments, the encoding device 18 further comprises a first obtaining module, a seventh determining module, and an encoding module, wherein the first obtaining module is configured to obtain original values of the second color component of the current block, the seventh determining module is configured to determine residual values of the second color component of the current block based on the original values of the second color component of the current block and the first predicted values of the second color component, and the encoding module is configured to encode the residual values of the second color component of the current block and write the resulting encoded bits into a bitstream.
[0363] In some embodiments, the encoding device 18 further comprises a first correction module, a first obtaining module, an eighth determination module, and an encoding module, where the first correction module is configured to perform a correction operation on a first predicted value of a second color component of the current block to obtain a corrected first predicted value, the first obtaining module is configured to obtain an original value of the second color component of the current block, the eighth determination module is configured to determine a residual value of the second color component of the current block based on the original value of the second color component of the current block and the corrected first predicted value, and the encoding module is configured to encode the residual value of the second color component of the current block and write the obtained encoded bits into a bitstream.
[0364] In some embodiments, encoding device 18 further comprises an encoding module configured to encode the first encoding parameter or an index of the first encoding parameter and to write the resulting encoded bits into a bitstream.
[0365] As can be understood, in the embodiments of the present application, a "module" may be a part of a circuit, a part of a processor, a part of a program, or software, and may of course be a unit or a non-unit type. In addition, each component in the present embodiment may be integrated into one processing unit, each module may exist physically separately, or two or more modules may be integrated into one unit. The integrated module may be realized in the form of hardware or in the form of a software function module.
[0366] If the integrated module is realized in the form of a software function module and is not sold or used as an independent product, it can be stored in one computer-readable storage medium. Based on this understanding, the essential part of the technical solution of this embodiment, i.e., the part that contributes to the prior art, or all or part of the solution of the technology can be embodied in the form of a software product, and the computer software product is stored in one storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor to execute all or part of the steps of the method described in this embodiment. The aforementioned storage medium includes various media that can store program code, such as a U disk, a mobile hard disk, a read only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0367] Therefore, an embodiment of the present application provides a computer-readable storage medium having a computer program stored therein, the computer program realizing a method according to any one of the above embodiments when executed by a first processor.
[0368] Based on the configuration of the encoding device 18 and the computer storage medium, refer to FIG. 19, which is a schematic diagram showing a specific hardware configuration of an encoding device according to an embodiment of the present application. As shown in FIG. 19, the encoding device 19 may include a first communication interface 191, a first memory 192, and a first processor 193, and each component is coupled via a first bus system 194. It can be understood that the first bus system 194 is used to realize the connection communication between these components. In addition to a data bus, the first bus system 194 includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, in FIG. 19, various buses are all represented as the first bus system 194. Here, The first communication interface 191 is configured to send and receive signals in the process of transmitting and receiving information to and from other external network elements.
[0369] The first memory 192 is configured to store a computer program executable by the first processor 193 .
[0370] The first processor 193, when executing the computer program, determines a first encoding parameter based on the template region; The method further comprises the steps of: determining a reference sample value of a first color component of the current block; determining a first weighting coefficient based on the reference sample value of the first color component of the current block and the first encoding parameter; and determining a first predicted value of a second color component of the current block based on the first weighting coefficient and the reference sample value of a second color component of the current block.
[0371] It can be understood that the first memory 192 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 memory. Here, 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) used as an external cache. By way of illustrative but non-limiting example, many forms of RAM are available, such as, for example, 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), synchlink dynamic random access memory (SLDRAM), direct memory bus random access memory (DRRAM), etc. The first memory 222 in the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0372] The first processor 193 may be an integrated circuit chip with signal processing functions. In the implementation process, each step of the above method may be completed by an instruction in the form of a hardware integrated logic circuit or software in the first processor 193. The above first processor 193 may be a general-purpose processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, etc. Each method, step, and logic block disclosed in the embodiments of the present application may be realized or executed. The general-purpose processor may be a microprocessor, or the processor may be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application may be directly executed by a hardware decoding processor, or may be executed by a combination of hardware and software modules in the decoding processor. The software module can be arranged in a conventional storage medium such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is arranged in a first memory 192, and a first processor 193 reads the information in the first memory 192 and completes the steps of the above method in combination with its hardware.
[0373] It can be understood that the embodiments described herein may be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. For a hardware implementation, the processing unit is implemented in one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processing (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field-Programmable Gate Arrays (FPGAs), general-purpose processors, controllers, microcontrollers, microprocessors, other electronic units configured to perform the functions described herein, or a combination thereof. For a software implementation, the technical solutions described herein may be realized by executing the functional modules (processes, functions, etc.) described herein. The software code may be stored in a memory and executed by a processor. The memory may be implemented in the processor or external to the processor.
[0374] Optionally, as another embodiment, the first processor 193 is further configured to, when executing the computer program, perform the method according to any of the aforementioned embodiments.
[0375] In yet another embodiment of the present application, based on the same inventive concept as the above-mentioned embodiment, refer to Fig. 20, which is a schematic diagram showing the configuration of a decoding device according to the embodiment of the present application. As shown in Fig. 20, the decoding device 200 includes a fourth determination module 2001, a fifth determination module 2002, a sixth determination module 2003, and a second prediction module 2004; The fourth determination module 2001 is configured to determine a first decoding parameter based on the template region; a fifth determination module 2002 configured to determine a reference sample value of a first color component of the current block; a sixth determination module 2003 configured to determine a first weighting coefficient according to the reference sample value of a first color component of the current block and the first decoding parameter; The second prediction module 2004 is configured to determine a first predicted value of a second color component of the current block based on the first weighting coefficient and a reference sample value of a second color component of the current block.
[0376] In some embodiments, the fourth determination module 2001 comprises a third determination unit and a fourth determination unit, the third determination unit configured to determine a reference sample value of the template region, and the fourth determination unit configured to determine the first decoding parameter based on the reference sample value of the template region.
[0377] In some embodiments, the third determination unit is configured to determine a reconstruction value of a first color component of the template region and a reconstruction value of a second color component of the template region, and to determine a reconstruction value of the first color component of a reference region of the template region and a reconstruction value of the second color component of the reference region of the template region.
[0378] In some embodiments, the fourth determination unit comprises a third subunit and a fourth subunit, the third subunit configured to determine a first difference value of the template region, the first difference value of the template region being set equal to an absolute value of a difference between a reference value of a first color component of the template region and a reference value of a first color component of a reference region of the template region, and the fourth subunit configured to determine the first decoding parameter based on the first difference value of the template region.
[0379] In some embodiments, the reference value of the first color component of the template region is a reconstructed value of the first color component of the template region or a value obtained by filtering the reconstructed value of the first color component of the template region, and the reference value of the first color component of the reference region of the template region is a reconstructed value of the first color component of the reference region of the template region or a value obtained by filtering the reconstructed value of the first color component of the reference region of the template region.
[0380] In some embodiments, the fourth subunit is configured to determine a second predicted value of the second color component of the template region based on the first difference value and the candidate first decoding parameters, determine a first prediction error of the second color component of the template region, and determine the first decoding parameters based on the first prediction error, where the first prediction error is an error between a reference value of the second color component of the template region and the second predicted value of the second color component of the template region, and the reference value of the second color component of the template region is a reconstructed value of the second color component of the template region or a value obtained by filtering the reconstructed value of the second color component of the template region.
[0381] In some embodiments, the fourth sub-unit is configured to set a second predicted value of the second color component of the template region equal to a weighted sum of a reference value of the second color component of a reference region of the template region and a second weighting coefficient, and set the first decoding parameter equal to a value of the candidate first decoding parameter corresponding to when the first prediction error satisfies a first condition, wherein the reference value of the second color component of the reference region of the template region is a reconstructed value of the second color component of the reference region of the template region or a value obtained by filtering the reconstructed value of the second color component of the reference region of the template region.
[0382] In some embodiments, the fourth subunit is further configured to determine the second weighting factor based on the first difference value of the template region and the candidate first decoding parameter using a predetermined correspondence relationship.
[0383] In some embodiments, the fourth subunit is configured to select, from among each candidate first decoding parameter of the template region, a parameter whose first prediction error satisfies a first condition, and determine the first decoding parameter based on the parameter corresponding to the template region whose first prediction error satisfies a first condition.
[0384] In some embodiments, the fourth sub-unit is configured to set the first decoding parameter equal to a parameter for which the first prediction error satisfies a first condition, or to set the first decoding parameter equal to a blended value of parameters for which the first prediction error satisfies a first condition.
[0385] In some embodiments, the fourth sub-unit is configured to set the first decoding parameter equal to a weighted sum of the parameter for which the first prediction error satisfies a first condition and a third weighting factor.
[0386] In some embodiments, the fourth subunit is further configured to determine a corresponding third weighting factor based on the first prediction error corresponding to the parameter for which the first prediction error satisfies the first condition, or to set the third weighting factor to a predetermined constant value.
[0387] In some embodiments, the fourth sub-unit is configured to extend a parameter for which the first prediction error satisfies a first condition to obtain a first extended parameter, and to fuse the first extended parameter and / or the parameter for which the first prediction error satisfies the first condition to obtain the first decoded parameter.
[0388] In some embodiments, the fourth sub-unit is configured to set the first decoding parameter equal to a weighted sum of each of the candidate first decoding parameters and a fourth weighting factor.
[0389] In some embodiments, the fourth sub-unit is further configured to determine a fourth weighting factor for the corresponding candidate first decoding parameter based on the first prediction error.
[0390] In some embodiments, the first condition includes the first prediction error being minimal or the first prediction error being less than a first threshold.
[0391] In some embodiments, the fourth subunit is configured to determine, based on first prediction errors corresponding to each of the same candidate first decoding parameters of the template region, an evaluation parameter representing a performance of the corresponding candidate first decoding parameter, and to determine the first decoding parameter based on the evaluation parameter of each of the candidate first decoding parameters.
[0392] In some embodiments, the fourth sub-unit is configured to set the evaluation parameter equal to a blended value of first prediction errors corresponding to each of the same candidate first decoding parameters of the template region.
[0393] In some embodiments, the fourth sub-unit is configured to set said evaluation parameter equal to a sum of first prediction errors corresponding to each of the same candidate first decoding parameters of said template region.
[0394] In some embodiments, the fourth subunit is configured to select, from among the candidate first decoding parameters, a parameter whose evaluation parameter satisfies a second condition, and determine the first decoding parameter based on the parameter whose evaluation parameter satisfies the second condition.
[0395] In some embodiments, the fourth subunit is configured to set the first decoding parameter equal to a parameter whose evaluation parameter satisfies a second condition, or to set the first decoding parameter equal to a fusion value of parameters whose evaluation parameter satisfies a second condition.
[0396] In some embodiments, the fourth sub-unit is configured to set the first decoding parameter equal to a weighted sum of the parameter for which the evaluation parameter satisfies the second condition and a fifth weighting factor.
[0397] In some embodiments, the fourth subunit is further configured to determine, based on the template region corresponding to the parameter whose evaluation parameter satisfies the second condition, a fifth weighting factor for the corresponding parameter.
[0398] In some embodiments, the fourth subunit is configured to determine a fifth weighting factor for the corresponding parameter based on the number of pixels of the template region and / or the template type corresponding to the parameter whose evaluation parameter satisfies the second condition.
[0399] In some embodiments, the decoding device 200 further comprises a parsing module and a second acquisition module, the parsing module being configured to parse the bitstream to obtain an index of the first decoding parameter, and the second acquisition module being configured to obtain the first decoding parameter based on the index of the first decoding parameter, or the parsing module being configured to parse the bitstream to obtain the first decoding parameter.
[0400] In some embodiments, the fourth determination module 2001 is further configured to determine the template region based on a template type included in a configured prediction mode.
[0401] In some embodiments, the template types include at least one of: an upper template, a left template, an upper right template, a lower left template, and an upper left template.
[0402] In some embodiments, the fourth determination module 2001 is configured to set the template region as a region corresponding to a template type included in the configured prediction mode.
[0403] In some embodiments, the fourth determination module 2001 is further configured to determine a template region based on pixel availability of adjacent regions of the current block, the adjacent regions including at least one of an upper region of the current block, a left region of the current block, an upper right region of the current block, a lower left region of the current block, and an upper left region of the current block.
[0404] In some embodiments, the second prediction module 2004 is further configured to set a default value to the predicted value of the second color component of the current block based on determining that the template region does not exist.
[0405] In some embodiments, the second prediction module 2004 is further configured to determine, based on determining that the template region does not exist, to adopt another prediction method different from the above method to predict a second color component of the current block.
[0406] In some embodiments, the fourth subunit is configured to set a second predicted value for determining the first prediction error equal to a second predicted value obtained by a correction operation on a second predicted value of a second color component of the template region.
[0407] In some embodiments, the decoding device 200 further comprises an analysis module and a ninth decision module, the analysis module being configured to analyze the bitstream to obtain a residual value of a second color component of the current block, and the ninth decision module being configured to determine a reconstructed value of the second color component of the current block based on the residual value of the second color component and a first predicted value of the second color component of the current block.
[0408] In some embodiments, the decoding device 200 further comprises a second correction module and a tenth determination module, the second correction module being configured to perform a correction operation on a first predicted value of a second color component of the current block to obtain a corrected first predicted value, and the tenth determination module being configured to determine a reconstructed value of the second color component of the current block based on a residual value of the second color component and the corrected first predicted value.
[0409] As can be understood, in the embodiments of the present application, a "module" may be a part of a circuit, a part of a processor, a part of a program, or software, and may of course be a unit or a non-unit type. In addition, each component in the present embodiment may be integrated into one processing unit, each module may exist physically separately, or two or more modules may be integrated into one unit. The integrated module may be realized in the form of hardware or in the form of a software function module.
[0410] When the integrated module is realized in the form of a software function module and is not sold or used as an independent product, it can be stored in one computer-readable storage medium. Based on this understanding, the present embodiment provides a computer-readable storage medium, in which a computer program is stored, and the computer program, when executed by a second processor, realizes the method according to any one of the above embodiments.
[0411] Based on the configuration of the decoding device 200 and the computer storage medium, refer to FIG. 21, which is a schematic diagram showing a specific hardware configuration of a decoding device according to an embodiment of the present application. As shown in FIG. 21, the decoding device 21 may include a second communication interface 211, a second memory 212, and a second processor 213, and each component is coupled via a second bus system 214. It can be understood that the second bus system 214 is used to realize the connection communication between these components. In addition to the data bus, the second bus system 214 includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, in FIG. 21, various buses are all represented as the second bus system 214. Here, The second communication interface 211 is configured to send and receive signals in the process of transmitting and receiving information to and from other external network elements, the second memory 212 is configured to store a computer program executable by the second processor 213, and the second processor 213 is configured to perform the method according to any one of the above-mentioned embodiments when executing the computer program.
[0412] Optionally, as another embodiment, the second processor 213 is further configured to perform the method according to any one of the previous embodiments when executing the computer program.
[0413] It can be understood that the second memory 212 has the same hardware function as the first memory 222, and the second processor 213 has the same hardware function as the first processor 223, which will not be described again here.
[0414] In another embodiment of the present application, reference is made to Fig. 22, which is a schematic diagram showing a configuration of a codec system according to an embodiment of the present application. As shown in Fig. 22, the codec system 22 may include an encoder 221 and a decoder 222. Here, the encoder 221 may be a device incorporating the encoding device 18 described in the previous embodiment, or may be a device incorporating the encoding device 19 described in the previous embodiment, and the decoder 222 may be a device incorporating the decoding device 200 described in the previous embodiment, or may be a device incorporating the decoding device 21 described in the previous embodiment.
[0415] It should be explained that, in this application, the terms "comprising," "including," or any other variation thereof, are intended to cover a non-exclusive inclusion, whereby a process, method, article, or apparatus that comprises a set of elements includes not only those elements, but also other elements not expressly listed or that are inherent to such process, method, article, or apparatus. Unless specifically limited, an element defined with the phrase "comprising..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes the element.
[0416] The numbers of the above examples of the present application are merely for explanation and do not represent the superiority or inferiority of the examples. The methods disclosed in some method examples provided in the present application can be arbitrarily combined without contradiction to obtain new method examples. The features disclosed in some product examples provided in the present application can be arbitrarily combined without contradiction to obtain new product examples. The features disclosed in some method or device examples provided in the present application can be arbitrarily combined without contradiction to obtain new method examples or device examples. The above content is merely an embodiment of the present application, and the protection scope of the present invention is not limited thereto. Any modifications or replacements that can be easily conceived by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims
1. 1. A method of decoding, comprising: determining a first decoding parameter based on the template region; determining a reference sample value of a first color component of the current block; determining a first weighting factor based on a reference sample value of a first color component of the current block and the first decoding parameter; determining a first predicted value of a second color component of the current block based on the first weighting coefficient and a reference sample value of a second color component of the current block.
2. The step of determining a first decoding parameter based on the template region includes: determining a reference sample value of the template region; determining the first decoding parameter based on reference sample values of the template region. The method of decoding according to claim 1 .
3. The step of determining a reference sample value of the template region comprises: determining a reconstruction value for a first color component of the template region and a reconstruction value for a second color component of the template region; determining a reconstruction value of a first color component of a reference area of the template area and a reconstruction value of a second color component of a reference area of the template area; The decoding method according to claim 2.
4. The step of determining the first decoding parameter based on the reference sample value of the template region includes: determining a first difference value for the template region, the first difference value for the template region being set equal to an absolute value of a difference between a reference value for a first color component of the template region and a reference value for a first color component of a reference region of the template region; determining the first decoding parameter based on a first difference value of the template region. The decoding method according to claim 3.
5. the reference value of the first color component of the template region is a reconstructed value of the first color component of the template region or a value obtained by filtering the reconstructed value of the first color component of the template region; the reference value of the first color component in the reference area of the template area is a reconstructed value of the first color component in the reference area of the template area, or a value obtained by filtering the reconstructed value of the first color component in the reference area of the template area; The decoding method according to claim 4.
6. determining the first decoding parameter based on a first difference value of the template region, determining a second prediction value for a second color component of the template region based on the first difference value and candidate first decoding parameters; determining a first prediction error for a second color component of the template region; determining the first decoding parameters based on the first prediction error; the first prediction error is an error between a reference value of a second color component of the template region and a second predicted value of the second color component of the template region, and the reference value of the second color component of the template region is a reconstructed value of the second color component of the template region or a value obtained by filtering the reconstructed value of the second color component of the template region. The decoding method according to claim 4.
7. setting a second predicted value of a second color component of the template region equal to a weighted sum of a reference value of the second color component of a reference region of the template region and a second weighting factor; setting the first decoding parameter equal to a value of the candidate first decoding parameter corresponding to when the first prediction error satisfies a first condition; the reference value of the second color component of the reference area of the template area is a reconstructed value of the second color component of the reference area of the template area, or a value obtained by filtering the reconstructed value of the second color component of the reference area of the template area; The decoding method according to claim 6.
8. determining the second weighting factors based on the first difference values of the template region and the candidate first decoding parameters using a predetermined correspondence relationship; The decoding method according to claim 7.
9. The predetermined correspondence is a softmax function, or the predetermined correspondence is obtained using a softmax function, and the input of the softmax function is a ratio between the first difference value and the candidate first decoding parameter; the product of the first difference value and the candidate first decoding parameter; one of values obtained by bit-shifting the first difference value, the number of bits of the bit shift being equal to the candidate first decoding parameter; The decoding method according to claim 8.
10. the candidate first decoding parameters include one or more candidate first decoding parameters; The decoding method according to claim 6.
11. The reference region of the template region is an upper adjacent region of the template region; a lower adjacent region of the template region; a left adjacent region of the template region; a right adjacent region of the template region; at least one of the template regions; The decoding method according to claim 3.
12. determining the first decoding parameter based on the first prediction error, selecting, from among the candidate first decoded parameters of the template region, a parameter whose first prediction error satisfies a first condition; determining the first decoding parameter based on a parameter corresponding to the template region for which a first prediction error satisfies a first condition; The decoding method according to claim 6.
13. setting the first decoding parameter equal to a parameter for which the first prediction error satisfies a first condition, or setting the first decoding parameter equal to a blended value of parameters for which the first prediction error satisfies a first condition; The method of decoding according to claim 12.
14. setting the first decoding parameter equal to a weighted sum of a parameter for which the first prediction error satisfies a first condition and a third weighting factor; The method of decoding according to claim 13.
15. The decoding method includes: and determining a corresponding third weighting factor based on the first prediction error corresponding to the parameter for which the first prediction error satisfies the first condition, or setting the third weighting factor to a predetermined constant value.
15. The method of decoding according to claim 14.
16. The step of determining the first decoding parameter based on a parameter corresponding to the template region for which a first prediction error satisfies a first condition includes: expanding the parameters for which the first prediction error satisfies the first condition to obtain first expanded parameters; fusing the first extension parameters and / or the parameters for which the first prediction error satisfies a first condition to obtain the first decoding parameters; The method of decoding according to claim 12.
17. setting the first decoding parameter equal to a weighted sum of each of the candidate first decoding parameters and a fourth weighting factor; The decoding method according to claim 6.
18. The decoding method includes: determining a fourth weighting factor for the corresponding candidate first decoding parameter based on the first prediction error; 18. The method of decoding according to claim 17.
19. the first condition includes the first prediction error being a minimum, the first prediction error being smaller than a first threshold, the first prediction error being a maximum, or the first prediction error being larger than a third threshold. A decoding method according to any one of claims 12 to 16.
20. determining the first decoding parameter based on the first prediction error, determining an evaluation parameter representing the performance of each of the first decoding parameters of the same candidate according to a first prediction error corresponding to each of the first decoding parameters of the template region; determining the first decoding parameters based on evaluation parameters of each of the candidate first decoding parameters; The decoding method according to claim 6.
21. setting the evaluation parameter equal to a blended value of first prediction errors corresponding to each of the same candidate first decoding parameters of the template region; 21. The method of decoding according to claim 20.
22. setting the evaluation parameter equal to a sum of first prediction errors corresponding to each of the same candidate first decoding parameters of the template region; 22. The method of decoding according to claim 21.
23. The step of determining the first decoding parameters based on evaluation parameters of each of the candidate first decoding parameters includes: selecting, from among the candidate first decoding parameters, a parameter whose evaluation parameter satisfies a second condition; determining the first decoding parameter based on the evaluation parameter satisfying a second condition; 21. The method of decoding according to claim 20.
24. setting the first decoding parameter equal to the parameter for which the evaluation parameter satisfies a second condition, or setting the first decoding parameter equal to a fusion value of parameters for which the evaluation parameter satisfies a second condition; 24. The method of decoding according to claim 23.
25. setting the first decoding parameter equal to a weighted sum of the parameter for which the evaluation parameter satisfies the second condition and a fifth weighting factor; 25. The method of decoding according to claim 24.
26. The decoding method includes: and determining a fifth weighting factor for the corresponding parameter based on the template region corresponding to the parameter whose evaluation parameter satisfies the second condition.
26. The method of decoding according to claim 25.
27. The step of determining a fifth weighting factor of the corresponding parameter based on the template region corresponding to the parameter whose evaluation parameter satisfies the second condition includes: determining a fifth weighting coefficient for the corresponding parameter based on the number of pixels in the template region and / or the template type corresponding to the evaluation parameter that satisfies the second condition; 27. The method of decoding according to claim 26.
28. The fifth weighting factor is a predetermined constant value.
26. The method of decoding according to claim 25.
29. the second condition includes the evaluation parameter being a minimum, the evaluation parameter being smaller than a second threshold, the evaluation parameter being a maximum, or the evaluation parameter being larger than a fourth threshold; A decoding method according to any one of claims 23 to 28.
30. The decoding method includes: Parsing a bitstream to obtain an index of the first decoding parameter, and obtaining the first decoding parameter based on the index of the first decoding parameter; or and further comprising the step of parsing the bitstream to obtain the first decoding parameters. The method of decoding according to claim 1 .
31. The decoding method includes: determining the template region based on a template type included in a configured prediction mode; The method of decoding according to claim 1 .
32. The template types include at least one of an upper template, a left template, an upper right template, a lower left template, and an upper left template.
32. The method of decoding according to claim 31.
33. setting the template region as a region corresponding to a template type included in the configured prediction mode; 33. The method of decoding according to claim 32.
34. The decoding method includes: determining a template region based on pixel availability of neighboring regions of the current block; the neighboring region includes at least one of an upper region of the current block, a left region of the current block, an upper right region of the current block, a lower left region of the current block, and an upper left region of the current block; The method of decoding according to claim 1 .
35. The decoding method includes: and determining, based on determining that the template region does not exist, that a default value is a predicted value of the second color component of the current block. The method of decoding according to claim 1 .
36. The decoding method includes: and determining, based on determining that the template region does not exist, to predict a second color component of the current block by adopting another prediction method different from the decoding method. The method of decoding according to claim 1 .
37. setting a second predicted value for determining the first prediction error equal to a second predicted value obtained by a correction operation on a second predicted value of a second color component of the template region; The decoding method according to claim 6.
38. The decoding method includes: parsing the bitstream to obtain a residual value of a second color component of the current block; determining a reconstructed value of the second color component of the current block based on the residual value of the second color component and a first predicted value of the second color component of the current block. The method of decoding according to claim 1 .
39. The decoding method includes: performing a correction operation on a first predicted value of a second color component of the current block to obtain a corrected first predicted value; determining a reconstructed value of a second color component of the current block based on the residual value of the second color component and the corrected first predicted value. The method of decoding according to claim 1 .
40. 1. A method of encoding, comprising: determining a first encoding parameter based on the template region; determining a reference sample value of a first color component of the current block; determining a first weighting factor based on a reference sample value of a first color component of the current block and the first coding parameter; determining a first predicted value of a second color component of the current block based on the first weighting coefficient and a reference sample value of a second color component of the current block.
41. The step of determining a first encoding parameter based on the template region includes: determining a reference sample value of the template region; determining the first encoding parameters based on reference sample values of the template region. The encoding method according to claim 1 .
42. The step of determining a reference sample value of the template region comprises: determining a reconstruction value for a first color component of the template region and a reconstruction value for a second color component of the template region; determining a reconstruction value of a first color component of a reference area of the template area and a reconstruction value of a second color component of a reference area of the template area; 42. The encoding method of claim 41.
43. determining the first encoding parameter based on reference sample values of the template region, determining a first difference value for the template region, the first difference value for the template region being set equal to an absolute value of a difference between a reference value for a first color component of the template region and a reference value for a first color component of a reference region of the template region; determining the first encoding parameter based on a first difference value of the template region.
43. The encoding method of claim 42.
44. the reference value of the first color component of the template region is a reconstructed value of the first color component of the template region or a value obtained by filtering the reconstructed value of the first color component of the template region, or the reference value of the first color component of the template region is an original value of the first color component of the template region or a value obtained by filtering the original value of the first color component of the template region, the reference value of the first color component in the reference area of the template area is a reconstructed value of the first color component in the reference area of the template area, or a value obtained by filtering the reconstructed value of the first color component in the reference area of the template area; 44. The encoding method of claim 43.
45. determining the first encoding parameter based on a first difference value of the template region, determining a second prediction value of a second color component for the template region based on the first difference value and candidate first coding parameters; determining a first prediction error for a second color component of the template region; determining the first coding parameter based on the first prediction error; the first prediction error is an error between a reference value of a second color component of the template region and a second predicted value of the second color component of the template region, and the reference value of the second color component of the template region is a reconstructed value of the second color component of the template region or a value obtained by filtering the reconstructed value of the second color component of the template region.
44. The encoding method of claim 43.
46. setting a second predicted value of a second color component of the template region equal to a weighted sum of a reference value of the second color component of a reference region of the template region and a second weighting factor; setting the first coding parameter equal to a value of the candidate first coding parameter that corresponds when the first prediction error satisfies a first condition; the reference value of the second color component of the reference area of the template area is a reconstructed value of the second color component of the reference area of the template area, or a value obtained by filtering the reconstructed value of the second color component of the reference area of the template area; 46. The encoding method of claim 45.
47. determining the second weighting factors based on the first difference values of the template regions and the candidate first encoding parameters using a predetermined correspondence relationship; 47. The encoding method of claim 46.
48. The predetermined correspondence is a softmax function, or the predetermined correspondence is obtained using a softmax function, and the input of the softmax function is a ratio of the first difference value to the candidate first coding parameter; the product of the first difference value and the candidate first encoding parameter; one of values obtained by bit-shifting the first difference value, the number of bits of the bit shift being equal to the candidate first encoding parameter; 48. The encoding method of claim 47.
49. the candidate first encoding parameters include one or more candidate first encoding parameters; 46. The encoding method of claim 45.
50. The reference region of the template region is an upper adjacent region of the template region; a lower adjacent region of the template region; a left adjacent region of the template region; a right adjacent region of the template region; at least one of the template regions; 43. The encoding method of claim 42.
51. determining the first coding parameter based on the first prediction error, selecting, from among the candidate first encoding parameters of the template region, a parameter whose first prediction error satisfies a first condition; determining the first encoding parameter based on a parameter corresponding to the template region for which a first prediction error satisfies a first condition; 46. The encoding method of claim 45.
52. The step of determining the first encoding parameter based on a parameter corresponding to the template region and for which a first prediction error satisfies a first condition includes: determining a sixth weighting factor based on a reference sample value of a first color component of the current block and a candidate first coding parameter for which a first prediction error satisfies a first condition; determining a third predicted value of a second color component of the current block based on the sixth weighting coefficient and a reference sample value of the second color component of the current block; determining second prediction errors of candidate first coding parameters whose corresponding first prediction errors satisfy a first condition according to a third predicted value and an original value of a second color component of the current block; determining the first encoding parameter based on a second prediction error of a candidate first encoding parameter whose first prediction error satisfies a first condition; 52. The encoding method of claim 51.
53. The step of determining the first encoding parameter based on a second prediction error of a candidate first encoding parameter for which the first prediction error satisfies a first condition includes: selecting a candidate first encoding parameter whose second prediction error satisfies a third condition from among the candidate first encoding parameters whose first prediction error satisfies a first condition; determining the first encoding parameter based on candidate first encoding parameters for which the second prediction error satisfies a third condition; 53. The encoding method of claim 52.
54. setting the first coding parameters equal to candidate first coding parameters for which the second prediction error satisfies a third condition; or setting the first coding parameter equal to a blended value of a candidate first coding parameter for which the second prediction error satisfies a third condition; 54. The encoding method of claim 53.
55. the third condition is that the second prediction error is the smallest or the second prediction error is the largest; 54. The encoding method of claim 53.
56. The step of determining the first encoding parameter based on a parameter corresponding to the template region and for which a first prediction error satisfies a first condition includes: expanding the candidate first coding parameters for which the first prediction errors satisfy a first condition to obtain first expanded parameters; determining a seventh weighting factor according to a reference sample value of a first color component of the current block, a candidate first coding parameter for which a first prediction error satisfies a first condition, and the first extension parameter; determining a fourth predicted value of a second color component of the current block based on the seventh weighting coefficient and a reference sample value of the second color component of the current block; determining a third prediction error of a corresponding parameter according to a fourth predicted value of a second color component of the current block and an original value; determining the first coding parameters based on each of the candidate first coding parameters and a third prediction error of the first extension parameter; 52. The encoding method of claim 51.
57. determining the first encoding parameter based on each of the candidate first encoding parameters and a third prediction error of the first extension parameter, selecting, from among the candidate first encoding parameters and the first extension parameters, a parameter for which a third prediction error satisfies a fourth condition; determining the first coding parameter based on the parameter for which the third prediction error satisfies a fourth condition; 57. The encoding method of claim 56.
58. setting the first coding parameter equal to a parameter for which the third prediction error satisfies a fourth condition, or setting the first coding parameter equal to a blended value of parameters for which the third prediction error satisfies a fourth condition; 58. The encoding method of claim 57.
59. the fourth condition includes that the third prediction error is the smallest or that the third prediction error is the largest; 58. The encoding method of claim 57.
60. setting the first coding parameter equal to a parameter for which the first prediction error satisfies a first condition, or setting the first coding parameter equal to a blended value of parameters for which the first prediction error satisfies a first condition; 52. The encoding method of claim 51.
61. setting the first encoding parameter equal to a weighted sum of a parameter for which the first prediction error satisfies a first condition and a third weighting factor; 61. The encoding method of claim 60.
62. The encoding method comprises: and determining a corresponding third weighting factor based on the first prediction error corresponding to the parameter for which the first prediction error satisfies the first condition, or setting the third weighting factor to a predetermined constant value.
62. The encoding method of claim 61.
63. The step of determining the first encoding parameter based on a parameter corresponding to the template region and for which a first prediction error satisfies a first condition includes: expanding the parameters for which the first prediction error satisfies the first condition to obtain first expanded parameters; fusing the first extension parameters and / or the parameters for which the first prediction error satisfies a first condition to obtain the first coding parameters; 52. The encoding method of claim 51.
64. setting the first encoding parameter equal to a weighted sum of each of the candidate first encoding parameters and a fourth weighting factor; 46. The encoding method of claim 45.
65. The encoding method comprises: determining a fourth weighting factor for the corresponding candidate first coding parameter based on the first prediction error; 65. The encoding method of claim 64.
66. the first condition includes the first prediction error being a minimum, the first prediction error being smaller than a first threshold, the first prediction error being a maximum, or the first prediction error being larger than a third threshold.
47. The encoding method of claim 46.
67. determining the first coding parameter based on the first prediction error, determining an evaluation parameter representing the performance of each of the first encoding parameters of the template region according to a first prediction error corresponding to the first encoding parameters of the template region; determining the first encoding parameters based on evaluation parameters of each of the candidate first encoding parameters; 46. The encoding method of claim 45.
68. setting the evaluation parameter equal to a blended value of first prediction errors corresponding to each of the same candidate first coding parameters of the template region; 68. The encoding method of claim 67.
69. setting the evaluation parameter equal to a sum of first prediction errors corresponding to each of the same candidate first coding parameters of the template region; 69. The encoding method of claim 68.
70. The step of determining the first encoding parameter based on an evaluation parameter of each of the candidate first encoding parameters comprises: selecting, from among the candidate first encoding parameters, a parameter whose evaluation parameter satisfies a second condition; determining the first encoding parameter based on the evaluation parameter satisfying a second condition; 68. The encoding method of claim 67.
71. setting the first encoding parameter equal to the parameter for which the evaluation parameter satisfies a second condition, or setting the first encoding parameter equal to a blended value of parameters for which the evaluation parameter satisfies a second condition; 71. The encoding method of claim 70.
72. setting the first encoding parameter equal to a weighted sum of the parameter for which the evaluation parameter satisfies the second condition and a fifth weighting factor; 72. The encoding method of claim 71.
73. The encoding method comprises: and determining a fifth weighting factor for the corresponding parameter based on the template region corresponding to the parameter whose evaluation parameter satisfies the second condition.
73. The encoding method of claim 72.
74. The step of determining a fifth weighting factor of the corresponding parameter based on the template region corresponding to the parameter whose evaluation parameter satisfies the second condition includes: determining a fifth weighting coefficient for the corresponding parameter based on the number of pixels in the template region and / or the template type corresponding to the evaluation parameter that satisfies the second condition; 74. The encoding method of claim 73.
75. The fifth weighting factor is a predetermined constant value.
73. The encoding method of claim 72.
76. the second condition includes the evaluation parameter being a minimum, the evaluation parameter being smaller than a second threshold, the evaluation parameter being a maximum, or the evaluation parameter being larger than a fourth threshold; Encoding method according to any one of claims 70 to 75.
77. The step of determining the first encoding parameter based on the evaluation parameter satisfying a second condition includes: determining an eighth weighting coefficient according to the reference sample value of the first color component of the current block and the evaluation parameter satisfying a second condition; determining a fifth predicted value of a second color component of the current block based on the eighth weighting coefficient and a reference sample value of a second color component of the current block; determining a fourth prediction error of a parameter whose corresponding evaluation parameter satisfies a second condition according to a fifth predicted value and an original value of the second color component of the current block; determining the first encoding parameters based on a fourth prediction error of each candidate first encoding parameter; 71. The encoding method of claim 70.
78. determining the first encoding parameter based on a fourth prediction error of each of the candidate first encoding parameters, expanding the evaluation parameters that satisfy the second condition to obtain second expanded parameters; determining a ninth weighting coefficient according to a reference sample value of the first color component of the current block, a parameter whose evaluation parameter satisfies a second condition, and a second extension parameter; determining a sixth predicted value of a second color component of the current block based on the ninth weighting coefficient and a reference sample value of the second color component of the current block; determining a fifth prediction error of a corresponding parameter according to a sixth predicted value and an original value of a second color component of the current block; determining the first coding parameters based on each candidate first coding parameter and a fifth prediction error of the second extension parameter; 78. The encoding method of claim 77.
79. The encoding method comprises: determining the template region based on a template type included in a configured prediction mode; 41. The encoding method of claim 40.
80. The template types include at least one of an upper template, a left template, an upper right template, a lower left template, and an upper left template.
80. The encoding method of claim 79.
81. The step of determining the template region based on a template type included in the configured prediction mode includes: A step of determining a template included in a configured prediction mode as the template region.
81. The encoding method of claim 80.
82. The encoding method comprises: determining the template region based on pixel availability of neighboring regions of the current block; Based on a relative positional relationship with the current block, the neighboring region includes at least one of an upper region of the current block, a left region of the current block, an upper right region of the current block, a lower left region of the current block, and an upper left region of the current block; 41. The encoding method of claim 40.
83. The encoding method comprises: If the template region does not exist, a default value is set as the predicted value of the second color component of the current block.
41. The encoding method of claim 40.
84. The encoding method comprises: and determining, when the template region does not exist, to predict a second color component of the current block by adopting a prediction method different from the encoding method.
41. The encoding method of claim 40.
85. setting a second predicted value for determining the first prediction error equal to a second predicted value obtained by a correction operation on a second predicted value of a second color component of the template region; 46. The encoding method of claim 45.
86. The encoding method comprises: obtaining an original value of a second color component of the current block; determining a residual value of a second color component of the current block based on an original value of the second color component of the current block and a first predicted value of the second color component; The method further includes the step of encoding a residual value of a second color component of the current block and writing the resulting encoded bits into a bitstream.
41. The encoding method of claim 40.
87. The encoding method comprises: performing a correction operation on a first predicted value of a second color component of the current block to obtain a corrected first predicted value; obtaining an original value of a second color component of the current block; determining a residual value of a second color component of the current block based on the original value of the second color component of the current block and the corrected first predicted value; encoding a residual value of a second color component of the current block and writing the resulting encoded bits into a bitstream.
41. The encoding method of claim 40.
88. The encoding method comprises: encoding the first coding parameter or an index of the first coding parameter and writing the resulting coded bits into a bitstream.
41. The encoding method of claim 40.
89. An encoding device, comprising: a first determination module, a second determination module, a third determination module, and a first prediction module; The first determination module is configured to determine a first encoding parameter based on a template region; The second determination module is configured to determine a reference sample value of a first color component of a current block; The third determination module is configured to determine a first weighting factor based on a reference sample value of a first color component of the current block and the first coding parameter; The first prediction module is configured to determine a first predicted value of a second color component of the current block based on the first weighting coefficient and a reference sample value of a second color component of the current block.
90. An encoding device, the encoding device comprising: a first memory; and a first processor; the first memory stores a computer program executable by the first processor; An encoding device, wherein the first processor realizes the encoding method according to any one of claims 40 to 88 when executing the program.
91. A decoding device, comprising: a fourth determination module, a fifth determination module, a sixth determination module, and a second prediction module; The fourth determination module is configured to determine a first decoding parameter based on a template region; The fifth determining module is configured to determine a reference sample value of a first color component of a current block; The sixth determination module is configured to determine a first weighting factor based on the reference sample value of a first color component of the current block and the first decoding parameter; The second prediction module is configured to determine a first predicted value of a second color component of the current block based on the first weighting coefficient and a reference sample value of a second color component of the current block.
92. A decoding device, the decoding device comprising: a second memory; and a second processor; the second memory stores a computer program executable by the second processor; A decoding device, wherein the second processor, when executing the program, realizes the decoding method according to any one of claims 1 to 39.
93. A computer storage medium having stored thereon a computer program which, when executed, performs the method according to any one of claims 1 to 39 or the method according to any one of claims 40 to 88.
Citation Information
Patent Citations
Methods, architectures, apparatuses and systems directed to improved linear model estimation for template based video coding
US20220094940A1