Encoding and decoding methods, apparatus, encoding equipment, decoding equipment, and storage medium

JP7902278B2Active Publication Date: 2026-08-07GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
Filing Date
2022-04-12
Publication Date
2026-08-07

Smart Images

  • Figure 0007902278000027
    Figure 0007902278000027
  • Figure 0007902278000028
    Figure 0007902278000028
  • Figure 0007902278000029
    Figure 0007902278000029
Patent Text Reader

Abstract

An embodiment of the present application provides an encoding and decoding method, an apparatus, an encoding device, a decoding device, and a storage medium, and the decoding method includes a step of determining a first decoding parameter based on a template region, a step of determining a reference sample value of a first color component of a current block, a step of 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 a step of 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.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the technical field of video codec, and in particular, to encoding and decoding methods, devices, encoding devices, decoding devices, and storage media.

Background Art

[0002] As the quality requirements for video display increase, new forms of video applications such as high-definition and ultra-high-definition have emerged. The Joint Video Exploration Team (JVET) of the International Organization for Standardization ISO / IEC and ITU-T has developed the next-generation video coding standard H.266 / VVC (Versatile Video Coding).

[0003] H.266 / VVC includes prediction techniques between color components. However, there is a large difference between the predicted value and the original value of the encoding waiting block calculated by the prediction technique between color components of H.266 / VVC, which reduces the prediction accuracy, degrades the quality of the decoded video, and reduces the encoding performance.

Summary of the Invention

[0004] The embodiments of the present application provide an encoding and decoding method, device, encoding device, decoding device, and storage media that can improve the prediction accuracy of the second color component, save the bit rate, and improve the encoding and decoding performance.

[0005] In a first aspect, the embodiments of the present application provide a decoding method, the method includes: 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 the reference sample value of the second color component of the current block.

[0006] In a second aspect, embodiments of the present application provide 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 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 the second color component of the current block. In this way, the first encoding parameter is determined based on the template region, and based on this, a first weighting coefficient that conforms to the characteristics of the current block can be obtained, thereby improving the prediction accuracy of the second color component, saving the bit rate, and improving the encoding and decoding performance.

[0007] In a third aspect, embodiments of the present application provide an encoding apparatus. The apparatus includes 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 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 is 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 the second color component of the current block.

[0008] In a fourth aspect, embodiments of the present application provide an encoding device. The encoding device includes a first memory and a first processor. The first memory stores a computer program executable by the first processor. When the first processor executes the computer program, the method described in the second aspect is executed.

[0009] In a fifth aspect, an embodiment of the present application provides a decoding device comprising a fourth decision module, a fifth decision module, a sixth decision module, and a second prediction module, wherein the fourth decision module is configured to determine a first decoding parameter based on a template region, the fifth decision module is configured to determine a reference sample value for the first color component of the current block, the sixth decision module is configured to determine a first weighting coefficient based on the reference sample value for the first color component of the current block and the first decoding parameter, and the second prediction module is configured to determine a first prediction value for the second color component of the current block based on the first weighting coefficient and the reference sample value for the second color component of the current block.

[0010] In a sixth aspect, an embodiment of the present application provides a decoding device comprising a second memory and a second processor, wherein the second memory stores a computer program executable by the second processor, and the second processor executes the method described in the first aspect when executing the computer program.

[0011] In the seventh aspect, an embodiment of the present application provides a computer-readable storage medium in which a computer program is stored, and when the computer program is executed, it implements the method of the first aspect or the method of the second aspect. [Brief explanation of the drawing]

[0012] [Figure 1] This is a schematic diagram showing the distribution of effective adjacent regions. [Figure 2] This is a schematic diagram showing the distribution of selection regions in different prediction modes. [Figure 3] This is a flowchart showing the method for deriving model parameters. [Figure 4A] This is a block diagram showing the configuration of an encoder according to an embodiment of the present application. [Figure 4B] This is a block diagram showing the configuration of a decoder according to an embodiment of the present application. [Figure 5] This is a flowchart illustrating the implementation of the encoding method according to the embodiment of the present invention. [Figure 6] This is a schematic diagram showing the location of the adjacent region of the current block according to an embodiment of the present invention. [Figure 7] This figure shows an example in which the upper template and left template according to the embodiment of the present invention are not currently in contact with the block. [Figure 8] This figure shows an example of different types of templates according to the embodiments of the present application currently in contact with a block. [Figure 9] This is a flowchart illustrating the implementation of step 51 according to the embodiment of the present invention. [Figure 10] This figure shows an example where the left-hand template according to the embodiment of the present application overlaps with the reference area. [Figure 11] This figure shows another example of the reference areas of the left template and the right template according to the embodiment of the present application. [Figure 12A] This figure shows yet another example of the reference areas of the left template and the right template according to the embodiment of the present application. [Figure 12B] This is a schematic diagram of the WCP prediction process according to an embodiment of the present invention. [Figure 13] This is a flowchart illustrating the implementation of the decoding method according to the embodiment of the present invention. [Figure 14] This is a schematic diagram of the prediction process of WCP technology according to an embodiment of the present invention. [Figure 15] This figure shows an example of the reference region of the current block according to an embodiment of the present application. [Figure 16] This is a flowchart illustrating the implementation of step 143 according to the embodiment of the present invention. [Figure 17] This is a flowchart illustrating the implementation of step 144 according to the embodiment of the present application. [Figure 18] This is a schematic diagram showing the configuration of an encoding device according to an embodiment of the present invention. [Figure 19] This is a schematic diagram showing the specific hardware configuration of the encoding device according to the embodiment of the present invention. [Figure 20]This is a schematic diagram showing the configuration of a decoding device according to an embodiment of the present invention. [Figure 21] This is a schematic diagram showing the specific hardware configuration of the decoding device according to the embodiment of the present invention. [Figure 22] This is a schematic diagram showing the configuration of a codec system according to an embodiment of the present invention. [Modes for carrying out the invention]

[0013] To gain a more detailed understanding of the features and technical content of the embodiments of this application, the implementation of the embodiments will be described in detail below with reference to the drawings. The attached drawings are for reference only and are not intended to limit the embodiments of this application.

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

[0015] In the following, the phrase "several embodiments" describes a subset of all possible embodiments, but it is understandable that "several embodiments" may be the same subset or a different subset of all possible embodiments and can be combined with each other without contradiction. Furthermore, it should be noted that terms such as "first / second / third" in the embodiments of this application do not limit a specific order, but rather distinguish similar objects. It is understandable that "first / second / third" can be changed in a specific order or chronological order where appropriate, so that the embodiments of this application described herein may be performed in an order other than that illustrated or described herein.

[0016] In video images, three color components are typically used to represent a coding block (CB). These three color components are the luminance component, the blue chromaticity component, and the red chromaticity component. For example, the luminance component is usually represented by the symbol Y, the blue chromaticity component by the symbol Cb or U, and the red chromaticity component by the symbol Cr or V. Thus, video images may be represented in YCbCr format or YUV format. Furthermore, video images may be in RGB format or YCgCo format, and the embodiments of this application are not particularly limited.

[0017] Understandably, in current video image or video codec processing, cross-component prediction techniques mainly include cross-component linear model (CCLM) prediction modes and multi-directional linear model (MDLM) prediction modes. Whether the model parameters are derived based on the CCLM prediction mode or the MDLM prediction mode, the corresponding prediction models can achieve predictions 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 the first color component is the luminance component and the second color component is the chromaticity component, VVC uses the CCLM prediction mode to reduce redundancy between the luminance and chromaticity components, i.e., Pred C (i,j) = α × Rec L The predicted chromaticity value is constructed based on the luminance reconstruction value of the same coding block, as in (i,j)+β.

[0019] Here, i and j represent the position coordinates of the prediction-waiting pixels within the coding block, i represents the horizontal direction, and j represents the vertical direction. C(i,j) represents the predicted chromaticity value corresponding to the pixel awaiting prediction at position coordinates (i,j) within the coding block, and Rec L (i,j) represents the luminance reconstruction value corresponding to the predicted pixel at the (downsampled) position coordinates (i,j) within the same coding block. α and β are model parameters that can be derived from the reference pixel.

[0020] For an encoded block, its adjacent region can be divided into five parts: the left adjacent region, the upper adjacent region, the lower left adjacent region, the upper left adjacent region, and the upper right adjacent region. H.266 / VVC includes three cross-component linear model prediction modes: an intra-CCLM prediction mode adjacent to the left and upper sides (which can be represented as INTRA_LT_CCLM), an intra-CCLM prediction mode adjacent to the left and lower left sides (which can be represented as INTRA_L_CCLM), and an intra-CCLM prediction mode adjacent to the upper and upper right sides (which can be represented as INTRA_T_CCLM). In these three prediction modes, each prediction mode can select a predetermined number (e.g., four) of reference pixels to derive the model parameters α and β, and the main difference between these three prediction modes is that the selection regions corresponding to the reference pixels used to derive the model parameters α and β are different.

[0021] Specifically, assuming that the size of the coding block corresponding to the chromaticity component is W × H, and that the upper selection region corresponding to the reference pixel is W' and the left selection region corresponding to the reference pixel is H', Thus, in INTRA_LT_CCLM mode, the reference pixel can be selected from the upper adjacent region and the left adjacent region, i.e., W'=W and H'=H. In INTRA_L_CCLM mode, the reference pixel can be selected from the left adjacent region and the lower left adjacent region, i.e., H'=W+H, and W'=0 is set. In INTRA_T_CCLM mode, the reference pixel 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 within the W range are stored in the upper right adjacent region, and only pixel points within the H range are stored in the lower left adjacent region. Therefore, although the selection area range for INTRA_L_CCLM mode and INTRA_T_CCLM mode is defined as W+H, in actual application, the selection area for INTRA_L_CCLM mode is limited to H+H, and the selection area for INTRA_T_CCLM mode is limited to W+W.

[0023] Thus, in INTRA_L_CCLM mode, the reference pixel can be selected from the left adjacent region and the lower left adjacent region, and H' = min{W+H,H+H}. In INTRA_T_CCLM mode, the reference pixel can be selected from the upper adjacent region and the upper right adjacent region, and W' = min{W+H,W+W}.

[0024] Referring to Figure 1, which is a schematic diagram showing the distribution of valid adjacent regions, the left adjacent region, the lower left adjacent region, the upper adjacent region, and the upper right adjacent region are all valid. The gray-filled blocks are prediction-awaited pixels with position coordinates (i,j) within the coded block.

[0025] Thus, based on Figure 1, the selection regions for the three prediction modes are shown in Figure 2. Here, in Figure 2, (a) represents the selection region for the INTRA_LT_CCLM mode, including the left adjacent region and the upper adjacent region; (b) represents the selection region for the INTRA_L_CCLM mode, including the left adjacent region and the lower left adjacent region; and (c) represents the selection region for the INTRA_T_CCLM mode, including the upper adjacent region and the upper right adjacent region. After determining the selection regions for the three prediction modes in this way, pixel selection for model parameter derivation can be performed within the selection regions. The pixels thus selected may be called reference pixels, and there are usually four reference pixels, and the positions of the reference pixels are generally determined for a single W×H coding block of a determined size.

[0026] After acquiring a predetermined number of reference pixels, chromaticity prediction is currently 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, a reference pixel is acquired in the selected area. In S302, the number of effective reference pixels is determined. In S303, if the number of effective reference pixels is 0, the model parameter α is set to 0 and β is set to its default value. In S304, the chromaticity prediction value is set to the default value. In S305, if the number of effective reference pixels is 4, the two reference pixels with the largest luminance component values ​​and the two reference pixels with the smallest luminance component values ​​are obtained by comparison. In S306, the average score corresponding to the larger value and the average score corresponding to the smaller value are calculated. In S307, the model parameters α and β are derived from the two mean scores. In S308, chromaticity prediction is performed using the prediction model constructed with α and β.

[0028] It should be explained that in VVC, the step where the number of effective reference pixels is 0 is determined based on the effectiveness of the adjacent region.

[0029] Furthermore, it should be explained that a predictive model is constructed using the principle of "determining a straight line with two points," where the two points can be called fitting points. In the current technical solution, after obtaining four reference pixels, two reference pixels with large luminance component values ​​and two reference pixels with small luminance component values ​​are obtained by comparison, and then a single mean point is determined based on the two reference pixels with large values. max We find the mean (which can be expressed as) and, based on the two reference pixels with smaller values, we find another mean min We find the two mean points (which can be expressed as...), that is, the mean max and mean mincan be obtained, and further, 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 chrominance components is performed based on this prediction model.

[0030] However, in the related art, for each encoding block, a simple linear model Pred C (i,j)=α·Rec L (i,j)+β is used to predict chrominance components, and pixels at any position in each encoding block are predicted using the same model parameters α and β. As a result, the following problems occur: (1) Encoding blocks with different content characteristics use a simple linear model to perform the mapping from luminance to chrominance to achieve chrominance prediction. However, the mapping function from luminance to chrominance within any encoding block cannot be accurately fitted by this simple linear model, so the prediction effect of some encoding blocks becomes inaccurate. (2) During prediction, pixel points at different positions within an encoding block all use the same model parameters α and β, and there are also significant differences in the prediction accuracy at different positions within the encoding block. (3) During CCLM prediction, the characteristics of encoding blocks with different contents and different sizes are not fully considered, so the high correlation between the reconstructed luminance information of the current block and the reference information of the reference region is lost. Therefore, in such a technology, some encoding blocks cannot be accurately predicted, and as a result, the gain effect of such a technology is affected. In short, in the related solutions of the CCLM technology, there is a large difference between the predicted value and the original value of some encoding blocks, so the prediction accuracy decreases, the quality of the decoded video decreases, and the encoding performance decreases.

[0031] Based on this, embodiments of the present application provide an encoding and decoding method, the principle of which is the same for both the encoding and decoding sides. Taking the encoding side as an example, a first encoding parameter is determined based on a template region, a reference sample value for the first color component of the current block is determined, a first weighting coefficient is determined based on the reference sample value for the first color component of the current block and the first encoding parameter, and a first predicted value for the second color component of the current block is determined based on the first weighting coefficient and the reference sample value for the second color component of the current block. In this way, a first encoding parameter is determined based on a template region, and based on this, a first weighting coefficient that better fits the characteristics of the current block can be obtained, thereby improving the prediction accuracy of the second color component of the current block, saving bitrate, and improving encoding performance.

[0032] The embodiments of this application will be described in detail below with reference to the drawings.

[0033] Referring to Figure 4A, Figure 4A is a block diagram showing the configuration of an encoder according to an embodiment of the present invention. As shown in Figure 4A, the encoder (specifically, the "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 decoding image buffer unit 110, where the filtering unit 108 can implement deblocking filtering and sample adaptive offset (SAO) filtering, and the encoding unit 109 can implement header information encoding and context-based adaptive binary arithmetic coding (CABAC). For the input original video signal, a video coding block is obtained by dividing the coding tree block (CTU). Next, the video coding block is transformed by the transformation and quantization unit 101 using residual pixel information obtained through intra-prediction or inter-prediction. This transformation includes transforming the residual information from the pixel domain to the transformation domain and quantizing the resulting transformation coefficients in order to further reduce the bitrate. 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 the 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 interpredictive coding of received video coding blocks for one or more blocks in one or more reference frames to provide time prediction information, the motion estimation performed by the motion estimation unit 105 is a process that generates motion vectors which can estimate the motion of the video coding blocks, the motion compensation unit 104 then performs motion compensation based on the motion vectors determined by the motion estimation unit 105 and determines an intraprediction mode, the intraprediction unit 103 is further configured to provide selected intraprediction data to the coding unit 109, and the motion estimation unit 105 also transmits the computationally determined motion vector data to the coding unit 109. Furthermore, the inverse transform and inverse quantization unit 106 is for reconstructing the video coding block and is configured to reconstruct the residual block in the pixel domain. This reconstructed residual block is then filtered for blocking effect artifacts by the filter control analysis unit 107 and the filtering unit 108. This reconstructed residual block is then added to one prediction block in the frame of the decoding image buffer unit 110 to generate a reconstructed video coding block. The coding unit 109 is configured to encode various coding parameters and quantized transformation coefficients. In the CABAC-based coding algorithm, contextual content can be based on adjacent coding blocks and may be used to encode information indicating a determined intra-prediction mode and output a bitstream of this video signal. The decoding image buffer unit 110 is configured to store the reconstructed video coding blocks for prediction reference. As video image coding progresses, new reconstructed video coding blocks are continuously generated, and these reconstructed video coding blocks are stored in the decoding image buffer unit 110.

[0034] Referring to Figure 4B, Figure 4B is a block diagram showing the configuration of a decoder according to an embodiment of the present invention. As shown in Figure 4B, the decoder (specifically, the "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, where the decoding unit 201 can perform header information decoding and CABAC decoding, and the filtering unit 205 can perform deblocking filtering and SAO filtering. The input video signal undergoes the encoding process shown in Figure 4A and then outputs a bitstream of the video signal. This bitstream is input to the decoder 200, which first passes through the decoding unit 201 to obtain the decoded conversion coefficients. These conversion coefficients are processed by the inverse transform and inverse quantization unit 202 to generate residual blocks in the pixel domain. The intra-prediction unit 203 may be configured to generate prediction data for the current video decoding block based on a determined intra-prediction mode and data from previously decoded blocks from the current frame or picture. The motion compensation unit 204 determines prediction information for the video decoding block by analyzing motion vectors and other relevant syntactic elements, and uses this prediction information to generate prediction blocks for the video decoding block being decoded. The residual blocks from the inverse transform and inverse quantization unit 202 and the corresponding prediction blocks generated by the intra-prediction unit 203 or the motion compensation unit 204 are summed to form the decoded video block. This decoded video signal passes through the filtering unit 205 to remove blocking effect artifacts, thereby improving video quality. Next, the decoded video block is stored in the decoded image buffer unit 206, which is configured to store a reference image for subsequent intra-prediction or motion compensation and to output a video signal, i.e., the restored original video signal is obtained.

[0035] It should be noted that the method of the embodiment of this application is mainly applied to the intra-prediction unit 103 portion shown in Figure 4A and the intra-prediction unit 203 portion shown in Figure 4B. In other words, the embodiment of this application may be applied to an encoder, or to a decoder, or even to both an encoder and a decoder simultaneously, but the embodiment of this application is not particularly limited.

[0036] Furthermore, it should be explained that when applied to the intra-prediction unit 103, "current block" specifically refers to the coded block currently awaiting intra-prediction, and when applied to the intra-prediction unit 203, "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. Figure 5 is a flowchart showing the implementation of the encoding method according to the embodiment of the present application, and as shown in Figure 5, the encoding method may include the following steps 51 to 54.

[0038] In step 51, the first coding parameter is determined based on the template region. In step 52, the reference sample value of the first color component of the current block is determined. In step 53, a first weighting coefficient 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 for the second color component of the current block is determined based on the first weighting coefficient and the reference sample value for the second color component of the current block.

[0039] In the embodiments of the present invention, the first coding parameter is determined based on a template region rather than a predetermined fixed value, so that the resulting first weighting coefficient is better suited to the features of the current block, thereby improving the prediction accuracy of the second color component of the current block, saving bitrate, and improving coding performance.

[0040] The following sections will describe further alternative embodiments and related nouns for each of the steps described above.

[0041] In step 51, the first coding parameter is determined based on the template region.

[0042] In embodiments of the present application, the template region may include some or all of the current block and the reference region of the current block, or the template region may include the reference region of the template region but not the current block. In some embodiments, the template region is an encoded region.

[0043] The template region may be determined first. For example, the template region may be determined based on the pixel availability of the adjacent region of the current block, and based on its relative position to the current block, the adjacent region includes at least one of the following: the upper region of the current block, the left region of the current block, the upper right region of the current block, the lower left region of the current block, and the upper left region of the current block.

[0044] Understandably, unavailable pixels are not set as pixels in the template region. In some embodiments, the availability of a pixel can be determined based on the location of the pixel in an adjacent region and / or the encoding state of the pixel. For example, if the location of the pixel belongs to a defined edge region, the pixel is determined to be unavailable. In another example, if the encoding state of the pixel is unencoded, the pixel is determined to be unavailable, and in yet another example, if the location of the pixel belongs to a defined edge region and the encoding state of the pixel is unencoded, the pixel is determined to be unavailable.

[0045] In the embodiments of the present application, the adjacent region of the current block may include regions adjacent to and / or not adjacent to the current block. Taking the region adjacent to the current block as an example, as shown in Figure 6, the adjacent region may include at least one of the regions in each of the illustrated directions.

[0046] In another example, the template region can also be determined based on the template types included in the configured prediction mode.

[0047] In some embodiments, the template type includes at least one of the following: upper template, left template, upper right template, lower left template, and upper left template.

[0048] Furthermore, in some embodiments, the template included in the configured prediction mode can be the template region.

[0049] The template region may include regions that are currently adjacent to the block, or regions that are not currently adjacent to the block. For example, as shown in Figure 7, Figure 7 shows the case where the upper template and left template are not currently adjacent to the block, and as shown in Figure 8, Figure 8 shows the case where the upper template, left template, upper right template, lower left template and upper left template are currently adjacent to the block.

[0050] It should be explained that the width and height of adjacent regions can be configured based on the requirements of metrics such as bitrate. Similarly, the width and height of template regions can also be configured based on the requirements of metrics such as bitrate.

[0051] After determining the template region, in some embodiments, step 51 can be realized by the following steps 511 and 512, as shown in Figure 9.

[0052] In step 511, the reference sample value of the template area is determined.

[0053] In some embodiments, the reference sample value of the template region includes the reconstructed value of the first color component of the template region, the reconstructed value of the second color component of the template region, the reconstructed value of the first color component of the reference region of the template region, and the reconstructed value of the second color component of the reference region of the template region.

[0054] The reference area of ​​a template area varies depending on the type of template area, and the template area may overlap with its reference area. In some embodiments, the reference area of ​​a template area includes at least one of the upper adjacent area, the lower adjacent area, the left adjacent area, the right adjacent area, and the template area itself, where, if the reference area of ​​a template area includes the template area, the area of ​​the reference area is larger than the area of ​​the template area. In embodiments of the present application, the sizes of the upper, lower, left, and right adjacent areas of the template area are not limited, and the sizes of the adjacent areas may be predetermined depending on the type of template area. The left and right edges of the upper and lower adjacent areas of the template area may or may not be aligned with the left and right edges of the upper template. Similarly, the upper and lower edges of the left adjacent area and right adjacent area of ​​the template area may or may not be aligned with the upper and lower edges of the upper template.

[0055] For example, as shown in Figure 10, Figure 10 shows an example where the left template overlaps with the reference area, and an example where the right template overlaps with the reference area. The reference area of ​​the upper template includes the upper template, and the reference area of ​​the left template includes the left template. Also, as shown in Figure 11, Figure 11 shows the reference areas of the left template and the right template, and the reference areas include the upper adjacent area of ​​the upper template and the left adjacent area of ​​the left template. Furthermore, as shown in Figure 12A, Figure 12A shows the reference areas of the left template and the right template, and the reference areas include the lower adjacent area of ​​the upper template and the right adjacent area of ​​the left template.

[0056] In step 512, the first coding parameter is determined based on the reference sample value of the template region.

[0057] In some embodiments, step 512 can be achieved by steps 5121 and 5122.

[0058] In step 5121, the first difference value of the template region is determined, and the first difference value of the template region is set to be equal to the absolute value of the difference between the reference 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.

[0059] Furthermore, in some embodiments, the reference value of the first color component of the template region is the 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 the 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 coding parameter is determined based on the first difference value of the template region.

[0061] Furthermore, in some embodiments, the first coding parameter can be determined by querying a mapping table of pre-set first difference values ​​and first coding parameters, the mapping table records the first coding parameter corresponding to the maximum bitrate for each different first difference value. Furthermore, in some embodiments, step 5122 can be implemented by steps 5122-1 to 5122-3.

[0062] In step 5122-1, a second predicted value for the second color component of the template region is determined based on the first difference value and the candidate first coding parameter.

[0063] In some embodiments, the second predicted value of the second color component of the template region is set to be equal to the weighted sum of the reference value of the second color component of the reference region of the template region and the second weighting coefficient.

[0064] Furthermore, in some embodiments, the second weighting coefficient is determined using a predetermined correspondence based on the first difference value of the template region and the candidate first coding parameter.

[0065] In some embodiments, the predetermined correspondence is not limited and may be of various types of function models, where the candidate first coding parameter is one model parameter of this function model and affects the magnitude of the second weighting coefficient. The predetermined correspondence can also be obtained using a function model, for example, where the predetermined correspondence is the second weighting coefficient corresponding to the first difference value and the candidate first coding parameter.

[0066] Furthermore, in some embodiments, the predetermined correspondence is a softmax function, and the input to the softmax function is one of the following: the ratio of the first difference value to the candidate first coding parameter, the product of the first difference value to the candidate first coding parameter, or a value obtained by bit-shifting the first difference value, and the number of bits of the bit shift is equal to the candidate first coding parameter. The direction of the bit shift may be to the left or to the right.

[0067] For example, Equation 1 below shows an example of the 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 k-th pixel in the reference region of the template region, and recTempY[i][j] represents the reference value of the first color component of the pixel with pixel coordinates (i,j) in the template region.

[0070] Based on this, the second predicted value of the second color component of the pixel whose pixel coordinates within the template region are (i,j) is calculated, as shown in Equation 3.

[0071]

number

[0072] In some embodiments, the predetermined correspondence can also be obtained using the softmax function. First, the predetermined correspondence (e.g., a predetermined mapping table) is calculated in advance according to the softmax function, and then, when determining the second weighting coefficient, the predetermined correspondence is queried to obtain the second weighting coefficient corresponding to the first difference value of the template region and the candidate decoding parameter.

[0073] In some embodiments, the candidate first coding parameter includes one or more candidate first coding parameters. For each candidate first coding parameter, the corresponding first prediction error can be calculated by steps 5122-1 and 5122-2.

[0074] In step 5122-2, a first prediction error of the second color component of the template region is determined, wherein the first prediction error is the error between the reference value of the second color component of the template region and the second prediction value of the second color component of the template region, and the reference value of the second color component of the template region is the 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, the second prediction value for determining the first prediction error is set to be equal to the second prediction value obtained by a correction operation on the second prediction value of the second color component of the template region.

[0076] In step 5122-3, the first coding parameter is determined based on the first prediction error.

[0077] In the embodiments of this application, the embodiments for realizing step 5122-3 are not limited and may vary. For example, it can be realized by any of the following embodiments 1 to 4.

[0078] In Example 1, step 5122-3 can be realized as follows: The first coding parameter is set to be equal to the value of the candidate first coding parameter corresponding when the first prediction error satisfies the 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.

[0079] In some embodiments, the first condition includes the first prediction error being minimal, the first prediction error being less than a first threshold, the first prediction error being maximum, or the first prediction error being greater than a third threshold.

[0080] It should be explained that the first prediction error for different evaluation criteria corresponds to different first conditions. For example, in the evaluation criterion of Sum of Absolute Differences (SAD), the first condition includes the first prediction error being the minimum or the first prediction error being less than the first threshold. In another example, in the evaluation criterion of Peak Signal-to-Noise Ratio (PSNR), the first condition includes the first prediction error being the maximum or the first prediction error being greater than the third threshold.

[0081] In Example 2, step 5122-3 (i.e., the step of determining the first coding parameter based on the first prediction error) can also be implemented as follows: From among the candidate first coding parameters of the template region, a parameter is selected whose first prediction error satisfies the first condition, and the first coding 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 coding parameter based on a parameter corresponding to the template region whose first prediction error satisfies the first condition" can be realized by following Examples 1, 2, 3, or 4 below.

[0083] In Example 1, a sixth weighting coefficient is determined based on the reference sample value of the first color component of the current block and a candidate first coding parameter whose first prediction error satisfies the first condition. A third predicted value of the second color component of the current block is determined based on the sixth weighting coefficient and the reference sample value of the second color component of the current block. A second prediction error is determined for the corresponding candidate first coding parameter whose first prediction error satisfies the first condition based on the third predicted value of the second color component of the current block and the original value. The first coding parameter is determined based on the second prediction error of the candidate first coding parameter whose first prediction error satisfies the first condition.

[0084] Here, the calculation principle for the sixth weighting coefficient is the same as the calculation principle for the second weighting coefficient, and equations 1 and 2 can be referenced. Therefore, the specific calculation method for the sixth weighting coefficient will not be explained again here. In some embodiments, the reference sample value of the first color component of the current block includes the reconstructed value of the first color component of the reference region of the current block (or a value obtained by filtering the reconstructed value) and the 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 the reconstructed value of the second color component of the reference region of the current block, a value obtained by filtering the reconstructed value of the second color component of the reference region of the current block, or the original value of the second color component of the reference region of the current block or a value obtained by filtering the original value of the second color component of the reference region of the current block.

[0085] In some embodiments, a candidate first coding parameter is selected from among candidate first coding parameters whose first prediction error satisfies the first condition, and a candidate first coding parameter whose second prediction error satisfies the third condition is selected. Based on the candidate first coding parameter whose second prediction error satisfies the third condition, the first coding parameter is determined.

[0086] For example, the first coding parameter is set to be equal to a candidate first coding parameter whose second prediction error satisfies the third condition. Here, the number of candidate first coding parameters whose second prediction error satisfies the third condition may be one or more. If there are multiple, the first coding parameter is set to be equal to any of the candidate first coding parameters whose second prediction error satisfies the third condition.

[0087] In another example, the first coding parameter is set to be equal to the fused value of a candidate first coding parameter whose second prediction error satisfies the third condition. Furthermore, in some embodiments, a weighting coefficient for the corresponding candidate first coding parameter can be determined based on the magnitude of the second prediction error, and based on this, the first coding parameter is set to be equal to the weighted sum of the candidate first coding parameter whose second prediction error satisfies the third condition and the corresponding weighting coefficient. In some embodiments, the third condition includes the second prediction error being minimized or the second prediction error being maximized.

[0088] It should be explained that different evaluation criteria for the second prediction error correspond to different third conditions. For example, in the evaluation criterion of the sum of absolute differences (SAD), the third condition includes the second prediction error being minimized, while in another example, in the evaluation criterion of the peak signal-to-noise ratio (PSNR), the third condition includes the second prediction error being maximized.

[0089] In Example 2, the step of "determining the first coding parameter based on a parameter corresponding to the template region whose first prediction error satisfies the first condition" can be implemented as follows: a candidate first coding parameter whose first prediction error satisfies the first condition is extended to obtain a first extended parameter; a seventh weighting coefficient is determined based on the reference sample value of the first color component of the current block, the candidate first coding parameter whose first prediction error satisfies the first condition, and the first extended parameter; a fourth predicted value of the second color component of the current block is determined based on the seventh weighting coefficient and the reference sample value of the second color component of the current block; a third prediction error of the corresponding parameter is determined based on the fourth predicted value of the second color component of the current block and the original value; and the first coding parameter is determined based on the third prediction error of each candidate first coding parameter and the first extended parameter.

[0090] Similarly, the calculation principle for the seventh weighting coefficient is the same as that for the second weighting coefficient, and can be referenced from Equations 1 and 2 above, which will not be repeated here. One seventh weighting coefficient corresponds to one candidate first coding parameter or one first extension parameter, that is, the seventh weighting coefficient is determined based on one candidate first coding parameter or one first extension parameter and the reference sample value of the first color component of the current block.

[0091] In some embodiments, at least one first extended parameter is obtained by extending left and / or right based on a predetermined step length, centering on a candidate first coding parameter whose first prediction error satisfies a first condition.

[0092] In some embodiments, a parameter is selected from each of the candidate first coding parameters and the first extension parameter such that the third prediction error satisfies the fourth condition, and the first coding parameter can be determined based on the parameter whose third prediction error satisfies the fourth condition.

[0093] For example, the first coding parameter is set to be equal to a parameter whose third prediction error satisfies the fourth condition, where the number of parameters whose third prediction error satisfies the fourth condition may be one or more. If there are multiple parameters, the first coding parameter is set to be equal to any of the parameters whose third prediction error satisfies the fourth condition.

[0094] In another example, the first coding parameter is set to be equal to the fused value of the parameter whose third prediction error satisfies the fourth condition. Furthermore, in some embodiments, the weighting coefficients of the corresponding parameter can be determined based on the magnitude of the third prediction error, and based on this, the first coding parameter is set to be equal to the weighted sum of the parameter whose third prediction error satisfies the fourth condition and the corresponding weighting coefficients.

[0095] In some embodiments, the fourth condition includes the third prediction error being minimized or the third prediction error being maximized.

[0096] It should be explained that different evaluation criteria for the third prediction error correspond to different fourth conditions. For example, in the evaluation criterion of the sum of absolute differences (SAD), the fourth condition includes the third prediction error being minimized, while in another example, in the evaluation criterion of the peak signal-to-noise ratio (PSNR), the fourth condition includes the third prediction error being maximized.

[0097] In Example 3, the step of "determining the first coding parameter based on a parameter corresponding to the template region whose first prediction error satisfies the first condition" can also be implemented as follows: that is, the first coding parameter is set to be equal to a parameter whose first prediction error satisfies the first condition, or the first coding parameter is set to be equal to the fused value of a parameter whose first prediction error satisfies the first condition.

[0098] Furthermore, in some embodiments, the first coding parameter is set to be equal to the weighted sum of the parameter that satisfies the first condition for the first prediction error and the third weighting coefficient.

[0099] In some embodiments, a corresponding third weighting coefficient can be determined based on the first prediction error, which corresponds to a parameter that satisfies a first condition, or the third weighting coefficient can be set to a predetermined constant value.

[0100] In Example 4, the step of "determining the first coding parameter based on a parameter corresponding to the template region in which the first prediction error satisfies the first condition" can also be implemented as follows: the parameter in which the first prediction error satisfies the first condition is extended to obtain a first extended parameter, and the first extended parameter and / or the parameter in which the first prediction error satisfies the first condition are fused to obtain the first coding parameter.

[0101] In some embodiments, the weighting coefficients of the corresponding parameters can be determined based on the magnitude of the first prediction error, and the weighting coefficients of the first extended parameters may be predetermined constant values ​​or the weighting coefficients of the corresponding candidate first coding parameters. Based on this, a weighting calculation is performed on the first extended parameters and / or parameters whose first prediction error satisfies the first condition to obtain the first coding parameters.

[0102] In Example 3, step 5122-3 (i.e., the step of determining the first coding parameter based on the first prediction error) can be further implemented as follows: the first coding parameter is set to be equal to the weighted sum of each candidate first coding parameter and the fourth weighting coefficient.

[0103] In some embodiments, a fourth weighting coefficient for the corresponding candidate first coding parameter is determined based on the first prediction error.

[0104] In Example 4, step 5122-3 (i.e., the step of determining the first coding parameter based on the first prediction error) can be further implemented as follows: an evaluation parameter representing the performance of the corresponding candidate first coding parameter is determined based on the first prediction error corresponding to each of the identical candidate first coding parameters in the template region, and the first coding parameter is determined based on the evaluation parameter of each candidate first coding parameter.

[0105] Furthermore, in some embodiments, the evaluation parameter is set to be equal to the fused value of the first prediction errors corresponding to each of the identical candidate first coding parameters in the template region. This fused value may be the sum or product of these first prediction errors, etc.

[0106] Furthermore, in some embodiments, the evaluation parameter is set to be equal to the sum of the first prediction errors corresponding to each of the identical candidate first coding parameters in the template region.

[0107] Furthermore, in some embodiments, the step of "determining the first coding parameter based on the evaluation parameter of each candidate first coding parameter" can also be implemented as follows: that is, a parameter whose evaluation parameter satisfies the second condition is selected from among the candidate first coding parameters, and the first coding parameter is determined based on the parameter whose evaluation parameter satisfies the second condition.

[0108] Furthermore, the step of "determining the first coding parameter based on the evaluation parameter that satisfies the second condition" can be realized by following Example 5 or Example 6.

[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 evaluation parameter that satisfies the 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 is determined for the corresponding evaluation parameter that satisfies the second condition based on the fifth predicted value of the second color component of the current block and the original value. The first coding parameter is determined based on the fourth prediction error of each candidate first coding parameter.

[0110] Furthermore, in some embodiments, a second extended parameter is obtained by extending the evaluation parameter to satisfy the second condition, a ninth weighting coefficient is determined based on the reference sample value of the first color component of the current block, the evaluation parameter to satisfy the second condition, and the second extended parameter, 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 the corresponding parameter is determined based on the sixth predicted value of the second color component of the current block and the original value, and the first coding parameter is determined based on each candidate first coding parameter and the fifth prediction error of the second extended parameter.

[0111] Similarly, the calculation principles for the eighth and ninth weighting coefficients are the same as those for the second weighting coefficient, and can be referenced from Equations 1 and 2 above, which will not be repeated here. One ninth weighting coefficient corresponds to one candidate first coding parameter or one second extension parameter, that is, the ninth weighting coefficient is determined based on one candidate first coding parameter or one second extension parameter and the reference sample value of the first color component of the current block.

[0112] In Example 6, the step of "determining the first coding parameter based on a parameter whose evaluation parameter satisfies the second condition" can be implemented as follows: that is, the first coding parameter is set to be equal to a parameter whose evaluation parameter satisfies the second condition, or the first coding parameter is set to be equal to the fused value of a parameter whose evaluation parameter satisfies the second condition. In some embodiments, the first coding parameter is set to be equal to the weighted sum of a parameter whose evaluation parameter satisfies the second condition and a fifth weighting coefficient.

[0113] Furthermore, a fifth weighting coefficient is obtained using Example 7 or Example 8.

[0114] In Example 7, the fifth weighting coefficient for a 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 coefficient for a corresponding parameter is determined based on the number of pixels in the template region and / or the template type corresponding to the parameter whose evaluation parameter satisfies the second condition.

[0116] In some embodiments, the second condition includes the evaluation parameter being minimal, the evaluation parameter being less than a second threshold, the evaluation parameter being maximum, or the evaluation parameter being greater than a fourth threshold. Understandably, the first prediction error for different evaluation criteria corresponds to different second conditions. For example, for the evaluation criterion of sum of absolute differences (SAD), the second condition includes the evaluation parameter being minimal or the evaluation parameter being less than a second threshold, while in another example, for the evaluation criterion of peak signal-to-noise ratio (PSNR), the second condition includes the evaluation parameter being maximum or the evaluation parameter being greater than a fourth threshold.

[0117] In Example 8, the fifth weighting coefficient is a predetermined constant value.

[0118] When performing an intra-prediction for a given block, there may be cases where no template region exists. In some embodiments, if the template region does not exist, the default value is set to the predicted value of the second color component of the current block. In some other embodiments, if the template region does not exist, it may be decided to use a different prediction method than the one described above to predict the second color component of the current block. A different prediction method than the one described above is, for example, a prediction method based on a cross-component linear model (CCLM).

[0119] In some embodiments, after obtaining a first encoding parameter, the first encoding parameter or the index of the first encoding parameter can be encoded, and the resulting encoded bits can be written to a bitstream.

[0120] In step 52, the reference sample value of the 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 the reconstructed value of the first color component of the current block and the reconstructed value of the first color component of the reference region of the current block.

[0122] In step 53, the first weighting coefficient 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 can be determined, where the second difference value of the current block is set to be equal to the absolute difference between the reference value of the first color component of the current block and the reference value of the first color component of the reference region of the current block, and a first weighting coefficient is determined based on the second difference value of the current block and the first coding parameter. Here, the reference value of the first color component of the current block is the 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 region of the current block is the reconstructed value of the first color component of the reference region of the current block, or a value obtained by filtering the reconstructed value of the first color component of the reference region of the current block.

[0124] Furthermore, in some embodiments, a first weighting coefficient can be determined using a predetermined correspondence based on the second difference value of the current block and the first coding parameter.

[0125] Furthermore, in some embodiments, the predetermined correspondence is a softmax function, or the predetermined correspondence is obtained using a softmax function, wherein the input to the softmax function is one of the following: the ratio of the second difference value to the first coding parameter, the product of the second difference value to the candidate first decoding parameter, or a value obtained by bit-shifting the second difference value, and the number of bits of the bit shift is equal to the candidate first decoding parameter.

[0126] For example, equation 4 below shows an example of the 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 k-th pixel in the reference region of the current block (e.g., reconstructed value, value obtained by filtering the reconstructed value, original value, or 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 are (i,j) in the current block (e.g., reconstructed value, value obtained by filtering the reconstructed value, original value, or value obtained by filtering the original value).

[0129] In step 54, a first predicted value for the second color component of the current block is determined based on the first weighting coefficient and the reference sample value for 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 includes the reconstructed value of the second color component of the reference region of the current block, or a value obtained by filtering the reconstructed value, or the original value of the second color component of the reference region of the current block, or a value obtained by filtering the original value.

[0131] Based on Equation 5, the first predicted value of the second color component of the pixel whose current pixel coordinates within the block are (i,j) is calculated as shown in Equation 6.

[0132]

number

[0133] In some embodiments, after obtaining a first predicted value for the second color component of the current block by 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, the 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 a first predicted value for the second color component of the current block by 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 the 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, the 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 If the value of C

[0141] By this, it is ensured that all predicted values in predWcp are within 0 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] The following provides an embodiment of the decoding side, and the decoding method provided by the embodiment of the present application is the same as the encoding method described above, the first encoding parameter described above corresponds to the first decoding parameter described in the following embodiment and is essentially the same, and the candidate first encoding parameter described above corresponds to the candidate first decoding parameter described in the following embodiment and is essentially the same, and both 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. 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 described above. Therefore, technical details not disclosed in the embodiment of the decoding method of the present application and specific embodiments will not be described again.

[0147] Embodiments of the present application provide a decoding method, and Figure 13 is a flowchart showing the implementation of the decoding method according to embodiments of the present application, and as shown in Figure 13, the method may include the following steps 131 to 134.

[0148] In step 131, the first decoding parameter is determined based on the template region.

[0149] In step 132, the reference sample value of the first color component of the current block is determined.

[0150] In step 133, a first weighting coefficient 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 for the second color component of the current block is determined based on the first weighting coefficient and the reference sample value for the second color component of the current block.

[0152] The following sections will describe further alternative embodiments and related nouns for each of the steps described above.

[0153] In step 131, the first decoding parameters are determined based on the template region.

[0154] In some embodiments, the template region may be determined first. For example, the template region may be determined based on the pixel availability of the adjacent region of the current block, and based on its relative position to the current block, the adjacent region includes at least one of the following: the upper region of the current block, the left region of the current block, the upper right region of the current block, the lower left region of the current block, and the upper left region of the current block.

[0155] In another example, the template region can also be determined based on the template types included in the configured prediction mode.

[0156] In some embodiments, the template type includes at least one of the following: upper template, left template, upper right template, lower left template, and upper left template.

[0157] Furthermore, in some embodiments, the template included in the configured prediction mode can be the template region.

[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, the reference sample value of the template area is determined.

[0160] In some embodiments, the reference sample value includes the reconstructed value of the first color component of the template region, the reconstructed value of the second color component of the template region, the reconstructed value of the first color component of the reference region of the template region, and the reconstructed value of the second color component of the reference region of the template region.

[0161] Furthermore, in some embodiments, the reference region of the template region includes at least one of the upper adjacent region of the template region, the lower adjacent region of the template region, the left adjacent region of the template region, the right adjacent region of the template region, and the template region itself.

[0162] In step 112, the first decoding parameter is determined based on the reference sample value of the template region.

[0163] In some embodiments, step 112 can be achieved by steps 1121 and 1122.

[0164] In step 1121, the first difference value of the template region is determined, and the first difference value of the template region is set to be equal to the absolute value of the difference between the reference 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.

[0165] Furthermore, in some embodiments, the reference value of the first color component of the template region is the 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 the 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 the first difference value of the template region.

[0167] Furthermore, in some embodiments, step 1122 can be achieved by steps 1122-1 to 1122-3.

[0168] In step 1122-1, a second predicted value for the second color component of the template region is determined based on the first difference value and the candidate first decoding parameter.

[0169] In some embodiments, the candidate first coding parameter includes one or more candidate first decoding parameters.

[0170] In step 1122-2, a first prediction error of the second color component of the template region is determined, wherein the first prediction error is the error between the reference value of the second color component of the template region and the second prediction value of the second color component of the template region, and the reference value of the second color component of the template region is the 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, the second prediction value for determining the first prediction error is set to be equal to the second prediction value obtained by a correction operation on the second prediction value of the second color component of the template region.

[0172] In step 1122-3, the first decoding parameter is determined based on the first prediction error.

[0173] In the embodiments of this application, the embodiments for realizing step 1122-3 are not limited and may vary. For example, it can be realized by any of the following embodiments 5 to 8.

[0174] In Example 5, step 1122-3 can be realized as follows: The second predicted value of the second color component of the template region is set to be equal to the weighted sum of the reference value of the second color component of the reference region of the template region and the second weighting coefficient; the first decoding parameter is set to be equal to the value of the candidate first decoding parameter corresponding when the first prediction error satisfies the 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 coefficient is determined using a predetermined correspondence based on the first difference value of the template region and the candidate first decoding parameter.

[0176] Furthermore, in some embodiments, the predetermined correspondence is a softmax function, or the predetermined correspondence is obtained using a softmax function, wherein the input to the softmax function is one of the following: the ratio of the first difference value to the candidate first decoding parameter, the product of the first difference value to the candidate first decoding parameter, or a value obtained by bit-shifting the first difference value, and the number of bits in the bit shift is equal to the candidate first decoding parameter.

[0177] In some embodiments, the first condition includes the first prediction error being minimal, the first prediction error being less than a first threshold, the first prediction error being maximum, or the first prediction error being greater than a third threshold.

[0178] In Example 6, step 1122-3 (i.e., the step of determining the first decoding parameter based on the first prediction error) can also be implemented as follows: From among the candidate first decoding parameters of the template region, a parameter is selected whose first prediction error satisfies the first condition, 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 whose first prediction error satisfies the first condition" can be realized by 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 whose first prediction error satisfies the first condition" can also be implemented as follows: the first decoding parameter is set to be equal to a parameter whose first prediction error satisfies the first condition, or the first decoding parameter is set to be equal to the fused value of a parameter whose first prediction error satisfies the first condition.

[0181] Furthermore, in some embodiments, the first decoding parameter is set to be equal to the weighted sum of the parameter that satisfies the first condition for the first prediction error and the third weighting coefficient.

[0182] In some embodiments, a corresponding third weighting coefficient can be determined based on the first prediction error, which corresponds to a parameter that satisfies a first condition, or the third weighting coefficient can be set to a predetermined constant value.

[0183] In Example 10, the step of "determining the first decoding parameter based on a parameter corresponding to the template region in which the first prediction error satisfies the first condition" can also be implemented as follows: the parameter in which the first prediction error satisfies the first condition is extended to obtain a first extended parameter, and the first extended parameter and / or the parameter in which the first prediction error satisfies the first condition are fused to obtain the first decoding parameter.

[0184] In Example 7, step 1122-3 (i.e., the step of determining the first decoding parameter based on the first prediction error) can be further implemented as follows: the first decoding parameter is set to be equal to the weighted sum of each candidate first decoding parameter and the fourth weighting coefficient.

[0185] In some embodiments, a fourth weighting coefficient for the corresponding candidate first decoding parameter is determined based on the first prediction error.

[0186] In Example 8, step 1122-3 (i.e., the step of determining the first decoding parameter based on the first prediction error) can be further implemented as follows: an evaluation parameter representing the performance of the corresponding candidate first decoding parameter is determined based on the first prediction error corresponding to each of the identical candidate first decoding parameters in the template region, and the first decoding parameter is determined based on the evaluation parameter of each candidate first decoding parameter.

[0187] Furthermore, in some embodiments, the evaluation parameter is set to be equal to the fused value of the first prediction error corresponding to each of the identical candidate first decoding parameters in the template region.

[0188] Furthermore, in some embodiments, the evaluation parameter is set to be equal to the sum of the first prediction errors corresponding to each of the identical candidate first decoding parameters in the template region.

[0189] Furthermore, in some embodiments, the step of "determining the first decoding parameter based on the evaluation parameter of each candidate first decoding parameter" can also be implemented as follows: that is, a parameter whose evaluation parameter satisfies the second condition is selected from among the candidate first decoding parameters, and the first decoding parameter is determined based on the parameter whose evaluation parameter satisfies the second condition.

[0190] Furthermore, the following example 11 can be used to realize the step of "determining the first decoding parameter based on the evaluation parameter that satisfies the second condition."

[0191] In Example 11, the first decoding parameter is set to be equal to the parameter whose evaluation parameter satisfies the second condition, or the first decoding parameter is set to be equal to the fused value of the parameter whose evaluation parameter satisfies the second condition.

[0192] In some embodiments, the first decoding parameter is set to be equal to the weighted sum of the parameter that satisfies the second condition and the fifth weighting coefficient.

[0193] Furthermore, a fifth weighting coefficient is obtained using Example 12 or Example 13.

[0194] In Example 12, the fifth weighting coefficient 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 coefficient for a corresponding parameter is determined based on the number of pixels in the template region and / or the template type corresponding to the parameter whose evaluation parameter satisfies the second condition.

[0196] In some embodiments, the second condition includes the evaluation parameter being at its minimum, being less than a second threshold, being at its maximum, or being greater than a fourth threshold.

[0197] In Example 13, the fifth weighting coefficient is a predetermined constant value.

[0198] When performing an intra-prediction for a given current block, there may be cases where no template region exists. In some embodiments, if the template region does not exist, the default value is set to the predicted value of the second color component of the current block. In some other embodiments, if the template region does not exist, it may be decided to use a different prediction method than the one described above to predict the second color component of the current block.

[0199] In some embodiments, the decoding method further includes the steps of analyzing the 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 includes the step of analyzing the bitstream to obtain the first decoding parameter.

[0201] In some embodiments, the decoding method further includes the steps of: analyzing a bitstream to obtain a residual value of the 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 the steps of: performing a correction operation on a first predicted value of the 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 the residual value of the second color component and the corrected first predicted value.

[0203] In the embodiments of this application, the first and second color components are of different types. For example, the first color component is the luminance component, and the second color component is the chromaticity component. In another example, the first color component is the chromaticity component, and the second color component is the luminance component.

[0204] When performing chromaticity 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 chromaticity information of the adjacent reference region are all encoded reconstructed information. Therefore, the aim is to use the above reconstructed information to employ weight-based chromaticity prediction technology (WCP), add a template matching step before the weight-based chromaticity prediction process, and select the optimal model parameters based on the current block of different size and different content. The important point here is to employ a template matching method to find the optimal model parameters of the weight model used to calculate the weight vector within the adjacent region. For the decoding side, the optimal model parameters are an example of the first decoding parameters described in the above embodiment, and for the encoding side, the optimal model parameters are an example of the first encoding parameters described in the above embodiment.

[0205] In some embodiments, the detailed steps of the chromaticity prediction process of the WCP technology are as follows: WCP input: Current block position (xTbCmp, yTbCmp), current block width nTbW, and current block height nTbH.

[0206] The output of WCP is the predicted chromaticity value of the current block, predSamples[x][y], where the coordinate origin is the position of the upper-left corner pixel in the current block, and x=0,...,nTbW-1, y=0,...,nTbH-1. It should be explained that the chromaticity component is an example of the second color component described in the above example, and the luminance component described below is an example of the first color component described in the above example.

[0207] As shown in Figure 14, the prediction process of the WCP technology includes the following steps 141 to 145, namely setting core parameters, acquiring input information, weight-based chromaticity prediction, and post-processing, with a template matching step added between the two steps of acquiring input information and weight-based chromaticity prediction. Through these steps, the chromaticity prediction value of the current block can be obtained.

[0208] In step 141, the WCP core parameters are determined, and these parameters may be pre-set.

[0209] In step 142, input information is obtained based on the determined core parameters, which includes obtaining reference chromaticity information, reference luminance information, and reconstruction luminance information for the current block.

[0210] In step 143, control parameters are determined by template matching, where, in the case of the decoding side, the control parameters correspond to an example of the first decoding parameters described in the above embodiment, and in the case of the encoding side, they correspond to an example of the first encoding parameters described in the above embodiment.

[0211] In step 144, a weight-based chromaticity prediction calculation is performed based on the acquired input information.

[0212] In step 145, post-processing is performed on the chromaticity prediction calculation results.

[0213] Each step shown in Figure 14 above will be explained in detail.

[0214] Step 141 determines the WCP core parameters.

[0215] Here, the core parameters related to the WCP are determined; that is, the WCP core parameters can be obtained or inferred by the configuration or by some other method. For example, the decoding side obtains the WCP core parameters from the bitstream. Specific applications will be explained in detail later.

[0216] Determining the WCP core parameters includes, but is not limited to, determining the control parameter (T), the number of various input information for weight-based chromaticity prediction (inSize), and the number of weight-based chromaticity prediction outputs (predWcp). predWcp is arrayed as predSizeW × predSizeH, where the number of weight-based chromaticity prediction outputs (predWcp) can be set to the same value (e.g., predSizeW = predSizeH = S / 4) or can be set in relation to the current block size (e.g., predSizeW = nTbW, predSizeH = nTbH). Here, the control parameter (T) may be used to adjust the nonlinear function of subsequent stages or to adjust the data related to subsequent stages.

[0217] The determination of the WCP core parameters is influenced by the size or content of the block under certain conditions. The current block can be classified based on its size, content, or the number of pixels within the block, and the same or different core parameters can be configured based on different classifications. That is, the inSize or predWcp (arranged as predSizeW × predSizeH) corresponding to different classifications may be the same, for example, predSizeW = predSizeH = s / 4, and predWcp may be associated with the size of the current block, for example, predSizeW = nTbW, predSizeH = nTbH. It should be noted that predSizeW and predSizeH may be the same or different. The control parameter (T) corresponding to current blocks of different sizes, different content, or different numbers of pixels within the block is determined by template matching in step 143.

[0218] Step 142 retrieves the input information.

[0219] When predicting a current block, the area above, the upper left, and the left side of the predicted block are called the reference area of ​​the current block. As shown in Figure 15, the pixels within the reference area of ​​the current block are the reconstructed pixels and are called reference pixels.

[0220] The reference chromaticity information refC and reference luminance information refY are obtained from the reference region. The obtained reference chromaticity information refC includes, but is not limited to, the reference reconstructed chromaticity values ​​of the region above and to the left of the currently selected block. The obtained reference luminance information refY includes, but is not limited to, the corresponding reference luminance information obtained based on the reference chromaticity information position.

[0221] The method for obtaining the reconstructed luminance information recY of the current block includes, but is not limited to, obtaining the corresponding reconstructed luminance information based on the chromaticity information position of the current block and using that as the reconstructed luminance information of the current block.

[0222] It should be explained that the reference chromaticity information refC is an example of a reference sample value for 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 ​​for the first color component of the current block.

[0223] Obtaining input information includes obtaining the reference chromaticity information refC of the inSize quantity (after preprocessing if preprocessing is required), obtaining the reference luminance information refY of the inSize quantity (after preprocessing if preprocessing is required), and obtaining the reconstructed luminance information recY of the current block (after preprocessing if preprocessing is required).

[0224] In step 143, the control parameters are determined by template matching.

[0225] The WCP prediction process is simulated using the reconstructed luminance pixels and chromaticity pixels in the template region, and the reconstructed luminance pixels and chromaticity pixels in the reference region of the template region, and the optimal control parameter (best_T) is selected from among them. Specifically, as shown in Figure 16, this includes the following steps 1431 and 1433.

[0226] In step 1431, the template area and the template reference area are determined.

[0227] Based on the pixel availability of adjacent areas of the current block, it is determined whether pixels in the template area and the reference area of ​​the template area are available, and reconstructed luminance information and reconstructed chromaticity information are included. Based on the relative positional relationship between the template area and the current block, the template area can be classified into template types such as upper template, left template, upper right template, lower left template, and upper left template, but is not limited to these. The reference area of ​​the template area changes depending on the type of template area, and the template area is allowed to overlap with its reference area. Also, as shown in Figures 10, 11, and 12A, the template type and the reference area corresponding to the template area can be flexibly combined to meet the needs of different current blocks. Different template sizes for different types of current blocks may be fixed to the same or may be different. For example, different template sizes can be selected based on different sizes of the current block. To explain using the template in Figure 11 as an example, the template size setting conditions are shown by 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 showing three types of template positions and their corresponding reference area positions, respectively. The templates in the following embodiments will be explained using the upper and left templates in Figure 11 as examples. In the 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 luminance information of the template region, the reconstructed chromaticity information of the template region, the reconstructed luminance information of the reference region of the template region, and the reconstructed chromaticity information are all encoded reconstruction information. Therefore, the basic process of WCP can be performed in the template region, where the reconstructed luminance information of the template region and the reconstructed luminance information of the reference region of the template region are examples of reference sample values ​​for the first color component of the template region, and the reconstructed chromaticity information of the template region and the reconstructed chromaticity information of the reference region of the template region are examples of reference sample values ​​for the second color component of the template region.

[0233] First, we perform a WCP prediction for the upper template. The detailed process is as follows: The WCP inputs for the template are: the position of the upper template (xTemp, yTemp), the width of the upper template nTbW, and the height of the upper template iTempH.

[0234] The WCP output of the template: PredTempSamples[x][y], which is the chromaticity prediction value of the upper template, i.e., an example of the second prediction value of the second color component of the template region, where the coordinate origin is the position of the upper left corner pixel of the upper template, and x=0,...,nTbW-1, y=0,...,nTbH-1.

[0235] Determination of WCP core parameters includes, but is not limited to, the determination of the control parameter (T), the number of various types of input information for weight-based chromaticity prediction (inTempSize), and the number of weight-based chromaticity prediction outputs (predTempWcp) (arranged in predTempSizeW × predTempSizeH). The above inTempSize, predTempSizeW, and predTempSizeH parameters may vary depending on different template types and may also vary depending on the WCP core parameters configured during the WCP prediction process of the current block.

[0236] Input Information Acquisition: The reference chromaticity information refTempC and reference luminance information refTempY are obtained from the reference area of ​​the upper template. Obtaining the reference chromaticity information refTempC includes, but is not limited to, selecting the reference reconstruction chromaticity value of the reference area of ​​the upper template. Obtaining the reference luminance information refTempY includes, but is not limited to, obtaining the corresponding reference luminance information based on the position of the reference chromaticity information.

[0237] The method for obtaining the reconstructed chromaticity information recTempC of a template currently includes, but is not limited to, selecting the reconstructed chromaticity information within the 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 based on the position of the reconstructed chrominance information in the current template and using it as the reconstructed luminance information of the current template. In this process, preprocessing can also be performed according to different requirements. For example, up / downsampling can be performed based on different input color format information, only a part of the reference area can be selected, or point selection can be executed in the reference area.

[0239] Next, the template chrominance prediction value C predT [i][j] (i = 0…predTempSizeW - 1, j = 0…predTempSizeH - 1) is obtained one by one. It should be noted that predTempSizeH and predTempSizeW are the determined WCP core parameters, and they 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] Taking i = 0,…,predTempSizeW - 1, j = 0,…,predTempSizeH - 1 as the processing targets, Taking k = 0, 1,…,inTempSize - 1 as the processing targets, Constructing each element diffTempY[i][j][k] in the luminance difference vector, Calculating each element cTempWeight[i][j][k] (or cTempWeightFloat[i][j][k]) in the weight vector, Calculating the chrominance prediction value C predT [i][j] by cTempWeight[i][j] (or cTempWeightFloat[i][j][k]) and refTempC.

[0242] Construction of the luminance difference vector: For each chrominance pixel C waiting for prediction in the template within the size defined 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 the inTempSize quantity, and the absolute value is taken to obtain the 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 examples of first difference values.

[0243] [Formula 10] diffTempY[i][j][k]=abs(refTempY[k]-recTempY[i][j]) Here,

number

[0244]

number

[0245] [Formula 12] cTempWeight[i][j][k]=round(cTempWeightFloat[i][j][k]×2 Shift) Here, round(x)=Sign(x)×Floor(Abs(x)+0.5)

number

[0246]

number

[0247] If k = 0, 1 ... in Size - 1, [Formula 13] subTempCFloat[i][j][k]=(cTempWeightFloat[i][j][k]×refTempC[k]) After the calculation is complete, fixed-point arithmetic can be performed on subTempCFloat, and in the fixed-point arithmetic process, it can be multiplied by a single coefficient, as shown in Equations 14 and 15, in order to maintain a certain level of calculation precision.

[0248] [Formula 14] subTempC[i][j][k]=round(subTempCFloat[i][j][k]×2 Shift ) Or, [Equation 15] subTempC[i][j][k]=(cTempWeight[i][j][k]×refTempC[k]) Assuming i = 0…predSizeW - 1 and j = 0…predSizeH - 1, [Number] After the calculation is completed, for C predT For Float[i][j], fixed-point arithmetic can be performed as in Equation 17.

[0249] [Equation 17] C predT [i][j]=round(C predT Float[i][j]) Or calculate using subTempC[i][j][k] that has been fixed-point arithmetic as in Equation 18.

[0250] [Number] Or calculate using subTempC[i][j][k] that has been fixed-point arithmetic as in Equation 19.

[0251] [Number] Here, Offset = 1 << (Shift1 - 1), and Shift1 is the shift amount required for fixed-point arithmetic operations to improve accuracy when calculating cTempWeight[i][j][k] or subTempC[i][j][k] (Shift1 = Shift), or in other processes.

[0252] The chrominance prediction value C predT [i][j] of each pixel waiting for prediction is stored in a separate space and used as the output predTempWcp of chrominance prediction based on weights.

[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, it is set to 0, C predT If the value of C[i][j] is greater than (1<<BitDepth)-1, it is set to (1<<BitDepth)-1.

[0256] This ensures that all prediction values in predTempWcp are within 0 to (1<<BitDepth)-1.

[0257] That is,

Number

[0258] Figure 12B shows the WCP process, which may be a WCP process performed based on the template region and reference region of the template region shown in Figure 12A, or it may be a WCP process performed based on other types of template regions and corresponding reference regions. As shown in Figure 12B, for each sample recTempY[i][j] in the downsampled luminance block, first, a luminance difference vector diffTempY[i][j][k] is obtained based on the absolute value of the difference between recTempY[i][j] and the adjacent luminance vector refTempY[k], second, 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 chromaticity vector to obtain the predicted chromaticity sample C predT [i][j] is obtained.

[0259] The WCP prediction process in the left-hand template only describes the WCP inputs, outputs, core parameter configuration, and input information acquisition in the WCP prediction process in the upper template, or the other operations are the same.

[0260] The WCP input for the template is: the position of the left template (xTemp, yTemp), the width of the left template iTempW, and the height of the left template nTbH.

[0261] The WCP output of the template is the chromaticity prediction value of the left template, predTempSamples[x][y], where the coordinate origin is the upper left corner pixel of the left template, and x=0,...,iTempW-1, y=0,...,nTbH-1.

[0262] The core parameter configuration includes, but is not limited to, the determination of the control parameter (T), the number of different types of input information for weight-based chromaticity prediction (inTempSize), and the number of weight-based chromaticity prediction outputs (predTempWcp) (arranged in predTempSizeW × predTempSizeW). The above inTempSize, predTempSizeW, and predTempSizeW parameters may be the same as the parameters configured in the upper template, or different parameters may be selected based on the type of the template itself.

[0263] Input information acquisition: The reference areas for the upper template and the left template may be the same, or different reference areas may be selected for each. Similarly, preprocessing operations may be performed according to different requirements.

[0264] Once the WCP prediction process for the left-hand template is complete, the output of the chromaticity prediction, based on its own weights, is also saved.

[0265] In step 1433, the optimal control parameter best_T is selected.

[0266] The above describes the WCP prediction process for the upper and left templates, and in this way, the reconstructed chromaticity information recTempC[i][j] and the predicted chromaticity information predTempWcp[i][j] corresponding to a certain control parameter (T) are obtained within each template.

[0267] By loop-scanning the template WCP prediction process at different control parameters (T), a plurality of corresponding 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 evaluation criterion 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 For weighted fusion, fixed weighting coefficients may be selected, or weighting coefficients may be assigned based on the mean absolute error between the reconstructed chromaticity and predicted chromaticity of each template. The former fixed weighting coefficient is {0.5,0.5}, while the latter calculates the weighting coefficients using Equation 22 and MAE A This is the mean absolute error of the upper template, MAE L This is the mean absolute error of the left template, MAE A This is the mean absolute error of the upper template, where MAE L and MAE A These are all examples of the first prediction error.

[0273]

number

[0274] A third method is to similarly maintain above_T and left_T and scan for neighboring parameter values ​​in above_T and left_T during the weight-based chromaticity prediction in step 144. The encoding side processes the original and predicted chromaticity values ​​of the current block according to some evaluation criteria, selects the optimal control parameter from the reduced parameter interval, and can transmit the index of the optimal control parameter within the reduced parameter interval in the encoded bitstream, or it can transmit the parameter value directly. In the case of multiple optimal control parameters as in the second and third methods, step 144 is not specifically described.

[0275] In the template selection process, if you select two or more templates and perform subsequent operations, you may perform the process according to the above instructions.

[0276] In step 144, a weight-based chromaticity prediction calculation is performed based on the acquired input information.

[0277] Predicted chromaticity value C within the size defined 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 current template height nTbH or width nTbW. Thus, under certain conditions, the following calculation is performed only on a portion of the pixels awaiting prediction in the current block.

[0278] As shown in Figure 17, step 144 includes the following steps 1441 to 1444.

[0279] In step 1441, a luminance difference vector is constructed for each pixel awaiting prediction using the acquired reference chromaticity information, reference luminance information, and the reconstructed luminance information of the current block.

[0280] In step 1442, for each pixel awaiting prediction, a weight vector is calculated using a nonlinear function based on the brightness difference vector.

[0281] In step 1443, for each pixel awaiting prediction, a chromaticity prediction value is calculated by weighting based on the weight vector and the acquired reference chromaticity information.

[0282] In step 1444, the calculated chromaticity prediction value is corrected for each pixel awaiting prediction, and this correction includes a clip operation.

[0283] Specifically, weights are obtained, and weighted predictions are made based on these weights to obtain weight-based chromaticity prediction values, which are then corrected. The weight acquisition process includes constructing a luminance difference vector and calculating a weight vector.

[0284] The detailed calculation process is as follows:

[0285] i=0…predSizeW-1, j=0…predSizeH-1 are the targets for processing. The target of processing is k=0,1...inSize-1. Construct each element diffY[i][j][k] in the luminance difference vector, Calculate each element cWeight[i][j][k] (or cWeightFloat[i][j][k]) in the weight vector, The chromaticity prediction value Cpred[i][j] is calculated using cWeight[i][j] (or cWeightFloat[i][j][k]) and refC.

[0286] In step 1441, a luminance difference vector is constructed for each pixel awaiting prediction, using the acquired reference chromaticity information, reference luminance information, and the reconstructed luminance information of the current block.

[0287] Each predicted wait color pixel C within the size defined 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]) Here,

number

[0289] For example, the numerical value of the brightness difference vector of a predicted pixel can be scaled based on the WCP control parameter T within the WCP core parameters.

[0290] In step 1442, for each pixel awaiting prediction, a weight vector is calculated using a nonlinear function based on the brightness difference vector.

[0291] Based on the optimal control parameters (best_T) obtained in step 143, a nonlinear weighting model is adopted for each predicted waiting pixel C. pred The luminance 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, nonlinear normalization functions and nonlinear exponential normalization functions.

[0292] for example, A nonlinear Softmax function is adopted as the weight model, and each prediction waiting pixel C pred The luminance difference vector diffY[i][j] corresponding to [i][j] is used as input to the weight model, and the optimal control parameter (best_T) can be used as the model's adjustment parameter. The model outputs a weight vector cWeightFloat[i][j] corresponding to each pixel awaiting prediction. 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 ) Here, Round(x)=Sign(x)×Floor(Abs(x)+0.5)

number

[0295]

number

[0296] Based on the weight vector cWeight[i][j] (or cWeightFloat[i][j]) corresponding to each pixel awaiting prediction and the reference chromaticity information refC, the predicted chromaticity value of the pixel awaiting prediction is calculated. Specifically, for each pixel awaiting prediction C pred The reference chromaticity information refC of [i][j] is multiplied by assigning one weight vector element corresponding to each pixel awaiting prediction 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 awaiting prediction. pred Let [i][j] be the weighted prediction. The calculation formula is shown in Equation 26 below.

[0297] If k = 0, 1 ... in Size - 1, [Formula 26] subCFloat[i][j][k]=(cWeightFloat[i][j][k]×refC[k]) After the calculation is complete, fixed-point arithmetic can be performed on the subCFloat, and in the fixed-point arithmetic process, it can be multiplied by one coefficient, as shown in Equation 27, in order to maintain a certain level of calculation precision.

[0298] [Formula 27] subC[i][j][k]=round(subCFloat[i][j][k]×2 Shift ) Alternatively, as shown in Equation 28.

[0299] [Formula 28] subC[i][j][k]=(cWeight[i][j][k]×refC[k]) If i=0...predSizeW-1 and j=0...predSizeH-1,

number

[0300] [Formula 30] C pred [i][j]=round(C pred Float[i][j]) Alternatively, the calculation can be performed using fixed-point arithmetic subC[i][j][k] as shown in Equation 31.

[0301]

number

[0302] chromaticity prediction value C for each predicted waiting pixel pred [i] and [j] are stored in separate spaces, and the output of the weight-based chromaticity prediction, predWcp, is used.

[0303] In step 1444, the calculated chromaticity prediction value is corrected for each pixel awaiting prediction, and this correction includes a clip operation.

[0304] The chromaticity prediction value within predWcp should be within a limited range; if it exceeds this 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, set it to 0. C pred If the value of [i][j] is greater than (1 << BitDepth) - 1, set it 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 will be predWcp.

[0310] The above solution can improve the accuracy of WCP prediction technology. By optimizing the control parameter (T) within the WCP core parameters, this technical solution can self-adaptively select the optimal control parameter when the content characteristics of the current block differ, further improving the weight model in step 144, thereby obtaining more accurate chromaticity prediction values. The weight model employed in the WCP prediction process can be made more accurate because it matches the content characteristics of the current block with spatial correlation.

[0311] A key innovation in this technical solution lies in optimizing the control parameter configuration during the WCP prediction process.

[0312] (1) Make full use of the content characteristics of the current block to improve the accuracy of the prediction process.

[0313] (2) Make full use of existing reconstructed pixel information in adjacent regions to improve the accuracy of the prediction model.

[0314] (3) Design different template matching methods, taking into full consideration the characteristic information of prediction blocks in different directions.

[0315] Extended Solution 1: The changes to "3. Template Matching" in the above solution are merely implementation methods; the main idea is to directly select one optimal control parameter by template matching in the WCP chromaticity prediction mode. Multiple WCP chromaticity prediction modes are defined in the encoder, corresponding to combinations of different template types and different template reference regions. Currently, when the block scans all chromaticity prediction modes to remove rate distortion and select the optimal chromaticity prediction mode for optimization, if a WCP chromaticity prediction mode that matches a certain template type is found, the template selection process in step 1431 selects only one or a relatively small number of template types and their corresponding template reference regions.

[0316] Taking the upper and left templates as examples, three template-matched WCP chromaticity prediction modes, WCP_L, WCP_T, and WCP_LT, are added to the existing chromaticity 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 parameters for the weight model of the WCP prediction for 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 parameters for the weight model of the WCP prediction for the current block; and WCP_LT means that in the template matching step of the WCP prediction process, only the left and upper templates are used to select the optimal control parameters as parameters for the weight model of the WCP prediction for the current block. Here, the selection of the optimal control parameters is the same as in the case of multiple template types in the solution described above. Other operations are the same as in the solution of the embodiment described above.

[0317] Extended Strategy 2: The main idea behind the solution in the above embodiment is to perform various weighted fusions or retain multiple optimal parameters while performing subsequent operations, based on the premise of finding the optimal parameters for each of the acquired templates. However, in this implementation method, there may be situations where it is not always possible to equal the optimal parameters of the current block. Here, we briefly describe another implementation method.

[0318] As an example of a case where both the upper and left templates are obtained, and taking the WCP_LT mode of Extended Option 1 as an example, modify "3.3, Selection of Optimal Parameters" as follows.

[0319] Step 1432 describes the WCP prediction process for the upper and left templates, thereby obtaining the reconstructed chromaticity information within each template and the predicted chromaticity information corresponding to a certain control parameter (T). kThe predicted chromaticity information corresponding to ) is predAboveTempWcp k The control parameter (T) is a template on the left side. k The predicted chromaticity information corresponding to ) is predLeftTempWcp k This is the case. Taking MAE as an example, the MAE of the upper template and the left template. A and MAE L Each of these is calculated, and here, a different evaluation criterion may be adopted.

[0320] MAE A and MAE L Adding these together, the MAE is the sum of the evaluations of the upper template and the left template. Sum (That is, an example of an evaluation parameter) is obtained, which is a control parameter (T k ) corresponds to. By scanning different control parameters (T) and repeating the above operation, multiple MAEs can be generated. Sum You can obtain the smallest MAE from among them. Sum Select the corresponding control parameter (best_T) and perform chromaticity prediction based on the weights in step 144.

[0321] MAE supports multiple control parameters Sum If they are equal, the processing operation includes, but is not limited to, the following methods:

[0322] The first method involves weighting and fusing these multiple control parameters into a single optimal parameter, best_T. The criteria for weighting and fusing include selecting fixed weighting coefficients or assigning weighting coefficients based on the number of pixels in the template.

[0323] The second method is to retain these multiple control parameters and continue chromaticity prediction based on the weights from step 144. The encoding side processes the original and predicted chromaticity values ​​of the current block according to a certain evaluation criterion and selects the optimal control parameters from among them. The encoded bitstream can transmit the indices of the upper or left template, or the parameter values ​​can be transmitted directly.

[0324] A third method is to similarly maintain these multiple control parameters and scan for neighboring parameter values ​​during chromaticity prediction based on the weights of step 144. The encoding side processes the original and predicted chromaticity values ​​of the current block according to some evaluation criteria, selects the best parameter from the reduced parameter interval, and can either transmit the best control parameter index within the reduced parameter interval in the encoded bitstream, or transmit the parameter value directly.

[0325] In Solution 1 above, if you select two or more templates and perform subsequent operations, you may perform the process according to the above procedure.

[0326] It should be noted that although the steps of the method of this application are described in a specific order in the drawings, this does not require or suggest that the steps must be performed in a specific order, or that all illustrated steps must be performed to achieve the desired result. Furthermore, or alternatively, some steps may be omitted, multiple steps may be combined into one step for execution, and / or one step may be broken down into multiple steps for execution. Alternatively, steps from different embodiments may be combined to create new technical solutions.

[0327] The embodiment of the present application provides an encoding device, and Figure 18 is a schematic diagram showing the configuration of the encoding device according to the embodiment of the present application. As shown in Figure 18, the encoding device 18 comprises a first decision module 181, a second decision module 182, a third decision module 183, and a first prediction module 184. The first decision module 181 is configured to determine the first coding parameters based on the template region. The second determination module 182 is configured to determine the reference sample value of the first color component of the current block, The third decision module 183 is 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 coding parameter. The first prediction module 184 is 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.

[0328] In some embodiments, the first decision module 181 comprises a first decision unit and a second decision unit, the first decision unit being configured to determine a reference sample value for the template region, and the second decision unit being configured to determine the first coding parameter based on the reference sample value for the template region.

[0329] In some embodiments, the first determination unit is configured to determine the reconstructed value of the first color component of the template region and the reconstructed value of the second color component of the template region, and to determine the reconstructed value of the first color component of the reference region of the template region and the reconstructed 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 of the template region, the first difference value of the template region being set to be equal to the absolute difference between the reference 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, and the second subunit configured to determine the first coding parameter based on the first difference value of 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, to determine a first prediction error of the second color component of the template region, and to determine the first coding parameter based on the first prediction error, wherein the first prediction error is the error between the 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 the 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 subunit is further configured to determine the second weighting coefficient using a predetermined correspondence based on the first difference value of the template region and the candidate first coding parameter.

[0333] In some embodiments, the second subunit is configured to select a parameter from among the candidate first coding parameters of the template region whose first prediction error satisfies the first condition, and to determine the first coding parameter based on the parameter corresponding to the template region whose first prediction error satisfies the first condition.

[0334] In some embodiments, the second subunit is configured to determine a sixth weighting coefficient based on a reference sample value of the first color component of the current block and a candidate first coding parameter whose first prediction error satisfies a first condition; to determine a third prediction value of the 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; to determine a second prediction error of the corresponding candidate first coding parameter whose first prediction error satisfies a first condition based on the third prediction value of the second color component of the current block and the original value; and to determine the first coding parameter based on the second prediction error of the candidate first coding parameter whose first prediction error satisfies a first condition.

[0335] In some embodiments, the second subunit is configured to select a candidate first coding parameter from among candidate first coding parameters whose first prediction error satisfies the first condition, such that the second prediction error satisfies the third condition, and to determine the first coding parameter based on the candidate first coding parameter whose second prediction error satisfies the third condition.

[0336] In some embodiments, the second subunit is configured to set the first coding parameter to be equal to a candidate first coding parameter whose second prediction error satisfies the third condition, or to set the first coding parameter to be equal to a fused value of a candidate first coding parameter whose second prediction error satisfies the 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 extended parameter, to determine a seventh weighting coefficient based on the reference sample value of the first color component of the current block, the candidate first coding parameter whose first prediction error satisfies a first condition, and the first extended parameter, to determine a fourth predicted value of the second color component of the current block based on the seventh weighting coefficient and the reference sample value of the second color component of the current block, to determine a third prediction error of the corresponding parameter based on the fourth predicted value of the second color component of the current block and the original value, and to determine the first coding parameter based on the third prediction error of each candidate first coding parameter and the first extended parameter.

[0338] In some embodiments, the second subunit is configured to select a parameter from each of the candidate first coding parameters and the first extension parameter such that the third prediction error satisfies the fourth condition, and to determine the first coding parameter based on the parameter whose third prediction error satisfies the fourth condition.

[0339] In some embodiments, the second subunit is configured to set the first coding parameter to be equal to a parameter for which the third prediction error satisfies the fourth condition, or to set the first coding parameter to be equal to a fused value of the parameter for which the third prediction error satisfies the fourth condition.

[0340] In some embodiments, the second subunit is configured to set the first coding parameter to be equal to a parameter whose first prediction error satisfies the first condition, or to set the first coding parameter to be equal to a fused value of the parameters whose first prediction error satisfies the first condition.

[0341] In some embodiments, the second subunit is configured to set the first coding parameter to be equal to the weighted sum of the parameter that satisfies the first condition for the first prediction error and the third weighting coefficient.

[0342] In some embodiments, the second subunit is further configured to determine a corresponding third weighting coefficient based on the first prediction error corresponding to a parameter that satisfies a first condition, or to set the third weighting coefficient to a predetermined constant value.

[0343] In some embodiments, the second subunit is configured to extend a parameter whose first prediction error satisfies a first condition to obtain a first extended parameter, and to fuse the first extended parameter and / or a parameter whose first prediction error satisfies a first condition to obtain the first coding parameter.

[0344] In some embodiments, the second subunit is configured to set the first coding parameter to be equal to the weighted sum of each candidate first coding parameter and a fourth weighting coefficient.

[0345] In some embodiments, the second subunit is further configured to determine a fourth weighting coefficient for the corresponding candidate first coding parameter based on the first prediction error.

[0346] In some embodiments, the second subunit is configured to determine an evaluation parameter representing the performance of a corresponding candidate first coding parameter based on a first prediction error corresponding to each of the identical candidate first coding parameters in the template region, and to determine the first coding parameter based on the evaluation parameter for each of the candidate first coding parameters.

[0347] In some embodiments, the second subunit is configured to set the evaluation parameter to a fused value of the first prediction error corresponding to each of the identical candidate first coding parameters in the template region.

[0348] In some embodiments, the second subunit is configured to set the evaluation parameter to be equal to the sum of the first prediction errors corresponding to each of the identical candidate first coding parameters in the template region.

[0349] In some embodiments, the second subunit is configured to select a parameter from each of the candidate first coding parameters in which the evaluation parameter satisfies the second condition, and to determine the first coding parameter based on the parameter in which the evaluation parameter satisfies the second condition.

[0350] In some embodiments, the second subunit is configured to set the first coding parameter to be equal to a parameter whose evaluation parameter satisfies the second condition, or to set the first coding parameter to be equal to a fused value of a parameter whose evaluation parameter satisfies the second condition.

[0351] In some embodiments, the second subunit is configured to set the first coding parameter to be equal to the weighted sum of the parameter that satisfies the second condition and the fifth weighting coefficient.

[0352] In some embodiments, the second subunit is further configured to determine a fifth weighting coefficient for a corresponding parameter based on a template region corresponding to a parameter whose evaluation parameter satisfies a second condition.

[0353] In some embodiments, the second subunit is configured to determine a fifth weighting coefficient for a corresponding parameter based on the number of pixels in the template region and / or template type corresponding to the parameter whose evaluation parameter satisfies the second condition.

[0354] In some embodiments, the second subunit is configured to determine an eighth weighting coefficient based on a reference sample value of the first color component of the current block and a parameter whose evaluation parameter satisfies a second condition; to determine a fifth predicted value of the second color component of the current block based on the eighth weighting coefficient and a reference sample value of the second color component of the current block; to determine a fourth prediction error for the corresponding parameter whose evaluation parameter satisfies a second condition based on the fifth predicted value of the second color component of the current block and the original value; and to determine the first coding parameter based on the fourth prediction error of each candidate first coding parameter.

[0355] In some embodiments, the second subunit is configured to obtain a second extended parameter by extending the evaluation parameter to satisfy the second condition, determine a ninth weighting coefficient based on the reference sample value of the first color component of the current block, the evaluation parameter to satisfy the second condition, and the second extended parameter, determine a sixth predicted value of the second color component of the current block based on the ninth weighting coefficient and the reference sample value of the second color component of the current block, determine a fifth prediction error for the corresponding parameter based on the sixth predicted value and the original value of the second color component of the current block, and determine the first coding parameter based on each candidate first coding parameter and the fifth prediction error of the second extended parameter.

[0356] In some embodiments, the first decision module 181 is further configured to determine the template region based on the template type included in the configured prediction mode.

[0357] In some embodiments, the first decision module 181 is configured to make the template region a template included in the configured prediction mode.

[0358] In some embodiments, the first determination module 181 is further configured to determine the template region based on the pixel availability of an adjacent region of the current block, and based on its relative position to the current block, the adjacent region includes at least one of the following: the upper region of the current block, the left region of the current block, the upper right region of the current block, the lower left region of the current block, and the upper left region of the current block.

[0359] In some embodiments, the first prediction module 184 is further configured to set a default value to 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 decide to predict the second color component of the current block by employing a different prediction method than the one described above if the template region is not present.

[0361] In some embodiments, the second subunit is configured to set the second predicted value for determining the first predicted error to be equal to the second predicted value obtained by a correction operation on the second predicted value of the second color component of the template region.

[0362] In some embodiments, the encoding device 18 further comprises a first acquisition module, a seventh determination module, and an encoding module, wherein the first acquisition module is configured to acquire the original value of the second color component of the current block, the seventh determination module is configured to determine the 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 a first predicted value of the second color component, and the encoding module is configured to encode the residual value of the second color component of the current block and write the resulting encoded bits to a bitstream.

[0363] In some embodiments, the encoding device 18 further comprises a first correction module, a first acquisition module, an eighth decision module, and an encoding module, wherein the first correction module is configured to perform a correction operation on a first predicted value of the second color component of the current block to obtain a corrected first predicted value, the first acquisition module is configured to acquire the original value of the second color component of the current block, the eighth decision module is configured to determine the 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 to a bitstream.

[0364] In some embodiments, the encoding device 18 further comprises an encoding module configured to encode the first encoding parameter or an index of the first encoding parameter and write the resulting encoded bits to a bitstream.

[0365] It is understandable that in the embodiments of this application, a "module" may be part of a circuit, part of a processor, part of a program, or software, and may, of course, be a unit or a non-unit. Furthermore, each component in this embodiment may be integrated into a single processing unit, each module may exist physically separately, or two or more modules may be integrated into a single unit. The integrated module may be implemented in hardware form or in the form of a software functional module.

[0366] If the integrated module is implemented in the form of a software function module and is not sold or used as an independent product, it can be stored on a single computer-readable storage medium. Based on this understanding, an essential part of the technical solution of this embodiment, i.e., a part that contributes to the prior art, or all or part of the solution of the said technology, can be implemented in the form of a software product, which is stored on a single storage medium and contains several instructions for causing a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the method described in this embodiment. The aforementioned storage mediums include various media capable of storing program code, such as U disks, mobile hard disks, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0367] Accordingly, embodiments of the present application provide a computer-readable storage medium in which a computer program is stored, and the computer program, when executed by a first processor, implements the method described in any one of the above embodiments.

[0368] Referring to Figure 19, based on the configuration of the encoding device 18 and the computer storage medium, Figure 19 is a schematic diagram showing the specific hardware configuration of the encoding device according to an embodiment of the present application. As shown in Figure 19, the encoding device 19 may comprise a first communication interface 191, a first memory 192, and a first processor 193, each component being coupled via a first bus system 194. Understandably, the first bus system 194 is used to realize connection communication between these components. In addition to the data bus, the first bus system 194 includes a power bus, a control bus, and a status signal bus. However, for clarity of explanation, in Figure 19, all types of buses are represented as the first bus system 194. Here, The first communication interface 191 is configured to send and receive signals in the process of sending and receiving information with other external network elements.

[0369] The first memory 192 is configured to store computer programs that can be executed by the first processor 193.

[0370] The first processor 193, when executing the computer program, includes the step of determining a first coding parameter based on a template area, The following steps are performed: determine the reference sample value of the first color component of the current block; determine a first weighting coefficient based on the reference sample value of the first color component of the current block and the first coding parameter; and 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.

[0371] Understandably, the first memory 192 in the embodiments of the present application may be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. Here, non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory may be random access memory (RAM) used as an external cache. To the extent of illustrative but non-limiting examples, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous-connected dynamic random access memory (SLDRAM), and direct memory bus random access memory (DRRAM). The first memory 222 in the systems and methods described herein includes, 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 capabilities. In the implementation process, each step of the above method may be completed by instructions in the form of hardware integrated logic circuits or software in the first processor 193. The 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 this application can be implemented 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 this application may be performed directly by a hardware decoding processor, or by a combination of hardware and software modules within the decoding processor. The software module can be placed in a conventional storage medium such as random access memory, flash memory, read-only memory, programmable read-only memory, or electrically erasable programmable memory, or registers. The storage medium is placed in the first memory 192, and the first processor 193 reads the information in the first memory 192 and combines it with its hardware to complete the steps of the method described above.

[0373] Understandably, these embodiments described herein can be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementations, the processing unit may be implemented in one or more application-specific integrated circuits (ASICs), digital signal processors (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 software implementations, the technical solutions described herein can be implemented by executing modules (processes, functions, etc.) of the functions described herein. The software code may be stored in memory and executed by a processor. Memory may be implemented in the processor or outside the processor.

[0374] Optionally, in another embodiment, the first processor 193 is further configured to perform the method described in any of the embodiments described above when executing the computer program.

[0375] In yet another embodiment of the present application, based on the same inventive concept as the embodiments described above, referring to Figure 20, Figure 20 is a schematic diagram showing the configuration of a decoding device according to an embodiment of the present application. As shown in Figure 20, the decoding device 200 comprises a fourth decision module 2001, a fifth decision module 2002, a sixth decision module 2003, and a second prediction module 2004. The fourth decision module 2001 is configured to determine the first decoding parameter based on the template region. The fifth decision module 2002 is configured to determine the reference sample value of the first color component of the current block, The sixth decision module 2003 is 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. The second prediction module 2004 is configured to determine a first predicted value for the second color component of the current block based on the first weighting coefficient and the reference sample value for the second color component of the current block.

[0376] In some embodiments, the fourth decision module 2001 comprises a third decision unit and a fourth decision unit, the third decision unit being configured to determine a reference sample value for the template region, and the fourth decision unit being configured to determine the first decoding parameter based on the reference sample value for the template region.

[0377] In some embodiments, the third determination unit is configured to determine the reconstructed value of the first color component of the template region and the reconstructed value of the second color component of the template region, and to determine the reconstructed value of the first color component of the reference region of the template region and the reconstructed 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 to be equal to the absolute difference between the reference 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, 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 the 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 the 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 a candidate first decoding parameter, to determine a first prediction error of the second color component of the template region, and to determine the first decoding parameter based on the first prediction error, wherein the first prediction error is the error between the 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 the 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 subunit is configured to set the second predicted value of the second color component of the template region to be equal to the weighted sum of the reference value of the second color component of the reference region of the template region and the second weighting coefficient, and to set the first decoding parameter to be equal to the value of the corresponding candidate first decoding parameter when the first prediction error satisfies the 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.

[0382] In some embodiments, the fourth subunit is further configured to determine the second weighting coefficient using a predetermined correspondence based on the first difference value of the template region and the candidate first decoding parameter.

[0383] In some embodiments, the fourth subunit is configured to select a parameter from among the candidate first decoding parameters of the template region such that the first prediction error satisfies the first condition, and to determine the first decoding parameter based on the parameter corresponding to the template region such that the first prediction error satisfies the first condition.

[0384] In some embodiments, the fourth subunit is configured to set the first decoding parameter to be equal to a parameter whose first prediction error satisfies the first condition, or to set the first decoding parameter to be equal to a fused value of the parameters whose first prediction error satisfies the first condition.

[0385] In some embodiments, the fourth subunit is configured to set the first decoding parameter to be equal to the weighted sum of the parameter that satisfies the first condition for the first prediction error and the third weighting coefficient.

[0386] In some embodiments, the fourth subunit is further configured to determine a corresponding third weighting coefficient based on the first prediction error corresponding to a parameter that satisfies a first condition, or to set the third weighting coefficient to a predetermined constant value.

[0387] In some embodiments, the fourth subunit is configured to extend a parameter whose first prediction error satisfies a first condition to obtain a first extended parameter, and to fuse the first extended parameter and / or a parameter whose first prediction error satisfies a first condition to obtain the first decoding parameter.

[0388] In some embodiments, the fourth subunit is configured to set the first decoding parameter to be equal to the weighted sum of each candidate first decoding parameter and the fourth weighting coefficient.

[0389] In some embodiments, the fourth subunit is further configured to determine a fourth weighting coefficient 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 an evaluation parameter representing the performance of a corresponding candidate first decoding parameter based on a first prediction error corresponding to each of the identical candidate first decoding parameters in the template region, and to determine the first decoding parameter based on the evaluation parameter for each candidate first decoding parameter.

[0392] In some embodiments, the fourth subunit is configured to set the evaluation parameter to a fused value of the first prediction error corresponding to each of the identical candidate first decoding parameters in the template region.

[0393] In some embodiments, the fourth subunit is configured to set the evaluation parameter to be equal to the sum of the first prediction errors corresponding to each of the identical candidate first decoding parameters in the template region.

[0394] In some embodiments, the fourth subunit is configured to select a parameter from each of the candidate first decoding parameters in which the evaluation parameter satisfies the second condition, and to determine the first decoding parameter based on the parameter in which the evaluation parameter satisfies the second condition.

[0395] In some embodiments, the fourth subunit is configured to set the first decoding parameter to be equal to a parameter whose evaluation parameter satisfies the second condition, or to set the first decoding parameter to be equal to the fused value of a parameter whose evaluation parameter satisfies the second condition.

[0396] In some embodiments, the fourth subunit is configured to set the first decoding parameter to be equal to the weighted sum of the parameter that satisfies the second condition and the fifth weighting coefficient.

[0397] In some embodiments, the fourth subunit is further configured to determine a fifth weighting coefficient for a corresponding parameter based on a template region corresponding to a parameter whose evaluation parameter satisfies a second condition.

[0398] In some embodiments, the fourth subunit is configured to determine a fifth weighting coefficient for a corresponding parameter based on the number of pixels in the template region and / or template type corresponding to the parameter whose evaluation parameter satisfies the second condition.

[0399] In some embodiments, the decoding device 200 further comprises an analysis module and a second acquisition module, wherein the analysis module is configured to analyze a bitstream to obtain an index of the first decoding parameter, and the second acquisition module is configured to acquire the first decoding parameter based on the index of the first decoding parameter, or the analysis module is configured to analyze a bitstream to obtain the first decoding parameter.

[0400] In some embodiments, the fourth decision module 2001 is further configured to determine the template region based on the template type included in the configured prediction mode.

[0401] In some embodiments, the template type includes at least one of the following: upper template, left template, upper right template, lower left template, and upper left template.

[0402] In some embodiments, the fourth decision module 2001 is configured to set the template region as a region corresponding to the template type included in the configured prediction mode.

[0403] In some embodiments, the fourth decision module 2001 is further configured to determine a template region based on the pixel availability of an adjacent region of the current block, the adjacent region including at least one of the following: the upper region of the current block, the left region of the current block, the upper right region of the current block, the lower left region of the current block, and the 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 the determination that the template region does not exist.

[0405] In some embodiments, the second prediction module 2004 is further configured to decide to predict the second color component of the current block by employing a different prediction method than the one described above, based on the determination that the template region does not exist.

[0406] In some embodiments, the fourth subunit is configured to set the second predicted value for determining the first predicted error to be equal to the second predicted value obtained by a correction operation on the second predicted value of the 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, wherein the analysis module is configured to analyze a bitstream to obtain a residual value of the second color component of the current block, and the ninth decision module is 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, wherein the second correction module is configured to perform a correction operation on a first predicted value of the second color component of the current block to obtain a corrected first predicted value, and the tenth determination module is 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 the corrected first predicted value.

[0409] It is understandable that in the embodiments of this application, a "module" may be part of a circuit, part of a processor, part of a program, or software, and may, of course, be a unit or a non-unit. Furthermore, each component in this embodiment may be integrated into a single processing unit, each module may exist physically separately, or two or more modules may be integrated into a single unit. The integrated module may be implemented in hardware form or in the form of a software functional module.

[0410] If the integrated module is implemented in the form of a software function module and is not sold or used as an independent product, it can be stored on a single computer-readable storage medium. Based on this understanding, this embodiment provides a computer-readable storage medium on which a computer program is stored, and the computer program, when executed by a second processor, implements the method described in any one of the above embodiments.

[0411] Referring to Figure 21, based on the configuration of the decoding device 200 and the computer storage medium, Figure 21 is a schematic diagram showing the specific hardware configuration of a decoding device according to an embodiment of the present application. As shown in Figure 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. Understandably, the second bus system 214 is used to realize 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 clarity of explanation, in Figure 21, all types of buses are represented as the second bus system 214. Here, The second communication interface 211 is configured to send and receive signals in the process of sending and receiving information with other external network elements, the second memory 212 is configured to store a computer program that can be executed by the second processor 213, and the second processor 213 is configured to perform the method described in any one of the embodiments described above when executing the computer program.

[0412] Optionally, in another embodiment, the second processor 213 is further configured to perform the method described in any one of the embodiments described above when executing the computer program.

[0413] It is understandable that the second memory 212 has the same hardware functionality as the first memory 222, and the second processor 213 has the same hardware functionality as the first processor 223, which will not be explained again here.

[0414] In another embodiment of the present application, referring to Figure 22, Figure 22 is a schematic diagram showing the configuration of a codec system according to an embodiment of the present application. As shown in Figure 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 above embodiment, or a device incorporating the encoding device 19 described in the above embodiment, and the decoder 222 may be a device incorporating the decoding device 200 described in the above embodiment, or a device incorporating the decoding device 21 described in the above embodiment.

[0415] It should be explained that in this application, the terms “compose,” “include,” or any other variation thereof are intended to encompass non-exclusive inclusion, thereby including not only those elements but also other elements not expressly enumerated, or elements specific to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the expression “includes” does not preclude the existence of another identical element in a process, method, article, or apparatus that includes that element.

[0416] The above-mentioned numbering of embodiments of this application is for illustrative purposes only and does not indicate any superiority or inferiority of the embodiments. The methods disclosed in the embodiments of some methods provided herein can be arbitrarily combined without contradiction to obtain embodiments of new methods. The features disclosed in the embodiments of some products provided herein can be arbitrarily combined without contradiction to obtain embodiments of new products. The features disclosed in the embodiments of some methods or devices provided herein can be arbitrarily combined without contradiction to obtain embodiments of new methods or devices. The above is merely an embodiment of this application, and the scope of protection of the present invention is not limited thereto. All modifications or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed herein should be included within the scope of protection of this application. Accordingly, the scope of protection of this application shall be subject to the scope of protection of the claims.

Claims

1. A decoding method applicable to intra prediction, The steps include determining the first decoding parameter based on the template region, The current step is to determine the reference sample value of the first color component of the block, The steps include 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, A decoding method comprising the step of determining a first predicted value of the second color component of the current block based on the first weighting coefficient and a reference sample value of the second color component of the current block.

2. The step of determining the first decoding parameter based on the template region is: The steps include determining the reference sample value of the template area, The step includes determining the first decoding parameter based on the reference sample value of the template region, The step of determining the reference sample value of the template area is: The steps include determining the reconstruction value of the first color component of the template region and the reconstruction value of the second color component of the template region, The steps include determining the reconstruction value of the first color component of the reference region of the template region, and the reconstruction value of the second color component of the reference region of the template region. The decoding method according to claim 1.

3. The step of determining the first decoding parameter based on the reference sample value of the template region is: A step of determining a first difference value of the template region, wherein the first difference value of the template region is set to be equal to the absolute value of the difference between the reference 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. The step includes determining the first decoding parameter based on the first difference value of the template region, The reference value of the first color component of the template region is the 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 of the reference region of the template region is the 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. The decoding method according to claim 2.

4. The step of determining the first decoding parameter based on the first difference value of the template region is: The steps include determining a second predicted value for the second color component of the template region based on the first difference value and the candidate first decoding parameter, The steps include determining the first prediction error of the second color component of the template region, The steps include determining the first decoding parameter based on the first prediction error, The first prediction error is the error between the 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 the 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 3.

5. The second predicted value of the second color component of the template region is set to be equal to the weighted sum of the reference value of the second color component of the reference region of the template region and the second weighting coefficient. The first decoding parameter is set to be equal to the value of the candidate first decoding parameter corresponding when the first prediction error satisfies the first condition. 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. The decoding method according to claim 4.

6. Based on the first difference value of the template region and the candidate first decoding parameter, the second weighting coefficient is determined using a predetermined correspondence. The decoding method according to claim 5.

7. The predetermined correspondence is the softmax function, or the predetermined correspondence is obtained using the softmax function, and the input to the softmax function is 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, It is one of the values ​​obtained by bit-shifting the first difference value, and the number of bits in the bit shift is equal to the candidate first decoding parameter. The decoding method according to claim 6.

8. The step of determining the first decoding parameter based on the first prediction error is: The steps include selecting a parameter from among the candidate first decoding parameters of the template region such that the first prediction error satisfies the first condition, The step of determining the first decoding parameter based on a parameter corresponding to the template region in which the first prediction error satisfies a first condition, The decoding method according to claim 4.

9. The first decoding parameter is set to be equal to the parameter that satisfies the first condition for the first prediction error, or The first decoding parameter is set to be equal to the fused value of the parameter whose first prediction error satisfies the first condition. The decoding method according to claim 8.

10. The step of determining the first decoding parameter based on the first prediction error is: The steps include determining an evaluation parameter that represents the performance of a corresponding candidate first decoding parameter based on a first prediction error corresponding to each of the identical candidate first decoding parameters in the template region, The steps include determining the first decoding parameter based on the evaluation parameter for each candidate first decoding parameter, The decoding method according to claim 4.

11. An encoding method applicable to intra prediction, The steps include determining the first coding parameter based on the template region, The current step is to determine the reference sample value of the first color component of the block, The steps include determining a first weighting coefficient based on the reference sample value of the first color component of the current block and the first coding parameter, An encoding method comprising the step of determining a first predicted value for the second color component of the current block based on the first weighting coefficient and a reference sample value for the second color component of the current block.

12. The step of determining the first coding parameter based on the template region is: The steps include determining the reference sample value of the template area, The step of determining the first coding parameter based on the reference sample value of the template region, The step of determining the reference sample value of the template area is: The steps include determining the reconstruction value of the first color component of the template region and the reconstruction value of the second color component of the template region, The steps include determining the reconstruction value of the first color component of the reference region of the template region, and the reconstruction value of the second color component of the reference region of the template region. The encoding method according to claim 11.

13. The step of determining the first coding parameter based on the reference sample value of the template region is: A step of determining a first difference value of the template region, wherein the first difference value of the template region is set to be equal to the absolute value of the difference between the reference 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. The step of determining the first coding parameter based on the first difference value of the template region, The reference value of the first color component of the template region is the 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 the 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 of the reference region of the template region is the 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. The encoding method according to claim 12.

14. The step of determining the first coding parameter based on the first difference value of the template region is: The steps include determining a second predicted value for the second color component of the template region based on the first difference value and the candidate first coding parameter, The steps include determining the first prediction error of the second color component of the template region, The steps include determining the first coding parameter based on the first prediction error, The first prediction error is the error between the 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 the 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 encoding method according to claim 13.

15. A computer storage medium storing a bitstream and a program that causes a processor to execute the encoding method described in any one of claims 11 to 14 to generate the bitstream.

Citation Information

Patent Citations

  • Methods, architectures, apparatuses and systems directed to improved linear model estimation for template based video coding

    US20220094940A1