WO2023197193A1 - 编解码方法、装置、编码设备、解码设备以及存储介质 - Google Patents

编解码方法、装置、编码设备、解码设备以及存储介质 Download PDF

Info

Publication number
WO2023197193A1
WO2023197193A1 PCT/CN2022/086470 CN2022086470W WO2023197193A1 WO 2023197193 A1 WO2023197193 A1 WO 2023197193A1 CN 2022086470 W CN2022086470 W CN 2022086470W WO 2023197193 A1 WO2023197193 A1 WO 2023197193A1
Authority
WO
WIPO (PCT)
Prior art keywords
parameter
value
color component
template
area
Prior art date
Application number
PCT/CN2022/086470
Other languages
English (en)
French (fr)
Inventor
霍俊彦
马彦卓
杨付正
张振尧
李明
Original Assignee
Oppo广东移动通信有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Oppo广东移动通信有限公司 filed Critical Oppo广东移动通信有限公司
Priority to PCT/CN2022/086470 priority Critical patent/WO2023197193A1/zh
Publication of WO2023197193A1 publication Critical patent/WO2023197193A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/80Details of filtering operations specially adapted for video compression, e.g. for pixel interpolation
    • H04N19/82Details of filtering operations specially adapted for video compression, e.g. for pixel interpolation involving filtering within a prediction loop

Definitions

  • the embodiments of the present application relate to the field of video coding and decoding technology, and in particular, to a coding and decoding method, device, encoding device, decoding device, and storage medium.
  • JVET Joint Video Exploration Team
  • H.266/VVC includes inter-color component prediction technology.
  • inter-color component prediction technology of H.266/VVC and the original value, which results in low prediction accuracy, resulting in a decrease in the quality of the decoded video and reduced encoding performance.
  • Embodiments of the present application provide a coding and decoding method, device, coding equipment, decoding equipment and storage medium, which can improve the prediction accuracy of the second color component, thereby saving code rate and improving coding and decoding performance.
  • embodiments of the present application provide a decoding method, which method includes: determining a first decoding parameter according to a template area; determining a reference sample value of the first color component of the current block; The reference sample value of the color component and the first decoding parameter are used to determine a first weighting coefficient; the second weighting coefficient of the current block is determined based on the first weighting coefficient and the reference sample value of the second color component of the current block. The first predicted value of the color component.
  • embodiments of the present application provide an encoding method, which method includes: determining a first encoding parameter according to the template area; determining a reference sample value of the first color component of the current block; The reference sample value of the color component and the first encoding parameter are used to determine a first weighting coefficient; the second weighting coefficient of the current block is determined based on the first weighting coefficient and the reference sample value of the second color component of the current block.
  • the first predicted value of the color component in this way, the first encoding parameter is determined according to the template area, based on which the first weighted coefficient that is more consistent with the characteristics of the current block can be obtained, thereby improving the prediction accuracy of the second color component of the current block, and then Save code rate and improve encoding performance.
  • embodiments of the present application provide an encoding device, including: a first determination module, a second determination module, a third determination module and a first prediction module; wherein the first determination module is configured to, according to the template area, Determine the first encoding parameter; the second determination module is configured to determine the reference sample value of the first color component of the current block; the third determination module is configured to determine the reference sample value of the first color component of the current block and the a first encoding parameter to determine a first weighting coefficient; a first prediction module configured to determine a second color component of the current block based on the first weighting coefficient and a reference sample of the second color component of the current block the first predicted value.
  • embodiments of the present application provide a coding device, including a first memory and a first processor; wherein the first memory is used to store a computer program that can run on the first processor; the first processor , used to perform the method described in the second aspect when running the computer program.
  • embodiments of the present application provide a decoding device, including: a fourth determination module configured to determine the first decoding parameter according to the template area; and a fifth determination module configured to determine the first color component of the current block. reference sample value; a sixth determination module configured to determine a first weighting coefficient according to the reference sample value of the first color component of the current block and the first decoding parameter; a second prediction module configured to determine the first weighting coefficient according to the first color component of the current block.
  • a weighting coefficient and a reference sample value of the second color component of the current block determine a first predicted value of the second color component of the current block.
  • embodiments of the present application provide a decoding device, including a second memory and a second processor; wherein the second memory is used to store a computer program that can run on the second processor; the second processor , used to execute the method described in the first aspect when running the computer program.
  • embodiments of the present application provide a computer-readable storage medium that stores a computer program.
  • the computer program When the computer program is executed, the method described in the first aspect is implemented, or the method described in the first aspect is implemented. The methods described in the two aspects.
  • Figure 1 is a schematic diagram of the distribution of effective adjacent areas
  • Figure 2 is a schematic diagram of the distribution of selected areas under different prediction modes
  • Figure 3 is a schematic flow chart of a model parameter derivation scheme
  • Figure 4A is a schematic block diagram of an encoder provided by an embodiment of the present application.
  • Figure 4B is a schematic block diagram of a decoder provided by an embodiment of the present application.
  • Figure 5 is a schematic flow chart of the implementation of the encoding method provided by the embodiment of the present application.
  • Figure 6 is a schematic position diagram of the adjacent area of the current block provided by the embodiment of the present application.
  • Figure 7 is a schematic diagram of an example in which the upper template, the left template and the current block do not intersect with each other according to the embodiment of the present application;
  • Figure 8 is a schematic diagram of an example of the interface between different types of templates and the current block provided by the embodiment of the present application.
  • Figure 9 is a schematic flow chart for implementing step 51 provided by the embodiment of the present application.
  • Figure 10 is a schematic diagram of an example of overlap between the left template and the reference area provided by the embodiment of the present application.
  • Figure 11 is another example schematic diagram of the reference areas of the left template and the right template provided by the embodiment of the present application.
  • Figure 12A is another example schematic diagram of the reference areas of the left template and the right template provided by the embodiment of the present application.
  • Figure 12B is a schematic diagram of the WCP prediction process provided by the embodiment of the present application.
  • Figure 13 is a schematic flow chart of the implementation of the decoding method provided by the embodiment of the present application.
  • Figure 14 is a schematic diagram of the prediction process of WCP technology provided by the embodiment of the present application.
  • Figure 15 is an example schematic diagram of the reference area of the current block provided by the embodiment of the present application.
  • Figure 16 is a schematic flow chart for implementing step 143 provided by the embodiment of the present application.
  • Figure 17 is a schematic flow chart for implementing step 144 provided by the embodiment of the present application.
  • Figure 18 is a schematic structural diagram of an encoding device provided by an embodiment of the present application.
  • Figure 19 is a schematic diagram of the specific hardware structure of an encoding device provided by an embodiment of the present application.
  • Figure 20 is a schematic structural diagram of a decoding device provided by an embodiment of the present application.
  • Figure 21 is a schematic diagram of the specific hardware structure of a decoding device provided by an embodiment of the present application.
  • Figure 22 is a schematic structural diagram of a coding and decoding system provided by an embodiment of the present application.
  • three color components are generally used to represent a coding block (CB); among them, these three color components are a brightness component, a blue chroma component, and a red chroma component.
  • the brightness component is usually represented by the symbol Y
  • the blue chroma component is usually represented by the symbol Cb or U
  • the red chroma component is usually represented by the symbol Cr or V; in this way, the video image can be represented in the YCbCr format or YUV Format representation.
  • the video image may also be in RGB format or YCgCo format, etc., and the embodiments of this application do not impose any limitations.
  • the cross-component prediction technology mainly includes the inter-component linear model (Cross-component Linear Model, CCLM) prediction mode and the multi-directional linear model (Multi-Directional Linear Model, MDLM) prediction mode, whether it is the model parameters derived according to the CCLM prediction mode or the model parameters derived according to the MDLM prediction mode, the corresponding prediction model can realize the first color component to the second color component, and the second color component to the third color component. Prediction between one color component, the first color component to the third color component, the third color component to the first color component, the second color component to the third color component, or the third color component to the second color component, etc. .
  • the first color component is the brightness component and the second color component is the chrominance component.
  • i, j represents the position coordinates of the pixel to be predicted in the coding block, i represents the horizontal direction, and j represents the vertical direction;
  • Pred C (i, j) represents the correspondence of the pixel to be predicted at the position coordinate (i, j) in the coding block.
  • the chroma prediction value, Rec L (i, j) represents the reconstructed brightness value corresponding to the pixel to be predicted at the (downsampled) position coordinate (i, j) in the same coding block.
  • ⁇ and ⁇ represent model parameters, which can be derived from reference pixels.
  • H.266/VVC includes three cross-component linear model prediction modes, namely: left and upper adjacent intra-frame CCLM prediction mode (can be represented by INTRA_LT_CCLM), left and lower left adjacent intra-frame The CCLM prediction mode (can be represented by INTRA_L_CCLM) and the upper and upper right adjacent intra-frame CCLM prediction mode (can be represented by INTRA_T_CCLM).
  • each prediction mode can select a preset number (such as 4) of reference pixels for derivation of model parameters ⁇ and ⁇ . The biggest difference between these three prediction modes is that they are used to derive the model.
  • the selection areas corresponding to the reference pixels of parameters ⁇ and ⁇ are different.
  • the coding block size corresponding to the chroma component is W ⁇ H, assuming that the upper selection area corresponding to the reference pixel is W', and the left selection area corresponding to the reference pixel is H'; thus,
  • Figure 1 shows a schematic distribution diagram of effective adjacent areas.
  • the left adjacent area, the lower left adjacent area, the upper adjacent area and the upper right adjacent area are all valid; in addition, the block filled with gray is the position coordinate in the coding block (i, j) pixel to be predicted.
  • Figure 2 shows the selection areas for the three prediction modes, including the left adjacent area and the upper adjacent area; (b) shows the selection area of the INTRA_L_CCLM mode, including the left adjacent area. and the lower left adjacent area; (c) shows the selected area of the INTRA_T_CCLM mode, including the upper adjacent area and the upper right adjacent area.
  • pixel selection for model parameter derivation can be performed within the selection areas.
  • the pixels selected in this way can be called reference pixels, and usually the number of reference pixels is four; and for a W ⁇ H coding block with a certain size, the position of the reference pixel is generally determined.
  • the chromaticity prediction is currently performed according to the flow diagram of the model parameter derivation scheme shown in Figure 3.
  • the process can include:
  • VVC the step in which the effective reference pixel is 0 is judged based on the validity of adjacent areas.
  • the prediction model is constructed using the principle of "two points determine a straight line", and the two points here can be called fitting points.
  • two reference pixels with larger values and two reference pixels with smaller values in the brightness component are obtained through comparison; then based on the two reference pixels with larger values, Find a mean point (can be expressed by mean max ), and find another mean point (can be expressed by mean min ) based on the two reference pixels with smaller values, and you can get two mean points mean max and mean min ; Then, using mean max and mean min as two fitting points, the model parameters (represented by ⁇ and ⁇ ) can be derived; finally, a prediction model is constructed based on ⁇ and ⁇ , and the prediction processing of the chroma component is performed based on the prediction model.
  • the first coding parameter is determined according to the template area; the current A reference sample value of the first color component of the block; determining a first weighting coefficient according to the reference sample value of the first color component of the current block and the first encoding parameter; according to the first weighting coefficient and the current
  • the reference sample value of the second color component of the block determines the first predicted value of the second color component of the current block.
  • the first coding parameter is determined according to the template area, and based on this, the first weighting coefficient that is more in line with the characteristics of the current block can be obtained, thereby improving the prediction accuracy of the second color component of the current block, thereby saving code rate and improving coding performance.
  • the encoder 100 may include a transformation 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
  • the filter unit 108 can implement deblocking filtering and sample adaptive indentation (Sample Adaptive Offset, SAO ) filtering
  • the encoding unit 109 can implement header information encoding and context-based adaptive binary arithmetic coding (Context-based Adaptive Binary Arithmetic Coding, CABAC).
  • a video coding block can be obtained by dividing the coding tree block (Coding Tree Unit, CTU), and then the residual pixel information obtained after intra-frame or inter-frame prediction is processed through the transformation and quantization unit 101
  • the video coding block is transformed, including transforming the residual information from the pixel domain to the transform domain, and quantizing the resulting transform coefficients to further reduce the bit rate;
  • the intra-frame estimation unit 102 and the intra-frame prediction unit 103 are used to Intra prediction is performed on the video encoding block; specifically, intra estimation unit 102 and intra prediction unit 103 are used to determine an intra prediction mode to be used to encode the video encoding block;
  • motion compensation unit 104 and motion estimation unit 105 is used to perform inter-frame prediction encoding of the received video encoding block with respect to one or more blocks in one or more reference frames to provide temporal prediction information; motion estimation performed by the motion estimation unit 105 is to generate a motion vector.
  • the motion vector can estimate the motion of the video encoding block, and then the motion compensation unit 104 performs motion compensation based on the motion vector determined by the motion estimation unit 105; after determining the intra prediction mode, the intra prediction unit 103 also is used to provide the selected intra prediction data to the encoding unit 109, and the motion estimation unit 105 also sends the calculated and determined motion vector data to the encoding unit 109; in addition, the inverse transformation and inverse quantization unit 106 is used for the video Reconstruction of the coding block, the residual block is reconstructed in the pixel domain, the reconstructed residual block removes block effect artifacts through the filter control analysis unit 107 and the filtering unit 108, and then the reconstructed residual block is added to the decoding A predictive block in the frame of the image cache unit 110 is used to generate a reconstructed video encoding block; the encoding unit 109 is used to encode various encoding parameters and quantized transform coefficients.
  • the contextual content can be based on adjacent coding blocks and can be used to encode information indicating the determined intra prediction mode and output the code stream of the video signal; and the decoded image buffer unit 110 is used to store the reconstructed video coding blocks for Forecast reference. As the video image encoding proceeds, new reconstructed video encoding blocks will be continuously generated, and these reconstructed video encoding blocks will be stored in the decoded image cache unit 110 .
  • the 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 cache unit. 206, etc., wherein the decoding unit 201 can implement header information decoding and CABAC decoding, and the filtering unit 205 can implement deblocking filtering and SAO filtering.
  • the code stream of the video signal is output; the code stream is input into the decoder 200 and first passes through the decoding unit 201 to obtain the decoded transformation coefficient; for the transformation coefficient, the inverse Transform and inverse quantization unit 202 performs processing to generate a residual block in the pixel domain; intra prediction unit 203 may be operable to generate a current block based on the determined intra prediction mode and data from previously decoded blocks of the current frame or picture. Prediction data for the video decoding block; motion compensation unit 204 determines prediction information for the video decoding block by parsing motion vectors and other associated syntax elements, and uses the prediction information to generate predictive blocks for the video decoding block being decoded.
  • a decoded video block is formed by summing the residual block from the inverse transform and inverse quantization unit 202 and the corresponding predictive block produced by the intra prediction unit 203 or the motion compensation unit 204; the decoded video signal is formed by The filtering unit 205 removes blocking artifacts, which can improve video quality; the decoded video blocks are then stored in the decoded image cache unit 206, which stores reference images for subsequent intra prediction or motion compensation, At the same time, it is also used for the output of video signals, that is, the restored original video signals are obtained.
  • the method in the embodiment of the present application is mainly applied to the intra prediction unit 103 part as shown in FIG. 4A and the intra prediction unit 203 part as shown in FIG. 4B. That is to say, the embodiments of the present application can be applied to both encoders and decoders, or even to both encoders and decoders. However, the embodiments of the present application are not specifically limited.
  • the "current block” specifically refers to the coding block currently to be intra-predicted; when applied to the intra prediction unit 203 part, the "current block” specifically refers to Refers to the decoding block currently to be intra-predicted.
  • Figure 5 is a schematic flow chart of the implementation of the encoding method provided by the embodiment of the present application. As shown in Figure 5, the method may include the following steps 51 to 54:
  • Step 51 Determine the first encoding parameter according to the template area
  • Step 52 Determine the reference sample value of the first color component of the current block
  • Step 53 Determine a first weighting coefficient according to the reference sample value of the first color component of the current block and the first encoding parameter
  • Step 54 Determine the 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.
  • the first encoding parameter is determined based on the template area instead of a preset fixed value. Therefore, the obtained first weighting coefficient is more in line with the characteristics of the current block, thereby improving the second color of the current block. Component accuracy, thereby saving bit rate and improving encoding performance.
  • step 51 the first encoding parameter is determined according to the template area.
  • the template area may include part or all of the current block, as well as the reference area of the current block; the template area may not include the current block, but may include the reference area of the template area.
  • the template region is an encoded region.
  • the template area is determined according to pixel availability in a neighboring area of the current block; wherein, based on a relative positional relationship with the current block, the neighboring area includes at least one of the following: an upper side of the current block area, the left area of the current block, the upper right area of the current block, the lower left area of the current block, and the upper left area of the current block.
  • pixel availability for a pixel may be determined based on the location of the pixel in the neighborhood and/or the encoding status of the pixel. For example, if the position of the pixel belongs to the defined edge area, it is determined that the pixel is not available. For another example, if the coding status of the pixel is uncoded, it is determined that the pixel is unavailable; for another example, if the position of the pixel belongs to a defined edge area, and the coding status of the pixel is uncoded, it is determined that the pixel is unavailable.
  • adjacent areas of the current block may include areas that are bounded by the current block and/or areas that are not bounded. Taking the area bordering the current block as an example, as shown in FIG. 6 , the adjacent area may include at least one of the areas in various directions shown in the figure.
  • the template area may also be determined in this way: the template area is determined according to the template type included in the configured prediction mode.
  • the template type includes at least one of the following: an upper template, a left template, an upper right template, a lower left template, and an upper left template.
  • a template included in the configured prediction mode may be used as the template region.
  • the template area may include an area that is bounded by the current block or an area that is not bounded by the current block. For example, as shown in Figure 7, it shows that the upper template and the left template do not interface with the current block; and as shown in Figure 8, it shows that the upper template, the left template, the upper right template, the lower left template, the upper left template and The current block boundary situation.
  • width and height of the adjacent area can be configured according to the code rate and other index requirements.
  • width and height of the template area can also be configured based on index requirements such as code rate.
  • step 51 can be implemented through the following steps 511 and 512:
  • Step 511 Determine the reference sample value of the template area.
  • the reference sample value of the template region includes: a reconstructed value of the first color component of the template region, a reconstructed value of the second color component of the template region, a reconstructed value of the reference region of the template region. The reconstructed value of the first color component and the reconstructed value of the second color component of the reference area of the template area.
  • the reference area of a template area varies with the type of template area, and the template area is allowed to overlap with its reference area.
  • the reference area of the template area includes at least one of the following: an upper adjacent area of the template area; a lower adjacent area of the template area; a left adjacent area of the template area; The right adjacent area of the template area; the template area; wherein, when the reference area of the template area contains the template area, the area of the reference area is greater than the area of the template area.
  • the size of the upper, lower, left, and right adjacent areas of the template area is not limited, and the size of the adjacent areas can be preset according to the type of the template area.
  • the left and right edges of the upper adjacent area and the lower adjacent area of the template area may be aligned with the left and right edges of the upper template, or may not be aligned.
  • the upper and lower edges of the left adjacent area and the right adjacent area of the template area may be aligned with the upper and lower edges of the left template, or may not be aligned.
  • FIG 10 it shows an example in which the left template overlaps the reference area, and an example in which the right template overlaps the reference area.
  • the reference area of the upper template includes the upper template
  • the reference area of the left template includes the left template.
  • Figure 11 which shows the reference area of the left template and the right template
  • the reference area includes the upper adjacent area of the upper template and the left adjacent area of the left template
  • Figure 12A which shows The reference area of the left template and the right template is obtained, and the reference area includes the lower adjacent area of the upper template and the right adjacent area of the left template.
  • Step 512 Determine the first encoding parameter according to the reference sample value of the template area.
  • step 512 may be implemented through steps 5121 and 5122:
  • Step 5121 Determine the first difference value of the template area, wherein the first difference value of the template area is set equal to the reference value of the first color component of the template area and the third value of the reference area of the template area. The absolute value of the difference between reference values of a color component.
  • the reference value of the first color component of the template area is a reconstructed value of the first color component of the template area, or the reconstructed value of the first color component of the template area is filtered
  • the value obtained by processing; the reference value of the first color component of the reference area of the template area is the reconstructed value of the first color component of the reference area of the template area, or the first color component of the reference area of the template area
  • the reconstructed value is obtained by filtering.
  • Step 5122 Determine the first encoding parameter according to the first difference value of the template area.
  • the first encoding parameter can be determined by querying a preset mapping table between the first difference value and the first encoding parameter; wherein the mapping table records different first difference values.
  • the respective corresponding first encoding parameters can make the code rate reach the maximum.
  • step 5122 can be implemented through steps 5122-1 to 5122-3:
  • Step 5122-1 Determine a second predicted value of the second color component of the template region based on the first difference value and the candidate first encoding parameter.
  • the second predicted value of the second color component of the template region is set equal to a weighted sum of the reference value of the second color component of the reference region of the template region and a second weighting coefficient.
  • the second weighting coefficient is determined using a preset correspondence relationship based on the first difference value of the template area and the candidate first encoding parameter.
  • the preset corresponding relationship is not limited and can be various types of function models.
  • the candidate first coding parameter is a model parameter of the function model, which affects the size of the second weighting coefficient.
  • the preset correspondence relationship can also be obtained using a function model.
  • the preset correspondence relationship is the second weighting coefficient corresponding to the first difference value and the candidate first encoding parameter.
  • the preset corresponding relationship is a softmax function; wherein the input of the softmax function is one of the following: the ratio of the first difference to the candidate first encoding parameter. ; The product of the first difference and the candidate first coding parameter; the value obtained by bit shifting the first difference; wherein the number of bit shifts is equal to the candidate first Encoding parameters.
  • the direction of the bit shift may be to the left or to the right.
  • [i] represents the abscissa coordinate of the pixel with pixel coordinates (i, j) in the template area
  • [j] represents the ordinate coordinate of the pixel with pixel coordinates (i, j) in the template area.
  • cTempWeight[i][j][k] represents the second weighting coefficient of the k-th pixel of the reference area of the template area corresponding to the pixel with pixel coordinates (i,j) in the template area; diffTempY[i][j][ k] represents the reference value of the first color component of the pixel with pixel coordinates (i,j) in the template area and the k-th pixel of the reference area of the template area corresponding to the pixel with pixel coordinates (i,j) in the template area.
  • refTempY[k] represents the reference value of the first color component of the k-th pixel in the reference area of the template area
  • recTempY[i][j] represents the first color component of the pixel with pixel coordinates (i, j) in the template area. Reference values for color components.
  • the second predicted value of the second color component of the pixel whose pixel coordinates are (i, j) in the template area is set equal to the reference value of the second color component of each pixel in the reference area of the template area and The weighted sum of the corresponding second weighting coefficients.
  • the preset correspondence relationship may also be obtained using a softmax function.
  • the preset correspondence relationship (such as a preset mapping table) can be pre-calculated according to the softmax function, and then when determining the second weighting coefficient, the first difference of the template area can be obtained by querying the preset correspondence relationship. value and the second weighting coefficient corresponding to the candidate decoding parameter.
  • the candidate first encoding parameters include one or more candidate first encoding parameters.
  • the corresponding first prediction error can be calculated through step 5122-1 and step 5122-2.
  • Step 5122-2 Determine the first prediction error of the second color component of the template area; wherein the first prediction error is the reference value of the second color component of the template area and the second value of the template area.
  • the error between the second predicted values of the color component, the reference value of the second color component of the template area is the reconstructed value of the second color component of the template area, or the reconstruction of the second color component of the template area The value obtained by filtering.
  • the second prediction value used to determine the first prediction error is set equal to a second prediction value obtained by performing a correction operation on the second prediction value of the second color component of the template region.
  • Step 5122-3 Determine the first coding parameter according to the first prediction error.
  • step 5122-3 there is no limitation on the implementation of step 5122-3, and it can be various. For example, it can be implemented through any one of the following examples from Embodiment 1 to Embodiment 4.
  • step 5122-3 can be implemented as follows: setting the first coding parameter equal to the value of the corresponding candidate first coding parameter when the first prediction error reaches the first condition; Wherein, the reference value of the second color component of the reference area of the template area is the reconstructed value of the second color component of the reference area of the template area, or the reconstructed value of the second color component of the reference area of the template area. The value obtained after filtering.
  • the first condition includes: the first prediction error is minimum, the first prediction error is less than a first threshold, the first prediction error is maximum, or the first prediction error is greater than a third threshold.
  • the first prediction errors of different measurement criteria correspond to different first conditions.
  • the first condition includes that the first prediction error is minimum or the first prediction error is less than the first threshold; for another example, under the measurement criterion of the peak signal-to-noise ratio (PSNR), the first condition One condition includes the first prediction error being maximum or the first prediction error being greater than a third threshold.
  • SAD sum of absolute errors
  • PSNR peak signal-to-noise ratio
  • step 5122-3 (that is, determining the first coding parameter according to the first prediction error) can also be implemented as follows: select the first coding parameter from each candidate first coding parameter in the template region. The prediction error satisfies the parameter of the first condition; the first encoding parameter is determined according to the parameter of the first prediction error corresponding to the template region that satisfies the first condition.
  • Example 1 the step of "determining the first encoding parameter based on the parameter that the first prediction error corresponding to the template region satisfies the first condition" can be implemented through the following Example 1, Example 2, Example 3 or Example 4:
  • the sixth weighting coefficient is determined according to the reference sample value of the first color component of the current block and the candidate first coding parameter whose first prediction error satisfies the first condition; according to the sixth weighting coefficient and the Determine the third predicted value of the second color component of the current block based on the reference sample value of the second color component of the current block; determine the corresponding value based on the third predicted value and the original value of the second color component of the current block.
  • the first prediction error satisfies the first condition and the second prediction error of the candidate first coding parameter; the first coding parameter is determined according to the second prediction error of the candidate first coding parameter whose first prediction error satisfies the first condition.
  • the reference sample value of the first color component of the current block includes a reconstructed value of the first color component of the reference area of the current block (or a value obtained by filtering the reconstructed value) and the The reconstructed value of the first color component of the current block (or the value obtained after filtering the reconstructed value);
  • the reference sample value of the second color component of the current block includes the second color of the reference area of the current block The reconstruction value of the component, the reconstructed value of the second color component of the reference area of the current block after filtering, or the original value of the second color component of the reference area of the current block, or the current block The value obtained after filtering the original value of the second color component of the reference area.
  • a candidate first coding parameter whose second prediction error satisfies a third condition is selected from the candidate first coding parameters whose first prediction error satisfies the first condition; and the second prediction error satisfies the third condition.
  • candidate first encoding parameters and determine the first encoding parameters.
  • the first coding parameter is set equal to a candidate first coding parameter whose second prediction error satisfies a third condition.
  • the number of candidate first coding parameters whose second prediction error satisfies the third condition may be one or multiple. If there are more than one, the first coding parameter is set equal to any candidate first coding parameter whose second prediction error satisfies the third condition.
  • the first coding parameter is set equal to the fusion value of the candidate first coding parameter whose second prediction error satisfies the third condition.
  • the weighting coefficient of the corresponding candidate first coding parameter may be determined according to the size of the second prediction error, and based on this, the first coding parameter is set equal to the second prediction error satisfying the first The weighted sum of the candidate first coding parameters of the three conditions and the corresponding weighting coefficients.
  • the third condition includes: the second prediction error is minimum or maximum.
  • the third condition includes: the second prediction error is the smallest; another example, under the measurement criterion of the peak signal-to-noise ratio (PSNR), the third condition includes the second prediction error being the largest .
  • SPD sum of absolute errors
  • PSNR peak signal-to-noise ratio
  • the step of "determining the first coding parameter based on the parameter whose first prediction error corresponding to the template region satisfies the first condition" can also be implemented as follows: the candidate whose first prediction error satisfies the first condition The first coding parameter is expanded to obtain a first extended parameter; a candidate first coding parameter that satisfies the first condition according to the reference sample value of the first color component of the current block and the first prediction error and the first extended parameter, Determine a seventh weighting coefficient; determine a fourth prediction value of the second color component of the current block according to the seventh weighting coefficient and the reference sample value of the second color component of the current block; according to the The fourth predicted value and the original value of the second color component are used to determine the third prediction error of the corresponding parameter; according to the third prediction error of each of the candidate first encoding parameters and the first extended parameter, the first encoding is determined parameter.
  • a seventh weighting coefficient corresponds to a candidate first coding parameter or a first extension parameter, that is, based on a candidate first coding parameter or a first extension parameter and the reference sample of the first color component of the current block, the seventh weighting coefficient is determined. Seven weighting factors.
  • At least one first expansion parameter may be expanded to the left and/or right according to a preset step size, centered on the candidate first encoding parameter whose first prediction error satisfies the first condition.
  • a parameter whose third prediction error satisfies a fourth condition may be selected from each of the candidate first coding parameters and the first extension parameter; a parameter which satisfies the fourth condition according to the third prediction error , determine the first encoding parameter.
  • the first encoding parameter is set to be equal to the parameter for which the third prediction error satisfies the fourth condition; here, the number of parameters for which the third prediction error satisfies the fourth condition may be one or multiple . If there are more than one, the first encoding parameter is set equal to any parameter whose third prediction error satisfies the fourth condition.
  • the first coding parameter is set to be equal to the fusion value of the parameters whose third prediction error satisfies the fourth condition.
  • the weighting coefficient of the corresponding parameter can be determined according to the size of the third prediction error, and based on this, the first encoding parameter is set to be equal to the parameter where the third prediction error satisfies the fourth condition. and the weighted sum of the corresponding weighting coefficients.
  • the fourth condition includes: the third prediction error is minimum or maximum.
  • the fourth condition includes the smallest third prediction error; for example, under the metric criterion of peak signal-to-noise ratio (PSNR), the fourth condition includes the largest third prediction error.
  • SAD sum of absolute errors
  • PSNR peak signal-to-noise ratio
  • the step of "determining the first encoding parameter based on the parameter that the first prediction error corresponding to the template region satisfies the first condition" can also be implemented as follows: setting the first encoding parameter equal to the first A parameter whose prediction error satisfies the first condition; or, the first coding parameter is set to be equal to the fusion value of the parameter whose first prediction error satisfies the first condition.
  • the first coding parameter is set to be equal to the weighted sum of the parameter for which the first prediction error satisfies the first condition and the third weighting coefficient.
  • the corresponding third weighting coefficient may be determined based on the first prediction error corresponding to the parameter whose first prediction error satisfies the first condition; or, the third weighting coefficient may be set to a preset constant value.
  • the step of "determining the first encoding parameter based on the parameter that the first prediction error corresponding to the template region satisfies the first condition" can also be implemented as follows: determine the parameter that the first prediction error satisfies the first condition. Perform expansion to obtain a first expansion parameter; fuse the first expansion parameter and/or a parameter whose first prediction error satisfies the first condition to obtain the first coding parameter.
  • the weighting coefficient of the corresponding parameter may be determined according to the size of the first prediction error.
  • the weighting coefficient for the first extension parameter may be a preset constant value, or may be the weighting of the corresponding candidate first coding parameter. Coefficient; based on this, perform a weighted calculation on the first extension parameter and/or the parameter whose first prediction error satisfies the first condition to obtain the first coding parameter.
  • step 5122-3 (that is, determining the first coding parameter according to the first prediction error) can also be implemented as follows: setting the first coding parameter equal to each candidate first coding The weighted sum of the parameters and the fourth weighting coefficient.
  • a fourth weighting coefficient corresponding to the candidate first coding parameter is determined according to the first prediction error.
  • step 5122-3 (that is, determining the first encoding parameter according to the first prediction error) can also be implemented as follows: according to the first corresponding first encoding parameter of the same candidate first encoding parameter in the template region The prediction error determines the evaluation parameter that represents the performance of the corresponding candidate first coding parameter; and determines the first coding parameter according to the evaluation parameter of each candidate first coding parameter.
  • the evaluation parameter is set equal to the fusion value of the first prediction error corresponding to the same candidate first coding parameter of the template region.
  • the fusion value may be the sum or product of these first prediction errors, etc.
  • the evaluation parameter is set equal to the sum of the first prediction errors corresponding to the same candidate first coding parameters of the template region.
  • the step of "determining the first coding parameter according to the evaluation parameters of each candidate first coding parameter" can be implemented as follows: selecting an evaluation parameter from each candidate first coding parameter The parameter satisfies the second condition; the first encoding parameter is determined based on the evaluation parameter satisfying the second condition.
  • Example 5 the step "determine the first encoding parameter according to the parameter whose evaluation parameter satisfies the second condition" can be implemented through the following Example 5 or Example 6:
  • the 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 meets the second condition; the eighth weighting coefficient is determined based on the eighth weighting coefficient and the second value of the current block.
  • the reference sample value of the color component is used to determine the fifth predicted value of the second color component of the current block; based on the fifth predicted value and the original value of the second color component of the current block, it is determined that the corresponding evaluation parameter satisfies the second A fourth prediction error of the parameter of the condition; the first coding parameter is determined according to the fourth prediction error of each candidate first coding parameter.
  • the parameters whose evaluation parameters satisfy the second condition are expanded to obtain the second extended parameters; the parameters which satisfy the second condition are obtained according to the reference sample value of the first color component of the current block and the evaluation parameter. and a second extension parameter, determining a ninth weighting coefficient; determining a sixth prediction value of the second color component of the current block according to the ninth weighting coefficient and the reference sample value of the second color component of the current block; According to the sixth predicted value and the original value of the second color component of the current block, the fifth prediction error of the corresponding parameter is determined; according to the fifth prediction error of each candidate first coding parameter and the second extension parameter, the fifth prediction error of the corresponding parameter is determined.
  • the first encoding parameter determining a ninth weighting coefficient; determining a sixth prediction value of the second color component of the current block according to the ninth weighting coefficient and the reference sample value of the second color component of the current block; According to the sixth predicted value and the original value of the second color component of the current block, the fifth prediction error of the corresponding parameter is determined; according to
  • a ninth weighting coefficient corresponds to a candidate first coding parameter or a second extension parameter, that is, based on a candidate first coding parameter or a second extension parameter and the reference sample value of the first color component of the current block, the third Nine weighting factors.
  • the step "determine the first encoding parameter according to the parameter in which the evaluation parameter satisfies the second condition" can be implemented by: setting the first encoding parameter equal to the parameter in which the evaluation parameter satisfies the second condition; or, The first encoding parameter is set equal to a fusion value of parameters whose evaluation parameters satisfy the second condition. In some embodiments, the first encoding parameter is set equal to a weighted sum of a parameter whose evaluation parameter satisfies the second condition and a fifth weighting coefficient.
  • Example 7 Further, the fifth weighting coefficient can be obtained through Example 7 or Example 8:
  • Example 7 the fifth weighting coefficient of the corresponding parameter is determined according to the template area corresponding to the parameter whose evaluation parameter satisfies the second condition.
  • the fifth weighting coefficient of the corresponding parameter is determined according to the number of pixels and/or the template type of the template area corresponding to the parameter whose evaluation parameter satisfies the second condition.
  • the second condition includes: the evaluation parameter is minimum, the evaluation parameter is less than a second threshold, the evaluation parameter is maximum, or the evaluation parameter is greater than a fourth threshold.
  • the first prediction error and the second condition of different measurement criteria are different.
  • the second condition includes that the evaluation parameter is the minimum or the evaluation parameter is less than the second threshold;
  • the second condition includes the evaluation The maximum parameter or the evaluation parameter is greater than the fourth threshold.
  • the fifth weighting coefficient is a preset constant value.
  • a default value is used as the predicted value of the second color component of the current block.
  • another prediction method different from the above method may also be used to determine the second color component of the current block for prediction.
  • Another prediction method that is different from the above method is, for example, a prediction method based on a cross-component linear model (Cross-component Linear Model, CCLM).
  • the first encoding parameter or the index of the first encoding parameter may be encoded, and the obtained encoded bits may be written into the code stream.
  • step 52 a reference sample of the first color component of the current block is determined.
  • the reference sample value of the first color component of the current block includes a reconstructed value of the first color component of the current block and a reconstructed value of the first color component of the reference region of the current block.
  • a first weighting coefficient is determined based on the reference sample of the first color component of the current block and the first encoding parameter.
  • a second difference value of the current block may be determined, wherein the second difference value of the current block is set equal to a reference value of the first color component of the current block and a reference value of the current block.
  • the first weighting coefficient may be determined using a preset correspondence relationship based on the second difference value of the current block and the first encoding parameter.
  • the preset correspondence is a softmax function, or the preset correspondence is obtained using a softmax function; wherein the input of the softmax function is one of the following: The ratio of the second difference to the first encoding parameter; the product of the second difference and the candidate first decoding parameter; the value obtained by bit shifting the second difference; where , the number of bit shifts is equal to the candidate first decoding parameter.
  • [i] represents the abscissa coordinate of the pixel with pixel coordinates (i, j) in the current block
  • [j] represents the ordinate coordinate of the pixel with pixel coordinates (i, j) in the current block.
  • cWeight[i][j][k] represents the first weighting coefficient of the k-th pixel of the reference area of the current block corresponding to the pixel coordinates (i, j) in the current block
  • inSize represents the first weighting coefficient of the reference area of the current block.
  • refY[k] represents the reference value of the first color component of the k-th pixel in the reference area of the current block (such as the reconstructed value, the value obtained by filtering the reconstructed value, the original value or the value obtained by filtering the original value).
  • recY[i][j] represents the reference value of the first color component of the pixel with pixel coordinates (i, j) in the current block (such as the reconstructed value, the value obtained by filtering the reconstructed value, the original value or the original value value obtained by filtering).
  • a first predicted value of the second color component of the current block is determined based on the first weighting coefficient and the reference sample value of the second color component of the current block.
  • the reference sample value of the second color component of the current block includes a reconstructed value of the second color component of the reference area of the current block, or a value obtained by filtering the reconstructed value, or the current The original value of the second color component of the reference area of the block, or the value obtained by filtering the original value.
  • the first predicted value of the second color component of the pixel whose pixel coordinates are (i, j) in the current block is set equal to the reference value of the second color component of each pixel in the reference area of the current block and The weighted sum of the corresponding first weighting coefficients; wherein the reference value of the second color component of each pixel in the reference area of the current block is a reconstruction of the second color component of each pixel in the reference area of the current block value, or a value obtained by filtering the reconstructed value, or an original value of the second color component of each pixel in the reference area of the current block, or a value obtained by filtering the original value.
  • the method further includes the following steps 55 to 57:
  • Step 55 Obtain the original value of the second color component of the current block
  • Step 56 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 first predicted value of the second color component;
  • Step 57 Encode the residual value of the second color component of the current block, and write the resulting encoded bits into the code stream.
  • the method further includes the following steps 515 to 518:
  • Step 515 Perform a correction operation on the first predicted value of the second color component of the current block to obtain a corrected first predicted value.
  • the first predicted value of the second color component of the current block should be within a limited range. If it is exceeded, a corresponding correction operation is performed. For example:
  • a clamping operation can be performed on the first predicted value of the second color component of the current block, as follows:
  • C pred [i][j] When the value of C pred [i][j] is less than 0, set it to 0; where, C pred [i][j] represents the second color of the pixel whose pixel coordinates are (i, j) in the current block the first predicted value of the component;
  • Step 516 Obtain the original value of the second color component of the current block
  • Step 517 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 modified first predicted value;
  • Step 518 Encode the residual value of the second color component of the current block, and write the resulting encoded bits into the code stream.
  • the decoding method provided by the embodiment of the present application is similar to the above-mentioned encoding method.
  • the above-mentioned first encoding parameter is equivalent to the first decoding parameter described in the following embodiment, which is essentially the same; and the above-mentioned candidate first A coding parameter is equivalent to the candidate first decoding parameter described in the following embodiment, which is essentially the same and is used to control the size of the weighting coefficient.
  • the decoding method provided by the following embodiments has similar beneficial effects as the embodiments of the above encoding method.
  • For technical details not disclosed in the embodiments of the decoding method of the present application please refer to the description of the embodiments of the encoding method above to understand. Therefore, the technical details and specific embodiments that are not disclosed in the embodiments of the decoding method disclosed below will not be described again.
  • Figure 13 is a schematic flow chart of the implementation of the decoding method provided by the embodiment of the present application. As shown in Figure 13, the method may include the following steps 131 to 134:
  • Step 131 determine the first decoding parameter according to the template area
  • Step 132 Determine the reference sample value of the first color component of the current block
  • Step 133 Determine a first weighting coefficient based on the reference sample of the first color component of the current block and the first decoding parameter;
  • Step 134 Determine the 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.
  • step 131 the first decoding parameter is determined according to the template area.
  • the template area may be determined first.
  • the template area may be determined according to pixel availability in a neighboring area of the current block; wherein, based on a relative positional relationship with the current block, the neighboring area includes at least one of the following: an upper part of the current block side area, the left area of the current block, the upper right area of the current block, the lower left area of the current block, and the upper left area of the current block.
  • the template area may also be determined in this way: the template area is determined according to the template type included in the configured prediction mode.
  • the template type includes at least one of the following: an upper template, a left template, an upper right template, a lower left template, and an upper left template.
  • a template included in the configured prediction mode may be used as the template region.
  • step 131 may be implemented through the following steps 111 and 112:
  • Step 111 determine the reference sample value of the template area
  • the reference sample value includes: a reconstructed value of the first color component of the template region, a reconstructed value of the second color component of the template region, and a first color of the reference region of the template region. The reconstructed value of the component and the reconstructed value of the second color component of the reference area of the template area.
  • the reference area of the template area includes at least one of the following: an upper adjacent area of the template area; a lower adjacent area of the template area; a left adjacent area of the template area area; the right adjacent area of the template area; the template area.
  • Step 112 Determine the first decoding parameter according to the reference sample value of the template area.
  • step 112 may be implemented through steps 1121 and 1122:
  • Step 1121 Determine a first difference value of the template area, wherein the first difference value of the template area is set equal to the reference value of the first color component of the template area and the third value of the reference area of the template area.
  • the absolute value of the difference between the reference values of a color component is set equal to the reference value of the first color component of the template area and the third value of the reference area of the template area.
  • the reference value of the first color component of the template area is a reconstructed value of the first color component of the template area, or the reconstructed value of the first color component of the template area is filtered
  • the value obtained by processing; the reference value of the first color component of the reference area of the template area is the reconstructed value of the first color component of the reference area of the template area, or the first color component of the reference area of the template area
  • the reconstructed value is obtained by filtering.
  • Step 1122 Determine the first decoding parameter according to the first difference value of the template area.
  • step 1122 can be implemented through steps 1122-1 to 1122-3:
  • Step 1122-1 Determine the second predicted value of the second color component of the template region based on the first difference value and the first decoding parameter of the candidate first decoding parameter;
  • the candidate first encoding parameters include one or more candidate first decoding parameters.
  • Step 1122-2 Determine the first prediction error of the second color component of the template region; wherein the first prediction error is the reference value of the second color component of the template region and the second prediction error of the template region.
  • the error between the second predicted values of the color component, the reference value of the second color component of the template area is the reconstructed value of the second color component of the template area, or the reconstruction of the second color component of the template area The value obtained by filtering.
  • the second prediction value used to determine the first prediction error is set equal to a second prediction value obtained by performing a correction operation on the second prediction value of the second color component of the template region.
  • Step 1122-3 determine the first decoding parameter according to the first prediction error
  • step 1122-3 there is no limitation on the implementation of step 1122-3, and it can be various.
  • it can be implemented by any of the following examples from Embodiment 5 to Embodiment 8.
  • step 1122-3 can be implemented as follows: the second predicted value of the second color component of the template region is set equal to the reference value of the second color component of the reference region of the template region and the second weighted value. The weighted sum of coefficients; setting the first decoding parameter equal to the value of the candidate first decoding parameter corresponding to when the first prediction error reaches the first condition; wherein, the reference area of the template area
  • the reference value of the second color component is the reconstructed value of the second color component of the reference area of the template area, or the value obtained by filtering the reconstructed value of the second color component of the reference area of the template area.
  • the second weighting coefficient is determined using a preset correspondence relationship based on the first difference value of the template area and the candidate first decoding parameter.
  • the preset correspondence is a softmax function, or the preset correspondence is obtained using a softmax function; wherein the input of the softmax function is one of the following: The ratio of the first difference to the candidate first decoding parameter; the product of the first difference and the candidate first decoding parameter; the value obtained by bit-shifting the first difference; Wherein, the number of bit shifts is equal to the candidate first decoding parameter.
  • the first condition includes: the first prediction error is minimum, the first prediction error is less than a first threshold, the first prediction error is maximum, or the first prediction error is greater than a third threshold.
  • step 1122-3 (that is, determining the first decoding parameter based on the first prediction error) can also be implemented as follows: select a first decoding parameter from each candidate first decoding parameter in the template area. The prediction error satisfies the parameter of the first condition; the first decoding parameter is determined according to the parameter of the first prediction error corresponding to the template area that satisfies the first condition.
  • Example 9 the step of "determining the first decoding parameter based on the parameter that the first prediction error corresponding to the template region satisfies the first condition.
  • the step of "determining the first decoding parameter based on the parameter that the first prediction error corresponding to the template region satisfies the first condition" can also be implemented as follows: setting the first decoding parameter equal to the first A parameter whose prediction error satisfies the first condition; or, the first decoding parameter is set to be equal to the fusion value of the parameters whose first prediction error satisfies the first condition.
  • the first decoding parameter is set to be equal to the weighted sum of the parameter for which the first prediction error satisfies the first condition and the third weighting coefficient.
  • the corresponding third weighting coefficient may be determined based on the first prediction error corresponding to the parameter whose first prediction error satisfies the first condition; or, the third weighting coefficient may be set to a preset constant value.
  • the step of "determining the first decoding parameter based on the parameter that the first prediction error corresponding to the template region satisfies the first condition" can also be implemented as follows: determine the parameter that the first prediction error satisfies the first condition. Perform expansion to obtain a first expansion parameter; fuse the first expansion parameter and/or a parameter whose first prediction error satisfies the first condition to obtain the first decoding parameter.
  • step 1122-3 (that is, determining the first decoding parameter according to the first prediction error) can also be implemented as follows: setting the first decoding parameter equal to each of the candidate first decoding The weighted sum of the parameters and the fourth weighting coefficient.
  • a fourth weighting coefficient corresponding to the candidate first decoding parameter is determined according to the first prediction error.
  • step 1122-3 (that is, determining the first decoding parameter according to the first prediction error) can also be implemented as follows: according to the first corresponding first decoding parameter of the same candidate first decoding parameter in the template area.
  • the prediction error determines the evaluation parameter that represents the performance of the corresponding candidate first decoding parameter; and determines the first decoding parameter according to the evaluation parameter of each candidate first decoding parameter.
  • the evaluation parameter is set equal to the fusion value of the first prediction error corresponding to the same candidate first decoding parameter of the template region.
  • the evaluation parameter is set equal to the sum of the first prediction errors corresponding to the same candidate first decoding parameters of the template region.
  • the step of "determining the first decoding parameter according to the evaluation parameter of each candidate first decoding parameter" can be implemented as follows: select an evaluation parameter from each candidate first decoding parameter. The parameter satisfies the second condition; the first decoding parameter is determined according to the evaluation parameter satisfying the second condition.
  • step "determine the first decoding parameter according to the parameter whose evaluation parameter satisfies the second condition" can be implemented through the following example 11:
  • the first decoding parameter is set equal to a parameter whose evaluation parameter satisfies the second condition; or, the first decoding parameter is set equal to a fusion value of a parameter whose evaluation parameter satisfies the second condition.
  • the first decoding parameter is set equal to a weighted sum of a parameter whose evaluation parameter satisfies the second condition and a fifth weighting coefficient.
  • Example 12 Further, the fifth weighting coefficient can be obtained through Example 12 or Example 13:
  • Example 12 the fifth weighting coefficient of the corresponding parameter is determined based on the template area corresponding to the parameter whose evaluation parameter satisfies the second condition.
  • the fifth weighting coefficient of the corresponding parameter is determined according to the number of pixels and/or the template type of the template area corresponding to the parameter whose evaluation parameter satisfies the second condition.
  • the second condition includes: the evaluation parameter is minimum, the evaluation parameter is less than a second threshold, the evaluation parameter is maximum, or the evaluation parameter is greater than a fourth threshold.
  • the fifth weighting coefficient is a preset constant value.
  • a default value is used as the predicted value of the second color component of the current block.
  • another prediction method different from the above method may also be used to determine the second color component of the current block for prediction.
  • the method further includes: parsing the code stream to obtain an index of the first decoding parameter; and obtaining the first decoding parameter according to the index of the first decoding parameter.
  • the method further includes: parsing the code stream to obtain the first decoding parameter.
  • the method further includes: parsing the code stream to obtain a residual value of the second color component of the current block; and based on the residual value of the second color component and the second color component of the current block.
  • the first predicted value of the color component determines the reconstructed value of the second color component of the current block.
  • the method further includes: performing a correction operation on the first predicted value of the second color component of the current block to obtain a corrected first predicted value; according to the residual of the second color component value and the modified first predicted value to determine the reconstructed value of the second color component of the current block.
  • the first color component and the second color component are of different types.
  • the first color component is the brightness component
  • the second color component is the chrominance component.
  • the first color component is the chrominance component
  • the second color component is the brightness component.
  • the reconstructed luminance information of the current block, the reconstructed luminance information of the adjacent reference area, and the reconstructed chroma information of the adjacent reference area are all encoded reconstruction information. Therefore, the above reconstruction information can be used, Weight-based chroma prediction technology (WCP) is adopted, and a template matching step is added before the process of weight-based chroma prediction, with the purpose of selecting the best model parameters based on current blocks of different sizes and different contents.
  • WCP Weight-based chroma prediction technology
  • the key is to use template matching to search for the best model parameters of the weight model used to calculate the weight vector in the adjacent area; for the decoding end, the best model parameters are the first parameters described in the above embodiment.
  • An example of a decoding parameter; for the encoding end, the optimal model parameter is an example of the first encoding parameter described in the above embodiment.
  • the detailed steps of the chromaticity prediction process of WCP technology are as follows:
  • the input of WCP the position of the current block (xTbCmp, yTbCmp), the width of the current block nTbW and the height of the current block nTbH.
  • the chrominance component is an example of the second color component described in the above embodiment
  • the brightness component mentioned below is an example of the first color component described in the above embodiment.
  • the prediction process of WCP technology includes the following steps 141 to 145, namely core parameter configuration, obtaining input information, weight-based chroma prediction and post-processing. Between obtaining input information and weight-based chroma prediction, Add a template matching step between the two steps. After the above steps, the chroma prediction value of the current block can be obtained.
  • Step 141 determine WCP core parameters; these parameters can be pre-configured;
  • Step 142 Obtain input information according to the determined core parameters, including obtaining reference chroma information, reference brightness information, and reconstructed brightness information of the current block;
  • Step 143 Determine control parameters through template matching; wherein, for the decoding end, the control parameter is equivalent to an example of the first decoding parameter described in the above embodiment; for the encoding end, the control parameter is The control parameter is equivalent to an example of the first encoding parameter described in the above embodiment.
  • Step 144 Perform weight-based chromaticity prediction calculation based on the obtained input information
  • Step 145 Perform post-processing on the chromaticity prediction calculation results.
  • step 141 WCP core parameters are determined.
  • the core parameters involved in WCP are determined, that is, the WCP core parameters can be obtained or inferred through configuration or through some channel, such as obtaining the WCP core parameters from the code stream at the decoding end. Specific applications will be introduced in detail later.
  • the determination of WCP core parameters includes but is not limited to: control parameters (T), the number inSize of various input information for weight-based chroma prediction, and the number of outputs (predWcp) for weight-based chroma prediction; predWcp is arranged as predSizeW ⁇ predSizeH.
  • control parameters (T) can be used to adjust the nonlinear function in subsequent links or to adjust the data involved in subsequent links.
  • the control parameters (T) corresponding to the current block of different sizes or different contents or different numbers of pixels within the block are determined by the template matching in step 143.
  • step 142 input information is obtained.
  • the upper area, upper left area, and left area of the current block are called the reference area of the current block.
  • the pixels in the reference area of the current block are reconstructed pixels, which are called is the reference pixel.
  • the obtained reference chromaticity information refC includes but is not limited to: selecting the reference reconstructed chromaticity value of the upper region of the current block and the reference reconstructed chromaticity value of the left region.
  • the obtained reference brightness information refY includes but is not limited to: obtaining corresponding reference brightness information according to the position of the reference chrominance information.
  • the acquisition method includes but is not limited to: acquiring the corresponding reconstructed brightness information according to the chrominance information position of the current block as the reconstructed brightness information of the current block.
  • the reference chrominance information refC is an example of the reference sample of the second color component of the current block
  • the reference brightness information refY and the reconstructed brightness information recY of the current block are the reference samples of the first color component of the current block.
  • Obtaining input information includes: obtaining inSize amount of reference chromaticity information refC (if pre-processing is required, it is after pre-processing), obtaining inSize amount of reference brightness information refY (if pre-processing is needed, it is after pre-processing) After the processing operation) and obtain the reconstructed brightness information recY of the current block (if pre-processing is required, it is after the pre-processing operation).
  • step 143 the control parameters are determined through template matching.
  • the prediction process of WCP is simulated by using the reconstructed brightness pixels and reconstructed chroma pixels of the template area and the reconstructed brightness pixels and reconstructed chroma pixels of the reference area of the template area, and selects the best control parameter (best_T). As shown in Figure 16, it specifically includes the following steps 1431 to 1433:
  • Step 1431 Determine the template area and the reference area of the template.
  • 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.
  • the reference area of the template area varies with different templates. Varies depending on the type and allows the template area to overlap with the template area's reference area.
  • the template type and the reference area corresponding to the template area can be flexibly combined, as shown in Figure 10, Figure 11 and Figure 12A.
  • the template sizes of different types of different current blocks can be fixed to the same or different.
  • different template sizes can be selected according to the different sizes of the current block, etc.
  • the following formula illustrates the size setting conditions of a template.
  • nTbW and nTbH are the width and height of the current block
  • iTempW and iTempH are the width and height of the determined template:
  • nTbW and nTbH are the width and height of the current block
  • nTbW ⁇ nTbH is the number of pixels in the current block
  • iTempW and iTempH are the width and height of the template used:
  • the combination type of the template type and the reference area corresponding to the template area or the size of the template may also be transmitted in the code stream at the encoding end.
  • Figure 10, Figure 11 and Figure 12A respectively show the schematic diagrams of three types of template positions and their corresponding reference area positions.
  • the templates in the following embodiments are explained using the upper template and the left template in Figure 11 as examples. In practical applications The process can use more different template types with corresponding reference areas at this step.
  • Step 1432 Predict WCP in the template area.
  • the reconstructed brightness information of the template area, the reconstructed chroma information of the template area, the reconstructed brightness information and the reconstructed chroma information of the reference area of the template area are all encoded reconstruction information. Therefore, the basic process of WCP It can be performed in the template area; wherein the reconstructed brightness information of the template area and the reconstructed brightness information of the reference area of the template area are an example of the reference sample value of the first color component of the template area; the reconstructed chromaticity information of the template area and the template The reconstructed chromaticity information of the reference region of the region is an example of the reference sample of the second color component of the template region.
  • the input of the WCP of the template the position of the upper template (xTemp, yTemp), the width of the upper template nTbW and the height of the upper template iTempH.
  • Determine the WCP core parameters including but not limited to: control parameters (T), the number of various input information inTempSize for weight-based chroma prediction, and the number of outputs (predTempWcp) for weight-based chroma prediction (arranged into predTempSizeW ⁇ predTempSizeH).
  • control parameters T
  • predTempWcp the number of outputs for weight-based chroma prediction
  • Obtain input information Obtain reference chromaticity information refTempC and reference brightness information refTempY from the reference area of the upper template.
  • the obtained reference chromaticity information refTempC includes but is not limited to: selecting the reference reconstruction chromaticity value of the reference area of the upper template;
  • the obtained reference brightness information refTempY includes but is not limited to obtaining the corresponding reference brightness information according to the position of the reference chromaticity information.
  • the acquisition method includes but is not limited to selecting the reconstructed chromaticity information in the current template.
  • the acquisition method includes but is not limited to obtaining the corresponding reconstructed brightness information according to the position of the reconstructed chroma information in the current template as the reconstructed brightness information of the current template.
  • This process can also perform pre-processing operations according to different needs, such as up and down sampling based on different input color format information, selecting only part of the reference area or selecting points in the reference area, etc.
  • predTempSizeH and predTempSizeW are determined WCP core parameters and can be the same as or different from the height or width of the current template.
  • Construct a brightness difference vector For each to-be-predicted chroma pixel C predT [i][j] of the template within the size specified by the WCP core parameters, combine its corresponding reconstructed brightness information recTempY[i][j] with the reference number of inTempSize The brightness information refTempY is subtracted and the absolute value is obtained to obtain the brightness difference vector diffTempY[i][j][k].
  • the obtained brightness difference vector can also be subjected to linear or nonlinear numerical processing.
  • the elements in the brightness difference vector are an example of the first difference value.
  • the reference chromaticity information refTempC of each pixel to be predicted C predT [i][j] is multiplied one by one with the corresponding weight vector elements, subTempC[i][j] (or subTempCFloat[i][j] ), the multiplication results are accumulated to obtain the chroma prediction value C predT [i][j] of each pixel to be predicted.
  • the calculation formula is as follows (13):
  • subTempCFloat can be fixed-pointed. In order to retain a certain calculation accuracy during the fixed-pointing process, it can be multiplied by a coefficient, as shown in the following formulas (14) and (15):
  • Offset 1 ⁇ (Shift 1 -1)
  • the chroma prediction value C predT [i][j] of each pixel to be predicted is stored in a separate space, which is the weight-based chroma prediction output predTempWcp.
  • predTempWcp The predicted chromaticity value in predTempWcp should be within the limited range. If it exceeds, corresponding correction operations should be performed. This correction operation must be consistent with the correction operation used by the current block in step 1444 mentioned below.
  • the chroma prediction value in C predT [i][j] can be clamped, as follows:
  • C predT [i][j] is greater than (1 ⁇ BitDepth)–1, it is set to (1 ⁇ BitDepth)–1.
  • the WCP prediction process for the upper template is completed.
  • the WCP prediction process is performed for the left template.
  • the order of the WCP prediction process for the two templates is interchangeable.
  • Figure 12B describes the WCP process.
  • Figure 12B can be a WCP process based on the template area and the reference area of the template area shown in Figure 12A.
  • Figure 12B can also be a WCP process based on other types of template areas and corresponding reference areas. based on the WCP process.
  • the WCP prediction process of the left template only provides special instructions for the WCP input, output, configuration core parameters and acquisition of input information of the WCP prediction process of the upper template. Other operations remain the same:
  • the input of the WCP of the template the position of the left template (xTemp, yTemp), the width of the left template iTempW and the height of the left template nTbH.
  • Configure core parameters including but not limited to: control parameters (T), the number inTempSize of various input information for weight-based chroma prediction, and the number of weight-based chroma prediction outputs (predTempWcp) (arranged as predTempSizeW ⁇ predTempSizeW ).
  • control parameters T
  • predTempWcp weight-based chroma prediction outputs
  • the reference areas of the upper template and the left template can be the same, or different reference areas can be selected respectively. Pre-processing operations can also be performed according to different needs.
  • the left template After the left template completes the WCP prediction process, it also saves its own weight-based chroma prediction output.
  • Step 1433 select the best control parameter best_T.
  • an optimal control parameter (T) can be selected according to a certain evaluation criterion. For example, you can choose Sum of Absolute Errors (SAD), Sum of Transformed Absolute Errors (SATD), Sum of Squared Differences (SSE), Mean Absolute Difference (MAD), Mean Absolute Error (MAE), Mean Squared Error (MSE), Rate Distortion function (RDO) and other evaluation criteria are an example of the first prediction error. Any of the evaluation criteria mentioned in the following content can be selected from the above criteria. Taking the MAE evaluation criteria as an example, the calculation formula is as follows (20):
  • the default value can be set to (1 ⁇ BitDepth)–1, (BitDepth is the bit depth required by the chroma pixel value) or exit directly midway. WCP prediction algorithm (i.e. the current block does not use the WCP prediction algorithm).
  • the first method is to weightedly fuse above_T and left_T into an optimal parameter best_T, as shown in Equation (21):
  • the standard for weighted fusion can be to choose a fixed weighting coefficient or to allocate a weighting coefficient based on the average absolute error of the reconstructed chroma and predicted chroma of the respective templates.
  • the fixed weighting coefficient of the former is ⁇ 0.5, 0.5 ⁇ , and the formula for calculating the weighting coefficient of the latter is As shown in Equation (22), MAE A is the average absolute error of the upper template, MAE L is the average absolute error of the left template, and MAE A is the average absolute error of the upper template; among them, MAE L and MAE A are both the first prediction error an example;
  • the second method is to retain above_T and left_T, continue with the weight-based chroma prediction in step 144, process the original chroma value and predicted chroma value of the current block according to a certain evaluation criterion at the encoding end, and then use the two Select the best control parameter, and transmit the index of the upper template or left template in the encoded bit stream or directly transmit the parameter value;
  • the third method is to also retain above_T and left_T.
  • Process with the predicted chroma value select the best control parameter from the reduced parameter interval, and transmit the index of the optimal control parameter in the reduced interval or directly transmit the parameter value in the encoded bit stream.
  • multiple optimal control parameters such as the second method and the third method, no special explanation will be given in step 144.
  • step 144 a weight-based chromaticity prediction calculation is performed according to the acquired input information.
  • predSizeH and predSizeW are determined WCP core parameters, which can be the same as or different from the height nTbH or width nTbW of the current block. In this way, under certain conditions, the following calculations can also be performed on only some of the pixels to be predicted in the current block.
  • step 144 includes the following steps 1441 to 1444:
  • Step 1441 For each pixel to be predicted, a brightness difference vector is constructed using the obtained reference chroma information, reference brightness information, and reconstructed brightness information of the current block.
  • Step 1442 For each pixel to be predicted, use a nonlinear function to calculate a weight vector according to the brightness difference vector;
  • Step 1443 For each pixel to be predicted, calculate the chromaticity prediction value through weighting according to the weight vector and the obtained reference chromaticity information;
  • Step 1444 For each pixel to be predicted, correct the calculated chroma prediction value, including a clip operation.
  • the process of obtaining the weight includes constructing the brightness difference vector and calculating the weight vector.
  • step 1441 for each pixel to be predicted, a brightness difference vector is constructed using the obtained reference chroma information, reference brightness information and reconstructed brightness information of the current block.
  • linear or nonlinear numerical processing can be performed on the brightness difference vector of the pixel to be predicted.
  • the value of the brightness difference vector of the pixel to be predicted can be scaled according to the WCP control parameter T in the WCP core parameter.
  • step 1442 for each pixel to be predicted, a weight vector is calculated using a nonlinear function according to the brightness difference vector.
  • the nonlinear weight model is used to process the brightness difference vector diffY[i][j] corresponding to each pixel to be predicted C pred [i][j], and we get The corresponding weight vector cWeightFloat[i][j].
  • Weight models include but are not limited to nonlinear normalization functions, nonlinear exponential normalization functions, and so on.
  • the nonlinear Softmax function can be used as the weight model.
  • the brightness difference vector diffY[i][j] corresponding to each pixel to be predicted C pred [i][j] is used as the input of the weight model.
  • the best control parameter (best_T) can be used as Adjustment parameters of the model.
  • the model outputs the weight vector cWeightFloat[i][j] corresponding to each pixel to be predicted.
  • step 1443 for each pixel to be predicted, the chromaticity prediction value is calculated by weighting according to the weight vector and the obtained reference chromaticity information;
  • subCFloat can be fixed-pointed. In order to retain a certain calculation accuracy during the fixed-pointing process, it can be multiplied by a coefficient, as shown in the following equation (27):
  • subC[i][j][k] round(subCFloat[i][j][k] ⁇ 2 Shift ) (27);
  • Offset 1 ⁇ (Shift 1 -1)
  • other Link refers to the amount of shift required in the fixed-point operation to improve accuracy.
  • the chroma prediction value C pred [i][j] of each pixel to be predicted is spatially stored, which is the weight-based chroma prediction output predWcp.
  • step 1444 for each pixel to be predicted, the calculated chroma prediction value is modified, including a clip operation.
  • the predicted chromaticity value in predWcp should be within the limited range. If it exceeds the limit, corresponding correction operations should be performed. For example:
  • the chroma prediction value within C pred [i][j] can be clamped, as follows:
  • step 145 a post-processing process is performed on the chromaticity prediction calculation result.
  • the weight-based chroma prediction output predWcp needs to be post-processed as the final chroma prediction value predSamples under certain conditions, otherwise the final chroma prediction value predSamples is predWcp.
  • the above scheme can improve the accuracy of WCP prediction technology.
  • this technical solution can adaptively select the best control parameters, further improve the weight model in step 144, and then obtain a better Accurate colorimetric predictions. Since the weight model used in the WCP prediction process better matches the content characteristics and spatial correlation of the current block, the prediction value can be made more accurate.
  • Extension Scheme 1 The modification of "3. Template matching" in the above scheme is only an implementation method. The main idea is to directly select an optimal control parameter through template matching in a WCP chroma prediction mode. Multiple WCP chroma prediction modes are defined in the encoder, corresponding to combinations of different template types and different template reference areas. When the current block traverses all chroma prediction modes to eliminate rate distortion and optimize to select the best chroma prediction mode, and when it reaches the WCP chroma prediction mode that belongs to a certain template type matching, in the template selection process of step 1431, only One or a relatively small number of template types and their corresponding template reference areas will be selected.
  • WCP_L means that only the left template is used in the template matching step of the WCP prediction process to select the best control parameters as parameters of the weight model of the WCP prediction of the current block
  • WCP_T means that only the upper template is used in the template matching step of the WCP prediction process.
  • WCP_LT means that only the left template and the upper template are used in the template matching step of the WCP prediction process to select the best control parameters as the WCP prediction of the current block.
  • the parameters of the weight model, where the optimal control parameters are selected are the same as in the case of multiple template types in the above scheme. Other operations are consistent with the solutions of the above embodiments.
  • Extension 2 The main idea of the above embodiment is to search for the best parameters in all obtained templates, and then perform subsequent operations through various weighted fusions or retaining multiple best parameters. However, there may be cases where this implementation is not always equal to the optimal parameters of the current block. Here is a brief explanation of another implementation method.
  • Step 1432 introduces the WCP prediction process of the upper template and the left template, so that the reconstructed chromaticity information in the respective templates and the predicted chromaticity information corresponding to a certain control parameter (T) are obtained.
  • the predicted chromaticity information corresponding to a certain control parameter (T k ) of the upper template is predAboveTempWcp k
  • the predicted chromaticity information corresponding to a certain control parameter (T k ) of the left template is predLeftTempWcp k .
  • MAE as an example, respectively Calculate the MAE A and MAE L of the upper template and the left template. Other evaluation criteria can also be used here.
  • MAE Sum that is, an example of the evaluation parameter
  • T k the control parameter
  • the processing operations include but are not limited to the following methods:
  • the first method is to perform weighted fusion of these multiple control parameters into one optimal parameter best_T.
  • the weighted fusion standard can choose a fixed weighting coefficient or assign a weighting coefficient according to the number of pixels in the template, etc.;
  • the second method is to retain these multiple control parameters, continue with the weight-based chroma prediction in step 144, process the original chroma value and predicted chroma value of the current block according to a certain evaluation criterion at the encoding end, and then proceed from Select the best parameter between the two, and transmit the index of the upper template or left template in the encoded bit stream or directly transmit the parameter value;
  • the third method is to also retain these multiple control parameters.
  • the nearby parameter values of these values are traversed, and the original chroma value of the current block is evaluated at the encoding end according to a certain evaluation criterion.
  • Process with the predicted chroma value select the best parameter from the reduced parameter interval, and transmit the index of the best control parameter in the reduced interval in the encoded bit stream or directly transmit the parameter value.
  • FIG. 18 is a schematic structural diagram of the encoding device provided by an embodiment of the present application. As shown in Figure 18, the encoding device 18 includes:
  • the first determination module 181 is configured to determine the first encoding parameter according to the template area
  • the second determination module 182 is configured to determine the reference sample of the first color component of the current block
  • the third determination module 183 is configured to determine a first weighting coefficient according to the reference sample of the first color component of the current block and the first encoding parameter;
  • the first prediction module 184 is configured to determine a first prediction value of the second color component of the current block according to the first weighting coefficient and the reference sample value of the second color component of the current block.
  • the first determination module 181 includes a first determination unit and a second determination unit; wherein the first determination unit is configured to determine the reference sample value of the template area; the second determination unit is configured to determine the reference sample value according to the template area. The reference sample value of the template area is used to determine the first encoding parameter.
  • the first determination unit is configured to determine the reconstruction value of the first color component of the template area and the reconstruction value of the second color component of the template area; determine the reconstruction value of the reference area of the template area. The reconstructed value of the first color component, and the reconstructed value of the second color component of the reference area of the template area.
  • the second determining unit includes a first subunit and a second subunit; wherein the first subunit is configured to determine the first difference value of the template area, wherein the first difference value of the template area The difference value is set equal to the absolute value of the difference between the reference value of the first color component of the template area and the reference value of the first color component of the reference area of the template area; the second subunit is configured to be based on the The first difference value of the template area is used to determine the first encoding parameter.
  • 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 the candidate first encoding parameter; determine a second predicted value of the second color component of the template region; a first prediction error of the second color component; determining the first encoding parameter according to the first prediction error; wherein the first prediction error is the reference value of the second color component of the template area and the The error between the second predicted values of the second color component of the template region, 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 the second predicted value of the second color component of the template region The value obtained by filtering the reconstructed values of the two color components.
  • the second subunit is further configured to determine the second weighting coefficient using a preset correspondence based on the first difference value of the template area and the candidate first encoding parameter.
  • the second subunit is configured to: select a parameter whose first prediction error satisfies the first condition from each candidate first coding parameter of the template region; and according to the first prediction corresponding to the template region The first encoding parameter is determined if the error satisfies the first condition.
  • the second subunit is configured to: determine the sixth weighting coefficient according to the reference sample of the first color component of the current block and the candidate first coding parameter whose first prediction error satisfies the first condition; Determine a third predicted value of the second color component of the current block according to the sixth weighting coefficient and the reference sample value of the second color component of the current block; according to the third predicted value of the second color component of the current block Three predicted values and original values are used to determine the second prediction error of the candidate first coding parameter whose corresponding first prediction error satisfies the first condition; and the second prediction error of the candidate first coding parameter that satisfies the first condition based on the first prediction error , determine the first encoding parameter.
  • the second subunit is configured to: select a candidate first coding parameter whose second prediction error satisfies the third condition from the candidate first coding parameters whose first prediction error satisfies the first condition; according to the The first coding parameter is determined as a candidate first coding parameter whose second prediction error satisfies the third condition.
  • the second subunit is configured to: set the first coding parameter to be equal to the candidate first coding parameter whose second prediction error satisfies the third condition; or set the first coding parameter to is the fusion value of the candidate first coding parameter that is equal to the second prediction error and satisfies the third condition.
  • the second subunit is configured to: extend the candidate first coding parameter whose first prediction error satisfies the first condition to obtain the first extended parameter; according to the reference of the first color component of the current block Determine a seventh weighting coefficient based on the candidate first coding parameter whose sample value and first prediction error satisfy the first condition and the first extension parameter; according to the seventh weighting coefficient and the reference of the second color component of the current block sample values, determine the fourth predicted value of the second color component of the current block; determine the third prediction error of the corresponding parameter according to the fourth predicted value and the original value of the second color component of the current block; according to each of the The first coding parameter is determined based on a third prediction error of the candidate first coding parameter and the first extended parameter.
  • the second subunit is configured to: select a parameter whose third prediction error satisfies the fourth condition from each of the candidate first coding parameters and the first extension parameter; according to the third prediction For parameters whose errors satisfy the fourth condition, the first encoding parameter is determined.
  • the second subunit is configured to: set the first coding parameter to be equal to the parameter for which the third prediction error satisfies the fourth condition; or, set the first coding parameter to be equal to the parameter for which the third prediction error satisfies the fourth condition;
  • the third prediction error is the fusion value of the parameter that satisfies the fourth condition.
  • the second subunit is configured to: set the first coding parameter to be equal to a parameter where the first prediction error satisfies the first condition; or, set the first coding parameter to be equal to the first prediction error The fusion value of the parameters whose error satisfies the first condition.
  • the second subunit is configured to: set the first coding parameter to be equal to the weighted sum of the parameter for which the first prediction error satisfies the first condition and the third weighting coefficient.
  • the second subunit is further configured to: determine the corresponding third weighting coefficient based on the first prediction error corresponding to the parameter whose first prediction error satisfies the first condition; or, change the third weighting coefficient Set to a preset constant value.
  • the second subunit is configured to extend the parameters of the first prediction error that satisfy the first condition to obtain the first extended parameter; and the first extended parameter and/or the first prediction error satisfy the first condition.
  • the parameters are fused to obtain the first coding parameters.
  • the second subunit is configured to set the first encoding parameter equal to a weighted sum of each of the candidate first encoding parameters and the fourth weighting coefficient.
  • the second subunit is further configured to determine a fourth weighting coefficient corresponding to the candidate first coding parameter according to the first prediction error.
  • the second subunit is configured to: determine an evaluation parameter characterizing the performance of the corresponding candidate first coding parameter based on the first prediction error corresponding to the same candidate first coding parameter in the template region; The evaluation parameter of the candidate first encoding parameter determines the first encoding parameter.
  • the second subunit is configured to: set the evaluation parameter equal to the fusion value of the first prediction error corresponding to the same candidate first coding parameter in the template region.
  • the second subunit is configured to: set the evaluation parameter equal to the sum of first prediction errors corresponding to the same candidate first coding parameter in the template region.
  • the second subunit is configured to: select an evaluation parameter that satisfies the second condition from each of the candidate first encoding parameters; and determine the first parameter based on the evaluation parameter that satisfies the second condition. Encoding parameters.
  • the second subunit is configured to: set the first encoding parameter to be equal to the parameter in which the evaluation parameter satisfies the second condition; or, set the first encoding parameter to be equal to the evaluation parameter to satisfy the second condition.
  • the fused values of the parameters of the condition are configured to: set the first encoding parameter to be equal to the parameter in which the evaluation parameter satisfies the second condition; or, set the first encoding parameter to be equal to the evaluation parameter to satisfy the second condition.
  • the second subunit is configured to: set the first encoding parameter to be equal to the weighted sum of the parameter in which the evaluation parameter satisfies the second condition and the fifth weighting coefficient.
  • the second subunit is further configured to: determine the fifth weighting coefficient of the corresponding parameter according to the template area corresponding to the parameter whose evaluation parameter meets the second condition.
  • the second subunit is configured to determine the fifth weighting coefficient of the corresponding parameter based on the number of pixels and/or the template type of the template area corresponding to the parameter whose evaluation parameter satisfies the second condition.
  • the second subunit is configured to: determine the eighth weighting coefficient according to the reference sample value of the first color component of the current block and the evaluation parameter that satisfies the second condition; coefficient, and the reference sample value of the second color component of the current block, determine the fifth predicted value of the second color component of the current block; based on the fifth predicted value of the second color component of the current block and the original value, determine the fourth prediction error of the parameter whose corresponding evaluation parameter satisfies the second condition; determine the first coding parameter according to the fourth prediction error of each candidate first coding parameter.
  • the second subunit is configured to: expand the parameters whose evaluation parameters satisfy the second condition to obtain the second extended parameter; according to the reference sample value of the first color component of the current block and the evaluation parameter satisfy Determine the ninth weighting coefficient according to the parameters of the second condition and the second extension parameter; determine the second color component of the current block according to the ninth weighting coefficient and the reference sample value of the second color component of the current block.
  • a sixth predicted value according to the sixth predicted value and the original value of the second color component of the current block, determine the fifth prediction error of the corresponding parameter; according to the fifth predicted value of each candidate first coding parameter and the second extension parameter Prediction error determines the first encoding parameter.
  • the first determination module 181 is further configured to determine the template area according to the template type included in the configured prediction mode.
  • the first determination module 181 is configured to use a template included in the configured prediction mode as the template region.
  • the first determination module 181 is further configured to determine the template area according to the pixel availability of the adjacent area of the current block; wherein, based on the relative position relationship with the current block, the adjacent area Including at least one of the following: the upper area of the current block, the left area of the current block, the upper right area of the current block, the lower left area of the current block, the upper left side of the current block area.
  • the first prediction module 184 is further configured to use a default value as the predicted value of the second color component of the current block when the template region does not exist.
  • the first prediction module 184 is further configured to use another prediction method different from the above method to determine the second color component of the current block for prediction when the template area does not exist.
  • the second subunit is configured to set the second predicted value used to determine the first prediction error to be equal to the second predicted value obtained by performing a correction operation on the second predicted value of the second color component of the template region. the second predicted value.
  • the encoding device 18 further includes: a first acquisition module configured to acquire the original value of the second color component of the current block; a seventh determination module configured to obtain the original value of the second color component of the current block according to The original value of the second color component and the first predicted value of the second color component determine the residual value of the second color component of the current block; the encoding module is configured to determine the residual value of the second color component of the current block. Encode and write the resulting encoded bits into the code stream.
  • the encoding device 18 further includes: a first correction module configured to perform a correction operation on the first predicted value of the second color component of the current block to obtain a corrected first predicted value; a first acquisition A module configured to obtain the original value of the second color component of the current block; an eighth determination module configured to determine based on the original value of the second color component of the current block and the modified first predicted value.
  • the residual value of the second color component of the current block; the encoding module is configured to encode the residual value of the second color component of the current block and write the resulting coded bits into the code stream.
  • the encoding device 18 further includes an encoding module configured to encode the first encoding parameter or the index of the first encoding parameter, and write the resulting encoded bits into a code stream.
  • a "module” may be part of a circuit, part of a processor, part of a program or software, etc., and of course may also be a unit, or may be non-unitized.
  • each component in this embodiment can be integrated into one processing unit, each module can exist physically alone, or two or more modules can be integrated into one unit.
  • the above integrated modules can be implemented in the form of hardware or software function modules.
  • 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 in a computer-readable storage medium.
  • the technical solution of this embodiment is essentially either The part that contributes to the existing technology or all or part of the technical solution can be embodied in the form of a software product.
  • the computer software product is stored in a storage medium and includes a number of instructions to make a computer device (can It is a personal computer, server, or network device, etc.) or processor that executes all or part of the steps of the method described in this embodiment.
  • the aforementioned storage media include: U disk, mobile hard disk, Read Only Memory (ROM), Random Access Memory (RAM), magnetic disk or optical disk and other media that can store program code.
  • embodiments of the present application provide a computer-readable storage medium that stores a computer program.
  • the computer program is executed by a first processor, the method described in any one of the preceding embodiments is implemented. .
  • the encoding device 19 may include: a first communication interface 191 , a first memory 192 and a first processor 193 ; the various components are coupled together through a first bus system 194 .
  • the first bus system 194 is used to implement connection communication between these components.
  • the first bus system 194 includes a power bus, a control bus and a status signal bus in addition to the data bus.
  • the various buses are labeled as first bus system 194 in FIG. 19 . in,
  • the first communication interface 191 is used for receiving and sending signals during the process of sending and receiving information with other external network elements;
  • a first memory 192 for storing a computer program capable of running on the first processor 193;
  • the first processor 193 is configured to, when running the computer program, perform: determine the first encoding parameter according to the template area;
  • the first memory 192 in the embodiment of the present application may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories.
  • non-volatile memory can be read-only memory (Read-Only Memory, ROM), programmable read-only memory (Programmable ROM, PROM), erasable programmable read-only memory (Erasable PROM, EPROM), electrically removable memory. Erase programmable read-only memory (Electrically EPROM, EEPROM) or flash memory.
  • Volatile memory may be Random Access Memory (RAM), which is used as an external cache.
  • RAM static random access memory
  • DRAM dynamic random access memory
  • DRAM synchronous dynamic random access memory
  • SDRAM double data rate synchronous dynamic random access memory
  • Double Data Rate SDRAM DDRSDRAM
  • enhanced SDRAM ESDRAM
  • Synchlink DRAM SLDRAM
  • Direct Rambus RAM DRRAM
  • the first memory 222 of the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.
  • the first processor 193 may be an integrated circuit chip with signal processing capabilities. During the implementation process, each step of the above method can be completed by instructions in the form of hardware integrated logic circuits or software in the first processor 193 .
  • the above-mentioned first processor 193 can be a general-purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), or an off-the-shelf programmable gate array (Field Programmable Gate Array, FPGA). or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
  • DSP Digital Signal Processor
  • ASIC Application Specific Integrated Circuit
  • FPGA Field Programmable Gate Array
  • a general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.
  • the steps of the method disclosed in conjunction with the embodiments of the present application can be directly implemented by a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor.
  • the software module can be located in random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, registers and other mature storage media in this field.
  • the storage medium is located in the first memory 192.
  • the first processor 193 reads the information in the first memory 192 and completes the steps of the above method in combination with its hardware.
  • the embodiments described in this application can be implemented using hardware, software, firmware, middleware, microcode, or a combination thereof.
  • the processing unit can be implemented in one or more Application Specific Integrated Circuits (ASIC), Digital Signal Processing (DSP), Digital Signal Processing Device (DSP Device, DSPD), programmable Logic device (Programmable Logic Device, PLD), Field-Programmable Gate Array (FPGA), general-purpose processor, controller, microcontroller, microprocessor, and other devices used to perform the functions described in this application electronic unit or combination thereof.
  • ASIC Application Specific Integrated Circuits
  • DSP Digital Signal Processing
  • DSP Device Digital Signal Processing Device
  • DSPD Digital Signal Processing Device
  • PLD programmable Logic Device
  • FPGA Field-Programmable Gate Array
  • the technology described in this application can be implemented through modules (such as procedures, functions, etc.) that perform the functions described in this application.
  • Software code may be stored in memory and executed by a processor.
  • the memory can be implemented in the processor or external to the processor.
  • the first processor 193 is further configured to perform the method described in any one of the preceding embodiments when running the computer program.
  • FIG. 20 shows a schematic structural diagram of a decoding device provided by an embodiment of the present application.
  • the decoding device 200 may include:
  • the fourth determination module 2001 is configured to determine the first decoding parameter according to the template area
  • the fifth determination module 2002 is configured to determine the reference sample value of the first color component of the current block
  • the sixth determination module 2003 is configured to determine a first weighting coefficient according to the reference sample 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 prediction value of the second color component of the current block according to the first weighting coefficient and the reference sample value of the second color component of the current block.
  • the fourth determination module 2001 includes a third determination unit and a fourth determination unit; wherein the third determination unit is configured to determine the reference sample value of the template area; the fourth determination unit is configured to The first decoding parameter is determined based on the reference samples of the template area.
  • the third determination unit is configured to: determine the reconstruction value of the first color component of the template area and the reconstruction value of the second color component of the template area; determine the reconstruction value of the reference area of the template area. The reconstructed value of the first color component, and the reconstructed value of the second color component of the reference area of the template area.
  • the fourth determining unit includes a third subunit and a fourth subunit; wherein the third subunit is configured to determine the first difference value of the template area, wherein the first difference value of the template area The difference value is set equal to the absolute value of the difference between the reference value of the first color component of the template area and the reference value of the first color component of the reference area of the template area; the fourth subunit is configured to The first difference value of the template area is used to determine the first decoding parameter.
  • the reference value of the first color component of the template area is the reconstructed value of the first color component of the template area, or the reconstructed value of the first color component of the template area is obtained by filtering.
  • the reference value of the first color component of the reference area of the template area is the reconstructed value of the first color component of the reference area of the template area, or the reconstructed value of the first color component of the reference area of the template area The value obtained after filtering.
  • the fourth subunit is configured to: determine a second predicted value of the second color component of the template region according to the first difference value and the candidate first decoding parameter; determine a second predicted value of the second color component of the template region; a first prediction error of the second color component; determining the first decoding parameter according to the first prediction error; wherein the first prediction error is the reference value of the second color component of the template area and the The error between the second predicted values of the second color component of the template region, 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 the second predicted value of the second color component of the template region The value obtained by filtering the reconstructed values of the two color components.
  • the fourth subunit is configured to set the second predicted value of the second color component of the template area to be equal to the reference value of the second color component of the reference area of the template area and the second weighted value.
  • the weighted sum of coefficients setting the first decoding parameter equal to the value of the candidate first decoding parameter corresponding to when the first prediction error reaches the first condition; wherein, the reference area of the template area
  • the reference value of the second color component is the reconstructed value of the second color component of the reference area of the template area, or the value obtained by filtering the reconstructed value of the second color component of the reference area of the template area.
  • the fourth subunit is further configured to determine the second weighting coefficient using a preset correspondence based on the first difference value of the template area and the candidate first decoding parameter.
  • the fourth subunit is configured to: select a parameter whose first prediction error satisfies the first condition from each candidate first decoding parameter of the template region; and according to the first prediction corresponding to the template region The parameter whose error satisfies the first condition is determined as the first decoding parameter.
  • the fourth subunit is configured to: set the first decoding parameter to be equal to a parameter where the first prediction error satisfies the first condition; or, set the first decoding parameter to be equal to the first prediction error The fusion value of the parameters whose error satisfies the first condition.
  • the fourth subunit is configured to: set the first decoding parameter to be equal to the weighted sum of the parameter for which the first prediction error satisfies the first condition and the third weighting coefficient.
  • the fourth subunit is further configured to: determine the corresponding third weighting coefficient according to the first prediction error corresponding to the parameter whose first prediction error satisfies the first condition; or, change the third weighting coefficient Set to a preset constant value.
  • the fourth subunit is configured to: extend the parameters of the first prediction error that satisfy the first condition to obtain the first extended parameter; and extend the first extended parameter and/or the first prediction error that satisfy the first condition.
  • the parameters of a condition are fused to obtain the first decoding parameter.
  • the fourth subunit is configured to set the first decoding parameter equal to the weighted sum of each of the candidate first decoding parameters and the fourth weighting coefficient.
  • the fourth subunit is further configured to: determine a corresponding fourth weighting coefficient of the candidate first decoding parameter according to the first prediction error.
  • the first condition includes: the first prediction error is minimum or the first prediction error is less than a first threshold.
  • the fourth subunit is configured to: determine an evaluation parameter characterizing the performance of the corresponding candidate first decoding parameter according to the first prediction error corresponding to the same candidate first decoding parameter in the template region; The evaluation parameter of the candidate first decoding parameter determines the first decoding parameter.
  • the fourth subunit is configured to set the evaluation parameter equal to the fusion value of the first prediction error corresponding to the same candidate first decoding parameter in the template region.
  • the fourth subunit is configured to: set the evaluation parameter equal to the sum of first prediction errors corresponding to the same candidate first decoding parameter in the template region.
  • the fourth subunit is configured to: select parameters whose evaluation parameters satisfy the second condition from each of the candidate first decoding parameters; and determine the first parameter according to the parameters whose evaluation parameters satisfy the second condition. Decoding parameters.
  • the fourth subunit is configured to: set the first decoding parameter to be equal to a parameter in which the evaluation parameter satisfies the second condition; or, set the first decoding parameter to be equal to the parameter in which the evaluation parameter satisfies the second condition.
  • the fused values of the parameters of the condition are configured to: set the first decoding parameter to be equal to a parameter in which the evaluation parameter satisfies the second condition; or, set the first decoding parameter to be equal to the parameter in which the evaluation parameter satisfies the second condition.
  • the fourth subunit is configured to: set the first decoding parameter to be equal to the weighted sum of the parameter in which the evaluation parameter satisfies the second condition and the fifth weighting coefficient.
  • the fourth subunit is further configured to: determine the fifth weighting coefficient of the corresponding parameter according to the template area corresponding to the parameter whose evaluation parameter satisfies the second condition.
  • the fourth subunit is configured to: determine the fifth weighting coefficient of the corresponding parameter according to the number of pixels and/or the template type of the template area corresponding to the parameter whose evaluation parameter satisfies the second condition.
  • the decoding device 200 further includes a parsing module configured to parse the code stream to obtain the index of the first decoding parameter; and a second acquisition module configured to obtain the index of the first decoding parameter according to the index of the first decoding parameter.
  • the first decoding parameter; or, the parsing module is configured to parse the code stream to obtain the first decoding parameter.
  • the fourth determination module 2001 is further configured to determine the template area according to the template type included in the configured prediction mode.
  • the template type includes at least one of the following: an upper template, a left template, an upper right template, a lower left template, and an upper left template.
  • the fourth determination module 2001 is configured to set the template area to an area corresponding to the template type included in the configured prediction mode.
  • the fourth determination module 2001 is further configured to determine the template area according to the pixel availability of the adjacent area of the current block; wherein the adjacent area includes at least one of the following: the upper side of the current block area, the left area of the current block, the upper right area of the current block, the lower left area of the current block, and the upper left area of the current block.
  • the second prediction module 2004 is further configured to use a default value as the predicted value of the second color component of the current block based on determining that the template region does not exist.
  • the second prediction module 2004 is further configured to use another prediction method different from the above method to determine the second color component of the current block for prediction based on determining that the template area does not exist.
  • the fourth subunit is configured to: set the second predicted value used to determine the first prediction error equal to performing a correction operation on the second predicted value of the second color component of the template region. The second predicted value obtained.
  • the decoding device 200 further includes a parsing module configured to parse the code stream to obtain the residual value of the second color component of the current block; a ninth determination module configured to obtain the residual value of the second color component according to the The residual value and the first predicted value of the second color component of the current block determine the reconstructed value of the second color component of the current block.
  • the decoding device 200 further includes a second correction module and a tenth determination module; wherein the second correction module is configured to perform a correction operation on the first predicted value of the second color component of the current block, to obtain a modified first predicted value; a tenth determination module configured to determine a reconstruction value of the second color component of the current block according to the residual value of the second color component and the modified first predicted value; .
  • a "module” may be part of a circuit, part of a processor, part of a program or software, etc., and of course may also be a unit, or may be non-unitized.
  • each component in this embodiment can be integrated into one processing unit, each module can exist physically alone, or two or more modules can be integrated into one unit.
  • the above integrated modules can be implemented in the form of hardware or software function modules.
  • 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 in a computer-readable storage medium. Based on this understanding, this embodiment provides a computer-readable storage medium that stores a computer program. When the computer program is executed by a second processor, any one of the preceding embodiments is implemented. Methods.
  • the decoding device 21 may include: a second communication interface 211 , a second memory 212 and a second processor 213 ; each component is coupled together through a second bus system 214 .
  • the second bus system 214 is used to implement connection communication between these components.
  • the second bus system 214 also includes a power bus, a control bus and a status signal bus.
  • various buses are labeled as second bus system 214 in FIG. 21 . in,
  • the second communication interface 211 is used to receive and send signals during the process of sending and receiving information with other external network elements; the second memory 212 is used to store computer programs that can run on the second processor 213; Two processors 213, configured to execute the method described in any one of the preceding embodiments when running the computer program.
  • the second processor 213 is further configured to perform the method described in any one of the preceding embodiments when running the computer program.
  • FIG. 22 shows a schematic structural diagram of a coding and decoding system provided by an embodiment of the present application.
  • the encoding and decoding system 22 may include an encoder 221 and a decoder 222 .
  • the encoder 221 can be a device integrated with the encoding device 18 described in the previous embodiment, or can also be the encoding device 19 described in the previous embodiment;
  • the decoder 222 can be a device integrated with the decoding device 200 described in the previous embodiment. device, or may also be the decoding device 21 described in the previous embodiment.

Abstract

本申请实施例公开了一种编解码方法、装置、编码设备、解码设备以及存储介质,其中所述解码方法包括:根据模板区域,确定第一解码参数;确定当前块的第一颜色分量的参考样值;根据所述当前块的第一颜色分量的参考样值和所述第一解码参数,确定第一加权系数;根据所述第一加权系数和所述当前块的第二颜色分量的参考样值,确定所述当前块的第二颜色分量的第一预测值。

Description

编解码方法、装置、编码设备、解码设备以及存储介质 技术领域
本申请实施例涉及视频编解码技术领域,尤其涉及一种编解码方法、装置、编码设备、解码设备以及存储介质。
背景技术
随着人们对视频显示质量要求的提高,高清和超高清视频等新视频应用形式应运而生。国际标组织ISO/IEC和ITU-T的联合视频研究组(Joint Video Exploration Team,JVET)制定了下一代视频编码标准H.266/多功能视频编码(Versatile Video Coding,VVC)。
H.266/VVC中包含了颜色分量间预测技术。然而,H.266/VVC的颜色分量间预测技术计算得到的当前块的预测值与原始值之间存在较大偏差,这导致预测准确度低,造成解码视频的质量下降,降低了编码性能。
发明内容
本申请实施例提供一种编解码方法、装置、编码设备、解码设备以及存储介质,能够提高第二颜色分量的预测准确性,从而节省码率,提升编解码性能。
第一方面,本申请实施例提供了一种解码方法,该方法包括:根据模板区域,确定第一解码参数;确定当前块的第一颜色分量的参考样值;根据所述当前块的第一颜色分量的参考样值和所述第一解码参数,确定第一加权系数;根据所述第一加权系数和所述当前块的第二颜色分量的参考样值,确定所述当前块的第二颜色分量的第一预测值。
第二方面,本申请实施例提供了一种编码方法,该方法包括:根据模板区域,确定第一编码参数;确定当前块的第一颜色分量的参考样值;根据所述当前块的第一颜色分量的参考样值和所述第一编码参数,确定第一加权系数;根据所述第一加权系数和所述当前块的第二颜色分量的参考样值,确定所述当前块的第二颜色分量的第一预测值;这样,根据模板区域,确定第一编码参数,基于此能够得到更符合当前块特点的第一加权系数,从而提高当前块的第二颜色分量的预测准确性,进而节省码率,提升编码性能。
第三方面,本申请实施例提供了一种编码装置,包括:第一确定模块、第二确定模块、第三确定模块和第一预测模块;其中,第一确定模块,配置为根据模板区域,确定第一编码参数;第二确定模块,配置为确定当前块的第一颜色分量的参考样值;第三确定模块,配置为根据所述当前块的第一颜色分量的参考样值和所述第一编码参数,确定第一加权系数;第一预测模块,配置为根据所述第一加权系数和所述当前块的第二颜色分量的参考样值,确定所述当前块的第二颜色分量的第一预测值。
第四方面,本申请实施例提供了一种编码设备,包括第一存储器和第一处理器;其中,第一存储器,用于存储能够在第一处理器上运行的计算机程序;第一处理器,用于在运行计算机程序时,执行如第二方面所述的方法。
第五方面,本申请实施例提供了一种解码装置,包括:第四确定模块,配置为根据模板区域,确定第一解码参数;第五确定模块,配置为确定当前块的第一颜色分量的参考样值;第六确定模块,配置为根据所述当前块的第一颜色分量的参考样值和所述第一解码参数,确定第一加权系数;第二预测模块,配置为根据所述第一加权系数和所述当前块的第二颜色分量的参考样值,确定所述当前块的第二颜色分量的第一预测值。
第六方面,本申请实施例提供了一种解码设备,包括第二存储器和第二处理器;其中,第二存储器,用于存储能够在第二处理器上运行的计算机程序;第二处理器,用于在运行计算机程序时,执行如第一方面所述的方法。
第七方面,本申请实施例提供了一种计算机可读存储介质,该计算机可读存储介质存储有计算机程序,所述计算机程序被执行时实现如第一方面所述的方法、或者实现如第二方面所述的方法。
附图说明
图1为一种有效相邻区域的分布示意图;
图2为一种不同预测模式下选择区域的分布示意图;
图3为一种模型参数推导方案的流程示意图;
图4A为本申请实施例提供的一种编码器的组成框图示意图;
图4B为本申请实施例提供的一种解码器的组成框图示意图;
图5为本申请实施例提供的编码方法的实现流程示意图;
图6为本申请实施例提供的当前块的邻近区域的位置示意图;
图7为本申请实施例提供的上模板与左模板和当前块不交界的示例示意图;
图8为本申请实施例提供的不同类型的模板与当前块交界的示例示意图;
图9为本申请实施例提供的实现步骤51的流程示意图;
图10为本申请实施例提供的左模板与参考区域重叠的示例示意图;
图11为本申请实施例提供的左模板和右模板的参考区域的另一示例示意图;
图12A为本申请实施例提供的左模板和右模板的参考区域的又一示例示意图;
图12B为本申请实施例提供的WCP预测过程示意图;
图13为本申请实施例提供的解码方法的实现流程示意图;
图14为本申请实施例提供的WCP技术的预测过程示意图;
图15为本申请实施例提供的当前块的参考区域的示例示意图;
图16为本申请实施例提供的实现步骤143的流程示意图;
图17为本申请实施例提供的实现步骤144的流程示意图;
图18为本申请实施例提供的编码装置的结构示意图;
图19为本申请实施例提供的一种编码设备的具体硬件结构示意图;
图20为本申请实施例提供的一种解码装置的组成结构示意图;
图21为本申请实施例提供的一种解码设备的具体硬件结构示意图;
图22为本申请实施例提供的一种编解码系统的组成结构示意图。
具体实施方式
为了能够更加详尽地了解本申请实施例的特点与技术内容,下面结合附图对本申请实施例的实现进行详细阐述,所附附图仅供参考说明之用,并非用来限定本申请实施例。
除非另有定义,本文所使用的所有的技术和科学术语与属于本申请的技术领域的技术人员通常理解的含义相同。本文中所使用的术语只是为了描述本申请实施例的目的,不是旨在限制本申请。
在以下的描述中,涉及到“一些实施例”,其描述了所有可能实施例的子集,但是可以理解,“一些实施例”可以是所有可能实施例的相同子集或不同子集,并且可以在不冲突的情况下相互结合。还需要指出,本申请实施例所涉及的术语“第一\第二\第三”仅是用于区别类似的对象,不代表针对对象的特定排序,可以理解地,“第一\第二\第三”在允许的情况下可以互换特定的顺序或先后次序,以使这里描述的本申请实施例能够以除了在这里图示或描述的以外的顺序实施。
在视频图像中,一般采用三个颜色分量来表征编码块(Coding Block,CB);其中,这三个颜色分量分别为一个亮度分量、一个蓝色色度分量和一个红色色度分量。示例性地,亮度分量通常使用符号Y表示,蓝色色度分量通常使用符号Cb或者U表示,红色色度分量通常使用符号Cr或者V表示;这样,视频图像可以用YCbCr格式表示,也可以用YUV格式表示。除此之外,视频图像也可以是RGB格式或YCgCo格式等,本申请实施例不作任何限定。
可以理解,在当前的视频图像或者视频编解码过程中,对于跨分量预测技术,主要包括分量间线性模型(Cross-component Linear Model,CCLM)预测模式和多方向线性模型(Multi-Directional Linear Model,MDLM)预测模式,无论是根据CCLM预测模式推导的模型参数,还是根据MDLM预测模式推导的模型参数,其对应的预测模型均可以实现第一颜色分量到第二颜色分量、第二颜色分量到第一颜色分量、第一颜色分量到第三颜色分量、第三颜色分量到第一颜色分量、第二颜色分量到第三颜色分量、或者第三颜色分量到第二颜色分量等颜色分量间的预测。
以第一颜色分量到第二颜色分量的预测为例,假定第一颜色分量为亮度分量,第二颜色分量为色度分量,为了减少亮度分量与色度分量之间的冗余,在VVC中使用CCLM预测模式,即根据同一编码块的重建亮度值来构造色度的预测值,如:Pred C(i,j)=α·Rec L(i,j)+β。
其中,i,j表示编码块中待预测像素的位置坐标,i表示水平方向,j表示竖直方向;Pred C(i,j)表示编码块中位置坐标(i,j)的待预测像素对应的色度预测值,Rec L(i,j)表示同一编码块中(经过下采样的)位置坐标(i,j)的待预测像素对应的重建亮度值。另外,α和β表示模型参数,可通过参考像素推导得到。
对于编码块而言,其相邻区域可以分为五部分:左侧相邻区域、上侧相邻区域、左下侧相邻区域、左上侧相邻区域和右上侧相邻区域。在H.266/VVC中包括三种跨分量线性模型预测模式,分别为:左侧及上侧相邻的帧内CCLM预测模式(可以用INTRA_LT_CCLM表示)、左侧及左下侧相邻的帧内CCLM预测模式(可以用INTRA_L_CCLM表示)和上侧及右上侧相邻的帧内CCLM预测模式(可以用INTRA_T_CCLM表示)。在这三种预测模式中,每种预测模式都可以选取预设数量(比如4个)的参考像素用于模型参数α和β的推导,而这三种预测模式的最大区别在于用于推导模型参数α和β的参考像素对应的选择区域是不同的。
具体地,针对色度分量对应的编码块尺寸为W×H,假定参考像素对应的上侧选择区域为W′,参考像素对应的左侧选择区域为H′;这样,
对于INTRA_LT_CCLM模式,参考像素可以在上侧相邻区域和左侧相邻区域进行选取,即W′=W, H′=H;对于INTRA_L_CCLM模式,参考像素可以在左侧相邻区域和左下侧相邻区域进行选取,即H′=W+H,并设置W′=0;对于INTRA_T_CCLM模式,参考像素可以在上侧相邻区域和右上侧相邻区域进行选取,即W′=W+H,并设置H′=0。
需要注意的是,在VTM5.0中,对于右上侧相邻区域内最多只存储了W范围的像素点,对于左下侧相邻区域内最多只存储了H范围的像素点;因此,虽然INTRA_L_CCLM模式和INTRA_T_CCLM模式的选择区域的范围定义为W+H,但是在实际应用中,INTRA_L_CCLM模式的选择区域将限制在H+H之内,INTRA_T_CCLM模式的选择区域将限制在W+W之内;这样,
对于INTRA_L_CCLM模式,参考像素可以在左侧相邻区域和左下侧相邻区域进行选取,H′=min{W+H,H+H};
对于INTRA_T_CCLM模式,参考像素可以在上侧相邻区域和右上侧相邻区域进行选取,W′=min{W+H,W+W}。
参见图1,其示出了一种有效相邻区域的分布示意图。在图1中,左侧相邻区域、左下侧相邻区域、上侧相邻区域和右上侧相邻区域都是有效的;另外,灰色填充的块即为编码块中位置坐标为(i,j)的待预测像素。
如此,在图1的基础上,针对三种预测模式的选择区域如图2所示。其中,在图2中,(a)表示了INTRA_LT_CCLM模式的选择区域,包括了左侧相邻区域和上侧相邻区域;(b)表示了INTRA_L_CCLM模式的选择区域,包括了左侧相邻区域和左下侧相邻区域;(c)表示了INTRA_T_CCLM模式的选择区域,包括了上侧相邻区域和右上侧相邻区域。这样,在确定出三种预测模式的选择区域之后,可以在选择区域内进行用于模型参数推导的像素选取。如此选取到的像素可以称为参考像素,通常参考像素的个数为4个;而且对于一个尺寸确定的W×H的编码块,其参考像素的位置一般是确定的。
在获取到预设数量的参考像素之后,目前是按照图3所示的模型参数推导方案的流程示意图进行色度预测。根据图3所示的流程,假定预设数量为4个,该流程可以包括:
S301:在选择区域中获取参考像素。
S302:判断有效参考像素的个数。
S303:若有效参考像素的个数为0,则将模型参数α设置为0,β设置为默认值。
S304:色度预测值填充为默认值。
S305:若有效参考像素的个数为4,则经过比较获得亮度分量中较大值的两个参考像素和较小值的两个参考像素。
S306:计算较大值对应的均值点和较小值对应的均值点。
S307:根据两个均值点推导得到模型参数α和β。
S308:使用α和β所构建的预测模型进行色度预测。
需要说明的是,在VVC中,有效参考像素为0的这一步骤是根据相邻区域的有效性进行判断的。
还需要说明的是,利用“两点确定一条直线”原则来构建预测模型,这里的两点可以称为拟合点。目前的技术方案中,在获取到4个参考像素之后,经过比较获得亮度分量中较大值的两个参考像素和较小值的两个参考像素;然后根据较大值的两个参考像素,求取一均值点(可以用mean max表示),根据较小值的两个参考像素,求取另一均值点(可以用mean min表示),即可得到两个均值点mean max和mean min;再将mean max和mean min作为两个拟合点,能够推导出模型参数(用α和β表示);最后根据α和β构建出预测模型,并根据该预测模型进行色度分量的预测处理。
然而,在相关技术中,针对每个编码块都使用简单的线性模型Pred C(i,j)=α·Rec L(i,j)+β来预测色度分量,并且每个编码块任意位置像素都使用相同的模型参数α和β进行预测。这样会导致以下缺陷:(1)不同内容特性的编码块都利用简单线性模型进行亮度到色度的映射,以此实现色度预测,但是并非任意编码块内的亮度到色度的映射函数都可以准确由此简单线性模型拟合,这导致部分编码块预测效果不够准确;(2)在预测过程中,编码块内不同位置的像素点均使用相同的模型参数α和β,编码块内不同位置的预测准确性的同样存在较大差异。(3)在CCLM预测过程中,未充分考虑不同内容与不同尺寸的编码块的特性,这样会失去当前块的重建亮度信息与参考区域的参考信息的高度相关性,这会导致部分编码块在此技术下无法准确预测,从而影响该技术的增益效果。总之,CCLM技术的相关方案下部分编码块的预测值与原始值之间存在较大偏差,导致预测准确度低,造成质量下降,进而降低了编解码效率。
基于此,本申请实施例提供了一种编解码方法,无论是编码端还是解码端,方法原理是一样的,以编码端为例,通过根据模板区域,确定第一编码参数;确定所述当前块的第一颜色分量的参考样值;根据所述当前块的第一颜色分量的参考样值和所述第一编码参数,确定第一加权系数;根据所述第一加权系数和所述当前块的第二颜色分量的参考样值,确定所述当前块的第二颜色分量的第一预测值。这样, 根据模板区域,确定第一编码参数,基于此能够得到更符合当前块特点的第一加权系数,从而提高当前块的第二颜色分量的预测准确性,进而节省码率,提升编码性能。
下面将结合附图对本申请各实施例进行详细说明。
参见图4A,其示出了本申请实施例提供的一种编码器的组成框图示意图。如图4A所示,编码器(具体为“视频编码器”)100可以包括变换与量化单元101、帧内估计单元102、帧内预测单元103、运动补偿单元104、运动估计单元105、反变换与反量化单元106、滤波器控制分析单元107、滤波单元108、编码单元109和解码图像缓存单元110等,其中,滤波单元108可以实现去方块滤波及样本自适应缩进(Sample Adaptive 0ffset,SAO)滤波,编码单元109可以实现头信息编码及基于上下文的自适应二进制算术编码(Context-based Adaptive Binary Arithmetic Coding,CABAC)。针对输入的原始视频信号,通过编码树块(Coding Tree Unit,CTU)的划分可以得到一个视频编码块,然后对经过帧内或帧间预测后得到的残差像素信息通过变换与量化单元101对该视频编码块进行变换,包括将残差信息从像素域变换到变换域,并对所得的变换系数进行量化,用以进一步减少比特率;帧内估计单元102和帧内预测单元103是用于对该视频编码块进行帧内预测;明确地说,帧内估计单元102和帧内预测单元103用于确定待用以编码该视频编码块的帧内预测模式;运动补偿单元104和运动估计单元105用于执行所接收的视频编码块相对于一或多个参考帧中的一或多个块的帧间预测编码以提供时间预测信息;由运动估计单元105执行的运动估计为产生运动向量的过程,所述运动向量可以估计该视频编码块的运动,然后由运动补偿单元104基于由运动估计单元105所确定的运动向量执行运动补偿;在确定帧内预测模式之后,帧内预测单元103还用于将所选择的帧内预测数据提供到编码单元109,而且运动估计单元105将所计算确定的运动向量数据也发送到编码单元109;此外,反变换与反量化单元106是用于该视频编码块的重构建,在像素域中重构建残差块,该重构建残差块通过滤波器控制分析单元107和滤波单元108去除方块效应伪影,然后将该重构残差块添加到解码图像缓存单元110的帧中的一个预测性块,用以产生经重构建的视频编码块;编码单元109是用于编码各种编码参数及量化后的变换系数,在基于CABAC的编码算法中,上下文内容可基于相邻编码块,可用于编码指示所确定的帧内预测模式的信息,输出该视频信号的码流;而解码图像缓存单元110是用于存放重构建的视频编码块,用于预测参考。随着视频图像编码的进行,会不断生成新的重构建的视频编码块,这些重构建的视频编码块都会被存放在解码图像缓存单元110中。
参见图4B,其示出了本申请实施例提供的一种解码器的组成框图示意图。如图4B所示,解码器(具体为“视频解码器”)200包括解码单元201、反变换与反量化单元202、帧内预测单元203、运动补偿单元204、滤波单元205和解码图像缓存单元206等,其中,解码单元201可以实现头信息解码以及CABAC解码,滤波单元205可以实现去方块滤波以及SAO滤波。输入的视频信号经过图4A的编码处理之后,输出该视频信号的码流;该码流输入解码器200中,首先经过解码单元201,用于得到解码后的变换系数;针对该变换系数通过反变换与反量化单元202进行处理,以便在像素域中产生残差块;帧内预测单元203可用于基于所确定的帧内预测模式和来自当前帧或图片的先前经解码块的数据而产生当前视频解码块的预测数据;运动补偿单元204是通过剖析运动向量和其它关联语法元素来确定用于视频解码块的预测信息,并使用该预测信息以产生正被解码的视频解码块的预测性块;通过对来自反变换与反量化单元202的残差块与由帧内预测单元203或运动补偿单元204产生的对应预测性块进行求和,而形成解码的视频块;该解码的视频信号通过滤波单元205以便去除方块效应伪影,可以改善视频质量;然后将经解码的视频块存储于解码图像缓存单元206中,解码图像缓存单元206存储用于后续帧内预测或运动补偿的参考图像,同时也用于视频信号的输出,即得到了所恢复的原始视频信号。
需要说明的是,本申请实施例的方法主要应用在如图4A所示的帧内预测单元103部分和如图4B所示的帧内预测单元203部分。也就是说,本申请实施例既可以应用于编码器,也可以应用于解码器,甚至还可以同时应用于编码器和解码器,但是本申请实施例不作具体限定。
还需要说明的是,当应用于帧内预测单元103部分时,“当前块”具体是指当前待进行帧内预测的编码块;当应用于帧内预测单元203部分时,“当前块”具体是指当前待进行帧内预测的解码块。
首先对本申请实施例提供的编码方法进行介绍,图5为本申请实施例提供的编码方法的实现流程示意图,如图5所示,该方法可以包括如下步骤51至步骤54:
步骤51,根据模板区域,确定第一编码参数;
步骤52,确定所述当前块的第一颜色分量的参考样值;
步骤53,根据所述当前块的第一颜色分量的参考样值和所述第一编码参数,确定第一加权系数;
步骤54,根据所述第一加权系数和所述当前块的第二颜色分量的参考样值,确定所述当前块的第二颜色分量的第一预测值。
在本申请实施例中,第一编码参数是根据模板区域而确定的,而不是预设的固定值,因此得到的第 一加权系数更加符合当前块的特点,从而能够提高当前块的第二颜色分量的准确性,进而节省码率,提升编码性能。
以下分别对上述各个步骤的进一步的可选的实施方式以及相关名词等进行说明。
在步骤51中,根据模板区域,确定第一编码参数。
本申请实施例中,模板区域可以包含当前块的部分区域或全部区域,以及当前块的参考区域;模板区域也可以不包含当前块,而是包含模板区域的参考区域。在一些实施例中,模板区域为已编码的区域。
可以先确定模板区域。例如,根据所述当前块的邻近区域的像素可用性,确定所述模板区域;其中,基于与所述当前块的相对位置关系,所述邻近区域包括以下至少之一:所述当前块的上侧区域、所述当前块的左侧区域、所述当前块的上右侧区域、所述当前块的左下侧区域、所述当前块的左上侧区域。
可以理解地,不可用的像素不设置为模板区域的像素。在一些实施例中,可以根据邻近区域中的像素的位置和/或该像素的编码状态,确定该像素的像素可用性。比如,该像素的位置属于定义的边缘区域,则确定该像素不可用。又如,该像素的编码状态为未编码,确定该像素不可用;再如,该像素的位置属于定义的边缘区域,并且该像素的编码状态为未编码,确定该像素不可用。
在本申请实施例中,当前块的邻近区域可以包括与当前块交界的区域和/或不交界的区域。以与当前块交界的区域为例,如图6所示,邻近区域可以包括图中所示的各个方位的区域中的至少之一。
又如,也可以这样确定模板区域:根据配置的预测模式包括的模板类型,确定所述模板区域。
在一些实施例中,所述模板类型至少包括以下至少之一:上模板、左模板、上右模板、左下模板、左上模板。
进一步地,在一些实施例中,可以将配置的预测模式包括的模板作为所述模板区域。
模板区域可以包括与当前块交界的区域,也可以包括与当前块不交界的区域。例如图7所示,其示出了上模板与左模板和当前块不交界的情况;又如图8所示,其示出了上模板、左模板、上右模板、左下模板以及左上模板和当前块交界的情况。
需要说明的是,对于邻近区域的宽度和高度可以根据码率等指标要求进行配置。同样地,对于模板区域的宽度和高度也可以根据码率等指标要求进行配置。
在确定所述模板区域之后,在一些实施例中,如图9所示,可以通过如下步骤511和步骤512实现步骤51:
步骤511,确定所述模板区域的参考样值。
在一些实施例中,所述模板区域的参考样值包括:所述模板区域的第一颜色分量的重建值、所述模板区域的第二颜色分量的重建值、所述模板区域的参考区域的第一颜色分量的重建值和所述模板区域的参考区域的第二颜色分量的重建值。
模板区域的参考区域随模板区域的类型而变化,并允许模板区域与其参考区域重叠。在一些实施例中,所述模板区域的参考区域包含以下至少之一:所述模板区域的上相邻区域;所述模板区域的下相邻区域;所述模板区域的左相邻区域;所述模板区域的右相邻区域;所述模板区域;其中,在所述模板区域的参考区域包含所述模板区域的情况下,所述参考区域的面积大于所述模板区域的面积。在本申请实施例中,对于模板区域的上、下、左、右相邻区域的大小不做限定,可以根据模板区域的类型预先设置相邻区域的大小。模板区域的上相邻区域和下相邻区域的左右边缘可以是与上模板的左右边缘对齐的,也可以是不对齐的。同样地,模板区域的左相邻区域和右相邻区域的上下边缘可以是与左模板的上下边缘对齐的,也可以是不对齐的。
举例而言,如图10所示,其示出了左模板与参考区域重叠的示例,以及右模板与参考区域重叠的示例,上模板的参考区域包含上模板,左模板的参考区域包含左模板;又如图11所示,其示出了左模板和右模板的参考区域,该参考区域包括上模板的上相邻区域和左模板的左相邻区域;再如图12A所示,其示出了左模板和右模板的参考区域,该参考区域包括上模板的下相邻区域和左模板的右相邻区域。
步骤512,根据所述模板区域的参考样值,确定所述第一编码参数。
在一些实施例中,可以通过步骤5121和步骤5122实现步骤512:
步骤5121,确定所述模板区域的第一差值,其中,所述模板区域的第一差值设置为等于所述模板区域的第一颜色分量的参考值与所述模板区域的参考区域的第一颜色分量的参考值之间差值的绝对值。
进一步地,在一些实施例中,所述模板区域的第一颜色分量的参考值是所述模板区域的第一颜色分量的重建值,或所述模板区域的第一颜色分量的重建值经滤波处理得到的值;所述模板区域的参考区域的第一颜色分量的参考值是所述模板区域的参考区域的第一颜色分量的重建值,或所述模板区域的参考区域的第一颜色分量的重建值经滤波处理得到的值。
步骤5122,根据所述模板区域的第一差值,确定所述第一编码参数。
进一步地,在一些实施例中,可以通过查询预先设置的第一差值与第一编码参数的映射表,确定所 述第一编码参数;其中所述映射表记录的是不同的第一差值分别对应的可以使码率达到最大时对应的第一编码参数。在又一些实施例中,可以通过步骤5122-1至步骤5122-3实现步骤5122:
步骤5122-1,根据所述第一差值和候选第一编码参数,确定所述模板区域的第二颜色分量的第二预测值。
在一些实施例中,所述模板区域的第二颜色分量的第二预测值设置为等于所述模板区域的参考区域的第二颜色分量的参考值与第二加权系数的加权和。
进一步地,在一些实施例中,根据所述模板区域的第一差值和所述候选第一编码参数,使用预设的对应关系,确定所述第二加权系数。
在一些实施例中,对于预设的对应关系不做限定,可以是各种类型的函数模型,候选第一编码参数为该函数模型的一模型参数,其影响着第二加权系数的大小。预设的对应关系也可以是使用函数模型得到的,比如该预设的对应关系是第一差值和候选第一编码参数对应的第二加权系数。
更进一步地,在一些实施例中,所述预设的对应关系是softmax函数;其中,所述softmax函数的输入为以下之一:所述第一差值与所述候选第一编码参数的比值;所述第一差值与所述候选第一编码参数的乘积;所述第一差值经比特移位处理后得到的值;其中,所述比特移位的位数等于所述候选第一编码参数。所述比特移位的方向可以是向左或向右。
例如,如下公式(1)所示,其示出了softmax函数的一种示例:
Figure PCTCN2022086470-appb-000001
其中,[i]表示模板区域中像素坐标为(i,j)的像素的横坐标,[j]表示模板区域中像素坐标为(i,j)的像素的纵坐标。cTempWeight[i][j][k]表示模板区域中像素坐标为(i,j)的像素对应的模板区域的参考区域的第k个像素的第二加权系数;diffTempY[i][j][k]表示模板区域中像素坐标为(i,j)的像素的第一颜色分量的参考值与模板区域中像素坐标为(i,j)的像素对应的模板区域的参考区域的第k个像素的第一颜色分量的参考值之间的差值的绝对值;inTempSize表示模板区域的参考区域的像素数目;T表示候选第一编码参数;diffTempY[i][j][k]的计算公式如下式(2)所示:
diffTempY[i][j][k]=abs(refTempY[k]-recTempY[i][j])  (2);
其中,refTempY[k]表示模板区域的参考区域的第k个像素的第一颜色分量的参考值,recTempY[i][j]表示模板区域中像素坐标为(i,j)的像素的第一颜色分量的参考值。
基于此,计算模板区域中像素坐标为(i,j)的像素的第二颜色分量的第二预测值,如式(3)所示:
Figure PCTCN2022086470-appb-000002
即,所述模板区域的像素坐标为(i,j)的像素的第二颜色分量的第二预测值设置为等于所述模板区域的参考区域的每一像素的第二颜色分量的参考值与对应的第二加权系数的加权和。
在一些实施例中,所述预设的对应关系也可以是使用softmax函数得到的。可以先根据softmax函数预先计算得到预设的对应关系(例如预设的映射表),然后在确定第二加权系数时,通过查询所述预设的对应关系,得到所述模板区域的第一差值和所述候选解码参数对应的第二加权系数。
在一些实施例中,所述候选第一编码参数包含一个或多个候选第一编码参数。对于每一候选第一编码参数,均可通过步骤5122-1和步骤5122-2计算得到对应的第一预测误差。
步骤5122-2,确定所述模板区域的第二颜色分量的第一预测误差;其中,所述第一预测误差是所述模板区域的第二颜色分量的参考值与所述模板区域的第二颜色分量的第二预测值之间的误差,所述模板区域的第二颜色分量的参考值是所述模板区域的第二颜色分量的重建值,或所述模板区域的第二颜色分量的重建值经滤波处理得到的值。
在一些实施例中,将用于确定所述第一预测误差的第二预测值设置为等于对所述模板区域的第二颜色分量的第二预测值进行修正操作得到的第二预测值。
步骤5122-3,根据所述第一预测误差,确定所述第一编码参数。
在本申请实施例中,对于实现步骤5122-3的实施例不做限定,可以是各种各样的。例如,可以通过如下实施例1至实施例4中的任一示例实现。
在实施例1中,可以这样实现步骤5122-3:将所述第一编码参数设置为等于可以使所述第一预测误差达到第一条件时对应的所述候选第一编码参数的取值;其中,所述模板区域的参考区域的第二颜色分量的参考值是所述模板区域的参考区域的第二颜色分量的重建值,或所述模板区域的参考区域的第二颜色分量的重建值经滤波处理后得到的值。
在一些实施例中,所述第一条件包括:第一预测误差最小、第一预测误差小于第一阈值、第一预测误差最大或第一预测误差大于第三阈值。
需要说明的是,不同度量准则的第一预测误差,对应的第一条件是不同的。比如,在绝对误差和(SAD)的度量准则下,第一条件包括第一预测误差最小或第一预测误差小于第一阈值;又如,在峰值信噪比(PSNR)的度量准则下,第一条件包括第一预测误差最大或第一预测误差大于第三阈值。
在实施例2中,也可以这样实现步骤5122-3(即根据所述第一预测误差,确定所述第一编码参数):从所述模板区域的各个候选第一编码参数中选出第一预测误差满足第一条件的参数;根据所述模板区域对应的第一预测误差满足第一条件的参数,确定所述第一编码参数。
进一步地,可以通过如下示例1、示例2、示例3或示例4实现“根据所述模板区域对应的第一预测误差满足第一条件的参数,确定所述第一编码参数”的步骤:
在示例1中,根据所述当前块的第一颜色分量的参考样值和第一预测误差满足第一条件的候选第一编码参数,确定第六加权系数;根据所述第六加权系数和所述当前块的第二颜色分量的参考样值,确定所述当前块的第二颜色分量的第三预测值;根据所述当前块的第二颜色分量的第三预测值和原始值,确定对应的第一预测误差满足第一条件的候选第一编码参数的第二预测误差;根据第一预测误差满足第一条件的候选第一编码参数的第二预测误差,确定所述第一编码参数。
这里,第六加权系数与第二加权系数的计算原理是一致的,可以参考公式(1)和(2),因此这里对于第六加权系数的具体计算方法不再赘述。在一些实施例中,所述当前块的第一颜色分量的参考样值包括所述当前块的参考区域的第一颜色分量的重建值(或该重建值经滤波处理后得到的值)和所述当前块的第一颜色分量的重建值(或该重建值经滤波处理后得到的值);所述当前块的第二颜色分量的参考样值包括所述当前块的参考区域的第二颜色分量的重建值、所述当前块的参考区域的第二颜色分量的重建值经滤波处理后得到的值、或所述当前块的参考区域的第二颜色分量的原始值或、所述当前块的参考区域的第二颜色分量的原始值经滤波处理后得到的值。
在一些实施例中,从第一预测误差满足第一条件的候选第一编码参数中选出第二预测误差满足第三条件的候选第一编码参数;根据所述第二预测误差满足第三条件的候选第一编码参数,确定所述第一编码参数。
例如,将所述第一编码参数设置为等于所述第二预测误差满足第三条件的候选第一编码参数。这里,所述第二预测误差满足第三条件的候选第一编码参数的数目可能是一个,也可能是多个。是多个的情况下,将所述第一编码参数设置为等于所述第二预测误差满足第三条件的任一候选第一编码参数。
又如,将所述第一编码参数设置为等于所述第二预测误差满足第三条件的候选第一编码参数的融合值。进一步地,在一些实施例中,可以根据第二预测误差的大小确定对应的候选第一编码参数的加权系数,基于此,将所述第一编码参数设置为等于所述第二预测误差满足第三条件的候选第一编码参数与对应的加权系数的加权和。
在一些实施例中,所述第三条件包括:第二预测误差最小或最大。
需要说明的是,第二预测误差的不同度量准则,对应的第三条件是不同的。比如,在绝对误差和(SAD)的度量准则下,第三条件包括:第二预测误差最小;又如,在峰值信噪比(PSNR)的度量准则下,第三条件包括第二预测误差最大。
在示例2中,也可以这样实现“根据所述模板区域对应的第一预测误差满足第一条件的参数,确定所述第一编码参数”的步骤:对第一预测误差满足第一条件的候选第一编码参数进行扩展,得到第一扩展参数;根据所述当前块的第一颜色分量的参考样值和第一预测误差满足第一条件的候选第一编码参数以及所述第一扩展参数,确定第七加权系数;根据所述第七加权系数和所述当前块的第二颜色分量的参考样值,确定所述当前块的第二颜色分量的第四预测值;根据所述当前块的第二颜色分量的第四预测值和原始值,确定对应参数的第三预测误差;根据各个所述候选第一编码参数和所述第一扩展参数的第三预测误差,确定所述第一编码参数。
同样地,第七加权系数的计算原理与第二加权系数的计算原理一致,可以参考上述公式(1)和(2),这里也不再赘述。一个第七加权系数对应一个候选第一编码参数或一个第一扩展参数,即基于一个候选第一编码参数或一个第一扩展参数和所述当前块的第一颜色分量的参考样值,确定第七加权系数。
在一些实施例中,可以以第一预测误差满足第一条件的候选第一编码参数为中心,按照预设步长向左和/或向右扩展至少一个第一扩展参数。
在一些实施例中,可以从各个所述候选第一编码参数和所述第一扩展参数中选出第三预测误差满足第四条件的参数;根据所述第三预测误差满足第四条件的参数,确定所述第一编码参数。
例如,将所述第一编码参数设置为等于所述第三预测误差满足第四条件的参数;这里,所述第三预测误差满足第四条件的参数的数目可能是一个,也可能是多个。是多个的情况下,将所述第一编码参数设置为等于所述第三预测误差满足第四条件的任一参数。
又如,将所述第一编码参数设置为等于所述第三预测误差满足第四条件的参数的融合值。进一步地, 在一些实施例中,可以根据第三预测误差的大小确定对应的参数的加权系数,基于此,将所述第一编码参数设置为等于所述第三预测误差满足第四条件的参数与对应的加权系数的加权和。
在一些实施例中,所述第四条件包括:第三预测误差最小或最大。
需要说明的是,第三预测误差的不同度量准则,对应的第四条件是不同的。比如,在绝对误差和(SAD)的度量准则下,第四条件包括第三预测误差最小;又如,在峰值信噪比(PSNR)的度量准则下,第四条件包括第三预测误差最大。
在示例3中,也可以这样实现“根据所述模板区域对应的第一预测误差满足第一条件的参数,确定所述第一编码参数”的步骤:将所述第一编码参数设置为等于第一预测误差满足第一条件的参数;或者,将所述第一编码参数设置为等于第一预测误差满足第一条件的参数的融合值。
进一步地,在一些实施例中,将所述第一编码参数设置为等于第一预测误差满足第一条件的参数与第三加权系数的加权和。
在一些实施例中,可以根据第一预测误差满足第一条件的参数对应的第一预测误差,确定对应的第三加权系数;或者,将所述第三加权系数设置为预设常数值。
在示例4中,也可以这样实现“根据所述模板区域对应的第一预测误差满足第一条件的参数,确定所述第一编码参数”的步骤:对第一预测误差满足第一条件的参数进行扩展,得到第一扩展参数;对所述第一扩展参数和/或第一预测误差满足第一条件的参数进行融合,得到所述第一编码参数。
在一些实施例中,可以根据第一预测误差的大小,确定对应参数的加权系数,对于第一扩展参数的加权系数可以是预设的常数值,也可以是对应的候选第一编码参数的加权系数;基于此,对所述第一扩展参数和/或第一预测误差满足第一条件的参数进行加权计算,得到所述第一编码参数。
在实施例3中,还可以这样实现步骤5122-3(即根据所述第一预测误差,确定所述第一编码参数):将所述第一编码参数设置为等于各个所述候选第一编码参数与第四加权系数的加权和。
在一些实施例中,根据所述第一预测误差,确定对应的所述候选第一编码参数的第四加权系数。
在实施例4中,还可以这样实现步骤5122-3(即根据所述第一预测误差,确定所述第一编码参数):根据所述模板区域的同一候选第一编码参数各自对应的第一预测误差,确定表征对应候选第一编码参数的性能的评价参数;根据各个所述候选第一编码参数的评价参数,确定所述第一编码参数。
进一步地,在一些实施例中,将所述评价参数设置为等于所述模板区域的同一候选第一编码参数各自对应的第一预测误差的融合值。该融合值可以是这些第一预测误差之和或乘积等。
更进一步地,在一些实施例中,将所述评价参数设置为等于所述模板区域的同一候选第一编码参数各自对应的第一预测误差之和。
进一步地,在一些实施例中,可以这样实现“根据各个所述候选第一编码参数的评价参数,确定所述第一编码参数”的步骤:从各个所述候选第一编码参数中选出评价参数满足第二条件的参数;根据评价参数满足第二条件的参数,确定所述第一编码参数。
更进一步地,可以通过如下的示例5或示例6实现步骤“根据评价参数满足第二条件的参数,确定所述第一编码参数”:
在示例5中,根据所述当前块的第一颜色分量的参考样值和评价参数满足第二条件的参数,确定第八加权系数;根据所述第八加权系数和所述当前块的第二颜色分量的参考样值,确定所述当前块的第二颜色分量的第五预测值;根据所述当前块的第二颜色分量的第五预测值和原始值,确定对应的评价参数满足第二条件的参数的第四预测误差;根据各个候选第一编码参数的第四预测误差,确定所述第一编码参数。
进一步地,在一些实施例中,对评价参数满足第二条件的参数进行扩展,得到第二扩展参数;根据所述当前块的第一颜色分量的参考样值和评价参数满足第二条件的参数以及第二扩展参数,确定第九加权系数;根据所述第九加权系数和所述当前块的第二颜色分量的参考样值,确定所述当前块的第二颜色分量的第六预测值;根据所述当前块的第二颜色分量的第六预测值和原始值,确定对应参数的第五预测误差;根据各个候选第一编码参数和所述第二扩展参数的第五预测误差,确定所述第一编码参数。
同样地,第八加权系数和第九加权系数的计算原理与第二加权系数的计算原理一致,可以参考上述公式(1)和(2),这里也不再赘述。一个第九加权系数对应一个候选第一编码参数或一个第二扩展参数,即基于一个候选第一编码参数或一个第二扩展参数和所述当前块的第一颜色分量的参考样值,确定第九加权系数。
在示例6中,可以这样实现步骤“根据评价参数满足第二条件的参数,确定所述第一编码参数”:将所述第一编码参数设置为等于评价参数满足第二条件的参数;或者,将所述第一编码参数设置为等于评价参数满足第二条件的参数的融合值。在一些实施例中,将所述第一编码参数设置为等于评价参数满足第二条件的参数与第五加权系数的加权和。
进一步地,可以通过示例7或示例8获取第五加权系数:
在示例7中,根据评价参数满足第二条件的参数对应的模板区域,确定对应参数的第五加权系数。
更进一步地,在一些实施例中,根据评价参数满足第二条件的参数对应的模板区域的像素数目和/或模板类型,确定对应参数的第五加权系数。
在一些实施例中,所述第二条件包括:评价参数最小、评价参数小于第二阈值、评价参数最大或评价参数大于第四阈值。可以理解地,不同度量准则的第一预测误差,第二条件是不同的。比如,在绝对误差和(SAD)的度量准则下,第二条件包括评价参数最小或评价参数小于第二阈值;又如,在峰值信噪比(PSNR)的度量准则下,第二条件包括评价参数最大或评价参数大于第四阈值。
在示例8中,所述第五加权系数为预设常数值。
在对某一当前块进行帧内预测时,可能会出现不存在模板区域的情况。在一些实施例中,在不存在所述模板区域的情况下,将默认值作为所述当前块的第二颜色分量的预测值。在另一些实施例中,在不存在所述模板区域的情况下,也可以采用不同于所述方法的另一预测方法确定所述当前块的第二颜色分量进行预测。不同于所述方法的另一预测方法,例如为基于跨分量线性模型(Cross-component Linear Model,CCLM)的预测方法。
在一些实施例中,在得到第一编码参数之后,可以对所述第一编码参数或所述第一编码参数的索引进行编码,将所得到的编码比特写入码流。
在步骤52中,确定所述当前块的第一颜色分量的参考样值。
在一些实施例中,所述当前块的第一颜色分量的参考样值包括所述当前块的第一颜色分量的重建值和所述当前块的参考区域的第一颜色分量的重建值。
在步骤53中,根据当前块的第一颜色分量的参考样值和所述第一编码参数,确定第一加权系数。
在一些实施例中,可以确定所述当前块的第二差值,其中,所述当前块的第二差值设置为等于所述当前块的第一颜色分量的参考值与所述当前块的参考区域的第一颜色分量的参考值之间的差值的绝对值;根据所述当前块的第二差值和所述第一编码参数,确定第一加权系数;其中,所述当前块的第一颜色分量的参考值是所述当前块的第一颜色分量的重建值,或所述当前块的第一颜色分量的重建值经滤波处理得到的值;所述当前块的参考区域的第一颜色分量的参考值是所述当前块的参考区域的第一颜色分量的重建值,或所述当前块的参考区域的第一颜色分量的重建值经滤波处理得到的值。
进一步地,在一些实施例中,可以根据所述当前块的第二差值和所述第一编码参数,使用预设的对应关系,确定第一加权系数。
更进一步地,在一些实施例中,所述预设的对应关系是softmax函数,或者,所述预设的对应关系是使用softmax函数得到的;其中,所述softmax函数的输入为以下之一:所述第二差值与所述第一编码参数的比值;所述第二差值与所述候选第一解码参数的乘积;所述第二差值经比特移位处理后得到的值;其中,所述比特移位的位数等于所述候选第一解码参数。
举例而言,如下公式(4)所示,其示出了softmax函数的一种示例:
Figure PCTCN2022086470-appb-000003
其中,[i]表示当前块中像素坐标为(i,j)的像素的横坐标,[j]表示当前块中像素坐标为(i,j)的像素的纵坐标。cWeight[i][j][k]表示当前块中像素坐标为(i,j)的像素对应的当前块的参考区域的第k个像素的第一加权系数;inSize表示当前块的参考区域的像素数目;best_T表示第一编码参数;diffY[i][j][k]的计算公式如下式(5)所示:
diffY[i][j][k]=abs(refY[k]-recY[i][j])  (5);
其中,refY[k]表示当前块的参考区域的第k个像素的第一颜色分量的参考值(如重建值、重建值经滤波处理得到的值、原始值或原始值经滤波处理得到的值),recY[i][j]表示当前块中像素坐标为(i,j)的像素的第一颜色分量的参考值(如重建值、重建值经滤波处理得到的值、原始值或原始值经滤波处理得到的值)。
在步骤54中,根据所述第一加权系数和所述当前块的第二颜色分量的参考样值,确定所述当前块的第二颜色分量的第一预测值。
在一些实施例中,所述当前块的第二颜色分量的参考样值包括所述当前块的参考区域的第二颜色分量的重建值,或重建值经滤波处理得到的值,或所述当前块的参考区域的第二颜色分量的原始值,或原始值经滤波处理得到的值。
基于公式(5),计算当前块中像素坐标为(i,j)的像素的第二颜色分量的第一预测值,如下公式 (6)所示:
Figure PCTCN2022086470-appb-000004
即,所述当前块的像素坐标为(i,j)的像素的第二颜色分量的第一预测值设置为等于所述当前块的参考区域的每一像素的第二颜色分量的参考值与对应的第一加权系数的加权和;其中,所述当前块的参考区域的每一像素的第二颜色分量的参考值是所述当前块的参考区域的每一像素的第二颜色分量的重建值,或重建值经滤波处理得到的值,或所述当前块的参考区域的每一像素的第二颜色分量的原始值,或原始值经滤波处理得到的值。
在一些实施例中,在通过步骤54得到所述当前块的第二颜色分量的第一预测值之后,所述方法还包括如下步骤55至步骤57:
步骤55,获取所述当前块的第二颜色分量的原始值;
步骤56,根据所述当前块的第二颜色分量的原始值和所述第二颜色分量的第一预测值,确定所述当前块的第二颜色分量的残差值;
步骤57,对所述当前块的第二颜色分量的残差值进行编码,将所得到的编码比特写入码流。
在另一些实施例中,在通过步骤54得到所述当前块的第二颜色分量的第一预测值之后,所述方法还包括如下步骤515至步骤518:
步骤515,对所述当前块的第二颜色分量的第一预测值进行修正操作,得到修正后的第一预测值。
当前块的第二颜色分量的第一预测值应该在限定范围内,如果超出,则进行相应的修正操作。例如:
可以对当前块的第二颜色分量的第一预测值进行钳位操作,具体如下:
●当C pred[i][j]的值小于0时,将其置为0;其中,C pred[i][j]表示当前块的像素坐标为(i,j)的像素的第二颜色分量的第一预测值;
●当C pred[i][j]的值大于(1<<BitDepth)–1时,其置为(1<<BitDepth)–1。
以保证predWcp中所有预测值都在0到(1<<BitDepth)–1之间。
即:
C pred[i][j]=Clip3(0,(1<<BitDepth)-1,C pred[i][j])  (7)
其中:
Figure PCTCN2022086470-appb-000005
或把以上公式(7)和公式(8)的操作合并为以下一个公式(9)完成:
Figure PCTCN2022086470-appb-000006
步骤516,获取所述当前块的第二颜色分量的原始值;
步骤517,根据所述当前块的第二颜色分量的原始值和所述修正后的第一预测值,确定所述当前块的第二颜色分量的残差值;
步骤518,对所述当前块的第二颜色分量的残差值进行编码,将所得到的编码比特写入码流。
如下提供解码端的实施例,本申请实施例提供的解码方法与上述编码方法类似,上述第一编码参数相当于如下实施例所述的第一解码参数,其本质上是相同的;以及上述候选第一编码参数相当于如下实施例所述的候选第一解码参数,其本质上也是相同的,都是用来控制加权系数的大小。如下实施例提供的解码方法具有同上述编码方法的实施例相似的有益效果。对于本申请解码方法的实施例中未披露的技术细节,请参照上述编码方法的实施例的描述而理解。因此,如下公开的解码方法的实施例未披露的技术细节和具体的实施例等不再赘述。
本申请实施例提供一种解码方法,图13为本申请实施例提供的解码方法的实现流程示意图,如图13所示,该方法可以包括如下步骤131至步骤134:
步骤131,根据模板区域,确定第一解码参数;
步骤132,确定所述当前块的第一颜色分量的参考样值;
步骤133,根据所述当前块的第一颜色分量的参考样值和所述第一解码参数,确定第一加权系数;
步骤134,根据所述第一加权系数和所述当前块的第二颜色分量的参考样值,确定所述当前块的第二颜色分量的第一预测值。
以下分别对上述各个步骤的进一步的可选的实施方式以及相关名词等进行说明。
在步骤131中,根据模板区域,确定第一解码参数。
在一些实施例中,可以先确定模板区域。例如,可以根据所述当前块的邻近区域的像素可用性,确 定所述模板区域;其中,基于与所述当前块的相对位置关系,所述邻近区域包括以下至少之一:所述当前块的上侧区域、所述当前块的左侧区域、所述当前块的上右侧区域、所述当前块的左下侧区域、所述当前块的左上侧区域。
又如,也可以这样确定模板区域:根据配置的预测模式包括的模板类型,确定所述模板区域。
在一些实施例中,所述模板类型至少包括以下至少之一:上模板、左模板、上右模板、左下模板、左上模板。
进一步地,在一些实施例中,可以将配置的预测模式包括的模板作为所述模板区域。
在确定所述模板区域之后,在一些实施例中,可以通过如下步骤111和步骤112实现步骤131:
步骤111,确定所述模板区域的参考样值;
在一些实施例中,所述参考样值包括:所述模板区域的第一颜色分量的重建值、所述模板区域的第二颜色分量的重建值、所述模板区域的参考区域的第一颜色分量的重建值和所述模板区域的参考区域的第二颜色分量的重建值。
进一步地,在一些实施例中,所述模板区域的参考区域包含以下至少之一:所述模板区域的上相邻区域;所述模板区域的下相邻区域;所述模板区域的左相邻区域;所述模板区域的右相邻区域;所述模板区域。
步骤112,根据所述模板区域的参考样值,确定所述第一解码参数。
在一些实施例中,可以通过步骤1121和步骤1122实现步骤112:
步骤1121,确定所述模板区域的第一差值,其中,所述模板区域的第一差值设置为等于所述模板区域的第一颜色分量的参考值与所述模板区域的参考区域的第一颜色分量的参考值之间差值的绝对值;
进一步地,在一些实施例中,所述模板区域的第一颜色分量的参考值是所述模板区域的第一颜色分量的重建值,或所述模板区域的第一颜色分量的重建值经滤波处理得到的值;所述模板区域的参考区域的第一颜色分量的参考值是所述模板区域的参考区域的第一颜色分量的重建值,或所述模板区域的参考区域的第一颜色分量的重建值经滤波处理得到的值。
步骤1122,根据所述模板区域的第一差值,确定所述第一解码参数。
进一步地,在一些实施例中,可以通过步骤1122-1至步骤1122-3实现步骤1122:
步骤1122-1,根据所述第一差值和候选第一解码参数第一解码参数,确定所述模板区域的第二颜色分量的第二预测值;
在一些实施例中,所述候选第一编码参数包含一个或多个候选第一解码参数。
步骤1122-2,确定所述模板区域的第二颜色分量的第一预测误差;其中,所述第一预测误差是所述模板区域的第二颜色分量的参考值与所述模板区域的第二颜色分量的第二预测值之间的误差,所述模板区域的第二颜色分量的参考值是所述模板区域的第二颜色分量的重建值,或所述模板区域的第二颜色分量的重建值经滤波处理得到的值。
在一些实施例中,将用于确定所述第一预测误差的第二预测值设置为等于对所述模板区域的第二颜色分量的第二预测值进行修正操作得到的第二预测值。
步骤1122-3,根据所述第一预测误差,确定所述第一解码参数;
在本申请实施例中,对于实现步骤1122-3的实施例不做限定,可以是各种各样的。例如,可以通过如下实施例5至实施例8中的任一示例实现。
在实施例5中,可以这样实现步骤1122-3:所述模板区域的第二颜色分量的第二预测值设置为等于所述模板区域的参考区域的第二颜色分量的参考值与第二加权系数的加权和;将所述第一解码参数设置为等于可以使所述第一预测误差达到第一条件时对应的所述候选第一解码参数的取值;其中,所述模板区域的参考区域的第二颜色分量的参考值是所述模板区域的参考区域的第二颜色分量的重建值,或所述模板区域的参考区域的第二颜色分量的重建值经滤波处理后得到的值。
进一步地,在一些实施例中,根据所述模板区域的第一差值和所述候选第一解码参数,使用预设的对应关系,确定所述第二加权系数。
更进一步地,在一些实施例中,所述预设的对应关系是softmax函数,或者,所述预设的对应关系是使用softmax函数得到的;其中,所述softmax函数的输入为以下之一:所述第一差值与所述候选第一解码参数的比值;所述第一差值与所述候选第一解码参数的乘积;所述第一差值经比特移位处理后得到的值;其中,所述比特移位的位数等于所述候选第一解码参数。
在一些实施例中,所述第一条件包括:第一预测误差最小、第一预测误差小于第一阈值、第一预测误差最大或第一预测误差大于第三阈值。
在实施例6中,也可以这样实现步骤1122-3(即根据所述第一预测误差,确定所述第一解码参数):从所述模板区域的各个候选第一解码参数中选出第一预测误差满足第一条件的参数;根据所述模板区域 对应的第一预测误差满足第一条件的参数,确定所述第一解码参数。
进一步地,可以通过如下示例9或示例10实现“根据所述模板区域对应的第一预测误差满足第一条件的参数,确定所述第一解码参数”的步骤:
在示例9中,也可以这样实现“根据所述模板区域对应的第一预测误差满足第一条件的参数,确定所述第一解码参数”的步骤:将所述第一解码参数设置为等于第一预测误差满足第一条件的参数;或者,将所述第一解码参数设置为等于第一预测误差满足第一条件的参数的融合值。
进一步地,在一些实施例中,将所述第一解码参数设置为等于第一预测误差满足第一条件的参数与第三加权系数的加权和。
在一些实施例中,可以根据第一预测误差满足第一条件的参数对应的第一预测误差,确定对应的第三加权系数;或者,将所述第三加权系数设置为预设常数值。
在示例10中,也可以这样实现“根据所述模板区域对应的第一预测误差满足第一条件的参数,确定所述第一解码参数”的步骤:对第一预测误差满足第一条件的参数进行扩展,得到第一扩展参数;对所述第一扩展参数和/或第一预测误差满足第一条件的参数进行融合,得到所述第一解码参数。
在实施例7中,还可以这样实现步骤1122-3(即根据所述第一预测误差,确定所述第一解码参数):将所述第一解码参数设置为等于各个所述候选第一解码参数与第四加权系数的加权和。
在一些实施例中,根据所述第一预测误差,确定对应的所述候选第一解码参数的第四加权系数。
在实施例8中,还可以这样实现步骤1122-3(即根据所述第一预测误差,确定所述第一解码参数):根据所述模板区域的同一候选第一解码参数各自对应的第一预测误差,确定表征对应候选第一解码参数的性能的评价参数;根据各个所述候选第一解码参数的评价参数,确定所述第一解码参数。
进一步地,在一些实施例中,将所述评价参数设置为等于所述模板区域的同一候选第一解码参数各自对应的第一预测误差的融合值。
更进一步地,在一些实施例中,将所述评价参数设置为等于所述模板区域的同一候选第一解码参数各自对应的第一预测误差之和。
进一步地,在一些实施例中,可以这样实现“根据各个所述候选第一解码参数的评价参数,确定所述第一解码参数”的步骤:从各个所述候选第一解码参数中选出评价参数满足第二条件的参数;根据评价参数满足第二条件的参数,确定所述第一解码参数。
更进一步地,可以通过如下的示例11实现步骤“根据评价参数满足第二条件的参数,确定所述第一解码参数”:
在示例11中,将所述第一解码参数设置为等于评价参数满足第二条件的参数;或者,将所述第一解码参数设置为等于评价参数满足第二条件的参数的融合值。
在一些实施例中,将所述第一解码参数设置为等于评价参数满足第二条件的参数与第五加权系数的加权和。
进一步地,可以通过示例12或示例13获取第五加权系数:
在示例12中,根据评价参数满足第二条件的参数对应的模板区域,确定对应参数的第五加权系数。
更进一步地,在一些实施例中,根据评价参数满足第二条件的参数对应的模板区域的像素数目和/或模板类型,确定对应参数的第五加权系数。
在一些实施例中,所述第二条件包括:评价参数最小、评价参数小于第二阈值、评价参数最大或评价参数大于第四阈值。
在示例13中,所述第五加权系数为预设常数值。
在对某一当前块进行帧内预测时,可能会出现不存在模板区域的情况。在一些实施例中,在不存在所述模板区域的情况下,将默认值作为所述当前块的第二颜色分量的预测值。在另一些实施例中,在不存在所述模板区域的情况下,也可以采用不同于所述方法的另一预测方法确定所述当前块的第二颜色分量进行预测。
在一些实施例中,所述方法还包括:解析码流,得到所述第一解码参数的索引;以及根据所述第一解码参数的索引,获取所述第一解码参数。
在一些实施例中,所述方法还包括:解析码流,得到所述第一解码参数。
在一些实施例中,所述方法还包括:解析码流,得到所述当前块的第二颜色分量的残差值;根据所述第二颜色分量的残差值和所述当前块的第二颜色分量的第一预测值,确定所述当前块的第二颜色分量的重建值。
在一些实施例中,所述方法还包括:对所述当前块的第二颜色分量的第一预测值进行修正操作,得到修正后的第一预测值;根据所述第二颜色分量的残差值和所述修正后的第一预测值,确定所述当前块的第二颜色分量的重建值。
在本申请实施例中,第一颜色分量和第二颜色分量的类型不同。比如,第一颜色分量为亮度分量,第二颜色分量为色度分量。又如,第一颜色分量为色度分量,第二颜色分量为亮度分量。
对当前块进行色度预测时,当前块的重建亮度信息、相邻参考区域的重建亮度信息及相邻参考区域的重建色度信息都是已编码的重建信息,因此,可以利用上述重建信息,采用基于权重的色度预测技术(WCP),并在基于权重的色度预测的过程之前加入模板匹配的步骤,目的是根据不同尺寸和不同内容的当前块选择最佳模型参数。其中,关键在于采用模板匹配的方式在邻近区域内搜索用以计算权重向量的权重模型的最佳模型参数;对于解码端而言,所述最佳模型参数即为上述实施例所述的第一解码参数的一种示例;对于编码端而言,所述最佳模型参数即为上述实施例所述的第一编码参数的一种示例。
在一些实施例中,WCP技术的色度预测过程的详细步骤如下:
WCP的输入:当前块的位置(xTbCmp,yTbCmp),当前块的宽nTbW及当前块的高nTbH。
WCP的输出:当前块的色度预测值predSamples[x][y];其中,以当前块内左上角像素位置为坐标原点,x=0,···,nTbW-1;y=0,···,nTbH–1。需要说明的是,色度分量为上述实施例所述的第二颜色分量的一种示例,下文提到的亮度分量为上述实施例所述的第一颜色分量的一种示例。
如图14所示,WCP技术的预测过程包括如下步骤141至步骤145,即核心参数配置、获取输入信息、基于权重的色度预测和后处理,在获取输入信息与基于权重的色度预测这两个步骤之间添加模板匹配步骤。经过以上步骤可以得到当前块的色度预测值。
步骤141,确定WCP核心参数;可以预先配置这些参数;
步骤142,根据确定的核心参数获取输入信息,包括获取参考色度信息、参考亮度信息及当前块的重建亮度信息;
步骤143,通过模板匹配的方式确定控制参数;其中,所述控制参数,对于解码端而言,相当于上述实施例所述的第一解码参数的一种示例;对于编码端而言,所述控制参数,相当于上述实施例所述的第一编码参数的一种示例。
步骤144,根据获取的输入信息进行基于权重的色度预测计算;
步骤145,对所述色度预测计算结果进行后处理过程。
如下对上述图14所示的各个步骤进行详细介绍:
在步骤141中,确定WCP核心参数。
这里对WCP涉及的核心参数进行确定,即可以通过配置或通过某种渠道获取或推断WCP核心参数,比如在解码端从码流获取WCP核心参数。具体应用会在后面详细介绍。
WCP核心参数的确定包括但不限于:控制参数(T)、基于权重的色度预测的各类输入信息的个数inSize以及基于权重的色度预测的输出(predWcp)的个数;predWcp排列成predSizeW×predSizeH。其中,基于权重的色度预测输出(predWcp)的个数可以设为相同的值(如predSizeW=predSizeH=S/4)或当前块尺寸相关(如predSizeW=nTbW,predSizeH=nTbH)。其中控制参数(T)可以用来对后续环节中非线性函数进行调整或用来对后续环节涉及的数据进行调整。
WCP核心参数的确定在一定条件下受块尺寸或块内容或块内像素数的影响。可以根据当前块的尺寸或块内容或块内像素数进行分类,根据不同的类别配置相同或不同的核心参数。即不同类别对应的inSize或predWcp(排列成predSizeW×predSizeH)可以相同,例如predSizeW=predSizeH=s/4,predWcp可以当前块的尺寸相关,如predSizeW=nTbW,predSizeH=nTbH。注意,predSizeW和predSizeH也可以相同或不同。不同尺寸或不同内容或块内不同像素数的当前块对应的控制参数(T)由步骤143的模板匹配所确定。
在步骤142中,获取输入信息。
预测当前块时,当前块的上方区域、左上方区域及左方区域都被称为当前块的参考区域,如图15所示,当前块的参考区域中的像素都是已重建的像素,称为参考像素。
从参考区域中获取参考色度信息refC和参考亮度信息refY。获取的参考色度信息refC包括但不限于:选取当前块的上方区域的参考重建色度值和左方区域的参考重建色度值。获取的参考亮度信息refY包括但不限于:根据参考色度信息位置获取对应的参考亮度信息。
获取当前块的重建亮度信息recY,获取方式包括但不限于:根据当前块的色度信息位置获取对应的重建亮度信息作为当前块的重建亮度信息。
需要说明的是,参考色度信息refC为当前块的第二颜色分量的参考样值的一种示例;参考亮度信息refY和当前块的重建亮度信息recY为当前块的第一颜色分量的参考样值的一种示例。
获取输入信息包括:获取inSize数量的参考色度信息refC(若需要进行前处理,则是经过前处理操作后的)、获取inSize数量的参考亮度信息refY(若需要进行前处理,则是经过前处理操作后的)及获取当前块的重建亮度信息recY(若需要进行前处理,则是经过前处理操作后的)。
在步骤143中,通过模板匹配的方式确定控制参数。
利用模板区域的重建亮度像素、重建色度像素与模板区域的参考区域处的重建亮度像素和重建色度像素,模拟WCP的预测过程,并从中选择最佳的控制参数(best_T)。如图16所示,具体包括以下操作步骤1431至步骤1433:
步骤1431、确定模板区域与模板的参考区域。
根据当前块的邻近区域的像素可用性,判断模板区域及模板区域的参考区域的像素是否可用,包括重建亮度信息与重建色度信息。包括但不限于:根据模板区域与当前块的相对位置关系,可将模板区域分类为上模板、左模板、上右模板、左下模板和左上模板等模板类型,模板区域的参考区域随不同的模板类型而变化,并允许模板区域可以与模板区域的参考区域重叠。另外,为了满足不同当前块的需求,可以灵活地组合模板类型与模板区域所对应的参考区域,如图10、图11和图12A所示。不同当前块的不同类型的模板尺寸可以固定相同,也可以不同,例如,可以根据当前块的不同尺寸选择不同的模板尺寸等。以图11中的模板为例进行说明,则下式说明了一种模板的尺寸设置条件,nTbW和nTbH为当前块的宽度和高度,iTempW和iTempH为确定的模板的宽度和高度:
上模板:
Figure PCTCN2022086470-appb-000007
左模板:
Figure PCTCN2022086470-appb-000008
Figure PCTCN2022086470-appb-000009
也可以根据当前块内的像素数选择不同的模板尺寸,以图11中的模板为例进行说明,下式说明了一种模板的尺寸设置条件,nTbW和nTbH为当前块的宽度和高度,nTbW×nTbH为当前块的像素数,iTempW和iTempH为采用的模板的宽度和高度:
上模板:
Figure PCTCN2022086470-appb-000010
左模板:
Figure PCTCN2022086470-appb-000011
也可以将模板类型与模板区域所对应的参考区域的组合类型或者模板尺寸的大小在编码端的码流中进行传输。
图10、图11和图12A分别展示了三种类型的模板位置及其对应的参考区域位置示意图,如下实施例的模板均以图11中的上模板和左模板为例进行说明,在实际应用过程可以在该步骤使用更多的不同的模板类型与对应的参考区域。
步骤1432、在模板区域内进行WCP预测。
在不同的模板类型下,模板区域的重建亮度信息、模板区域的重建色度信息、模板区域的参考区域的重建亮度信息及重建色度信息都是已编码的重建信息,因此,WCP的基础流程可以在模板区域进行;其中,模板区域的重建亮度信息和模板区域的参考区域的重建亮度信息为模板区域的第一颜色分量的参考样值的一种示例;模板区域的重建色度信息和模板区域的参考区域的重建色度信息为模板区域的第二颜色分量的参考样值的一种示例。
这里首先进行上模板的WCP预测,详细过程如下:
模板的WCP的输入:上模板的位置(xTemp,yTemp),上模板的宽nTbW及上模板的高iTempH。
模板的WCP的输出:上模板的色度预测值predTempSamples[x][y],即模板区域的第二颜色分量的第二预测值的一种示例;其中,以上模板的左上角色度像素位置为坐标原点,x=0,···,nTbW-1;y=0,···,iTempH–1。
确定WCP核心参数:包括但不限于:控制参数(T)、基于权重的色度预测的各类输入信息的个数inTempSize、基于权重的色度预测的输出(predTempWcp)的个数(排列成predTempSizeW×predTempSizeH)。上述的inTempSize、predTempSizeW和predTempSizeH参数可以随不同的模板类型进行变化,也可以根据当前块的WCP预测过程中所配置的WCP核心参数进行变化。
获取输入信息:从上模板的参考区域中获取参考色度信息refTempC和参考亮度信息refTempY。获取的参考色度信息refTempC包括但不限于:选取上模板的参考区域的参考重建色度值;获取的参考亮度信息refTempY包括但不限于根据参考色度信息位置获取对应的参考亮度信息。
获取模板的重建色度信息recTempC,获取方式包括但不限于选取当前模板内的重建色度信息。
获取模板的重建亮度信息recTempY,获取方式包括但不限于根据当前模板内重建色度信息位置获取对应的重建亮度信息作为当前模板的重建亮度信息。此过程也可以根据不同需求进行前处理操作,例如根据不同的输入颜色格式信息进行上下采样、只选择部分参考区域或参考区域选点操作等。
接下来,对配置参数规定的尺寸内的模板色度预测值C predT[i][j],i=0…predTempSizeW-1,j=0…predTempSizeH-1,逐个进行获取。注意,predTempSizeH和predTempSizeW为确定的WCP核心参数,也可与当前模板的高或宽相同或不同。
详细计算过程如下:
对于i=0,···,predTempSizeW-1;j=0,···,predTempSizeH-1
对于k=0,1,···,inTempSize-1
构造亮度差向量中各个元素diffTempY[i][j][k]
计算权重向量中各个元素cTempWeight[i][j][k](或cTempWeightFloat[i][j][k])
由cTempWeight[i][j](或cTempWeightFloat[i][j][k])和refTempC计算色度预测值C predT[i][j];
构造亮度差向量:对WCP核心参数规定尺寸内的模板的每个待预测色度像素C predT[i][j],将其对应的重建亮度信息recTempY[i][j]与inTempSize数量的参考亮度信息refTempY相减并取绝对值,得到亮度差向量diffTempY[i][j][k]。计算公式如(10)所示,其中,k=0,1...inTempSize-1。同样,也可对得到的亮度差向量进行线性或非线性数值处理。其中,亮度差向量中的元素即为第一差值的一种示例。
diffTempY[i][j][k]=abs(refTempY[k]-recTempY[i][j])    (10);
其中
Figure PCTCN2022086470-appb-000012
计算权重向量:采用非线性权重模型对每个待预测像素C predT[i][j]对应的亮度差向量diffTempY[i][j][k]进行处理,得到对应的权重向量对应的浮点型权重向量cTempWeightFloat[i][j],其中,配置核心参数中传输的控制参数(T)作为模型的调整参数。注意,这里的权重模型必须与步骤1442中当前块所采用的权重模型保持一致。以非线性softmax函数为例,此时每个待预测像素对应的权重向量计算公式如(11)所示。其中,所述权重向量中的元素即为第二加权系数的一种示例。
Figure PCTCN2022086470-appb-000013
在以上计算完毕之后,可以对进行定点化,如下式(12):
cTempWeight[i][j][k]=round(cTempWeightFloat[i][j][k]×2 Shift)  (12);
其中,
round(x)=Sign(x)×Floor(Abs(x)+0.5)
Figure PCTCN2022086470-appb-000014
Floor(x)表示小于或等于x的最大整数
Figure PCTCN2022086470-appb-000015
计算色度预测值:根据模板的每个待预测像素C predT[i][j]对应的权重向量cTempWeight[i][j](或cTempWeightFloat[i][j])和参考色度信息refTempC,计算待预测像素C predT[i][j]的色度预测值。具体地,将每个待预测像素C predT[i][j]的参考色度信息refTempC与对应的权重向量元素逐一对应相乘,subTempC[i][j](或subTempCFloat[i][j]),将相乘结果累加即为每个待预测像素的色度预测值C predT[i][j]。计算公式如下式(13):
对于k=0,1...inTempSize-1
subTempCFloat[i][j][k]=(cTempWeightFloat[i][j][k]×refTempC[k])   (13);
在计算完毕之后,可以对subTempCFloat进行定点化,定点化过程中为保留一定的计算精度,可以乘上一个系数,如下公式(14)和公式(15)所示:
subTempC[i][j][k]=round(subTempCFloat[i][j][k]×2 Shift)  (14);
或者:
subTempC[i][j][k]=(cTempWeight[i][j][k]×refTempC[k])   (15);
对于i=0…predTempSizeW-1,j=0…predTempSizeH-1
Figure PCTCN2022086470-appb-000016
在计算完毕后,对C predTFloat[i][j]进行定点化,如式(17):
C predT[i][j]=round(C predTFloat[i][j])   (17);
或者用定点化的subTempC[i][j][k]进行计算,如式(18):
Figure PCTCN2022086470-appb-000017
或者用定点化的subTempC[i][j][k]进行计算,如式(19):
Figure PCTCN2022086470-appb-000018
其中,Offset=1<<(Shift 1-1),Shift 1是在计算cTempWeight[i][j][k]或者subTempC[i][j][k]时(Shift 1=Shift),或其他环节为了提高精度采取的定点化操作中需要的移位量。
将每个待预测像素的色度预测值C predT[i][j]进行单独的空间存储,即为基于权重的色度预测输出predTempWcp。
对predTempWcp进行修正:predTempWcp内的色度预测值应该在限定范围内,如果超出,应该进行相应的修正操作。该修正操作必须与下文提到的步骤1444中当前块所采用的修正操作保持一致。
例如:
可以对C predT[i][j]内的色度预测值进行钳位操作,具体如下:
●当C predT[i][j]的值小于0时,将其置为0;
●当C predT[i][j]的值大于(1<<BitDepth)–1时,其置为(1<<BitDepth)–1。
以保证predTempWcp中所有预测值都在0到(1<<BitDepth)–1之间。
即:
Figure PCTCN2022086470-appb-000019
至此,完成了对上模板的WCP预测过程,接下来对左模板进行WCP预测过程,两个模板进行WCP预测过程的前后顺序可互换。
图12B描述了WCP的过程,图12B可以是在图12A所示的模板区域和模板区域的参考区域的基础上进行的WCP过程,图12B也可以是在其它类型的模板区域和对应的参考区域的基础上进行的WCP过程。如图12B所示,对于下采样的亮度块中的每个样本recTempY[i][j],首先根据recTempY[i][j]与相邻亮度向量refTempY[k]的差值的绝对值得到亮度差向量diffTempY[i][j][k];其次,根据与diffTempY[i][j][k]相关的非线性映射模型,导出归一化权重向量cTempWeight[i][j][k];第三,利用权重向量,将权重向量与相邻色度向量进行向量乘法,得到预测色度样本C predT[i][j]。
左模板的WCP预测过程只对上模板的WCP预测过程的WCP的输入、输出、配置核心参数与获取输入信息进行特殊说明,其它操作保持一致:
模板的WCP的输入:左模板的位置(xTemp,yTemp),左模板的宽iTempW及左模板的高nTbH。
模板的WCP的输出:左模板的色度预测值predTempSamples[x][y],其中以左模板的左上角色度像素位置为坐标原点,x=0,···,iTempW-1;y=0,···,nTbH–1。
配置核心参数:包括但不限于:控制参数(T)、基于权重的色度预测的各类输入信息的个数inTempSize、基于权重的色度预测输出(predTempWcp)的个数(排列成predTempSizeW×predTempSizeW)。上述的inTempSize、predTempSizeW和predTempSizeW参数可以与上模板的配置参数相同,可以根据自身模板类型选择不同的参数。
获取输入信息:上模板和左模板的参考区域可以相同,也可以分别选择不同的参考区域。同样可以根据不同需求进行前处理操作。
在左模板完成WCP的预测过程后,也保存了自身的基于权重的色度预测输出。
步骤1433,选择最佳的控制参数best_T。
上文介绍了上模板和左模板的WCP预测过程,这样就获取到了各自的模板内的重建色度信息recTempC[i][j]与某个控制参数(T)所对应的预测色度信息predTempWcp[i][j]。
通过循环遍历不同的控制参数(T)下的模板WCP预测过程,能够得到对应的多组预测色度信息, 根据某种评价准则可以选择出一个最佳的控制参数(T)。例如,可以选择绝对误差和(SAD)、变换绝对误差和(SATD)、差值平方和(SSE)、平均绝对差值(MAD)、平均绝对误差(MAE)、平均平方误差(MSE)、率失真函数(RDO)等评价准则,即第一预测误差的一种示例。下述内容所提到的某种评价准则均可从上述准则中选择其一,以MAE的评价准则为例,计算公式如下式(20):
Figure PCTCN2022086470-appb-000020
若任何一个模板都无法获取,则将预测值全部填充为默认值,默认值可以设置为(1<<BitDepth)–1,(BitDepth为色度像素值所要求的的比特深度)或者直接中途退出WCP预测算法(即当前块不使用WCP预测算法)。
若只能获取到一个模板,上模板或左模板两者均可,此时就只能选出一个最佳的控制参数,那么将此控制参数保存,记作best_T。
若两个模板均能获取到,此时能够选择出上模板的最佳参数above_T和左模板的最佳参数left_T,那么接下来就要对这两者进行处理,包括但不限于以下方法:
第一种方法是将above_T和left_T两者进行加权融合为一个最佳参数best_T,如式(21)所示:
best_T=w 0×above_T+w 1×left_T    (21);
加权融合的标准可以选择固定加权系数或者根据各自模板重建色度与预测色度的平均绝对误差进行分配加权系数等,前者的固定加权系数为{0.5,0.5},后者的计算加权系数的公式如式(22),MAE A为上模板的平均绝对误差,MAE L为左模板的平均绝对误差,MAE A为上模板的平均绝对误差;其中,MAE L和MAE A均为第一预测误差的一种示例;
Figure PCTCN2022086470-appb-000021
第二种方法是保留above_T和left_T,继续进行步骤144的基于权重的色度预测,在编码端根据某种评价准则对当前块的原始色度值与预测色度值进行处理,再从两者中选出最佳的控制参数,在编码比特流中传输上模板或者左模板的索引或直接传输参数值均可;
第三种方法是同样保留above_T和left_T,在步骤144的基于权重的色度预测中,遍历above_T和left_T的值的附近参数值,在编码端根据某种评价准则对当前块的原始色度值与预测色度值进行处理,从已缩小的参数区间中选出最佳的控制参数,在编码比特流中传输传输最佳的控制参数在已缩小区间中的索引或直接传输参数值均可。在第二种方法和第三种方法等多个最佳控制参数的情况下,在步骤144中均不再特殊说明。
若在模板选择过程中,选择了超过2个模板进行后续操作,则可仿照上述情况进行处理。
在步骤144中,根据获取的输入信息进行基于权重的色度预测计算。
对配置参数规定的尺寸内的色度预测值C pred[i][j],i=0,···,predSizeW-1;j=0,···,predSizeH-1,逐个进行获取。注意,predSizeH和predSizeW为确定的WCP核心参数,可与当前块的高nTbH或宽nTbW相同或不同。这样在一定条件下,也可只对当前块内的部分待预测像素进行以下计算。
如图17所示,步骤144包括以下操作步骤1441至步骤1444:
步骤1441,对于每个待预测像素,利用获取的参考色度信息、参考亮度信息及当前块的重建亮度信息构造亮度差向量。
步骤1442,对于每个待预测像素,根据所述亮度差向量,利用非线性函数计算权重向量;
步骤1443,对于每个待预测像素,根据所述权重向量与获取的参考色度信息通过加权计算色度预测值;
步骤1444,对于每个待预测像素,对所述计算得到的色度预测值进行修正,包括clip操作。
即,通过获取权重,根据权重进行加权预测得到基于权重的色度预测值,再对其进行修正。权重的获取过程包括构造亮度差向量和计算权重向量。
详细计算过程如下:
对于i=0…predSizeW-1,j=0…predSizeH-1
对于k=0,1...inSize-1
构造亮度差向量中各个元素diffY[i][j][k]
计算权重向量中各个元素cWeight[i][j][k](或cWeightFloat[i][j][k])
由cWeight[i][j](或cWeightFloat[i][j][k])和refC计算色度预测值Cpred[i][j]。
在步骤1441中,对于每个待预测像素,利用获取的参考色度信息、参考亮度信息及当前块的重建 亮度信息构造亮度差向量。
对WCP核心参数规定的尺寸内的每个待预测像素C pred[i][j],将其对应的重建亮度信息recY[i][j]与inSize数量的参考亮度信息refY相减并取绝对值,得到亮度差向量diffY[i][j][k]。计算公式如(23)所示,其中,k=0,1...inSize-1。
diffY[i][j][k]=abs(refY[k]-recY[i][j])     (23);
其中
Figure PCTCN2022086470-appb-000022
在一定条件下,可对待预测像素的亮度差向量进行线性或非线性数值处理。
例如:可根据WCP核心参数中的WCP控制参数T缩放待预测像素的亮度差向量的数值。
在步骤1442中,对于每个待预测像素,根据所述亮度差向量,利用非线性函数计算权重向量。
根据步骤143所得到的最佳的控制参数(best_T),采用非线性权重模型对每个待预测像素C pred[i][j]对应的亮度差向量diffY[i][j]进行处理,得到对应的权重向量cWeightFloat[i][j]。权重模型包括但不限于非线性归一化函数、非线性指数归一化函数等等。
例如:
可以采用非线性Softmax函数作为权重模型,每个待预测像素C pred[i][j]对应的亮度差向量diffY[i][j]作为权重模型的输入,最佳控制参数(best_T)可以作为模型的调整参数,模型输出每个待预测像素对应的权重向量cWeightFloat[i][j],计算公式如(24)所示,其中k=0,1,···,inSize-1。
Figure PCTCN2022086470-appb-000023
在以上计算完毕之后,可以对cWeightFloat进行定点化,如下式(25)所示:
cWeight[i][j][k]=round(cWeightFloat[i][j][k]×2 Shift)  (25);
其中,
Round(x)=Sign(x)×Floor(Abs(x)+0.5)
Figure PCTCN2022086470-appb-000024
Floor(x)表示小于或等于x的最大整数
Figure PCTCN2022086470-appb-000025
在步骤1443中,对于每个待预测像素,根据所述权重向量与获取的参考色度信息通过加权计算色度预测值;
根据每个待预测像素对应的权重向量cWeight[i][j](或cWeightFloat[i][j])和参考色度信息refC计算待预测像素的色度预测值。具体地,将每个待预测像素C pred[i][j]的参考色度信息refC与每个待预测像素对应的权重向量元素逐一对应相乘,得到subC[i][j](或subCFloat[i][j]),将相乘结果累加即为每个待预测像素的色度预测值C pred[i][j](即加权预测)。计算公式如下式(26)所示:
对于k=0,1...inSize-1
subCFloat[i][j][k]=(cWeightFloat[i][j][k]×refC[k])    (26);
在计算完毕之后,可以对subCFloat进行定点化,定点化过程中为保留一定的计算精度,可以乘上一个系数,如下式(27)所示:
subC[i][j][k]=round(subCFloat[i][j][k]×2 Shift)    (27);
或者如下式(28)所示:
subC[i][j][k]=(cWeight[i][j][k]×refC[k])   (28);
对于i=0…predSizeW-1,j=0…predSizeH-1
Figure PCTCN2022086470-appb-000026
在计算完毕后,对C predFloat[i][j]进行定点化,如下式30所示:
C pred[i][j]=round(C predFloat[i][j])   (30);
或者用定点化的subC[i][j][k]进行计算,如下式(31)所示:
Figure PCTCN2022086470-appb-000027
其中,Offset=1<<(Shift 1-1),Shift 1是在计算cWeight[i][j][k]或者subC[i][j][k]时(Shift 1=Shift), 或其他环节为了提高精度采取的定点化操作中需要的移位量。
将每个待预测像素的色度预测值C pred[i][j]进行空间存储,即为基于权重的色度预测输出predWcp。
在步骤1444中,对于每个待预测像素,对所述计算得到的色度预测值进行修正,包括clip操作。
predWcp内的色度预测值应该在限定范围内,如果超出,应该进行相应的修正操作。例如:
可以对C pred[i][j]内的色度预测值进行钳位操作,具体如下:
●当C pred[i][j]的值小于0时,将其置为0;
●当C pred[i][j]的值大于(1<<BitDepth)–1时,其置为(1<<BitDepth)–1。
以保证predWcp中所有预测值都在0到(1<<BitDepth)–1之间。
即:
C pred[i][j]=Clip3(0,(1<<BitDepth)-1,C pred[i][j])   (32);
其中
Figure PCTCN2022086470-appb-000028
或把公式(32)和公式(33)的操作合并为以下一个公式(34)完成:
Figure PCTCN2022086470-appb-000029
在步骤145中,对所述色度预测计算结果进行后处理过程。
基于权重的色度预测输出predWcp在一定条件下需要后处理后作为最终的色度预测值predSamples,否则最终的色度预测值predSamples即为predWcp。
上述方案可以提高WCP预测技术的准确性。通过对WCP核心参数中的控制参数(T)的优化,在当前块内容特性不同的情况下,本技术方案可以自适应选择最佳的控制参数,进一步完善步骤144中的权重模型,进而得到更加精确的色度预测值。由于WCP预测过程所采用的权重模型更加匹配当前块的内容特性与空间相关性,这样就可以使得预测值更加准确。
本技术方案的关键创新点在于对WCP预测过程中对配置控制参数的优化:
(1)充分利用当前块的内容特性,提高预测过程的准确性;
(2)充分利用邻近区域的已有的重建像素信息,提升预测模型的精确性;
(3)充分考虑预测块在不同方向上的特性信息,设计不同的模板匹配方法。
扩展方案1:上述方案中关于“3、模板匹配”的修改仅为一种实现方法,主要思想是在一种WCP色度预测模式中直接通过模板匹配选择出一个最佳的控制参数。在编码器中定义多个WCP色度预测模式,对应着不同模板类型与不同模板参考区域的组合。当前块在遍历所有的色度预测模式去率失真优化选择出最佳的色度预测模式时,进行到属于某个模板类型匹配的WCP色度预测模式时,在步骤1431的模板选择过程中只会选择一种或者相对较少的模板类型及其对应的模板参考区域。
以上模板和左模板为例,在现有的色度预测模式中添加WCP_L、WCP_T、WCP_LT三种带有模板匹配的WCP色度预测模式。WCP_L指在WCP预测过程的模板匹配步骤中只使用左模板进行选择最佳的控制参数作为当前块的WCP预测的权重模型的参数;WCP_T指在WCP预测过程的模板匹配步骤中只使用上模板进行选择最佳的控制参数作为当前块的WCP预测的权重模型的参数;WCP_LT指在WCP预测过程的模板匹配步骤中只使用左模板和上模板进行选择最佳的控制参数作为当前块的WCP预测的权重模型的参数,其中选择最佳的控制参数与上述方案中多个模板类型时的情况相同。其它操作与上述实施例的方案保持一致。
扩展方案2:上述实施例方案的主要思想都是在所有获取到的模板内都搜索到各自的最佳参数的前提下,再通过各种加权融合或者保留多个最佳参数进行后续操作。但是,该实现方法可能存在无法始终与当前块的最佳参数相等的情况。这里简单说明另一种实现方法。
以上模板和左模板都能够获取为例,在扩展方案1的WCP_LT模式为例,修改“3.3、选择最佳参数”为:
步骤1432介绍了上模板和左模板的WCP预测过程,这样就获取到了各自的模板内的重建色度信息与某个控制参数(T)所对应的预测色度信息。上模板的某个控制参数(T k)所对应的预测色度信息为predAboveTempWcp k,左模板的某个控制参数(T k)所对应的预测色度信息为predLeftTempWcp k,以MAE为例,分别计算出上模板和左模板的MAE A和MAE L,此处也可以采用其它的评价准则。
将MAE A和MAE L相加得到上模板和左模板的评价之和MAE Sum(即评价参数的一种示例),对应的是控制参数(T k)。通过循环遍历不同的控制参数(T),重复上述操作,可以得到多个MAE Sum,从中选择出最小的MAE Sum所对应的控制参数(best_T),进行步骤144的基于权重的色度预测。
若出现多个控制参数所对应的MAE Sum相等的情况,处理操作包括但不限于以下方法:
第一种方法是将这多个控制参数进行加权融合为一个最佳参数best_T,加权融合的标准可以选择固定加权系数或者根据模板内的像素数目进行分配加权系数等;
第二种方法是保留这多个控制参数,继续进行步骤144的基于权重的色度预测,在编码端根据某种评价准则对当前块的原始色度值与预测色度值进行处理,再从两者中选出最佳的参数,在编码比特流中传输上模板或者左模板的索引或直接传输参数值均可;
第三种方法是同样保留保留这多个控制参数,在步骤144的基于权重的色度预测中,遍历这些值的附近参数值,在编码端根据某种评价准则对当前块的原始色度值与预测色度值进行处理,从已缩小的参数区间中选出最佳的参数,在编码比特流中传输最佳的控制参数在已缩小区间中的索引或直接传输参数值均可。
若在上述方案1中,选择了超过2个模板进行后续操作,则可仿照上述情况进行处理。
应当注意,尽管在附图中以特定顺序描述了本申请中方法的各个步骤,但是,这并非要求或者暗示必须按照该特定顺序来执行这些步骤,或是必须执行全部所示的步骤才能实现期望的结果。附加的或备选的,可以省略某些步骤,将多个步骤合并为一个步骤执行,以及/或者将一个步骤分解为多个步骤执行等;或者,将不同实施例中步骤组合为新的技术方案。
本申请实施例提供一种编码装置,图18为本申请实施例提供的编码装置的结构示意图,如图18所示,编码装置18包括:
第一确定模块181,配置为根据模板区域,确定第一编码参数;
第二确定模块182,配置为确定所述当前块的第一颜色分量的参考样值;
第三确定模块183,配置为根据所述当前块的第一颜色分量的参考样值和所述第一编码参数,确定第一加权系数;
第一预测模块184,配置为根据所述第一加权系数和所述当前块的第二颜色分量的参考样值,确定所述当前块的第二颜色分量的第一预测值。
在一些实施例中,第一确定模块181包括第一确定单元和第二确定单元;其中,第一确定单元,配置为确定所述模板区域的参考样值;第二确定单元,配置为根据所述模板区域的参考样值,确定所述第一编码参数。
在一些实施例中,第一确定单元,配置为确定所述模板区域的第一颜色分量的重建值、以及所述模板区域的第二颜色分量的重建值;确定所述模板区域的参考区域的第一颜色分量的重建值、以及所述模板区域的参考区域的第二颜色分量的重建值。
在一些实施例中,第二确定单元包括第一子单元和第二子单元;其中,第一子单元,配置为确定所述模板区域的第一差值,其中,所述模板区域的第一差值设置为等于所述模板区域的第一颜色分量的参考值与所述模板区域的参考区域的第一颜色分量的参考值之间差值的绝对值;第二子单元,配置为根据所述模板区域的第一差值,确定所述第一编码参数。
在一些实施例中,第二子单元,配置为:根据所述第一差值和候选第一编码参数,确定所述模板区域的第二颜色分量的第二预测值;确定所述模板区域的第二颜色分量的第一预测误差;根据所述第一预测误差,确定所述第一编码参数;其中,所述第一预测误差是所述模板区域的第二颜色分量的参考值与所述模板区域的第二颜色分量的第二预测值之间的误差,所述模板区域的第二颜色分量的参考值是所述模板区域的第二颜色分量的重建值,或所述模板区域的第二颜色分量的重建值经滤波处理得到的值。
在一些实施例中,第二子单元,还配置为根据所述模板区域的第一差值和所述候选第一编码参数,使用预设的对应关系,确定所述第二加权系数。
在一些实施例中,第二子单元,配置为:从所述模板区域的各个候选第一编码参数中选出第一预测误差满足第一条件的参数;根据所述模板区域对应的第一预测误差满足第一条件的参数,确定所述第一编码参数。
在一些实施例中,第二子单元,配置为:根据所述当前块的第一颜色分量的参考样值和第一预测误差满足第一条件的候选第一编码参数,确定第六加权系数;根据所述第六加权系数和所述当前块的第二颜色分量的参考样值,确定所述当前块的第二颜色分量的第三预测值;根据所述当前块的第二颜色分量的第三预测值和原始值,确定对应的第一预测误差满足第一条件的候选第一编码参数的第二预测误差;根据第一预测误差满足第一条件的候选第一编码参数的第二预测误差,确定所述第一编码参数。
在一些实施例中,第二子单元,配置为:从第一预测误差满足第一条件的候选第一编码参数中选出第二预测误差满足第三条件的候选第一编码参数;根据所述第二预测误差满足第三条件的候选第一编码参数,确定所述第一编码参数。
在一些实施例中,第二子单元,配置为:将所述第一编码参数设置为等于所述第二预测误差满足第三条件的候选第一编码参数;或者将所述第一编码参数设置为等于所述第二预测误差满足第三条件的候 选第一编码参数的融合值。
在一些实施例中,第二子单元,配置为:对第一预测误差满足第一条件的候选第一编码参数进行扩展,得到第一扩展参数;根据所述当前块的第一颜色分量的参考样值和第一预测误差满足第一条件的候选第一编码参数以及所述第一扩展参数,确定第七加权系数;根据所述第七加权系数和所述当前块的第二颜色分量的参考样值,确定所述当前块的第二颜色分量的第四预测值;根据所述当前块的第二颜色分量的第四预测值和原始值,确定对应参数的第三预测误差;根据各个所述候选第一编码参数和所述第一扩展参数的第三预测误差,确定所述第一编码参数。
在一些实施例中,第二子单元,配置为:从各个所述候选第一编码参数和所述第一扩展参数中选出第三预测误差满足第四条件的参数;根据所述第三预测误差满足第四条件的参数,确定所述第一编码参数。
在一些实施例中,第二子单元,配置为:将所述第一编码参数设置为等于所述第三预测误差满足第四条件的参数;或者,将所述第一编码参数设置为等于所述第三预测误差满足第四条件的参数的融合值。
在一些实施例中,第二子单元,配置为:将所述第一编码参数设置为等于第一预测误差满足第一条件的参数;或者,将所述第一编码参数设置为等于第一预测误差满足第一条件的参数的融合值。
在一些实施例中,第二子单元,配置为:将所述第一编码参数设置为等于第一预测误差满足第一条件的参数与第三加权系数的加权和。
在一些实施例中,第二子单元,还配置为:根据第一预测误差满足第一条件的参数对应的第一预测误差,确定对应的第三加权系数;或者,将所述第三加权系数设置为预设常数值。
在一些实施例中,第二子单元配置为对第一预测误差满足第一条件的参数进行扩展,得到第一扩展参数;对所述第一扩展参数和/或第一预测误差满足第一条件的参数进行融合,得到所述第一编码参数。
在一些实施例中,第二子单元,配置为将所述第一编码参数设置为等于各个所述候选第一编码参数与第四加权系数的加权和。
在一些实施例中,第二子单元,还配置为根据所述第一预测误差,确定对应的所述候选第一编码参数的第四加权系数。
在一些实施例中,第二子单元,配置为:根据所述模板区域的同一候选第一编码参数各自对应的第一预测误差,确定表征对应候选第一编码参数的性能的评价参数;根据各个所述候选第一编码参数的评价参数,确定所述第一编码参数。
在一些实施例中,第二子单元,配置为:将所述评价参数设置为等于所述模板区域的同一候选第一编码参数各自对应的第一预测误差的融合值。
在一些实施例中,第二子单元,配置为:将所述评价参数设置为等于所述模板区域的同一候选第一编码参数各自对应的第一预测误差之和。
在一些实施例中,第二子单元,配置为:从各个所述候选第一编码参数中选出评价参数满足第二条件的参数;根据评价参数满足第二条件的参数,确定所述第一编码参数。
在一些实施例中,第二子单元,配置为:将所述第一编码参数设置为等于评价参数满足第二条件的参数;或者,将所述第一编码参数设置为等于评价参数满足第二条件的参数的融合值。
在一些实施例中,第二子单元,配置为:将所述第一编码参数设置为等于评价参数满足第二条件的参数与第五加权系数的加权和。
在一些实施例中,第二子单元,还配置为:根据评价参数满足第二条件的参数对应的模板区域,确定对应参数的第五加权系数。
在一些实施例中,第二子单元,配置为根据评价参数满足第二条件的参数对应的模板区域的像素数目和/或模板类型,确定对应参数的第五加权系数。
在一些实施例中,第二子单元,配置为:根据所述当前块的第一颜色分量的参考样值和评价参数满足第二条件的参数,确定第八加权系数;根据所述第八加权系数,和所述当前块的第二颜色分量的参考样值,确定所述当前块的第二颜色分量的第五预测值;根据所述当前块的第二颜色分量的第五预测值和原始值,确定对应的评价参数满足第二条件的参数第四预测误差;根据各个候选第一编码参数的第四预测误差,确定所述第一编码参数。
在一些实施例中,第二子单元,配置为:对评价参数满足第二条件的参数进行扩展,得到第二扩展参数;根据所述当前块的第一颜色分量的参考样值和评价参数满足第二条件的参数以及第二扩展参数,确定第九加权系数;根据所述第九加权系数和所述当前块的第二颜色分量的参考样值,确定所述当前块的第二颜色分量的第六预测值;根据所述当前块的第二颜色分量的第六预测值和原始值,确定对应参数的第五预测误差;根据各个候选第一编码参数和所述第二扩展参数的第五预测误差,确定所述第一编码参数。
在一些实施例中,第一确定模块181,还配置为根据配置的预测模式包括的模板类型,确定所述模板区域。
在一些实施例中,第一确定模块181,配置为将配置的预测模式包括的模板作为所述模板区域。
在一些实施例中,第一确定模块181,还配置为根据所述当前块的邻近区域的像素可用性,确定所述模板区域;其中,基于与所述当前块的相对位置关系,所述邻近区域包括以下至少之一:所述当前块的上侧区域、所述当前块的左侧区域、所述当前块的上右侧区域、所述当前块的左下侧区域、所述当前块的左上侧区域。
在一些实施例中,第一预测模块184,还配置为在不存在所述模板区域的情况下,将默认值作为所述当前块的第二颜色分量的预测值。
在一些实施例中,第一预测模块184,还配置为在不存在所述模板区域的情况下,采用不同于所述方法的另一预测方法确定所述当前块的第二颜色分量进行预测。
在一些实施例中,第二子单元,配置为将用于确定所述第一预测误差的第二预测值设置为等于对所述模板区域的第二颜色分量的第二预测值进行修正操作得到的第二预测值。
在一些实施例中,编码装置18还包括:第一获取模块,配置为获取所述当前块的第二颜色分量的原始值;第七确定模块,配置为根据所述当前块的第二颜色分量的原始值和所述第二颜色分量的第一预测值,确定所述当前块的第二颜色分量的残差值;编码模块,配置为对所述当前块的第二颜色分量的残差值进行编码,将所得到的编码比特写入码流。
在一些实施例中,编码装置18还包括:第一修正模块,配置为对所述当前块的第二颜色分量的第一预测值进行修正操作,得到修正后的第一预测值;第一获取模块,配置为获取所述当前块的第二颜色分量的原始值;第八确定模块,配置为根据所述当前块的第二颜色分量的原始值和所述修正后的第一预测值,确定所述当前块的第二颜色分量的残差值;编码模块,配置为对所述当前块的第二颜色分量的残差值进行编码,将所得到的编码比特写入码流。
在一些实施例中,编码装置18还包括编码模块,配置为对所述第一编码参数或所述第一编码参数的索引进行编码,将所得到的编码比特写入码流。
可以理解地,在本申请实施例中,“模块”可以是部分电路、部分处理器、部分程序或软件等等,当然也可以是单元,还可以是非单元化的。而且在本实施例中的各组成部分可以集成在一个处理单元中,也可以是各个模块单独物理存在,也可以两个或两个以上模块集成在一个单元中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。
所述集成的模块如果以软件功能模块的形式实现并非作为独立的产品进行销售或使用时,可以存储在一个计算机可读取存储介质中,基于这样的理解,本实施例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或processor(处理器)执行本实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。
因此,本申请实施例提供了一种计算机可读存储介质,该计算机可读存储介质存储有计算机程序,所述计算机程序被第一处理器执行时实现前述实施例中任一项所述的方法。
基于上述编码装置18的组成以及计算机可读存储介质,参见图19,其示出了本申请实施例提供的编码设备的具体硬件结构示意图。如图19所示,编码设备19可以包括:第一通信接口191、第一存储器192和第一处理器193;各个组件通过第一总线系统194耦合在一起。可理解,第一总线系统194用于实现这些组件之间的连接通信。第一总线系统194除包括数据总线之外,还包括电源总线、控制总线和状态信号总线。但是为了清楚说明起见,在图19中将各种总线都标为第一总线系统194。其中,
第一通信接口191,用于在与其它外部网元之间进行收发信息过程中,信号的接收和发送;
第一存储器192,用于存储能够在第一处理器193上运行的计算机程序;
第一处理器193,用于在运行所述计算机程序时,执行:根据模板区域,确定第一编码参数;
确定所述当前块的第一颜色分量的参考样值;根据所述当前块的第一颜色分量的参考样值和所述第一编码参数,确定第一加权系数;根据所述第一加权系数和所述当前块的第二颜色分量的参考样值,确定所述当前块的第二颜色分量的第一预测值。
可以理解,本申请实施例中的第一存储器192可以是易失性存储器或非易失性存储器,或可包括易失性和非易失性存储器两者。其中,非易失性存储器可以是只读存储器(Read-Only Memory,ROM)、可编程只读存储器(Programmable ROM,PROM)、可擦除可编程只读存储器(Erasable PROM,EPROM)、电可擦除可编程只读存储器(Electrically EPROM,EEPROM)或闪存。易失性存储器可以是随机存取 存储器(Random Access Memory,RAM),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的RAM可用,例如静态随机存取存储器(Static RAM,SRAM)、动态随机存取存储器(Dynamic RAM,DRAM)、同步动态随机存取存储器(Synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(Double Data Rate SDRAM,DDRSDRAM)、增强型同步动态随机存取存储器(Enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(Synchlink DRAM,SLDRAM)和直接内存总线随机存取存储器(Direct Rambus RAM,DRRAM)。本申请描述的系统和方法的第一存储器222旨在包括但不限于这些和任意其它适合类型的存储器。
而第一处理器193可能是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤可以通过第一处理器193中的硬件的集成逻辑电路或者软件形式的指令完成。上述的第一处理器193可以是通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field Programmable Gate Array,FPGA)或者其它可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。可以实现或者执行本申请实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本申请实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于第一存储器192,第一处理器193读取第一存储器192中的信息,结合其硬件完成上述方法的步骤。
可以理解的是,本申请描述的这些实施例可以用硬件、软件、固件、中间件、微码或其组合来实现。对于硬件实现,处理单元可以实现在一个或多个专用集成电路(Application Specific Integrated Circuits,ASIC)、数字信号处理器(Digital Signal Processing,DSP)、数字信号处理设备(DSP Device,DSPD)、可编程逻辑设备(Programmable Logic Device,PLD)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、通用处理器、控制器、微控制器、微处理器、用于执行本申请所述功能的其它电子单元或其组合中。对于软件实现,可通过执行本申请所述功能的模块(例如过程、函数等)来实现本申请所述的技术。软件代码可存储在存储器中并通过处理器执行。存储器可以在处理器中或在处理器外部实现。
可选地,作为另一个实施例,第一处理器193还配置为在运行所述计算机程序时,执行前述实施例中任一项所述的方法。
在本申请的再一实施例中,基于前述实施例相同的发明构思,参见图20,其示出了本申请实施例提供的一种解码装置的组成结构示意图。如图20所示,该解码装置200可以包括:
第四确定模块2001,配置为根据模板区域,确定第一解码参数;
第五确定模块2002,配置为确定所述当前块的第一颜色分量的参考样值;
第六确定模块2003,配置为根据所述当前块的第一颜色分量的参考样值和所述第一解码参数,确定第一加权系数;
第二预测模块2004,配置为根据所述第一加权系数和所述当前块的第二颜色分量的参考样值,确定所述当前块的第二颜色分量的第一预测值。
在一些实施例中,第四确定模块2001包括第三确定单元和第四确定单元;其中,所述第三确定单元,配置为确定所述模板区域的参考样值;第四确定单元,配置为根据所述模板区域的参考样值,确定所述第一解码参数。
在一些实施例中,第三确定单元配置为:确定所述模板区域的第一颜色分量的重建值、以及所述模板区域的第二颜色分量的重建值;确定所述模板区域的参考区域的第一颜色分量的重建值、以及所述模板区域的参考区域的第二颜色分量的重建值。
在一些实施例中,第四确定单元包括第三子单元和第四子单元;其中,第三子单元,配置为确定所述模板区域的第一差值,其中,所述模板区域的第一差值设置为等于所述模板区域的第一颜色分量的参考值与所述模板区域的参考区域的第一颜色分量的参考值之间差值的绝对值;第四子单元,配置为根据所述模板区域的第一差值,确定所述第一解码参数。
在一些实施例中,所述模板区域的第一颜色分量的参考值是所述模板区域的第一颜色分量的重建值,或所述模板区域的第一颜色分量的重建值经滤波处理得到的值;所述模板区域的参考区域的第一颜色分量的参考值是所述模板区域的参考区域的第一颜色分量的重建值,或所述模板区域的参考区域的第一颜色分量的重建值经滤波处理得到的值。
在一些实施例中,第四子单元,配置为:根据所述第一差值和候选第一解码参数,确定所述模板区域的第二颜色分量的第二预测值;确定所述模板区域的第二颜色分量的第一预测误差;根据所述第一预测误差,确定所述第一解码参数;其中,所述第一预测误差是所述模板区域的第二颜色分量的参考值与所述模板区域的第二颜色分量的第二预测值之间的误差,所述模板区域的第二颜色分量的参考值是所述 模板区域的第二颜色分量的重建值,或所述模板区域的第二颜色分量的重建值经滤波处理得到的值。
在一些实施例中,第四子单元,配置为:所述模板区域的第二颜色分量的第二预测值设置为等于所述模板区域的参考区域的第二颜色分量的参考值与第二加权系数的加权和;将所述第一解码参数设置为等于可以使所述第一预测误差达到第一条件时对应的所述候选第一解码参数的取值;其中,所述模板区域的参考区域的第二颜色分量的参考值是所述模板区域的参考区域的第二颜色分量的重建值,或所述模板区域的参考区域的第二颜色分量的重建值经滤波处理后得到的值。
在一些实施例中,第四子单元,还配置为根据所述模板区域的第一差值和所述候选第一解码参数,使用预设的对应关系,确定所述第二加权系数。
在一些实施例中,第四子单元,配置为:从所述模板区域的各个候选第一解码参数中选出第一预测误差满足第一条件的参数;根据所述模板区域对应的第一预测误差满足第一条件的参数,确定所述第一解码参数。
在一些实施例中,第四子单元,配置为:将所述第一解码参数设置为等于第一预测误差满足第一条件的参数;或者,将所述第一解码参数设置为等于第一预测误差满足第一条件的参数的融合值。
在一些实施例中,第四子单元,配置为:将所述第一解码参数设置为等于第一预测误差满足第一条件的参数与第三加权系数的加权和。
在一些实施例中,第四子单元,还配置为:根据第一预测误差满足第一条件的参数对应的第一预测误差,确定对应的第三加权系数;或者,将所述第三加权系数设置为预设常数值。
在一些实施例中,第四子单元,配置为:对第一预测误差满足第一条件的参数进行扩展,得到第一扩展参数;对所述第一扩展参数和/或第一预测误差满足第一条件的参数进行融合,得到所述第一解码参数。
在一些实施例中,第四子单元,配置为:将所述第一解码参数设置为等于各个所述候选第一解码参数与第四加权系数的加权和。
在一些实施例中,第四子单元,还配置为:根据所述第一预测误差,确定对应的所述候选第一解码参数的第四加权系数。
在一些实施例中,所述第一条件包括:第一预测误差最小或第一预测误差小于第一阈值。
在一些实施例中,第四子单元,配置为:根据所述模板区域的同一候选第一解码参数各自对应的第一预测误差,确定表征对应候选第一解码参数的性能的评价参数;根据各个所述候选第一解码参数的评价参数,确定所述第一解码参数。
在一些实施例中,第四子单元,配置为:将所述评价参数设置为等于所述模板区域的同一候选第一解码参数各自对应的第一预测误差的融合值。
在一些实施例中,第四子单元,配置为:将所述评价参数设置为等于所述模板区域的同一候选第一解码参数各自对应的第一预测误差之和。
在一些实施例中,第四子单元,配置为:从各个所述候选第一解码参数中选出评价参数满足第二条件的参数;根据评价参数满足第二条件的参数,确定所述第一解码参数。
在一些实施例中,第四子单元,配置为:将所述第一解码参数设置为等于评价参数满足第二条件的参数;或者,将所述第一解码参数设置为等于评价参数满足第二条件的参数的融合值。
在一些实施例中,第四子单元,配置为:将所述第一解码参数设置为等于评价参数满足第二条件的参数与第五加权系数的加权和。
在一些实施例中,第四子单元,还配置为:根据评价参数满足第二条件的参数对应的模板区域,确定对应参数的第五加权系数。
在一些实施例中,第四子单元,配置为:根据评价参数满足第二条件的参数对应的模板区域的像素数目和/或模板类型,确定对应参数的第五加权系数。
在一些实施例中,解码装置200还包括解析模块,配置为解析码流,得到所述第一解码参数的索引;第二获取模块,配置为根据所述第一解码参数的索引,获取所述第一解码参数;或者,解析模块,配置为解析码流,得到所述第一解码参数。
在一些实施例中,第四确定模块2001,还配置为根据配置的预测模式包括的模板类型,确定所述模板区域。
在一些实施例中,所述模板类型至少包括以下至少之一:上模板、左模板、上右模板、左下模板、左上模板。
在一些实施例中,第四确定模块2001,配置为将所述模板区域设置为所述配置的预测模式包括的模板类型对应的区域。
在一些实施例中,第四确定模块2001,还配置为根据所述当前块的邻近区域的像素可用性,确定 模板区域;其中,所述邻近区域包括以下至少之一:所述当前块的上侧区域、所述当前块的左侧区域、所述当前块的上右侧区域、所述当前块的左下侧区域、所述当前块的左上侧区域。
在一些实施例中,第二预测模块2004,还配置为基于确定不存在所述模板区域,将默认值作为所述当前块的第二颜色分量的预测值。
在一些实施例中,第二预测模块2004,还配置为基于确定不存在所述模板区域,采用不同于所述方法的另一预测方法确定所述当前块的第二颜色分量进行预测。
在一些实施例中,第四子单元,配置为:将用于确定所述第一预测误差的第二预测值设置为等于对所述模板区域的第二颜色分量的第二预测值进行修正操作得到的第二预测值。
在一些实施例中,解码装置200还包括解析模块,配置为解析码流,得到所述当前块的第二颜色分量的残差值;第九确定模块,配置为根据所述第二颜色分量的残差值和所述当前块的第二颜色分量的第一预测值,确定所述当前块的第二颜色分量的重建值。
在一些实施例中,解码装置200还包括第二修正模块和第十确定模块;其中,第二修正模块,配置为对所述当前块的第二颜色分量的第一预测值进行修正操作,得到修正后的第一预测值;第十确定模块,配置为根据所述第二颜色分量的残差值和所述修正后的第一预测值,确定所述当前块的第二颜色分量的重建值。
可以理解地,在本申请实施例中,“模块”可以是部分电路、部分处理器、部分程序或软件等等,当然也可以是单元,还可以是非单元化的。而且在本实施例中的各组成部分可以集成在一个处理单元中,也可以是各个模块单独物理存在,也可以两个或两个以上模块集成在一个单元中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。
所述集成的模块如果以软件功能模块的形式实现并非作为独立的产品进行销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本实施例提供了一种计算机可读存储介质,该计算机可读存储介质存储有计算机程序,所述计算机程序被第二处理器执行时实现前述实施例中任一项所述的方法。
基于上述解码装置200的组成以及计算机可读存储介质,参见图21,其示出了本申请实施例提供的解码设备的具体硬件结构示意图。如图21所示,解码设备21可以包括:第二通信接口211、第二存储器212和第二处理器213;各个组件通过第二总线系统214耦合在一起。可理解,第二总线系统214用于实现这些组件之间的连接通信。第二总线系统214除包括数据总线之外,还包括电源总线、控制总线和状态信号总线。但是为了清楚说明起见,在图21中将各种总线都标为第二总线系统214。其中,
第二通信接口211,用于在与其它外部网元之间进行收发信息过程中,信号的接收和发送;第二存储器212,用于存储能够在第二处理器213上运行的计算机程序;第二处理器213,用于在运行所述计算机程序时,执行前述实施例中任一项所述的方法。
可选地,作为另一个实施例,第二处理器213还配置为在运行所述计算机程序时,执行前述实施例中任一项所述的方法。
可以理解,第二存储器212与第一存储器222的硬件功能类似,第二处理器213与第一处理器223的硬件功能类似;这里不再详述。
在本申请的再一实施例中,参见图22,其示出了本申请实施例提供的一种编解码系统的组成结构示意图。如图22所示,编解码系统22可以包括编码器221和解码器222。其中,编码器221可以为集成有前述实施例所述编码装置18的设备,或者也可以为前述实施例所述的编码设备19;解码器222可以为集成有前述实施例所述解码装置200的设备,或者也可以为前述实施例所述的解码设备21。
需要说明的是,在本申请中,术语“包括”、“包含”或者其任何其它变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其它要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。
上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。本申请所提供的几个方法实施例中所揭露的方法,在不冲突的情况下可以任意组合,得到新的方法实施例。本申请所提供的几个产品实施例中所揭露的特征,在不冲突的情况下可以任意组合,得到新的产品实施例。本申请所提供的几个方法或设备实施例中所揭露的特征,在不冲突的情况下可以任意组合,得到新的方法实施例或设备实施例。以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。

Claims (93)

  1. 一种解码方法,所述方法包括:
    根据模板区域,确定第一解码参数;
    确定当前块的第一颜色分量的参考样值;
    根据所述当前块的第一颜色分量的参考样值和所述第一解码参数,确定第一加权系数;
    根据所述第一加权系数和所述当前块的第二颜色分量的参考样值,确定所述当前块的第二颜色分量的第一预测值。
  2. 根据权利要求1所述的方法,其中,所述根据模板区域,确定第一解码参数,包括:
    确定所述模板区域的参考样值;
    根据所述模板区域的参考样值,确定所述第一解码参数。
  3. 根据权利要求2所述的方法,其中,所述确定所述模板区域的参考样值,包括:
    确定所述模板区域的第一颜色分量的重建值、以及所述模板区域的第二颜色分量的重建值;
    确定所述模板区域的参考区域的第一颜色分量的重建值、以及所述模板区域的参考区域的第二颜色分量的重建值。
  4. 根据权利要求3所述的方法,其中,所述根据所述模板区域的参考样值,确定所述第一解码参数,包括:
    确定所述模板区域的第一差值,其中,所述模板区域的第一差值设置为等于所述模板区域的第一颜色分量的参考值与所述模板区域的参考区域的第一颜色分量的参考值之间差值的绝对值;
    根据所述模板区域的第一差值,确定所述第一解码参数。
  5. 根据权利要求4所述的方法,其中,
    所述模板区域的第一颜色分量的参考值是所述模板区域的第一颜色分量的重建值,或所述模板区域的第一颜色分量的重建值经滤波处理得到的值;
    所述模板区域的参考区域的第一颜色分量的参考值是所述模板区域的参考区域的第一颜色分量的重建值,或所述模板区域的参考区域的第一颜色分量的重建值经滤波处理得到的值。
  6. 根据权利要求4所述的方法,其中,所述根据所述模板区域的第一差值,确定所述第一解码参数,包括:
    根据所述第一差值和候选第一解码参数,确定所述模板区域的第二颜色分量的第二预测值;
    确定所述模板区域的第二颜色分量的第一预测误差;
    根据所述第一预测误差,确定所述第一解码参数;
    其中,所述第一预测误差是所述模板区域的第二颜色分量的参考值与所述模板区域的第二颜色分量的第二预测值之间的误差,所述模板区域的第二颜色分量的参考值是所述模板区域的第二颜色分量的重建值,或所述模板区域的第二颜色分量的重建值经滤波处理得到的值。
  7. 根据权利要求6所述的方法,其中,
    所述模板区域的第二颜色分量的第二预测值设置为等于所述模板区域的参考区域的第二颜色分量的参考值与第二加权系数的加权和;
    将所述第一解码参数设置为等于可以使所述第一预测误差达到第一条件时对应的所述候选第一解码参数的取值;
    其中,所述模板区域的参考区域的第二颜色分量的参考值是所述模板区域的参考区域的第二颜色分量的重建值,或所述模板区域的参考区域的第二颜色分量的重建值经滤波处理后得到的值。
  8. 根据权利要求7所述的方法,其中,
    根据所述模板区域的第一差值和所述候选第一解码参数,使用预设的对应关系,确定所述第二加权系数。
  9. 根据权利要求8所述的方法,其中,
    所述预设的对应关系是softmax函数,或者,所述预设的对应关系是使用softmax函数得到的;其中,所述softmax函数的输入为以下之一:
    所述第一差值与所述候选第一解码参数的比值;
    所述第一差值与所述候选第一解码参数的乘积;
    所述第一差值经比特移位处理后得到值;其中,所述比特移位的位数等于所述候选第一解码参数。
  10. 根据权利要求6所述的方法,其中,所述候选第一解码参数包含一个或多个候选第一解码参数。
  11. 根据权利要求3所述的方法,其中,所述模板区域的参考区域包含以下至少之一:
    所述模板区域的上相邻区域;
    所述模板区域的下相邻区域;
    所述模板区域的左相邻区域;
    所述模板区域的右相邻区域;
    所述模板区域。
  12. 根据权利要求6所述的方法,其中,所述根据所述第一预测误差,确定所述第一解码参数,包括:
    从所述模板区域的各个候选第一解码参数中选出第一预测误差满足第一条件的参数;
    根据所述模板区域对应的第一预测误差满足第一条件的参数,确定所述第一解码参数。
  13. 根据权利要求12所述的方法,其中,
    将所述第一解码参数设置为等于第一预测误差满足第一条件的参数;或者,
    将所述第一解码参数设置为等于第一预测误差满足第一条件的参数的融合值。
  14. 根据权利要求13所述的方法,其中,
    将所述第一解码参数设置为等于第一预测误差满足第一条件的参数与第三加权系数的加权和。
  15. 根据权利要求14所述的方法,其中,所述方法还包括:
    根据第一预测误差满足第一条件的参数对应的第一预测误差,确定对应的第三加权系数;或者,将所述第三加权系数设置为预设常数值。
  16. 根据权利要求12所述的方法,其中,所述根据所述模板区域对应的第一预测误差满足第一条件的参数,确定所述第一解码参数,包括:
    对第一预测误差满足第一条件的参数进行扩展,得到第一扩展参数;
    对所述第一扩展参数和/或第一预测误差满足第一条件的参数进行融合,得到所述第一解码参数。
  17. 根据权利要求6所述的方法,其中,
    将所述第一解码参数设置为等于各个所述候选第一解码参数与第四加权系数的加权和。
  18. 根据权利要求17所述的方法,其中,所述方法还包括:
    根据所述第一预测误差,确定对应的所述候选第一解码参数的第四加权系数。
  19. 根据权利要求12至16任一项所述的方法,其中,所述第一条件包括:第一预测误差最小、第一预测误差小于第一阈值、第一预测误差最大或第一预测误差大于第三阈值。
  20. 根据权利要求6所述的方法,其中,所述根据所述第一预测误差,确定所述第一解码参数,包括:
    根据所述模板区域的同一候选第一解码参数各自对应的第一预测误差,确定表征对应候选第一解码参数的性能的评价参数;
    根据各个所述候选第一解码参数的评价参数,确定所述第一解码参数。
  21. 根据权利要求20所述的方法,其中,
    将所述评价参数设置为等于所述模板区域的同一候选第一解码参数各自对应的第一预测误差的融合值。
  22. 根据权利要求21所述的方法,其中,
    将所述评价参数设置为等于所述模板区域的同一候选第一解码参数各自对应的第一预测误差之和。
  23. 根据权利要求20所述的方法,其中,所述根据各个所述候选第一解码参数的评价参数,确定所述第一解码参数,包括:
    从各个所述候选第一解码参数中选出评价参数满足第二条件的参数;
    根据评价参数满足第二条件的参数,确定所述第一解码参数。
  24. 根据权利要求23所述的方法,其中,
    将所述第一解码参数设置为等于评价参数满足第二条件的参数;或者,
    将所述第一解码参数设置为等于评价参数满足第二条件的参数的融合值。
  25. 根据权利要求24所述的方法,其中,
    将所述第一解码参数设置为等于评价参数满足第二条件的参数与第五加权系数的加权和。
  26. 根据权利要求25所述的方法,其中,所述方法还包括:
    根据评价参数满足第二条件的参数对应的模板区域,确定对应参数的第五加权系数。
  27. 根据权利要求26所述的方法,其中,所述根据评价参数满足第二条件的参数对应的模板区域,确定对应参数的第五加权系数,包括:
    根据评价参数满足第二条件的参数对应的模板区域的像素数目和/或模板类型,确定对应参数的第 五加权系数。
  28. 根据权利要求25所述的方法,其中,所述第五加权系数为预设常数值。
  29. 根据权利要求23至28任一项所述的方法,其中,所述第二条件包括:评价参数最小、评价参数小于第二阈值、评价参数最大或评价参数大于第四阈值。
  30. 根据权利要求1所述的方法,其中,所述方法还包括:
    解析码流,得到所述第一解码参数的索引;以及根据所述第一解码参数的索引,获取所述第一解码参数;或者,
    解析码流,得到所述第一解码参数。
  31. 根据权利要求1所述的方法,其中,所述方法还包括:
    根据配置的预测模式包括的模板类型,确定所述模板区域。
  32. 根据权利要求31所述的方法,其中,所述模板类型至少包括以下至少之一:上模板、左模板、上右模板、左下模板、左上模板。
  33. 根据权利要求32所述的方法,其中,
    将所述模板区域设置为所述配置的预测模式包括的模板类型对应的区域。
  34. 根据权利要求1所述的方法,其中,所述方法还包括:
    根据所述当前块的邻近区域的像素可用性,确定模板区域;
    其中,所述邻近区域包括以下至少之一:所述当前块的上侧区域、所述当前块的左侧区域、所述当前块的上右侧区域、所述当前块的左下侧区域、所述当前块的左上侧区域。
  35. 根据权利要求1所述的方法,其中,所述方法还包括:
    基于确定不存在所述模板区域,将默认值作为所述当前块的第二颜色分量的预测值。
  36. 根据权利要求1所述的方法,其中,所述方法还包括:
    基于确定不存在所述模板区域,采用不同于所述方法的另一预测方法确定所述当前块的第二颜色分量进行预测。
  37. 根据权利要求6所述的方法,其中,
    将用于确定所述第一预测误差的第二预测值设置为等于对所述模板区域的第二颜色分量的第二预测值进行修正操作得到的第二预测值。
  38. 根据权利要求1所述的方法,其中,所述方法还包括:
    解析码流,得到所述当前块的第二颜色分量的残差值;
    根据所述第二颜色分量的残差值和所述当前块的第二颜色分量的第一预测值,确定所述当前块的第二颜色分量的重建值。
  39. 根据权利要求1所述的方法,其中,所述方法还包括:
    对所述当前块的第二颜色分量的第一预测值进行修正操作,得到修正后的第一预测值;
    根据所述第二颜色分量的残差值和所述修正后的第一预测值,确定所述当前块的第二颜色分量的重建值。
  40. 一种编码方法,所述方法包括:
    根据模板区域,确定第一编码参数;
    确定当前块的第一颜色分量的参考样值;
    根据所述当前块的第一颜色分量的参考样值和所述第一编码参数,确定第一加权系数;
    根据所述第一加权系数和所述当前块的第二颜色分量的参考样值,确定所述当前块的第二颜色分量的第一预测值。
  41. 根据权利要求1所述的方法,其中,所述根据模板区域,确定第一编码参数,包括:
    确定所述模板区域的参考样值;
    根据所述模板区域的参考样值,确定所述第一编码参数。
  42. 根据权利要求41所述的方法,其中,所述确定所述模板区域的参考样值,包括:
    确定所述模板区域的第一颜色分量的重建值、以及所述模板区域的第二颜色分量的重建值;
    确定所述模板区域的参考区域的第一颜色分量的重建值、以及所述模板区域的参考区域的第二颜色分量的重建值。
  43. 根据权利要求42所述的方法,其中,所述根据所述模板区域的参考样值,确定所述第一编码参数,包括:
    确定所述模板区域的第一差值,其中,所述模板区域的第一差值设置为等于所述模板区域的第一颜色分量的参考值与所述模板区域的参考区域的第一颜色分量的参考值之间差值的绝对值;
    根据所述模板区域的第一差值,确定所述第一编码参数。
  44. 根据权利要求43所述的方法,其中,
    所述模板区域的第一颜色分量的参考值是所述模板区域的第一颜色分量的重建值,或所述模板区域的第一颜色分量的重建值经滤波处理得到的值;或者,所述模板区域的第一颜色分量的参考值是所述模板区域的第一颜色分量的原始值,或所述模板区域的第一颜色分量的原始值经滤波处理得到的值;
    所述模板区域的参考区域的第一颜色分量的参考值是所述模板区域的参考区域的第一颜色分量的重建值,或所述模板区域的参考区域的第一颜色分量的重建值经滤波处理得到的值。
  45. 根据权利要求43所述的方法,其中,所述根据所述模板区域的第一差值,确定所述第一编码参数,包括:
    根据所述第一差值和候选第一编码参数,确定所述模板区域的第二颜色分量的第二预测值;
    确定所述模板区域的第二颜色分量的第一预测误差;
    根据所述第一预测误差,确定所述第一编码参数;
    其中,所述第一预测误差是所述模板区域的第二颜色分量的参考值与所述模板区域的第二颜色分量的第二预测值之间的误差,所述模板区域的第二颜色分量的参考值是所述模板区域的第二颜色分量的重建值,或所述模板区域的第二颜色分量的重建值经滤波处理得到的值。
  46. 根据权利要求45所述的方法,其中,
    所述模板区域的第二颜色分量的第二预测值设置为等于所述模板区域的参考区域的第二颜色分量的参考值与第二加权系数的加权和;
    将所述第一编码参数设置为等于可以使所述第一预测误差达到第一条件时对应的所述候选第一编码参数的取值;
    其中,所述模板区域的参考区域的第二颜色分量的参考值是所述模板区域的参考区域的第二颜色分量的重建值,或所述模板区域的参考区域的第二颜色分量的重建值经滤波处理后得到的值。
  47. 根据权利要求46所述的方法,其中,
    根据所述模板区域的第一差值和所述候选第一编码参数,使用预设的对应关系,确定所述第二加权系数。
  48. 根据权利要求47所述的方法,其中,
    所述预设的对应关系是softmax函数,或者,所述预设的对应关系是使用softmax函数得到的;其中,所述softmax函数的输入为以下之一:
    所述第一差值与所述候选第一编码参数的比值;
    所述第一差值与所述候选第一编码参数的乘积;
    所述第一差值经比特移位处理后得到值;其中,所述比特移位的位数等于所述候选第一编码参数。
  49. 根据权利要求45所述的方法,其中,所述候选第一编码参数包含一个或多个候选第一编码参数。
  50. 根据权利要求42所述的方法,其中,所述模板区域的参考区域包含以下至少之一:
    所述模板区域的上相邻区域;
    所述模板区域的下相邻区域;
    所述模板区域的左相邻区域;
    所述模板区域的右相邻区域;
    所述模板区域。
  51. 根据权利要求45所述的方法,其中,所述根据所述第一预测误差,确定所述第一编码参数,包括:
    从所述模板区域的各个候选第一编码参数中选出第一预测误差满足第一条件的参数;
    根据所述模板区域对应的第一预测误差满足第一条件的参数,确定所述第一编码参数。
  52. 根据权利要求51所述的方法,其中,所述根据所述模板区域对应的第一预测误差满足第一条件的参数,确定所述第一编码参数,包括:
    根据所述当前块的第一颜色分量的参考样值和第一预测误差满足第一条件的候选第一编码参数,确定第六加权系数;
    根据所述第六加权系数和所述当前块的第二颜色分量的参考样值,确定所述当前块的第二颜色分量的第三预测值;
    根据所述当前块的第二颜色分量的第三预测值和原始值,确定对应的第一预测误差满足第一条件的候选第一编码参数的第二预测误差;
    根据第一预测误差满足第一条件的候选第一编码参数的第二预测误差,确定所述第一编码参数。
  53. 根据权利要求52所述的方法,其中,所述根据第一预测误差满足第一条件的候选第一编码参数的第二预测误差,确定所述第一编码参数,包括:
    从第一预测误差满足第一条件的候选第一编码参数中选出第二预测误差满足第三条件的候选第一编码参数;
    根据所述第二预测误差满足第三条件的候选第一编码参数,确定所述第一编码参数。
  54. 根据权利要求53所述的方法,其中,
    将所述第一编码参数设置为等于所述第二预测误差满足第三条件的候选第一编码参数;或者
    将所述第一编码参数设置为等于所述第二预测误差满足第三条件的候选第一编码参数的融合值。
  55. 根据权利要求53所述的方法,其中,所述第三条件包括:第二预测误差最小或最大。
  56. 根据权利要求51所述的方法,其中,所述根据所述模板区域对应的第一预测误差满足第一条件的参数,确定所述第一编码参数,包括:
    对第一预测误差满足第一条件的候选第一编码参数进行扩展,得到第一扩展参数;
    根据所述当前块的第一颜色分量的参考样值和第一预测误差满足第一条件的候选第一编码参数以及所述第一扩展参数,确定第七加权系数;
    根据所述第七加权系数和所述当前块的第二颜色分量的参考样值,确定所述当前块的第二颜色分量的第四预测值;
    根据所述当前块的第二颜色分量的第四预测值和原始值,确定对应参数的第三预测误差;
    根据各个所述候选第一编码参数和所述第一扩展参数的第三预测误差,确定所述第一编码参数。
  57. 根据权利要求56所述的方法,其中,所述根据各个所述候选第一编码参数和所述第一扩展参数的第三预测误差,确定所述第一编码参数,包括:
    从各个所述候选第一编码参数和所述第一扩展参数中选出第三预测误差满足第四条件的参数;
    根据所述第三预测误差满足第四条件的参数,确定所述第一编码参数。
  58. 根据权利要求57所述的方法,其中,
    将所述第一编码参数设置为等于所述第三预测误差满足第四条件的参数;或者,
    将所述第一编码参数设置为等于所述第三预测误差满足第四条件的参数的融合值。
  59. 根据权利要求57所述的方法,其中,所述第四条件包括:第三预测误差最小或最大。
  60. 根据权利要求51所述的方法,其中,
    将所述第一编码参数设置为等于第一预测误差满足第一条件的参数;或者,
    将所述第一编码参数设置为等于第一预测误差满足第一条件的参数的融合值。
  61. 根据权利要求60所述的方法,其中,
    将所述第一编码参数设置为等于第一预测误差满足第一条件的参数与第三加权系数的加权和。
  62. 根据权利要求61所述的方法,其中,所述方法还包括:
    根据第一预测误差满足第一条件的参数对应的第一预测误差,确定对应的第三加权系数;或者,将所述第三加权系数设置为预设常数值。
  63. 根据权利要求51所述的方法,其中,所述根据所述模板区域对应的第一预测误差满足第一条件的参数,确定所述第一编码参数,包括:
    对第一预测误差满足第一条件的参数进行扩展,得到第一扩展参数;
    对所述第一扩展参数和/或第一预测误差满足第一条件的参数进行融合,得到所述第一编码参数。
  64. 根据权利要求45所述的方法,其中,
    将所述第一编码参数设置为等于各个所述候选第一编码参数与第四加权系数的加权和。
  65. 根据权利要求64所述的方法,其中,所述方法还包括:
    根据所述第一预测误差,确定对应的所述候选第一编码参数的第四加权系数。
  66. 根据权利要求46所述的方法,其中,所述第一条件包括:第一预测误差最小、第一预测误差小于第一阈值、第一预测误差最大或第一预测误差大于第三阈值。
  67. 根据权利要求45所述的方法,其中,所述根据所述第一预测误差,确定所述第一编码参数,包括:
    根据所述模板区域的同一候选第一编码参数各自对应的第一预测误差,确定表征对应候选第一编码参数的性能的评价参数;
    根据各个所述候选第一编码参数的评价参数,确定所述第一编码参数。
  68. 根据权利要求67所述的方法,其中,
    将所述评价参数设置为等于所述模板区域的同一候选第一编码参数各自对应的第一预测误差的融合值。
  69. 根据权利要求68所述的方法,其中,
    将所述评价参数设置为等于所述模板区域的同一候选第一编码参数各自对应的第一预测误差之和。
  70. 根据权利要求67所述的方法,其中,所述根据各个所述候选第一编码参数的评价参数,确定所述第一编码参数,包括:
    从各个所述候选第一编码参数中选出评价参数满足第二条件的参数;
    根据评价参数满足第二条件的参数,确定所述第一编码参数。
  71. 根据权利要求70所述的方法,其中,
    将所述第一编码参数设置为等于评价参数满足第二条件的参数;或者,
    将所述第一编码参数设置为等于评价参数满足第二条件的参数的融合值。
  72. 根据权利要求71所述的方法,其中,
    将所述第一编码参数设置为等于评价参数满足第二条件的参数与第五加权系数的加权和。
  73. 根据权利要求72所述的方法,其中,所述方法还包括:
    根据评价参数满足第二条件的参数对应的模板区域,确定对应参数的第五加权系数。
  74. 根据权利要求73所述的方法,其中,所述根据评价参数满足第二条件的参数对应的模板区域,确定对应参数的第五加权系数,包括:
    根据评价参数满足第二条件的参数对应的模板区域的像素数目和/或模板类型,确定对应参数的第五加权系数。
  75. 根据权利要求72所述的方法,其中,所述第五加权系数为预设常数值。
  76. 根据权利要求70至75任一项所述的方法,其中,所述第二条件包括:评价参数最小、评价参数小于第二阈值、评价参数最大或评价参数大于第四阈值。
  77. 根据权利要求70所述的方法,其中,所述根据评价参数满足第二条件的参数,确定所述第一编码参数,包括:
    根据所述当前块的第一颜色分量的参考样值和评价参数满足第二条件的参数,确定第八加权系数;
    根据所述第八加权系数,和所述当前块的第二颜色分量的参考样值,确定所述当前块的第二颜色分量的第五预测值;
    根据所述当前块的第二颜色分量的第五预测值和原始值,确定对应的评价参数满足第二条件的参数第四预测误差;
    根据各个候选第一编码参数的第四预测误差,确定所述第一编码参数。
  78. 根据权利要求77所述的方法,其中,所述根据各个候选第一编码参数的第四预测误差,确定所述第一编码参数,包括:
    对评价参数满足第二条件的参数进行扩展,得到第二扩展参数;
    根据所述当前块的第一颜色分量的参考样值和评价参数满足第二条件的参数以及第二扩展参数,确定第九加权系数;
    根据所述第九加权系数和所述当前块的第二颜色分量的参考样值,确定所述当前块的第二颜色分量的第六预测值;
    根据所述当前块的第二颜色分量的第六预测值和原始值,确定对应参数的第五预测误差;
    根据各个候选第一编码参数和所述第二扩展参数的第五预测误差,确定所述第一编码参数。
  79. 根据权利要求40所述的方法,其中,所述方法还包括:
    根据配置的预测模式包括的模板类型,确定所述模板区域。
  80. 根据权利要求79所述的方法,其中,所述模板类型至少包括以下至少之一:上模板、左模板、上右模板、左下模板、左上模板。
  81. 根据权利要求80所述的方法,其中,所述根据配置的预测模式包括的模板类型,确定所述模板区域,包括:
    将配置的预测模式包括的模板作为所述模板区域。
  82. 根据权利要求40所述的方法,其中,所述方法还包括:
    根据所述当前块的邻近区域的像素可用性,确定所述模板区域;
    其中,基于与所述当前块的相对位置关系,所述邻近区域包括以下至少之一:所述当前块的上侧区域、所述当前块的左侧区域、所述当前块的上右侧区域、所述当前块的左下侧区域、所述当前块的左上侧区域。
  83. 根据权利要求40所述的方法,其中,所述方法还包括:
    在不存在所述模板区域的情况下,将默认值作为所述当前块的第二颜色分量的预测值。
  84. 根据权利要求40所述的方法,其中,所述方法还包括:
    在不存在所述模板区域的情况下,采用不同于所述方法的另一预测方法确定所述当前块的第二颜色分量进行预测。
  85. 根据权利要求45所述的方法,其中,
    将用于确定所述第一预测误差的第二预测值设置为等于对所述模板区域的第二颜色分量的第二预测值进行修正操作得到的第二预测值。
  86. 根据权利要求40所述的方法,其中,所述方法还包括:
    获取所述当前块的第二颜色分量的原始值;
    根据所述当前块的第二颜色分量的原始值和所述第二颜色分量的第一预测值,确定所述当前块的第二颜色分量的残差值;
    对所述当前块的第二颜色分量的残差值进行编码,将所得到的编码比特写入码流。
  87. 根据权利要求40所述的方法,其中,所述方法还包括:
    对所述当前块的第二颜色分量的第一预测值进行修正操作,得到修正后的第一预测值;
    获取所述当前块的第二颜色分量的原始值;
    根据所述当前块的第二颜色分量的原始值和所述修正后的第一预测值,确定所述当前块的第二颜色分量的残差值;
    对所述当前块的第二颜色分量的残差值进行编码,将所得到的编码比特写入码流。
  88. 根据权利要求40所述的方法,其中,所述方法还包括:
    对所述第一编码参数或所述第一编码参数的索引进行编码,将所得到的编码比特写入码流。
  89. 一种编码装置,包括:
    第一确定模块,配置为根据模板区域,确定第一编码参数;
    第二确定模块,配置为确定当前块的第一颜色分量的参考样值;
    第三确定模块,配置为根据所述当前块的第一颜色分量的参考样值和所述第一编码参数,确定第一加权系数;
    第一预测模块,配置为根据所述第一加权系数和所述当前块的第二颜色分量的参考样值,确定所述当前块的第二颜色分量的第一预测值。
  90. 一种编码设备,包括第一存储器和第一处理器;其中,
    所述第一存储器,用于存储能够在所述第一处理器上运行的计算机程序;
    所述第一处理器,用于在运行所述计算机程序时,执行如权利要求40至88任一项所述的方法。
  91. 一种解码装置,包括:
    第四确定模块,配置为根据模板区域,确定第一解码参数;
    第五确定模块,配置为确定当前块的第一颜色分量的参考样值;
    第六确定模块,配置为根据所述当前块的第一颜色分量的参考样值和所述第一解码参数,确定第一加权系数;
    第二预测模块,配置为根据所述第一加权系数和所述当前块的第二颜色分量的参考样值,确定所述当前块的第二颜色分量的第一预测值。
  92. 一种解码设备,包括第二存储器和第二处理器;其中,
    所述第二存储器,用于存储能够在所述第二处理器上运行的计算机程序;
    所述第二处理器,用于在运行所述计算机程序时,执行如权利要求1至39任一项所述的方法。
  93. 一种计算机可读存储介质,其中,所述计算机可读存储介质存储有计算机程序,所述计算机程序被执行时实现如权利要求1至39任一项所述的方法、或者实现如权利要求40至88任一项所述的方法。
PCT/CN2022/086470 2022-04-12 2022-04-12 编解码方法、装置、编码设备、解码设备以及存储介质 WO2023197193A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2022/086470 WO2023197193A1 (zh) 2022-04-12 2022-04-12 编解码方法、装置、编码设备、解码设备以及存储介质

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2022/086470 WO2023197193A1 (zh) 2022-04-12 2022-04-12 编解码方法、装置、编码设备、解码设备以及存储介质

Publications (1)

Publication Number Publication Date
WO2023197193A1 true WO2023197193A1 (zh) 2023-10-19

Family

ID=88328754

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/086470 WO2023197193A1 (zh) 2022-04-12 2022-04-12 编解码方法、装置、编码设备、解码设备以及存储介质

Country Status (1)

Country Link
WO (1) WO2023197193A1 (zh)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101335902A (zh) * 2007-06-25 2008-12-31 华为技术有限公司 色度补偿方法和装置
WO2015146278A1 (ja) * 2014-03-28 2015-10-01 ソニー株式会社 画像処理装置及び画像処理方法
CN113365067A (zh) * 2021-05-21 2021-09-07 中山大学 基于位置加权的色度线性预测方法、装置、设备及介质
CN113475063A (zh) * 2018-12-27 2021-10-01 英迪股份有限公司 图像编码/解码方法和装置
CN114303369A (zh) * 2019-08-28 2022-04-08 株式会社Kt 视频信号处理方法和装置
CN114299193A (zh) * 2021-12-30 2022-04-08 山东大学 一种基于神经网络的黑白视频上色方法、系统、设备及存储介质

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101335902A (zh) * 2007-06-25 2008-12-31 华为技术有限公司 色度补偿方法和装置
WO2015146278A1 (ja) * 2014-03-28 2015-10-01 ソニー株式会社 画像処理装置及び画像処理方法
CN113475063A (zh) * 2018-12-27 2021-10-01 英迪股份有限公司 图像编码/解码方法和装置
CN114303369A (zh) * 2019-08-28 2022-04-08 株式会社Kt 视频信号处理方法和装置
CN113365067A (zh) * 2021-05-21 2021-09-07 中山大学 基于位置加权的色度线性预测方法、装置、设备及介质
CN114299193A (zh) * 2021-12-30 2022-04-08 山东大学 一种基于神经网络的黑白视频上色方法、系统、设备及存储介质

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
HUO JUNYAN; DU HONGQING; LI XINWEI; WAN SHUAI; YUAN HUI; MA YANZHUO; YANG FUZHENG: "Unified Cross-Component Linear Model in VVC Based on a Subset of Neighboring Samples", IEEE TRANSACTIONS ON INDUSTRIAL INFORMATICS, IEEE SERVICE CENTER, NEW YORK, NY., US, vol. 18, no. 12, 14 February 2022 (2022-02-14), US , pages 8654 - 8663, XP011921559, ISSN: 1551-3203, DOI: 10.1109/TII.2022.3151746 *

Similar Documents

Publication Publication Date Title
WO2018219357A1 (en) Intra prediction using unequal weight planar prediction
EP3386198A1 (en) Method and device for predictive picture encoding and decoding
WO2022104498A1 (zh) 帧内预测方法、编码器、解码器以及计算机存储介质
US20230388491A1 (en) Colour component prediction method, encoder, decoder and storage medium
JP7481332B2 (ja) デコードのための予測方法及びその装置、並びにコンピュータ記憶媒体
CN114830663A (zh) 变换方法、编码器、解码器以及存储介质
AU2019357929A1 (en) Video image component prediction method and apparatus, and computer storage medium
WO2023197193A1 (zh) 编解码方法、装置、编码设备、解码设备以及存储介质
WO2022174469A1 (zh) 一种光照补偿方法、编码器、解码器及存储介质
WO2022077490A1 (zh) 一种帧内预测方法、编码器、解码器及存储介质
WO2020258052A1 (zh) 图像分量预测方法、装置及计算机存储介质
WO2021134303A1 (zh) 变换方法、编码器、解码器以及存储介质
WO2020140214A1 (zh) 解码预测方法、装置及计算机存储介质
WO2024007165A1 (zh) 编解码方法、装置、编码设备、解码设备以及存储介质
WO2023197195A1 (zh) 视频编解码方法、编码器、解码器及存储介质
WO2023197189A1 (zh) 编解码方法、装置、编码设备、解码设备以及存储介质
WO2023197190A1 (zh) 编解码方法、装置、编码设备、解码设备以及存储介质
WO2024007128A1 (zh) 视频编解码方法、装置、设备、系统、及存储介质
WO2023197192A1 (zh) 编解码方法、装置、编码设备、解码设备以及存储介质
US11363257B2 (en) Image component prediction method and device, and computer storage medium
WO2023141781A1 (zh) 编解码方法、装置、编码设备、解码设备以及存储介质
WO2023197194A1 (zh) 编解码方法、装置、编码设备、解码设备以及存储介质
WO2023197433A1 (zh) 视频编解码方法、装置、设备、系统、及存储介质
WO2020258053A1 (zh) 图像分量预测方法、装置及计算机存储介质
WO2024007120A1 (zh) 编解码方法、编码器、解码器以及存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22936847

Country of ref document: EP

Kind code of ref document: A1